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
, VTY_NEWLINE
);
319 *bgp
= bgp_get_default ();
322 vty_out (vty
, "Unable to find default BGP instance%s", VTY_NEWLINE
);
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
, VTY_NEWLINE
);
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";
523 vty_out (vty
, "%% %s%s", str
, VTY_NEWLINE
);
529 /* BGP clear sort. */
540 bgp_clear_vty_error (struct vty
*vty
, struct peer
*peer
, afi_t afi
,
541 safi_t safi
, int error
)
545 case BGP_ERR_AF_UNCONFIGURED
:
547 "%%BGP: Enable %s address family for the neighbor %s%s",
548 afi_safi_print(afi
, safi
), peer
->host
, VTY_NEWLINE
);
550 case BGP_ERR_SOFT_RECONFIG_UNCONFIGURED
:
551 vty_out (vty
, "%%BGP: Inbound soft reconfig for %s not possible as it%s has neither refresh capability, nor inbound soft reconfig%s", peer
->host
, VTY_NEWLINE
, VTY_NEWLINE
);
558 /* `clear ip bgp' functions. */
560 bgp_clear (struct vty
*vty
, struct bgp
*bgp
, afi_t afi
, safi_t safi
,
561 enum clear_sort sort
,enum bgp_clear_type stype
, const char *arg
)
565 struct listnode
*node
, *nnode
;
567 /* Clear all neighbors. */
569 * Pass along pointer to next node to peer_clear() when walking all nodes
570 * on the BGP instance as that may get freed if it is a doppelganger
572 if (sort
== clear_all
)
574 for (ALL_LIST_ELEMENTS (bgp
->peer
, node
, nnode
, peer
))
576 if (stype
== BGP_CLEAR_SOFT_NONE
)
577 ret
= peer_clear (peer
, &nnode
);
578 else if (peer
->afc
[afi
][safi
])
579 ret
= peer_clear_soft (peer
, afi
, safi
, stype
);
584 bgp_clear_vty_error (vty
, peer
, afi
, safi
, ret
);
587 /* This is to apply read-only mode on this clear. */
588 if (stype
== BGP_CLEAR_SOFT_NONE
)
589 bgp
->update_delay_over
= 0;
594 /* Clear specified neighbors. */
595 if (sort
== clear_peer
)
600 /* Make sockunion for lookup. */
601 ret
= str2sockunion (arg
, &su
);
604 peer
= peer_lookup_by_conf_if (bgp
, arg
);
607 peer
= peer_lookup_by_hostname(bgp
, arg
);
610 vty_out (vty
, "Malformed address or name: %s%s", arg
, VTY_NEWLINE
);
617 peer
= peer_lookup (bgp
, &su
);
620 vty_out (vty
, "%%BGP: Unknown neighbor - \"%s\"%s", arg
, VTY_NEWLINE
);
625 if (stype
== BGP_CLEAR_SOFT_NONE
)
626 ret
= peer_clear (peer
, NULL
);
628 ret
= peer_clear_soft (peer
, afi
, safi
, stype
);
631 bgp_clear_vty_error (vty
, peer
, afi
, safi
, ret
);
636 /* Clear all peer-group members. */
637 if (sort
== clear_group
)
639 struct peer_group
*group
;
641 group
= peer_group_lookup (bgp
, arg
);
644 vty_out (vty
, "%%BGP: No such peer-group %s%s", arg
, VTY_NEWLINE
);
648 for (ALL_LIST_ELEMENTS (group
->peer
, node
, nnode
, peer
))
650 if (stype
== BGP_CLEAR_SOFT_NONE
)
652 peer_clear (peer
, NULL
);
656 if (! peer
->afc
[afi
][safi
])
659 ret
= peer_clear_soft (peer
, afi
, safi
, stype
);
662 bgp_clear_vty_error (vty
, peer
, afi
, safi
, ret
);
667 if (sort
== clear_external
)
669 for (ALL_LIST_ELEMENTS (bgp
->peer
, node
, nnode
, peer
))
671 if (peer
->sort
== BGP_PEER_IBGP
)
674 if (stype
== BGP_CLEAR_SOFT_NONE
)
675 ret
= peer_clear (peer
, &nnode
);
677 ret
= peer_clear_soft (peer
, afi
, safi
, stype
);
680 bgp_clear_vty_error (vty
, peer
, afi
, safi
, ret
);
685 if (sort
== clear_as
)
690 VTY_GET_INTEGER_RANGE ("AS", as
, arg
, 1, BGP_AS4_MAX
);
692 for (ALL_LIST_ELEMENTS (bgp
->peer
, node
, nnode
, peer
))
698 if (stype
== BGP_CLEAR_SOFT_NONE
)
699 ret
= peer_clear (peer
, &nnode
);
701 ret
= peer_clear_soft (peer
, afi
, safi
, stype
);
704 bgp_clear_vty_error (vty
, peer
, afi
, safi
, ret
);
707 vty_out (vty
, "%%BGP: No peer is configured with AS %s%s", arg
,
716 bgp_clear_vty (struct vty
*vty
, const char *name
, afi_t afi
, safi_t safi
,
717 enum clear_sort sort
, enum bgp_clear_type stype
,
722 /* BGP structure lookup. */
725 bgp
= bgp_lookup_by_name (name
);
728 vty_out (vty
, "Can't find BGP instance %s%s", name
, VTY_NEWLINE
);
734 bgp
= bgp_get_default ();
737 vty_out (vty
, "No BGP process is configured%s", VTY_NEWLINE
);
742 return bgp_clear (vty
, bgp
, afi
, safi
, sort
, stype
, arg
);
745 /* clear soft inbound */
747 bgp_clear_star_soft_in (struct vty
*vty
, const char *name
)
749 bgp_clear_vty (vty
, name
, AFI_IP
, SAFI_UNICAST
, clear_all
,
750 BGP_CLEAR_SOFT_IN
, NULL
);
751 bgp_clear_vty (vty
, name
, AFI_IP6
, SAFI_UNICAST
, clear_all
,
752 BGP_CLEAR_SOFT_IN
, NULL
);
755 /* clear soft outbound */
757 bgp_clear_star_soft_out (struct vty
*vty
, const char *name
)
759 bgp_clear_vty (vty
, name
, AFI_IP
, SAFI_UNICAST
, clear_all
,
760 BGP_CLEAR_SOFT_OUT
, NULL
);
761 bgp_clear_vty (vty
, name
, AFI_IP6
, SAFI_UNICAST
, clear_all
,
762 BGP_CLEAR_SOFT_OUT
, NULL
);
766 /* BGP global configuration. */
768 DEFUN (bgp_multiple_instance_func
,
769 bgp_multiple_instance_cmd
,
770 "bgp multiple-instance",
772 "Enable bgp multiple instance\n")
774 bgp_option_set (BGP_OPT_MULTIPLE_INSTANCE
);
778 DEFUN (no_bgp_multiple_instance
,
779 no_bgp_multiple_instance_cmd
,
780 "no bgp multiple-instance",
783 "BGP multiple instance\n")
787 ret
= bgp_option_unset (BGP_OPT_MULTIPLE_INSTANCE
);
790 vty_out (vty
, "%% There are more than two BGP instances%s", VTY_NEWLINE
);
796 DEFUN (bgp_config_type
,
798 "bgp config-type <cisco|zebra>",
800 "Configuration type\n"
805 if (argv_find (argv
, argc
, "cisco", &idx
))
806 bgp_option_set (BGP_OPT_CONFIG_CISCO
);
808 bgp_option_unset (BGP_OPT_CONFIG_CISCO
);
813 DEFUN (no_bgp_config_type
,
814 no_bgp_config_type_cmd
,
815 "no bgp config-type [<cisco|zebra>]",
818 "Display configuration type\n"
822 bgp_option_unset (BGP_OPT_CONFIG_CISCO
);
827 DEFUN (no_synchronization
,
828 no_synchronization_cmd
,
829 "no synchronization",
831 "Perform IGP synchronization\n")
836 DEFUN (no_auto_summary
,
840 "Enable automatic network number summarization\n")
845 /* "router bgp" commands. */
846 DEFUN_NOSH (router_bgp
,
848 "router bgp [(1-4294967295) [<view|vrf> VIEWVRFNAME]]",
852 BGP_INSTANCE_HELP_STR
)
855 int idx_view_vrf
= 3;
860 const char *name
= NULL
;
861 enum bgp_instance_type inst_type
;
863 // "router bgp" without an ASN
866 //Pending: Make VRF option available for ASN less config
867 bgp
= bgp_get_default();
871 vty_out (vty
, "%% No BGP process is configured%s", VTY_NEWLINE
);
875 if (listcount(bm
->bgp
) > 1)
877 vty_out (vty
, "%% Multiple BGP processes are configured%s", VTY_NEWLINE
);
885 VTY_GET_INTEGER_RANGE ("AS", as
, argv
[idx_asn
]->arg
, 1, BGP_AS4_MAX
);
887 inst_type
= BGP_INSTANCE_TYPE_DEFAULT
;
890 name
= argv
[idx_vrf
]->arg
;
892 if (!strcmp(argv
[idx_view_vrf
]->text
, "vrf"))
893 inst_type
= BGP_INSTANCE_TYPE_VRF
;
894 else if (!strcmp(argv
[idx_view_vrf
]->text
, "view"))
895 inst_type
= BGP_INSTANCE_TYPE_VIEW
;
898 ret
= bgp_get (&bgp
, &as
, name
, inst_type
);
901 case BGP_ERR_MULTIPLE_INSTANCE_NOT_SET
:
902 vty_out (vty
, "Please specify 'bgp multiple-instance' first%s",
905 case BGP_ERR_AS_MISMATCH
:
906 vty_out (vty
, "BGP is already running; AS is %u%s", as
, VTY_NEWLINE
);
908 case BGP_ERR_INSTANCE_MISMATCH
:
909 vty_out (vty
, "BGP instance name and AS number mismatch%s", VTY_NEWLINE
);
910 vty_out (vty
, "BGP instance is already running; AS is %u%s",
915 /* Pending: handle when user tries to change a view to vrf n vv. */
918 VTY_PUSH_CONTEXT(BGP_NODE
, bgp
);
923 /* "no router bgp" commands. */
924 DEFUN (no_router_bgp
,
926 "no router bgp [(1-4294967295) [<view|vrf> VIEWVRFNAME]]",
931 BGP_INSTANCE_HELP_STR
)
937 const char *name
= NULL
;
939 // "no router bgp" without an ASN
942 //Pending: Make VRF option available for ASN less config
943 bgp
= bgp_get_default();
947 vty_out (vty
, "%% No BGP process is configured%s", VTY_NEWLINE
);
951 if (listcount(bm
->bgp
) > 1)
953 vty_out (vty
, "%% Multiple BGP processes are configured%s", VTY_NEWLINE
);
959 VTY_GET_INTEGER_RANGE ("AS", as
, argv
[idx_asn
]->arg
, 1, BGP_AS4_MAX
);
962 name
= argv
[idx_vrf
]->arg
;
964 /* Lookup bgp structure. */
965 bgp
= bgp_lookup (as
, name
);
968 vty_out (vty
, "%% Can't find BGP instance%s", VTY_NEWLINE
);
982 DEFUN (bgp_router_id
,
984 "bgp router-id A.B.C.D",
986 "Override configured router identifier\n"
987 "Manually configured router identifier\n")
989 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
994 ret
= inet_aton (argv
[idx_ipv4
]->arg
, &id
);
997 vty_out (vty
, "%% Malformed bgp router identifier%s", VTY_NEWLINE
);
1001 bgp_router_id_static_set (bgp
, id
);
1006 DEFUN (no_bgp_router_id
,
1007 no_bgp_router_id_cmd
,
1008 "no bgp router-id [A.B.C.D]",
1011 "Override configured router identifier\n"
1012 "Manually configured router identifier\n")
1014 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1015 int idx_router_id
= 3;
1019 if (argc
> idx_router_id
)
1021 ret
= inet_aton (argv
[idx_router_id
]->arg
, &id
);
1024 vty_out (vty
, "%% Malformed BGP router identifier%s", VTY_NEWLINE
);
1028 if (! IPV4_ADDR_SAME (&bgp
->router_id_static
, &id
))
1030 vty_out (vty
, "%% BGP router-id doesn't match%s", VTY_NEWLINE
);
1036 bgp_router_id_static_set (bgp
, id
);
1042 /* BGP Cluster ID. */
1043 DEFUN (bgp_cluster_id
,
1045 "bgp cluster-id <A.B.C.D|(1-4294967295)>",
1047 "Configure Route-Reflector Cluster-id\n"
1048 "Route-Reflector Cluster-id in IP address format\n"
1049 "Route-Reflector Cluster-id as 32 bit quantity\n")
1051 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1054 struct in_addr cluster
;
1056 ret
= inet_aton (argv
[idx_ipv4
]->arg
, &cluster
);
1059 vty_out (vty
, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE
);
1063 bgp_cluster_id_set (bgp
, &cluster
);
1064 bgp_clear_star_soft_out (vty
, bgp
->name
);
1069 DEFUN (no_bgp_cluster_id
,
1070 no_bgp_cluster_id_cmd
,
1071 "no bgp cluster-id [<A.B.C.D|(1-4294967295)>]",
1074 "Configure Route-Reflector Cluster-id\n"
1075 "Route-Reflector Cluster-id in IP address format\n"
1076 "Route-Reflector Cluster-id as 32 bit quantity\n")
1078 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1079 bgp_cluster_id_unset (bgp
);
1080 bgp_clear_star_soft_out (vty
, bgp
->name
);
1085 DEFUN (bgp_confederation_identifier
,
1086 bgp_confederation_identifier_cmd
,
1087 "bgp confederation identifier (1-4294967295)",
1088 "BGP specific commands\n"
1089 "AS confederation parameters\n"
1091 "Set routing domain confederation AS\n")
1093 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1097 VTY_GET_INTEGER_RANGE ("AS", as
, argv
[idx_number
]->arg
, 1, BGP_AS4_MAX
);
1099 bgp_confederation_id_set (bgp
, as
);
1104 DEFUN (no_bgp_confederation_identifier
,
1105 no_bgp_confederation_identifier_cmd
,
1106 "no bgp confederation identifier [(1-4294967295)]",
1108 "BGP specific commands\n"
1109 "AS confederation parameters\n"
1111 "Set routing domain confederation AS\n")
1113 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1114 bgp_confederation_id_unset (bgp
);
1119 DEFUN (bgp_confederation_peers
,
1120 bgp_confederation_peers_cmd
,
1121 "bgp confederation peers (1-4294967295)...",
1122 "BGP specific commands\n"
1123 "AS confederation parameters\n"
1124 "Peer ASs in BGP confederation\n"
1127 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1132 for (i
= idx_asn
; i
< argc
; i
++)
1134 VTY_GET_INTEGER_RANGE ("AS", as
, argv
[i
]->arg
, 1, BGP_AS4_MAX
);
1138 vty_out (vty
, "%% Local member-AS not allowed in confed peer list%s",
1143 bgp_confederation_peers_add (bgp
, as
);
1148 DEFUN (no_bgp_confederation_peers
,
1149 no_bgp_confederation_peers_cmd
,
1150 "no bgp confederation peers (1-4294967295)...",
1152 "BGP specific commands\n"
1153 "AS confederation parameters\n"
1154 "Peer ASs in BGP confederation\n"
1157 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1162 for (i
= idx_asn
; i
< argc
; i
++)
1164 VTY_GET_INTEGER_RANGE ("AS", as
, argv
[i
]->arg
, 1, BGP_AS4_MAX
);
1166 bgp_confederation_peers_remove (bgp
, as
);
1172 * Central routine for maximum-paths configuration.
1173 * @peer_type: BGP_PEER_EBGP or BGP_PEER_IBGP
1174 * @set: 1 for setting values, 0 for removing the max-paths config.
1177 bgp_maxpaths_config_vty (struct vty
*vty
, int peer_type
, const char *mpaths
,
1178 u_int16_t options
, int set
)
1180 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1181 u_int16_t maxpaths
= 0;
1186 afi
= bgp_node_afi (vty
);
1187 safi
= bgp_node_safi (vty
);
1191 maxpaths
= strtol(mpaths
, NULL
, 10);
1192 if (maxpaths
> multipath_num
)
1195 "%% Maxpaths Specified: %d is > than multipath num specified on bgp command line %d",
1196 maxpaths
, multipath_num
);
1199 ret
= bgp_maximum_paths_set (bgp
, afi
, safi
, peer_type
, maxpaths
, options
);
1202 ret
= bgp_maximum_paths_unset (bgp
, afi
, safi
, peer_type
);
1207 "%% Failed to %sset maximum-paths %s %u for afi %u, safi %u%s",
1208 (set
== 1) ? "" : "un",
1209 (peer_type
== BGP_PEER_EBGP
) ? "ebgp" : "ibgp",
1210 maxpaths
, afi
, safi
, VTY_NEWLINE
);
1214 bgp_recalculate_all_bestpaths (bgp
);
1219 DEFUN (bgp_maxmed_admin
,
1220 bgp_maxmed_admin_cmd
,
1221 "bgp max-med administrative ",
1223 "Advertise routes with max-med\n"
1224 "Administratively applied, for an indefinite period\n")
1226 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1228 bgp
->v_maxmed_admin
= 1;
1229 bgp
->maxmed_admin_value
= BGP_MAXMED_VALUE_DEFAULT
;
1231 bgp_maxmed_update(bgp
);
1236 DEFUN (bgp_maxmed_admin_medv
,
1237 bgp_maxmed_admin_medv_cmd
,
1238 "bgp max-med administrative (0-4294967295)",
1240 "Advertise routes with max-med\n"
1241 "Administratively applied, for an indefinite period\n"
1242 "Max MED value to be used\n")
1244 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1247 bgp
->v_maxmed_admin
= 1;
1248 bgp
->maxmed_admin_value
= strtoul (argv
[idx_number
]->arg
, NULL
, 10);
1250 bgp_maxmed_update(bgp
);
1255 DEFUN (no_bgp_maxmed_admin
,
1256 no_bgp_maxmed_admin_cmd
,
1257 "no bgp max-med administrative [(0-4294967295)]",
1260 "Advertise routes with max-med\n"
1261 "Administratively applied, for an indefinite period\n"
1262 "Max MED value to be used\n")
1264 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1265 bgp
->v_maxmed_admin
= BGP_MAXMED_ADMIN_UNCONFIGURED
;
1266 bgp
->maxmed_admin_value
= BGP_MAXMED_VALUE_DEFAULT
;
1267 bgp_maxmed_update(bgp
);
1272 DEFUN (bgp_maxmed_onstartup
,
1273 bgp_maxmed_onstartup_cmd
,
1274 "bgp max-med on-startup (5-86400) [(0-4294967295)]",
1276 "Advertise routes with max-med\n"
1277 "Effective on a startup\n"
1278 "Time (seconds) period for max-med\n"
1279 "Max MED value to be used\n")
1281 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1284 argv_find (argv
, argc
, "(5-86400)", &idx
);
1285 bgp
->v_maxmed_onstartup
= strtoul (argv
[idx
]->arg
, NULL
, 10);
1286 if (argv_find (argv
, argc
, "(0-4294967295)", &idx
))
1287 bgp
->maxmed_onstartup_value
= strtoul (argv
[idx
]->arg
, NULL
, 10);
1289 bgp
->maxmed_onstartup_value
= BGP_MAXMED_VALUE_DEFAULT
;
1291 bgp_maxmed_update(bgp
);
1296 DEFUN (no_bgp_maxmed_onstartup
,
1297 no_bgp_maxmed_onstartup_cmd
,
1298 "no bgp max-med on-startup [(5-86400) [(0-4294967295)]]",
1301 "Advertise routes with max-med\n"
1302 "Effective on a startup\n"
1303 "Time (seconds) period for max-med\n"
1304 "Max MED value to be used\n")
1306 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1308 /* Cancel max-med onstartup if its on */
1309 if (bgp
->t_maxmed_onstartup
)
1311 THREAD_TIMER_OFF (bgp
->t_maxmed_onstartup
);
1312 bgp
->maxmed_onstartup_over
= 1;
1315 bgp
->v_maxmed_onstartup
= BGP_MAXMED_ONSTARTUP_UNCONFIGURED
;
1316 bgp
->maxmed_onstartup_value
= BGP_MAXMED_VALUE_DEFAULT
;
1318 bgp_maxmed_update(bgp
);
1324 bgp_update_delay_config_vty (struct vty
*vty
, const char *delay
,
1327 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1328 u_int16_t update_delay
;
1329 u_int16_t establish_wait
;
1331 VTY_GET_INTEGER_RANGE ("update-delay", update_delay
, delay
,
1332 BGP_UPDATE_DELAY_MIN
, BGP_UPDATE_DELAY_MAX
);
1334 if (!wait
) /* update-delay <delay> */
1336 bgp
->v_update_delay
= update_delay
;
1337 bgp
->v_establish_wait
= bgp
->v_update_delay
;
1341 /* update-delay <delay> <establish-wait> */
1342 establish_wait
= atoi (wait
);
1343 if (update_delay
< establish_wait
)
1345 vty_out (vty
, "%%Failed: update-delay less than the establish-wait!%s",
1350 bgp
->v_update_delay
= update_delay
;
1351 bgp
->v_establish_wait
= establish_wait
;
1357 bgp_update_delay_deconfig_vty (struct vty
*vty
)
1359 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1361 bgp
->v_update_delay
= BGP_UPDATE_DELAY_DEF
;
1362 bgp
->v_establish_wait
= bgp
->v_update_delay
;
1368 bgp_config_write_update_delay (struct vty
*vty
, struct bgp
*bgp
)
1370 if (bgp
->v_update_delay
!= BGP_UPDATE_DELAY_DEF
)
1372 vty_out (vty
, " update-delay %d", bgp
->v_update_delay
);
1373 if (bgp
->v_update_delay
!= bgp
->v_establish_wait
)
1374 vty_out (vty
, " %d", bgp
->v_establish_wait
);
1375 vty_out (vty
, "%s", VTY_NEWLINE
);
1382 /* Update-delay configuration */
1383 DEFUN (bgp_update_delay
,
1384 bgp_update_delay_cmd
,
1385 "update-delay (0-3600)",
1386 "Force initial delay for best-path and updates\n"
1390 return bgp_update_delay_config_vty(vty
, argv
[idx_number
]->arg
, NULL
);
1393 DEFUN (bgp_update_delay_establish_wait
,
1394 bgp_update_delay_establish_wait_cmd
,
1395 "update-delay (0-3600) (1-3600)",
1396 "Force initial delay for best-path and updates\n"
1398 "Wait for peers to be established\n"
1402 int idx_number_2
= 2;
1403 return bgp_update_delay_config_vty(vty
, argv
[idx_number
]->arg
, argv
[idx_number_2
]->arg
);
1406 /* Update-delay deconfiguration */
1407 DEFUN (no_bgp_update_delay
,
1408 no_bgp_update_delay_cmd
,
1409 "no update-delay [(0-3600) [(1-3600)]]",
1411 "Force initial delay for best-path and updates\n"
1413 "Wait for peers to be established\n")
1415 return bgp_update_delay_deconfig_vty(vty
);
1420 bgp_wpkt_quanta_config_vty (struct vty
*vty
, const char *num
, char set
)
1422 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1425 VTY_GET_INTEGER_RANGE ("write-quanta", bgp
->wpkt_quanta
, num
,
1428 bgp
->wpkt_quanta
= BGP_WRITE_PACKET_MAX
;
1434 bgp_config_write_wpkt_quanta (struct vty
*vty
, struct bgp
*bgp
)
1436 if (bgp
->wpkt_quanta
!= BGP_WRITE_PACKET_MAX
)
1437 vty_out (vty
, " write-quanta %d%s",
1438 bgp
->wpkt_quanta
, VTY_NEWLINE
);
1444 /* Update-delay configuration */
1445 DEFUN (bgp_wpkt_quanta
,
1446 bgp_wpkt_quanta_cmd
,
1447 "write-quanta (1-10000)",
1448 "How many packets to write to peer socket per run\n"
1449 "Number of packets\n")
1452 return bgp_wpkt_quanta_config_vty(vty
, argv
[idx_number
]->arg
, 1);
1455 /* Update-delay deconfiguration */
1456 DEFUN (no_bgp_wpkt_quanta
,
1457 no_bgp_wpkt_quanta_cmd
,
1458 "no write-quanta (1-10000)",
1460 "How many packets to write to peer socket per run\n"
1461 "Number of packets\n")
1464 return bgp_wpkt_quanta_config_vty(vty
, argv
[idx_number
]->arg
, 0);
1468 bgp_config_write_coalesce_time (struct vty
*vty
, struct bgp
*bgp
)
1470 if (bgp
->coalesce_time
!= BGP_DEFAULT_SUBGROUP_COALESCE_TIME
)
1471 vty_out (vty
, " coalesce-time %u%s",
1472 bgp
->coalesce_time
, VTY_NEWLINE
);
1478 DEFUN (bgp_coalesce_time
,
1479 bgp_coalesce_time_cmd
,
1480 "coalesce-time (0-4294967295)",
1481 "Subgroup coalesce timer\n"
1482 "Subgroup coalesce timer value (in ms)\n")
1484 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1487 argv_find (argv
, argc
, "(0-4294967295)", &idx
);
1488 bgp
->coalesce_time
= strtoul (argv
[idx
]->arg
, NULL
, 10);
1492 DEFUN (no_bgp_coalesce_time
,
1493 no_bgp_coalesce_time_cmd
,
1494 "no coalesce-time (0-4294967295)",
1496 "Subgroup coalesce timer\n"
1497 "Subgroup coalesce timer value (in ms)\n")
1499 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1501 bgp
->coalesce_time
= BGP_DEFAULT_SUBGROUP_COALESCE_TIME
;
1505 /* Maximum-paths configuration */
1506 DEFUN (bgp_maxpaths
,
1508 "maximum-paths (1-255)",
1509 "Forward packets over multiple paths\n"
1510 "Number of paths\n")
1513 return bgp_maxpaths_config_vty(vty
, BGP_PEER_EBGP
, argv
[idx_number
]->arg
, 0, 1);
1516 ALIAS_HIDDEN (bgp_maxpaths
,
1517 bgp_maxpaths_hidden_cmd
,
1518 "maximum-paths (1-255)",
1519 "Forward packets over multiple paths\n"
1520 "Number of paths\n")
1522 DEFUN (bgp_maxpaths_ibgp
,
1523 bgp_maxpaths_ibgp_cmd
,
1524 "maximum-paths ibgp (1-255)",
1525 "Forward packets over multiple paths\n"
1527 "Number of paths\n")
1530 return bgp_maxpaths_config_vty(vty
, BGP_PEER_IBGP
, argv
[idx_number
]->arg
, 0, 1);
1533 ALIAS_HIDDEN (bgp_maxpaths_ibgp
,
1534 bgp_maxpaths_ibgp_hidden_cmd
,
1535 "maximum-paths ibgp (1-255)",
1536 "Forward packets over multiple paths\n"
1538 "Number of paths\n")
1540 DEFUN (bgp_maxpaths_ibgp_cluster
,
1541 bgp_maxpaths_ibgp_cluster_cmd
,
1542 "maximum-paths ibgp (1-255) equal-cluster-length",
1543 "Forward packets over multiple paths\n"
1546 "Match the cluster length\n")
1549 return bgp_maxpaths_config_vty(vty
, BGP_PEER_IBGP
, argv
[idx_number
]->arg
,
1550 BGP_FLAG_IBGP_MULTIPATH_SAME_CLUSTERLEN
, 1);
1553 ALIAS_HIDDEN (bgp_maxpaths_ibgp_cluster
,
1554 bgp_maxpaths_ibgp_cluster_hidden_cmd
,
1555 "maximum-paths ibgp (1-255) equal-cluster-length",
1556 "Forward packets over multiple paths\n"
1559 "Match the cluster length\n")
1561 DEFUN (no_bgp_maxpaths
,
1562 no_bgp_maxpaths_cmd
,
1563 "no maximum-paths [(1-255)]",
1565 "Forward packets over multiple paths\n"
1566 "Number of paths\n")
1568 return bgp_maxpaths_config_vty(vty
, BGP_PEER_EBGP
, NULL
, 0, 0);
1571 ALIAS_HIDDEN (no_bgp_maxpaths
,
1572 no_bgp_maxpaths_hidden_cmd
,
1573 "no maximum-paths [(1-255)]",
1575 "Forward packets over multiple paths\n"
1576 "Number of paths\n")
1578 DEFUN (no_bgp_maxpaths_ibgp
,
1579 no_bgp_maxpaths_ibgp_cmd
,
1580 "no maximum-paths ibgp [(1-255) [equal-cluster-length]]",
1582 "Forward packets over multiple paths\n"
1585 "Match the cluster length\n")
1587 return bgp_maxpaths_config_vty(vty
, BGP_PEER_IBGP
, NULL
, 0, 0);
1590 ALIAS_HIDDEN (no_bgp_maxpaths_ibgp
,
1591 no_bgp_maxpaths_ibgp_hidden_cmd
,
1592 "no maximum-paths ibgp [(1-255) [equal-cluster-length]]",
1594 "Forward packets over multiple paths\n"
1597 "Match the cluster length\n")
1600 bgp_config_write_maxpaths (struct vty
*vty
, struct bgp
*bgp
, afi_t afi
,
1601 safi_t safi
, int *write
)
1603 if (bgp
->maxpaths
[afi
][safi
].maxpaths_ebgp
!= MULTIPATH_NUM
)
1605 bgp_config_write_family_header (vty
, afi
, safi
, write
);
1606 vty_out (vty
, " maximum-paths %d%s",
1607 bgp
->maxpaths
[afi
][safi
].maxpaths_ebgp
, VTY_NEWLINE
);
1610 if (bgp
->maxpaths
[afi
][safi
].maxpaths_ibgp
!= MULTIPATH_NUM
)
1612 bgp_config_write_family_header (vty
, afi
, safi
, write
);
1613 vty_out (vty
, " maximum-paths ibgp %d",
1614 bgp
->maxpaths
[afi
][safi
].maxpaths_ibgp
);
1615 if (CHECK_FLAG (bgp
->maxpaths
[afi
][safi
].ibgp_flags
,
1616 BGP_FLAG_IBGP_MULTIPATH_SAME_CLUSTERLEN
))
1617 vty_out (vty
, " equal-cluster-length");
1618 vty_out (vty
, "%s", VTY_NEWLINE
);
1628 "timers bgp (0-65535) (0-65535)",
1629 "Adjust routing timers\n"
1631 "Keepalive interval\n"
1634 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1636 int idx_number_2
= 3;
1637 unsigned long keepalive
= 0;
1638 unsigned long holdtime
= 0;
1640 VTY_GET_INTEGER ("keepalive", keepalive
, argv
[idx_number
]->arg
);
1641 VTY_GET_INTEGER ("holdtime", holdtime
, argv
[idx_number_2
]->arg
);
1643 /* Holdtime value check. */
1644 if (holdtime
< 3 && holdtime
!= 0)
1646 vty_out (vty
, "%% hold time value must be either 0 or greater than 3%s",
1651 bgp_timers_set (bgp
, keepalive
, holdtime
);
1656 DEFUN (no_bgp_timers
,
1658 "no timers bgp [(0-65535) (0-65535)]",
1660 "Adjust routing timers\n"
1662 "Keepalive interval\n"
1665 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1666 bgp_timers_unset (bgp
);
1672 DEFUN (bgp_client_to_client_reflection
,
1673 bgp_client_to_client_reflection_cmd
,
1674 "bgp client-to-client reflection",
1675 "BGP specific commands\n"
1676 "Configure client to client route reflection\n"
1677 "reflection of routes allowed\n")
1679 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1680 bgp_flag_unset (bgp
, BGP_FLAG_NO_CLIENT_TO_CLIENT
);
1681 bgp_clear_star_soft_out (vty
, bgp
->name
);
1686 DEFUN (no_bgp_client_to_client_reflection
,
1687 no_bgp_client_to_client_reflection_cmd
,
1688 "no bgp client-to-client reflection",
1690 "BGP specific commands\n"
1691 "Configure client to client route reflection\n"
1692 "reflection of routes allowed\n")
1694 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1695 bgp_flag_set (bgp
, BGP_FLAG_NO_CLIENT_TO_CLIENT
);
1696 bgp_clear_star_soft_out (vty
, bgp
->name
);
1701 /* "bgp always-compare-med" configuration. */
1702 DEFUN (bgp_always_compare_med
,
1703 bgp_always_compare_med_cmd
,
1704 "bgp always-compare-med",
1705 "BGP specific commands\n"
1706 "Allow comparing MED from different neighbors\n")
1708 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1709 bgp_flag_set (bgp
, BGP_FLAG_ALWAYS_COMPARE_MED
);
1710 bgp_recalculate_all_bestpaths (bgp
);
1715 DEFUN (no_bgp_always_compare_med
,
1716 no_bgp_always_compare_med_cmd
,
1717 "no bgp always-compare-med",
1719 "BGP specific commands\n"
1720 "Allow comparing MED from different neighbors\n")
1722 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1723 bgp_flag_unset (bgp
, BGP_FLAG_ALWAYS_COMPARE_MED
);
1724 bgp_recalculate_all_bestpaths (bgp
);
1729 /* "bgp deterministic-med" configuration. */
1730 DEFUN (bgp_deterministic_med
,
1731 bgp_deterministic_med_cmd
,
1732 "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
);
1738 if (!bgp_flag_check(bgp
, BGP_FLAG_DETERMINISTIC_MED
))
1740 bgp_flag_set (bgp
, BGP_FLAG_DETERMINISTIC_MED
);
1741 bgp_recalculate_all_bestpaths (bgp
);
1747 DEFUN (no_bgp_deterministic_med
,
1748 no_bgp_deterministic_med_cmd
,
1749 "no bgp deterministic-med",
1751 "BGP specific commands\n"
1752 "Pick the best-MED path among paths advertised from the neighboring AS\n")
1754 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1755 int bestpath_per_as_used
;
1759 struct listnode
*node
, *nnode
;
1761 if (bgp_flag_check(bgp
, BGP_FLAG_DETERMINISTIC_MED
))
1763 bestpath_per_as_used
= 0;
1765 for (ALL_LIST_ELEMENTS (bgp
->peer
, node
, nnode
, peer
))
1767 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
1768 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
1769 if (CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_ADDPATH_TX_BESTPATH_PER_AS
))
1771 bestpath_per_as_used
= 1;
1775 if (bestpath_per_as_used
)
1779 if (bestpath_per_as_used
)
1781 vty_out (vty
, "bgp deterministic-med cannot be disabled while addpath-tx-bestpath-per-AS is in use%s",
1787 bgp_flag_unset (bgp
, BGP_FLAG_DETERMINISTIC_MED
);
1788 bgp_recalculate_all_bestpaths (bgp
);
1795 /* "bgp graceful-restart" configuration. */
1796 DEFUN (bgp_graceful_restart
,
1797 bgp_graceful_restart_cmd
,
1798 "bgp graceful-restart",
1799 "BGP specific commands\n"
1800 "Graceful restart capability parameters\n")
1802 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1803 bgp_flag_set (bgp
, BGP_FLAG_GRACEFUL_RESTART
);
1807 DEFUN (no_bgp_graceful_restart
,
1808 no_bgp_graceful_restart_cmd
,
1809 "no bgp graceful-restart",
1811 "BGP specific commands\n"
1812 "Graceful restart capability parameters\n")
1814 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1815 bgp_flag_unset (bgp
, BGP_FLAG_GRACEFUL_RESTART
);
1819 DEFUN (bgp_graceful_restart_stalepath_time
,
1820 bgp_graceful_restart_stalepath_time_cmd
,
1821 "bgp graceful-restart stalepath-time (1-3600)",
1822 "BGP specific commands\n"
1823 "Graceful restart capability parameters\n"
1824 "Set the max time to hold onto restarting peer's stale paths\n"
1825 "Delay value (seconds)\n")
1827 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1829 u_int32_t stalepath
;
1831 VTY_GET_INTEGER_RANGE ("stalepath-time", stalepath
, argv
[idx_number
]->arg
, 1, 3600);
1832 bgp
->stalepath_time
= stalepath
;
1836 DEFUN (bgp_graceful_restart_restart_time
,
1837 bgp_graceful_restart_restart_time_cmd
,
1838 "bgp graceful-restart restart-time (1-3600)",
1839 "BGP specific commands\n"
1840 "Graceful restart capability parameters\n"
1841 "Set the time to wait to delete stale routes before a BGP open message is received\n"
1842 "Delay value (seconds)\n")
1844 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1848 VTY_GET_INTEGER_RANGE ("restart-time", restart
, argv
[idx_number
]->arg
, 1, 3600);
1849 bgp
->restart_time
= restart
;
1853 DEFUN (no_bgp_graceful_restart_stalepath_time
,
1854 no_bgp_graceful_restart_stalepath_time_cmd
,
1855 "no bgp graceful-restart stalepath-time [(1-3600)]",
1857 "BGP specific commands\n"
1858 "Graceful restart capability parameters\n"
1859 "Set the max time to hold onto restarting peer's stale paths\n"
1860 "Delay value (seconds)\n")
1862 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1864 bgp
->stalepath_time
= BGP_DEFAULT_STALEPATH_TIME
;
1868 DEFUN (no_bgp_graceful_restart_restart_time
,
1869 no_bgp_graceful_restart_restart_time_cmd
,
1870 "no bgp graceful-restart restart-time [(1-3600)]",
1872 "BGP specific commands\n"
1873 "Graceful restart capability parameters\n"
1874 "Set the time to wait to delete stale routes before a BGP open message is received\n"
1875 "Delay value (seconds)\n")
1877 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1879 bgp
->restart_time
= BGP_DEFAULT_RESTART_TIME
;
1883 DEFUN (bgp_graceful_restart_preserve_fw
,
1884 bgp_graceful_restart_preserve_fw_cmd
,
1885 "bgp graceful-restart preserve-fw-state",
1886 "BGP specific commands\n"
1887 "Graceful restart capability parameters\n"
1888 "Sets F-bit indication that fib is preserved while doing Graceful Restart\n")
1890 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1891 bgp_flag_set(bgp
, BGP_FLAG_GR_PRESERVE_FWD
);
1895 DEFUN (no_bgp_graceful_restart_preserve_fw
,
1896 no_bgp_graceful_restart_preserve_fw_cmd
,
1897 "no bgp graceful-restart preserve-fw-state",
1899 "BGP specific commands\n"
1900 "Graceful restart capability parameters\n"
1901 "Unsets F-bit indication that fib is preserved while doing Graceful Restart\n")
1903 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1904 bgp_flag_unset(bgp
, BGP_FLAG_GR_PRESERVE_FWD
);
1908 /* "bgp fast-external-failover" configuration. */
1909 DEFUN (bgp_fast_external_failover
,
1910 bgp_fast_external_failover_cmd
,
1911 "bgp fast-external-failover",
1913 "Immediately reset session if a link to a directly connected external peer goes down\n")
1915 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1916 bgp_flag_unset (bgp
, BGP_FLAG_NO_FAST_EXT_FAILOVER
);
1920 DEFUN (no_bgp_fast_external_failover
,
1921 no_bgp_fast_external_failover_cmd
,
1922 "no bgp fast-external-failover",
1925 "Immediately reset session if a link to a directly connected external peer goes down\n")
1927 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1928 bgp_flag_set (bgp
, BGP_FLAG_NO_FAST_EXT_FAILOVER
);
1932 /* "bgp enforce-first-as" configuration. */
1933 DEFUN (bgp_enforce_first_as
,
1934 bgp_enforce_first_as_cmd
,
1935 "bgp enforce-first-as",
1937 "Enforce the first AS for EBGP routes\n")
1939 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1940 bgp_flag_set (bgp
, BGP_FLAG_ENFORCE_FIRST_AS
);
1941 bgp_clear_star_soft_in (vty
, bgp
->name
);
1946 DEFUN (no_bgp_enforce_first_as
,
1947 no_bgp_enforce_first_as_cmd
,
1948 "no bgp enforce-first-as",
1951 "Enforce the first AS for EBGP routes\n")
1953 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1954 bgp_flag_unset (bgp
, BGP_FLAG_ENFORCE_FIRST_AS
);
1955 bgp_clear_star_soft_in (vty
, bgp
->name
);
1960 /* "bgp bestpath compare-routerid" configuration. */
1961 DEFUN (bgp_bestpath_compare_router_id
,
1962 bgp_bestpath_compare_router_id_cmd
,
1963 "bgp bestpath compare-routerid",
1964 "BGP specific commands\n"
1965 "Change the default bestpath selection\n"
1966 "Compare router-id for identical EBGP paths\n")
1968 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1969 bgp_flag_set (bgp
, BGP_FLAG_COMPARE_ROUTER_ID
);
1970 bgp_recalculate_all_bestpaths (bgp
);
1975 DEFUN (no_bgp_bestpath_compare_router_id
,
1976 no_bgp_bestpath_compare_router_id_cmd
,
1977 "no bgp bestpath compare-routerid",
1979 "BGP specific commands\n"
1980 "Change the default bestpath selection\n"
1981 "Compare router-id for identical EBGP paths\n")
1983 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1984 bgp_flag_unset (bgp
, BGP_FLAG_COMPARE_ROUTER_ID
);
1985 bgp_recalculate_all_bestpaths (bgp
);
1990 /* "bgp bestpath as-path ignore" configuration. */
1991 DEFUN (bgp_bestpath_aspath_ignore
,
1992 bgp_bestpath_aspath_ignore_cmd
,
1993 "bgp bestpath as-path ignore",
1994 "BGP specific commands\n"
1995 "Change the default bestpath selection\n"
1996 "AS-path attribute\n"
1997 "Ignore as-path length in selecting a route\n")
1999 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2000 bgp_flag_set (bgp
, BGP_FLAG_ASPATH_IGNORE
);
2001 bgp_recalculate_all_bestpaths (bgp
);
2006 DEFUN (no_bgp_bestpath_aspath_ignore
,
2007 no_bgp_bestpath_aspath_ignore_cmd
,
2008 "no bgp bestpath as-path ignore",
2010 "BGP specific commands\n"
2011 "Change the default bestpath selection\n"
2012 "AS-path attribute\n"
2013 "Ignore as-path length in selecting a route\n")
2015 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2016 bgp_flag_unset (bgp
, BGP_FLAG_ASPATH_IGNORE
);
2017 bgp_recalculate_all_bestpaths (bgp
);
2022 /* "bgp bestpath as-path confed" configuration. */
2023 DEFUN (bgp_bestpath_aspath_confed
,
2024 bgp_bestpath_aspath_confed_cmd
,
2025 "bgp bestpath as-path confed",
2026 "BGP specific commands\n"
2027 "Change the default bestpath selection\n"
2028 "AS-path attribute\n"
2029 "Compare path lengths including confederation sets & sequences in selecting a route\n")
2031 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2032 bgp_flag_set (bgp
, BGP_FLAG_ASPATH_CONFED
);
2033 bgp_recalculate_all_bestpaths (bgp
);
2038 DEFUN (no_bgp_bestpath_aspath_confed
,
2039 no_bgp_bestpath_aspath_confed_cmd
,
2040 "no bgp bestpath as-path confed",
2042 "BGP specific commands\n"
2043 "Change the default bestpath selection\n"
2044 "AS-path attribute\n"
2045 "Compare path lengths including confederation sets & sequences in selecting a route\n")
2047 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2048 bgp_flag_unset (bgp
, BGP_FLAG_ASPATH_CONFED
);
2049 bgp_recalculate_all_bestpaths (bgp
);
2054 /* "bgp bestpath as-path multipath-relax" configuration. */
2055 DEFUN (bgp_bestpath_aspath_multipath_relax
,
2056 bgp_bestpath_aspath_multipath_relax_cmd
,
2057 "bgp bestpath as-path multipath-relax [<as-set|no-as-set>]",
2058 "BGP specific commands\n"
2059 "Change the default bestpath selection\n"
2060 "AS-path attribute\n"
2061 "Allow load sharing across routes that have different AS paths (but same length)\n"
2062 "Generate an AS_SET\n"
2063 "Do not generate an AS_SET\n")
2065 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2067 bgp_flag_set (bgp
, BGP_FLAG_ASPATH_MULTIPATH_RELAX
);
2069 /* no-as-set is now the default behavior so we can silently
2071 if (argv_find (argv
, argc
, "as-set", &idx
))
2072 bgp_flag_set (bgp
, BGP_FLAG_MULTIPATH_RELAX_AS_SET
);
2074 bgp_flag_unset (bgp
, BGP_FLAG_MULTIPATH_RELAX_AS_SET
) ;
2076 bgp_recalculate_all_bestpaths (bgp
);
2081 DEFUN (no_bgp_bestpath_aspath_multipath_relax
,
2082 no_bgp_bestpath_aspath_multipath_relax_cmd
,
2083 "no bgp bestpath as-path multipath-relax [<as-set|no-as-set>]",
2085 "BGP specific commands\n"
2086 "Change the default bestpath selection\n"
2087 "AS-path attribute\n"
2088 "Allow load sharing across routes that have different AS paths (but same length)\n"
2089 "Generate an AS_SET\n"
2090 "Do not generate an AS_SET\n")
2092 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2093 bgp_flag_unset (bgp
, BGP_FLAG_ASPATH_MULTIPATH_RELAX
);
2094 bgp_flag_unset (bgp
, BGP_FLAG_MULTIPATH_RELAX_AS_SET
);
2095 bgp_recalculate_all_bestpaths (bgp
);
2100 /* "bgp log-neighbor-changes" configuration. */
2101 DEFUN (bgp_log_neighbor_changes
,
2102 bgp_log_neighbor_changes_cmd
,
2103 "bgp log-neighbor-changes",
2104 "BGP specific commands\n"
2105 "Log neighbor up/down and reset reason\n")
2107 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2108 bgp_flag_set (bgp
, BGP_FLAG_LOG_NEIGHBOR_CHANGES
);
2112 DEFUN (no_bgp_log_neighbor_changes
,
2113 no_bgp_log_neighbor_changes_cmd
,
2114 "no bgp log-neighbor-changes",
2116 "BGP specific commands\n"
2117 "Log neighbor up/down and reset reason\n")
2119 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2120 bgp_flag_unset (bgp
, BGP_FLAG_LOG_NEIGHBOR_CHANGES
);
2124 /* "bgp bestpath med" configuration. */
2125 DEFUN (bgp_bestpath_med
,
2126 bgp_bestpath_med_cmd
,
2127 "bgp bestpath med <confed [missing-as-worst]|missing-as-worst [confed]>",
2128 "BGP specific commands\n"
2129 "Change the default bestpath selection\n"
2131 "Compare MED among confederation paths\n"
2132 "Treat missing MED as the least preferred one\n"
2133 "Treat missing MED as the least preferred one\n"
2134 "Compare MED among confederation paths\n")
2136 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2139 if (argv_find (argv
, argc
, "confed", &idx
))
2140 bgp_flag_set (bgp
, BGP_FLAG_MED_CONFED
);
2142 if (argv_find (argv
, argc
, "missing-as-worst", &idx
))
2143 bgp_flag_set (bgp
, BGP_FLAG_MED_MISSING_AS_WORST
);
2145 bgp_recalculate_all_bestpaths (bgp
);
2150 DEFUN (no_bgp_bestpath_med
,
2151 no_bgp_bestpath_med_cmd
,
2152 "no bgp bestpath med <confed [missing-as-worst]|missing-as-worst [confed]>",
2154 "BGP specific commands\n"
2155 "Change the default bestpath selection\n"
2157 "Compare MED among confederation paths\n"
2158 "Treat missing MED as the least preferred one\n"
2159 "Treat missing MED as the least preferred one\n"
2160 "Compare MED among confederation paths\n")
2162 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2165 if (argv_find (argv
, argc
, "confed", &idx
))
2166 bgp_flag_unset (bgp
, BGP_FLAG_MED_CONFED
);
2168 if (argv_find (argv
, argc
, "missing-as-worst", &idx
))
2169 bgp_flag_unset (bgp
, BGP_FLAG_MED_MISSING_AS_WORST
);
2171 bgp_recalculate_all_bestpaths (bgp
);
2176 /* "no bgp default ipv4-unicast". */
2177 DEFUN (no_bgp_default_ipv4_unicast
,
2178 no_bgp_default_ipv4_unicast_cmd
,
2179 "no bgp default ipv4-unicast",
2181 "BGP specific commands\n"
2182 "Configure BGP defaults\n"
2183 "Activate ipv4-unicast for a peer by default\n")
2185 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2186 bgp_flag_set (bgp
, BGP_FLAG_NO_DEFAULT_IPV4
);
2190 DEFUN (bgp_default_ipv4_unicast
,
2191 bgp_default_ipv4_unicast_cmd
,
2192 "bgp default ipv4-unicast",
2193 "BGP specific commands\n"
2194 "Configure BGP defaults\n"
2195 "Activate ipv4-unicast for a peer by default\n")
2197 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2198 bgp_flag_unset (bgp
, BGP_FLAG_NO_DEFAULT_IPV4
);
2202 /* Display hostname in certain command outputs */
2203 DEFUN (bgp_default_show_hostname
,
2204 bgp_default_show_hostname_cmd
,
2205 "bgp default show-hostname",
2206 "BGP specific commands\n"
2207 "Configure BGP defaults\n"
2208 "Show hostname in certain command ouputs\n")
2210 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2211 bgp_flag_set (bgp
, BGP_FLAG_SHOW_HOSTNAME
);
2215 DEFUN (no_bgp_default_show_hostname
,
2216 no_bgp_default_show_hostname_cmd
,
2217 "no bgp default show-hostname",
2219 "BGP specific commands\n"
2220 "Configure BGP defaults\n"
2221 "Show hostname in certain command ouputs\n")
2223 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2224 bgp_flag_unset (bgp
, BGP_FLAG_SHOW_HOSTNAME
);
2228 /* "bgp network import-check" configuration. */
2229 DEFUN (bgp_network_import_check
,
2230 bgp_network_import_check_cmd
,
2231 "bgp network import-check",
2232 "BGP specific commands\n"
2233 "BGP network command\n"
2234 "Check BGP network route exists in IGP\n")
2236 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2237 if (!bgp_flag_check(bgp
, BGP_FLAG_IMPORT_CHECK
))
2239 bgp_flag_set (bgp
, BGP_FLAG_IMPORT_CHECK
);
2240 bgp_static_redo_import_check(bgp
);
2246 ALIAS_HIDDEN (bgp_network_import_check
,
2247 bgp_network_import_check_exact_cmd
,
2248 "bgp network import-check exact",
2249 "BGP specific commands\n"
2250 "BGP network command\n"
2251 "Check BGP network route exists in IGP\n"
2252 "Match route precisely\n")
2254 DEFUN (no_bgp_network_import_check
,
2255 no_bgp_network_import_check_cmd
,
2256 "no bgp network import-check",
2258 "BGP specific commands\n"
2259 "BGP network command\n"
2260 "Check BGP network route exists in IGP\n")
2262 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2263 if (bgp_flag_check(bgp
, BGP_FLAG_IMPORT_CHECK
))
2265 bgp_flag_unset (bgp
, BGP_FLAG_IMPORT_CHECK
);
2266 bgp_static_redo_import_check(bgp
);
2272 DEFUN (bgp_default_local_preference
,
2273 bgp_default_local_preference_cmd
,
2274 "bgp default local-preference (0-4294967295)",
2275 "BGP specific commands\n"
2276 "Configure BGP defaults\n"
2277 "local preference (higher=more preferred)\n"
2278 "Configure default local preference value\n")
2280 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2282 u_int32_t local_pref
;
2284 VTY_GET_INTEGER ("local preference", local_pref
, argv
[idx_number
]->arg
);
2286 bgp_default_local_preference_set (bgp
, local_pref
);
2287 bgp_clear_star_soft_in (vty
, bgp
->name
);
2292 DEFUN (no_bgp_default_local_preference
,
2293 no_bgp_default_local_preference_cmd
,
2294 "no bgp default local-preference [(0-4294967295)]",
2296 "BGP specific commands\n"
2297 "Configure BGP defaults\n"
2298 "local preference (higher=more preferred)\n"
2299 "Configure default local preference value\n")
2301 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2302 bgp_default_local_preference_unset (bgp
);
2303 bgp_clear_star_soft_in (vty
, bgp
->name
);
2309 DEFUN (bgp_default_subgroup_pkt_queue_max
,
2310 bgp_default_subgroup_pkt_queue_max_cmd
,
2311 "bgp default subgroup-pkt-queue-max (20-100)",
2312 "BGP specific commands\n"
2313 "Configure BGP defaults\n"
2314 "subgroup-pkt-queue-max\n"
2315 "Configure subgroup packet queue max\n")
2317 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2321 VTY_GET_INTEGER ("subgroup packet queue max", max_size
, argv
[idx_number
]->arg
);
2323 bgp_default_subgroup_pkt_queue_max_set (bgp
, max_size
);
2328 DEFUN (no_bgp_default_subgroup_pkt_queue_max
,
2329 no_bgp_default_subgroup_pkt_queue_max_cmd
,
2330 "no bgp default subgroup-pkt-queue-max [(20-100)]",
2332 "BGP specific commands\n"
2333 "Configure BGP defaults\n"
2334 "subgroup-pkt-queue-max\n"
2335 "Configure subgroup packet queue max\n")
2337 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2338 bgp_default_subgroup_pkt_queue_max_unset (bgp
);
2343 DEFUN (bgp_rr_allow_outbound_policy
,
2344 bgp_rr_allow_outbound_policy_cmd
,
2345 "bgp route-reflector allow-outbound-policy",
2346 "BGP specific commands\n"
2347 "Allow modifications made by out route-map\n"
2348 "on ibgp neighbors\n")
2350 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2352 if (!bgp_flag_check(bgp
, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY
))
2354 bgp_flag_set(bgp
, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY
);
2355 update_group_announce_rrclients(bgp
);
2356 bgp_clear_star_soft_out (vty
, bgp
->name
);
2362 DEFUN (no_bgp_rr_allow_outbound_policy
,
2363 no_bgp_rr_allow_outbound_policy_cmd
,
2364 "no bgp route-reflector allow-outbound-policy",
2366 "BGP specific commands\n"
2367 "Allow modifications made by out route-map\n"
2368 "on ibgp neighbors\n")
2370 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2372 if (bgp_flag_check(bgp
, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY
))
2374 bgp_flag_unset(bgp
, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY
);
2375 update_group_announce_rrclients(bgp
);
2376 bgp_clear_star_soft_out (vty
, bgp
->name
);
2382 DEFUN (bgp_listen_limit
,
2383 bgp_listen_limit_cmd
,
2384 "bgp listen limit (1-5000)",
2385 "BGP specific commands\n"
2386 "Configure BGP defaults\n"
2387 "maximum number of BGP Dynamic Neighbors that can be created\n"
2388 "Configure Dynamic Neighbors listen limit value\n")
2390 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2394 VTY_GET_INTEGER_RANGE ("listen limit", listen_limit
, argv
[idx_number
]->arg
,
2395 BGP_DYNAMIC_NEIGHBORS_LIMIT_MIN
,
2396 BGP_DYNAMIC_NEIGHBORS_LIMIT_MAX
);
2398 bgp_listen_limit_set (bgp
, listen_limit
);
2403 DEFUN (no_bgp_listen_limit
,
2404 no_bgp_listen_limit_cmd
,
2405 "no bgp listen limit [(1-5000)]",
2406 "BGP specific commands\n"
2407 "Configure BGP defaults\n"
2408 "unset maximum number of BGP Dynamic Neighbors that can be created\n"
2409 "Configure Dynamic Neighbors listen limit value to default\n"
2410 "Configure Dynamic Neighbors listen limit value\n")
2412 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2413 bgp_listen_limit_unset (bgp
);
2419 * Check if this listen range is already configured. Check for exact
2420 * match or overlap based on input.
2422 static struct peer_group
*
2423 listen_range_exists (struct bgp
*bgp
, struct prefix
*range
, int exact
)
2425 struct listnode
*node
, *nnode
;
2426 struct listnode
*node1
, *nnode1
;
2427 struct peer_group
*group
;
2432 afi
= family2afi(range
->family
);
2433 for (ALL_LIST_ELEMENTS (bgp
->group
, node
, nnode
, group
))
2435 for (ALL_LIST_ELEMENTS (group
->listen_range
[afi
], node1
,
2439 match
= prefix_same (range
, lr
);
2441 match
= (prefix_match (range
, lr
) || prefix_match (lr
, range
));
2450 DEFUN (bgp_listen_range
,
2451 bgp_listen_range_cmd
,
2452 "bgp listen range <A.B.C.D/M|X:X::X:X/M> peer-group WORD",
2453 "BGP specific commands\n"
2454 "Configure BGP dynamic neighbors listen range\n"
2455 "Configure BGP dynamic neighbors listen range\n"
2457 "Member of the peer-group\n"
2458 "Peer-group name\n")
2460 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2461 struct prefix range
;
2462 struct peer_group
*group
, *existing_group
;
2467 argv_find (argv
, argc
, "A.B.C.D/M", &idx
);
2468 argv_find (argv
, argc
, "X:X::X:X/M", &idx
);
2469 char *prefix
= argv
[idx
]->arg
;
2470 argv_find (argv
, argc
, "WORD", &idx
);
2471 char *peergroup
= argv
[idx
]->arg
;
2473 /* Convert IP prefix string to struct prefix. */
2474 ret
= str2prefix (prefix
, &range
);
2477 vty_out (vty
, "%% Malformed listen range%s", VTY_NEWLINE
);
2481 afi
= family2afi(range
.family
);
2483 if (afi
== AFI_IP6
&& IN6_IS_ADDR_LINKLOCAL (&range
.u
.prefix6
))
2485 vty_out (vty
, "%% Malformed listen range (link-local address)%s",
2490 apply_mask (&range
);
2492 /* Check if same listen range is already configured. */
2493 existing_group
= listen_range_exists (bgp
, &range
, 1);
2496 if (strcmp (existing_group
->name
, peergroup
) == 0)
2500 vty_out (vty
, "%% Same listen range is attached to peer-group %s%s",
2501 existing_group
->name
, VTY_NEWLINE
);
2506 /* Check if an overlapping listen range exists. */
2507 if (listen_range_exists (bgp
, &range
, 0))
2509 vty_out (vty
, "%% Listen range overlaps with existing listen range%s",
2514 group
= peer_group_lookup (bgp
, peergroup
);
2517 vty_out (vty
, "%% Configure the peer-group first%s", VTY_NEWLINE
);
2521 ret
= peer_group_listen_range_add(group
, &range
);
2522 return bgp_vty_return (vty
, ret
);
2525 DEFUN (no_bgp_listen_range
,
2526 no_bgp_listen_range_cmd
,
2527 "no bgp listen range <A.B.C.D/M|X:X::X:X/M> peer-group WORD",
2529 "BGP specific commands\n"
2530 "Unconfigure BGP dynamic neighbors listen range\n"
2531 "Unconfigure BGP dynamic neighbors listen range\n"
2533 "Member of the peer-group\n"
2534 "Peer-group name\n")
2536 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2537 struct prefix range
;
2538 struct peer_group
*group
;
2543 argv_find (argv
, argc
, "A.B.C.D/M", &idx
);
2544 argv_find (argv
, argc
, "X:X::X:X/M", &idx
);
2545 char *prefix
= argv
[idx
]->arg
;
2546 argv_find (argv
, argc
, "WORD", &idx
);
2547 char *peergroup
= argv
[idx
]->arg
;
2549 // VTY_GET_IPV4_PREFIX ("listen range", range, argv[idx_ipv4_prefixlen]->arg);
2551 /* Convert IP prefix string to struct prefix. */
2552 ret
= str2prefix (prefix
, &range
);
2555 vty_out (vty
, "%% Malformed listen range%s", VTY_NEWLINE
);
2559 afi
= family2afi(range
.family
);
2561 if (afi
== AFI_IP6
&& IN6_IS_ADDR_LINKLOCAL (&range
.u
.prefix6
))
2563 vty_out (vty
, "%% Malformed listen range (link-local address)%s",
2568 apply_mask (&range
);
2570 group
= peer_group_lookup (bgp
, peergroup
);
2573 vty_out (vty
, "%% Peer-group does not exist%s", VTY_NEWLINE
);
2577 ret
= peer_group_listen_range_del(group
, &range
);
2578 return bgp_vty_return (vty
, ret
);
2582 bgp_config_write_listen (struct vty
*vty
, struct bgp
*bgp
)
2584 struct peer_group
*group
;
2585 struct listnode
*node
, *nnode
, *rnode
, *nrnode
;
2586 struct prefix
*range
;
2588 char buf
[PREFIX2STR_BUFFER
];
2590 if (bgp
->dynamic_neighbors_limit
!= BGP_DYNAMIC_NEIGHBORS_LIMIT_DEFAULT
)
2591 vty_out (vty
, " bgp listen limit %d%s",
2592 bgp
->dynamic_neighbors_limit
, VTY_NEWLINE
);
2594 for (ALL_LIST_ELEMENTS (bgp
->group
, node
, nnode
, group
))
2596 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
2598 for (ALL_LIST_ELEMENTS (group
->listen_range
[afi
], rnode
, nrnode
, range
))
2600 prefix2str(range
, buf
, sizeof(buf
));
2601 vty_out(vty
, " bgp listen range %s peer-group %s%s",
2602 buf
, group
->name
, VTY_NEWLINE
);
2611 DEFUN (bgp_disable_connected_route_check
,
2612 bgp_disable_connected_route_check_cmd
,
2613 "bgp disable-ebgp-connected-route-check",
2614 "BGP specific commands\n"
2615 "Disable checking if nexthop is connected on ebgp sessions\n")
2617 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2618 bgp_flag_set (bgp
, BGP_FLAG_DISABLE_NH_CONNECTED_CHK
);
2619 bgp_clear_star_soft_in (vty
, bgp
->name
);
2624 DEFUN (no_bgp_disable_connected_route_check
,
2625 no_bgp_disable_connected_route_check_cmd
,
2626 "no bgp disable-ebgp-connected-route-check",
2628 "BGP specific commands\n"
2629 "Disable checking if nexthop is connected on ebgp sessions\n")
2631 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2632 bgp_flag_unset (bgp
, BGP_FLAG_DISABLE_NH_CONNECTED_CHK
);
2633 bgp_clear_star_soft_in (vty
, bgp
->name
);
2640 peer_remote_as_vty (struct vty
*vty
, const char *peer_str
,
2641 const char *as_str
, afi_t afi
, safi_t safi
)
2643 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2646 int as_type
= AS_SPECIFIED
;
2649 if (as_str
[0] == 'i')
2652 as_type
= AS_INTERNAL
;
2654 else if (as_str
[0] == 'e')
2657 as_type
= AS_EXTERNAL
;
2661 /* Get AS number. */
2662 VTY_GET_INTEGER_RANGE ("AS", as
, as_str
, 1, BGP_AS4_MAX
);
2665 /* If peer is peer group, call proper function. */
2666 ret
= str2sockunion (peer_str
, &su
);
2669 /* Check for peer by interface */
2670 ret
= peer_remote_as (bgp
, NULL
, peer_str
, &as
, as_type
, afi
, safi
);
2673 ret
= peer_group_remote_as (bgp
, peer_str
, &as
, as_type
);
2676 vty_out (vty
, "%% Create the peer-group or interface first%s",
2685 if (peer_address_self_check (bgp
, &su
))
2687 vty_out (vty
, "%% Can not configure the local system as neighbor%s",
2691 ret
= peer_remote_as (bgp
, &su
, NULL
, &as
, as_type
, afi
, safi
);
2694 /* This peer belongs to peer group. */
2697 case BGP_ERR_PEER_GROUP_MEMBER
:
2698 vty_out (vty
, "%% Peer-group AS %u. Cannot configure remote-as for member%s", as
, VTY_NEWLINE
);
2700 case BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT
:
2701 vty_out (vty
, "%% The AS# can not be changed from %u to %s, peer-group members must be all internal or all external%s", as
, as_str
, VTY_NEWLINE
);
2704 return bgp_vty_return (vty
, ret
);
2707 DEFUN (neighbor_remote_as
,
2708 neighbor_remote_as_cmd
,
2709 "neighbor <A.B.C.D|X:X::X:X|WORD> remote-as <(1-4294967295)|internal|external>",
2712 "Specify a BGP neighbor\n"
2714 "Internal BGP peer\n"
2715 "External BGP peer\n")
2718 int idx_remote_as
= 3;
2719 return peer_remote_as_vty (vty
, argv
[idx_peer
]->arg
, argv
[idx_remote_as
]->arg
, AFI_IP
, SAFI_UNICAST
);
2723 peer_conf_interface_get (struct vty
*vty
, const char *conf_if
, afi_t afi
,
2724 safi_t safi
, int v6only
, const char *peer_group_name
,
2727 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2729 int as_type
= AS_UNSPECIFIED
;
2731 struct peer_group
*group
;
2735 group
= peer_group_lookup (bgp
, conf_if
);
2739 vty_out (vty
, "%% Name conflict with peer-group %s", VTY_NEWLINE
);
2745 if (as_str
[0] == 'i')
2747 as_type
= AS_INTERNAL
;
2749 else if (as_str
[0] == 'e')
2751 as_type
= AS_EXTERNAL
;
2755 /* Get AS number. */
2756 VTY_GET_INTEGER_RANGE ("AS", as
, as_str
, 1, BGP_AS4_MAX
);
2757 as_type
= AS_SPECIFIED
;
2761 peer
= peer_lookup_by_conf_if (bgp
, conf_if
);
2765 ret
= peer_remote_as (bgp
, &su
, conf_if
, &as
, as_type
, afi
, safi
);
2769 if (bgp_flag_check (bgp
, BGP_FLAG_NO_DEFAULT_IPV4
)
2770 && afi
== AFI_IP
&& safi
== SAFI_UNICAST
)
2771 peer
= peer_create (NULL
, conf_if
, bgp
, bgp
->as
, as
, as_type
, 0, 0,
2774 peer
= peer_create (NULL
, conf_if
, bgp
, bgp
->as
, as
, as_type
, afi
, safi
,
2781 SET_FLAG(peer
->flags
, PEER_FLAG_IFPEER_V6ONLY
);
2783 /* Request zebra to initiate IPv6 RAs on this interface. We do this
2784 * any unnumbered peer in order to not worry about run-time transitions
2785 * (e.g., peering is initially IPv4, but the IPv4 /30 or /31 address
2786 * gets deleted later etc.)
2789 bgp_zebra_initiate_radv (bgp
, peer
);
2792 if ((v6only
&& !CHECK_FLAG(peer
->flags
, PEER_FLAG_IFPEER_V6ONLY
)) ||
2793 (!v6only
&& CHECK_FLAG(peer
->flags
, PEER_FLAG_IFPEER_V6ONLY
)))
2796 SET_FLAG(peer
->flags
, PEER_FLAG_IFPEER_V6ONLY
);
2798 UNSET_FLAG(peer
->flags
, PEER_FLAG_IFPEER_V6ONLY
);
2800 /* v6only flag changed. Reset bgp seesion */
2801 if (BGP_IS_VALID_STATE_FOR_NOTIF(peer
->status
))
2803 peer
->last_reset
= PEER_DOWN_V6ONLY_CHANGE
;
2804 bgp_notify_send (peer
, BGP_NOTIFY_CEASE
,
2805 BGP_NOTIFY_CEASE_CONFIG_CHANGE
);
2808 bgp_session_reset(peer
);
2811 if (!CHECK_FLAG (peer
->flags
, PEER_FLAG_CAPABILITY_ENHE
))
2812 peer_flag_set (peer
, PEER_FLAG_CAPABILITY_ENHE
);
2814 if (peer_group_name
)
2816 group
= peer_group_lookup (bgp
, peer_group_name
);
2819 vty_out (vty
, "%% Configure the peer-group first%s", VTY_NEWLINE
);
2823 ret
= peer_group_bind (bgp
, &su
, peer
, group
, &as
);
2826 return bgp_vty_return (vty
, ret
);
2829 DEFUN (neighbor_interface_config
,
2830 neighbor_interface_config_cmd
,
2831 "neighbor WORD interface [peer-group WORD]",
2833 "Interface name or neighbor tag\n"
2834 "Enable BGP on interface\n"
2835 "Member of the peer-group\n"
2836 "Peer-group name\n")
2839 int idx_peer_group_word
= 4;
2841 if (argc
> idx_peer_group_word
)
2842 return peer_conf_interface_get (vty
, argv
[idx_word
]->arg
, AFI_IP
, SAFI_UNICAST
, 0,
2843 argv
[idx_peer_group_word
]->arg
, NULL
);
2845 return peer_conf_interface_get (vty
, argv
[idx_word
]->arg
, AFI_IP
, SAFI_UNICAST
, 0,
2849 DEFUN (neighbor_interface_config_v6only
,
2850 neighbor_interface_config_v6only_cmd
,
2851 "neighbor WORD interface v6only [peer-group WORD]",
2853 "Interface name or neighbor tag\n"
2854 "Enable BGP on interface\n"
2855 "Enable BGP with v6 link-local only\n"
2856 "Member of the peer-group\n"
2857 "Peer-group name\n")
2860 int idx_peer_group_word
= 5;
2862 if (argc
> idx_peer_group_word
)
2863 return peer_conf_interface_get (vty
, argv
[idx_word
]->arg
, AFI_IP
, SAFI_UNICAST
, 1,
2864 argv
[idx_peer_group_word
]->arg
, NULL
);
2866 return peer_conf_interface_get (vty
, argv
[idx_word
]->arg
, AFI_IP
, SAFI_UNICAST
, 1,
2871 DEFUN (neighbor_interface_config_remote_as
,
2872 neighbor_interface_config_remote_as_cmd
,
2873 "neighbor WORD interface remote-as <(1-4294967295)|internal|external>",
2875 "Interface name or neighbor tag\n"
2876 "Enable BGP on interface\n"
2877 "Specify a BGP neighbor\n"
2879 "Internal BGP peer\n"
2880 "External BGP peer\n")
2883 int idx_remote_as
= 4;
2884 return peer_conf_interface_get (vty
, argv
[idx_word
]->arg
, AFI_IP
, SAFI_UNICAST
, 0,
2885 NULL
, argv
[idx_remote_as
]->arg
);
2888 DEFUN (neighbor_interface_v6only_config_remote_as
,
2889 neighbor_interface_v6only_config_remote_as_cmd
,
2890 "neighbor WORD interface v6only remote-as <(1-4294967295)|internal|external>",
2892 "Interface name or neighbor tag\n"
2893 "Enable BGP with v6 link-local only\n"
2894 "Enable BGP on interface\n"
2895 "Specify a BGP neighbor\n"
2897 "Internal BGP peer\n"
2898 "External BGP peer\n")
2901 int idx_remote_as
= 5;
2902 return peer_conf_interface_get (vty
, argv
[idx_word
]->arg
, AFI_IP
, SAFI_UNICAST
, 1,
2903 NULL
, argv
[idx_remote_as
]->arg
);
2906 DEFUN (neighbor_peer_group
,
2907 neighbor_peer_group_cmd
,
2908 "neighbor WORD peer-group",
2910 "Interface name or neighbor tag\n"
2911 "Configure peer-group\n")
2913 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2916 struct peer_group
*group
;
2918 peer
= peer_lookup_by_conf_if (bgp
, argv
[idx_word
]->arg
);
2921 vty_out (vty
, "%% Name conflict with interface: %s", VTY_NEWLINE
);
2925 group
= peer_group_get (bgp
, argv
[idx_word
]->arg
);
2934 "no neighbor <WORD|<A.B.C.D|X:X::X:X> [remote-as <(1-4294967295)|internal|external>]>",
2938 "Specify a BGP neighbor\n"
2940 "Internal BGP peer\n"
2941 "External BGP peer\n")
2943 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2947 struct peer_group
*group
;
2951 ret
= str2sockunion (argv
[idx_peer
]->arg
, &su
);
2954 /* look up for neighbor by interface name config. */
2955 peer
= peer_lookup_by_conf_if (bgp
, argv
[idx_peer
]->arg
);
2958 /* Request zebra to terminate IPv6 RAs on this interface. */
2960 bgp_zebra_terminate_radv (peer
->bgp
, peer
);
2965 group
= peer_group_lookup (bgp
, argv
[idx_peer
]->arg
);
2967 peer_group_delete (group
);
2970 vty_out (vty
, "%% Create the peer-group first%s", VTY_NEWLINE
);
2976 peer
= peer_lookup (bgp
, &su
);
2979 if (peer_dynamic_neighbor (peer
))
2981 vty_out (vty
, "%% Operation not allowed on a dynamic neighbor%s",
2986 other
= peer
->doppelganger
;
2988 if (other
&& other
->status
!= Deleted
)
2996 DEFUN (no_neighbor_interface_config
,
2997 no_neighbor_interface_config_cmd
,
2998 "no neighbor WORD interface [v6only] [peer-group WORD] [remote-as <(1-4294967295)|internal|external>]",
3002 "Configure BGP on interface\n"
3003 "Enable BGP with v6 link-local only\n"
3004 "Member of the peer-group\n"
3006 "Specify a BGP neighbor\n"
3008 "Internal BGP peer\n"
3009 "External BGP peer\n")
3011 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
3015 /* look up for neighbor by interface name config. */
3016 peer
= peer_lookup_by_conf_if (bgp
, argv
[idx_word
]->arg
);
3019 /* Request zebra to terminate IPv6 RAs on this interface. */
3021 bgp_zebra_terminate_radv (peer
->bgp
, peer
);
3026 vty_out (vty
, "%% Create the bgp interface first%s", VTY_NEWLINE
);
3032 DEFUN (no_neighbor_peer_group
,
3033 no_neighbor_peer_group_cmd
,
3034 "no neighbor WORD peer-group",
3038 "Configure peer-group\n")
3040 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
3042 struct peer_group
*group
;
3044 group
= peer_group_lookup (bgp
, argv
[idx_word
]->arg
);
3046 peer_group_delete (group
);
3049 vty_out (vty
, "%% Create the peer-group first%s", VTY_NEWLINE
);
3055 DEFUN (no_neighbor_interface_peer_group_remote_as
,
3056 no_neighbor_interface_peer_group_remote_as_cmd
,
3057 "no neighbor WORD remote-as <(1-4294967295)|internal|external>",
3060 "Interface name or neighbor tag\n"
3061 "Specify a BGP neighbor\n"
3063 "Internal BGP peer\n"
3064 "External BGP peer\n")
3066 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
3068 struct peer_group
*group
;
3071 /* look up for neighbor by interface name config. */
3072 peer
= peer_lookup_by_conf_if (bgp
, argv
[idx_word
]->arg
);
3075 peer_as_change (peer
, 0, AS_SPECIFIED
);
3079 group
= peer_group_lookup (bgp
, argv
[idx_word
]->arg
);
3081 peer_group_remote_as_delete (group
);
3084 vty_out (vty
, "%% Create the peer-group or interface first%s", VTY_NEWLINE
);
3090 DEFUN (neighbor_local_as
,
3091 neighbor_local_as_cmd
,
3092 "neighbor <A.B.C.D|X:X::X:X|WORD> local-as (1-4294967295)",
3095 "Specify a local-as number\n"
3096 "AS number used as local AS\n")
3104 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
3108 VTY_GET_INTEGER_RANGE ("Local AS", as
, argv
[idx_number
]->arg
, 1, BGP_AS4_MAX
);
3109 ret
= peer_local_as_set (peer
, as
, 0, 0);
3110 return bgp_vty_return (vty
, ret
);
3113 DEFUN (neighbor_local_as_no_prepend
,
3114 neighbor_local_as_no_prepend_cmd
,
3115 "neighbor <A.B.C.D|X:X::X:X|WORD> local-as (1-4294967295) no-prepend",
3118 "Specify a local-as number\n"
3119 "AS number used as local AS\n"
3120 "Do not prepend local-as to updates from ebgp peers\n")
3128 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
3132 VTY_GET_INTEGER_RANGE ("Local AS", as
, argv
[idx_number
]->arg
, 1, BGP_AS4_MAX
);
3133 ret
= peer_local_as_set (peer
, as
, 1, 0);
3134 return bgp_vty_return (vty
, ret
);
3137 DEFUN (neighbor_local_as_no_prepend_replace_as
,
3138 neighbor_local_as_no_prepend_replace_as_cmd
,
3139 "neighbor <A.B.C.D|X:X::X:X|WORD> local-as (1-4294967295) no-prepend replace-as",
3142 "Specify a local-as number\n"
3143 "AS number used as local AS\n"
3144 "Do not prepend local-as to updates from ebgp peers\n"
3145 "Do not prepend local-as to updates from ibgp peers\n")
3153 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
3157 VTY_GET_INTEGER_RANGE ("Local AS", as
, argv
[idx_number
]->arg
, 1, BGP_AS4_MAX
);
3158 ret
= peer_local_as_set (peer
, as
, 1, 1);
3159 return bgp_vty_return (vty
, ret
);
3162 DEFUN (no_neighbor_local_as
,
3163 no_neighbor_local_as_cmd
,
3164 "no neighbor <A.B.C.D|X:X::X:X|WORD> local-as [(1-4294967295) [no-prepend [replace-as]]]",
3168 "Specify a local-as number\n"
3169 "AS number used as local AS\n"
3170 "Do not prepend local-as to updates from ebgp peers\n"
3171 "Do not prepend local-as to updates from ibgp peers\n")
3177 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
3181 ret
= peer_local_as_unset (peer
);
3182 return bgp_vty_return (vty
, ret
);
3188 DEFUN (neighbor_solo
,
3190 "neighbor <A.B.C.D|X:X::X:X|WORD> solo",
3193 "Solo peer - part of its own update group\n")
3199 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
3203 ret
= update_group_adjust_soloness(peer
, 1);
3204 return bgp_vty_return (vty
, ret
);
3207 DEFUN (no_neighbor_solo
,
3208 no_neighbor_solo_cmd
,
3209 "no neighbor <A.B.C.D|X:X::X:X|WORD> solo",
3213 "Solo peer - part of its own update group\n")
3219 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
3223 ret
= update_group_adjust_soloness(peer
, 0);
3224 return bgp_vty_return (vty
, ret
);
3227 DEFUN (neighbor_password
,
3228 neighbor_password_cmd
,
3229 "neighbor <A.B.C.D|X:X::X:X|WORD> password LINE",
3240 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
3244 ret
= peer_password_set (peer
, argv
[idx_line
]->arg
);
3245 return bgp_vty_return (vty
, ret
);
3248 DEFUN (no_neighbor_password
,
3249 no_neighbor_password_cmd
,
3250 "no neighbor <A.B.C.D|X:X::X:X|WORD> password [LINE]",
3261 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
3265 ret
= peer_password_unset (peer
);
3266 return bgp_vty_return (vty
, ret
);
3270 DEFUN (neighbor_activate
,
3271 neighbor_activate_cmd
,
3272 "neighbor <A.B.C.D|X:X::X:X|WORD> activate",
3275 "Enable the Address Family for this Neighbor\n")
3281 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
3285 ret
= peer_activate (peer
, bgp_node_afi (vty
), bgp_node_safi (vty
));
3292 ALIAS_HIDDEN (neighbor_activate
,
3293 neighbor_activate_hidden_cmd
,
3294 "neighbor <A.B.C.D|X:X::X:X|WORD> activate",
3297 "Enable the Address Family for this Neighbor\n")
3299 DEFUN (no_neighbor_activate
,
3300 no_neighbor_activate_cmd
,
3301 "no neighbor <A.B.C.D|X:X::X:X|WORD> activate",
3305 "Enable the Address Family for this Neighbor\n")
3312 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
3316 ret
= peer_deactivate (peer
, bgp_node_afi (vty
), bgp_node_safi (vty
));
3323 ALIAS_HIDDEN (no_neighbor_activate
,
3324 no_neighbor_activate_hidden_cmd
,
3325 "no neighbor <A.B.C.D|X:X::X:X|WORD> activate",
3329 "Enable the Address Family for this Neighbor\n")
3331 DEFUN (neighbor_set_peer_group
,
3332 neighbor_set_peer_group_cmd
,
3333 "neighbor <A.B.C.D|X:X::X:X|WORD> peer-group WORD",
3336 "Member of the peer-group\n"
3337 "Peer-group name\n")
3339 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
3346 struct peer_group
*group
;
3350 ret
= str2sockunion (argv
[idx_peer
]->arg
, &su
);
3353 peer
= peer_lookup_by_conf_if (bgp
, argv
[idx_peer
]->arg
);
3356 vty_out (vty
, "%% Malformed address or name: %s%s", argv
[idx_peer
]->arg
, VTY_NEWLINE
);
3362 if (peer_address_self_check (bgp
, &su
))
3364 vty_out (vty
, "%% Can not configure the local system as neighbor%s",
3369 /* Disallow for dynamic neighbor. */
3370 peer
= peer_lookup (bgp
, &su
);
3371 if (peer
&& peer_dynamic_neighbor (peer
))
3373 vty_out (vty
, "%% Operation not allowed on a dynamic neighbor%s",
3379 group
= peer_group_lookup (bgp
, argv
[idx_word
]->arg
);
3382 vty_out (vty
, "%% Configure the peer-group first%s", VTY_NEWLINE
);
3386 ret
= peer_group_bind (bgp
, &su
, peer
, group
, &as
);
3388 if (ret
== BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT
)
3390 vty_out (vty
, "%% Peer with AS %u cannot be in this peer-group, members must be all internal or all external%s", as
, VTY_NEWLINE
);
3394 return bgp_vty_return (vty
, ret
);
3397 ALIAS_HIDDEN (neighbor_set_peer_group
,
3398 neighbor_set_peer_group_hidden_cmd
,
3399 "neighbor <A.B.C.D|X:X::X:X|WORD> peer-group WORD",
3402 "Member of the peer-group\n"
3403 "Peer-group name\n")
3405 DEFUN (no_neighbor_set_peer_group
,
3406 no_neighbor_set_peer_group_cmd
,
3407 "no neighbor <A.B.C.D|X:X::X:X|WORD> peer-group WORD",
3411 "Member of the peer-group\n"
3412 "Peer-group name\n")
3414 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
3419 struct peer_group
*group
;
3421 peer
= peer_lookup_vty (vty
, argv
[idx_peer
]->arg
);
3425 group
= peer_group_lookup (bgp
, argv
[idx_word
]->arg
);
3428 vty_out (vty
, "%% Configure the peer-group first%s", VTY_NEWLINE
);
3432 ret
= peer_group_unbind (bgp
, peer
, group
);
3434 return bgp_vty_return (vty
, ret
);
3437 ALIAS_HIDDEN (no_neighbor_set_peer_group
,
3438 no_neighbor_set_peer_group_hidden_cmd
,
3439 "no neighbor <A.B.C.D|X:X::X:X|WORD> peer-group WORD",
3443 "Member of the peer-group\n"
3444 "Peer-group name\n")
3447 peer_flag_modify_vty (struct vty
*vty
, const char *ip_str
,
3448 u_int16_t flag
, int set
)
3453 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
3458 * If 'neighbor <interface>', then this is for directly connected peers,
3459 * we should not accept disable-connected-check.
3461 if (peer
->conf_if
&& (flag
== PEER_FLAG_DISABLE_CONNECTED_CHECK
)) {
3462 vty_out (vty
, "%s is directly connected peer, cannot accept disable-"
3463 "connected-check%s", ip_str
, VTY_NEWLINE
);
3467 if (!set
&& flag
== PEER_FLAG_SHUTDOWN
)
3468 peer_tx_shutdown_message_unset (peer
);
3471 ret
= peer_flag_set (peer
, flag
);
3473 ret
= peer_flag_unset (peer
, flag
);
3475 return bgp_vty_return (vty
, ret
);
3479 peer_flag_set_vty (struct vty
*vty
, const char *ip_str
, u_int16_t flag
)
3481 return peer_flag_modify_vty (vty
, ip_str
, flag
, 1);
3485 peer_flag_unset_vty (struct vty
*vty
, const char *ip_str
, u_int16_t flag
)
3487 return peer_flag_modify_vty (vty
, ip_str
, flag
, 0);
3490 /* neighbor passive. */
3491 DEFUN (neighbor_passive
,
3492 neighbor_passive_cmd
,
3493 "neighbor <A.B.C.D|X:X::X:X|WORD> passive",
3496 "Don't send open messages to this neighbor\n")
3499 return peer_flag_set_vty (vty
, argv
[idx_peer
]->arg
, PEER_FLAG_PASSIVE
);
3502 DEFUN (no_neighbor_passive
,
3503 no_neighbor_passive_cmd
,
3504 "no neighbor <A.B.C.D|X:X::X:X|WORD> passive",
3508 "Don't send open messages to this neighbor\n")
3511 return peer_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, PEER_FLAG_PASSIVE
);
3514 /* neighbor shutdown. */
3515 DEFUN (neighbor_shutdown_msg
,
3516 neighbor_shutdown_msg_cmd
,
3517 "neighbor <A.B.C.D|X:X::X:X|WORD> shutdown message MSG...",
3520 "Administratively shut down this neighbor\n"
3521 "Add a shutdown message (draft-ietf-idr-shutdown-06)\n"
3522 "Shutdown message\n")
3528 struct peer
*peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
3533 message
= argv_concat (argv
, argc
, 4);
3534 peer_tx_shutdown_message_set (peer
, message
);
3535 XFREE (MTYPE_TMP
, message
);
3538 return peer_flag_set_vty (vty
, argv
[idx_peer
]->arg
, PEER_FLAG_SHUTDOWN
);
3541 ALIAS (neighbor_shutdown_msg
,
3542 neighbor_shutdown_cmd
,
3543 "neighbor <A.B.C.D|X:X::X:X|WORD> shutdown",
3546 "Administratively shut down this neighbor\n")
3548 DEFUN (no_neighbor_shutdown_msg
,
3549 no_neighbor_shutdown_msg_cmd
,
3550 "no neighbor <A.B.C.D|X:X::X:X|WORD> shutdown message MSG...",
3554 "Administratively shut down this neighbor\n"
3555 "Remove a shutdown message (draft-ietf-idr-shutdown-06)\n"
3556 "Shutdown message\n")
3560 return peer_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, PEER_FLAG_SHUTDOWN
);
3563 ALIAS (no_neighbor_shutdown_msg
,
3564 no_neighbor_shutdown_cmd
,
3565 "no neighbor <A.B.C.D|X:X::X:X|WORD> shutdown",
3569 "Administratively shut down this neighbor\n")
3571 /* neighbor capability dynamic. */
3572 DEFUN (neighbor_capability_dynamic
,
3573 neighbor_capability_dynamic_cmd
,
3574 "neighbor <A.B.C.D|X:X::X:X|WORD> capability dynamic",
3577 "Advertise capability to the peer\n"
3578 "Advertise dynamic capability to this neighbor\n")
3581 return peer_flag_set_vty (vty
, argv
[idx_peer
]->arg
, PEER_FLAG_DYNAMIC_CAPABILITY
);
3584 DEFUN (no_neighbor_capability_dynamic
,
3585 no_neighbor_capability_dynamic_cmd
,
3586 "no neighbor <A.B.C.D|X:X::X:X|WORD> capability dynamic",
3590 "Advertise capability to the peer\n"
3591 "Advertise dynamic capability to this neighbor\n")
3594 return peer_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, PEER_FLAG_DYNAMIC_CAPABILITY
);
3597 /* neighbor dont-capability-negotiate */
3598 DEFUN (neighbor_dont_capability_negotiate
,
3599 neighbor_dont_capability_negotiate_cmd
,
3600 "neighbor <A.B.C.D|X:X::X:X|WORD> dont-capability-negotiate",
3603 "Do not perform capability negotiation\n")
3606 return peer_flag_set_vty (vty
, argv
[idx_peer
]->arg
, PEER_FLAG_DONT_CAPABILITY
);
3609 DEFUN (no_neighbor_dont_capability_negotiate
,
3610 no_neighbor_dont_capability_negotiate_cmd
,
3611 "no neighbor <A.B.C.D|X:X::X:X|WORD> dont-capability-negotiate",
3615 "Do not perform capability negotiation\n")
3618 return peer_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, PEER_FLAG_DONT_CAPABILITY
);
3621 /* neighbor capability extended next hop encoding */
3622 DEFUN (neighbor_capability_enhe
,
3623 neighbor_capability_enhe_cmd
,
3624 "neighbor <A.B.C.D|X:X::X:X|WORD> capability extended-nexthop",
3627 "Advertise capability to the peer\n"
3628 "Advertise extended next-hop capability to the peer\n")
3631 return peer_flag_set_vty (vty
, argv
[idx_peer
]->arg
, PEER_FLAG_CAPABILITY_ENHE
);
3634 DEFUN (no_neighbor_capability_enhe
,
3635 no_neighbor_capability_enhe_cmd
,
3636 "no neighbor <A.B.C.D|X:X::X:X|WORD> capability extended-nexthop",
3640 "Advertise capability to the peer\n"
3641 "Advertise extended next-hop capability to the peer\n")
3644 return peer_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, PEER_FLAG_CAPABILITY_ENHE
);
3648 peer_af_flag_modify_vty (struct vty
*vty
, const char *peer_str
, afi_t afi
,
3649 safi_t safi
, u_int32_t flag
, int set
)
3654 peer
= peer_and_group_lookup_vty (vty
, peer_str
);
3659 ret
= peer_af_flag_set (peer
, afi
, safi
, flag
);
3661 ret
= peer_af_flag_unset (peer
, afi
, safi
, flag
);
3663 return bgp_vty_return (vty
, ret
);
3667 peer_af_flag_set_vty (struct vty
*vty
, const char *peer_str
, afi_t afi
,
3668 safi_t safi
, u_int32_t flag
)
3670 return peer_af_flag_modify_vty (vty
, peer_str
, afi
, safi
, flag
, 1);
3674 peer_af_flag_unset_vty (struct vty
*vty
, const char *peer_str
, afi_t afi
,
3675 safi_t safi
, u_int32_t flag
)
3677 return peer_af_flag_modify_vty (vty
, peer_str
, afi
, safi
, flag
, 0);
3680 /* neighbor capability orf prefix-list. */
3681 DEFUN (neighbor_capability_orf_prefix
,
3682 neighbor_capability_orf_prefix_cmd
,
3683 "neighbor <A.B.C.D|X:X::X:X|WORD> capability orf prefix-list <both|send|receive>",
3686 "Advertise capability to the peer\n"
3687 "Advertise ORF capability to the peer\n"
3688 "Advertise prefixlist ORF capability to this neighbor\n"
3689 "Capability to SEND and RECEIVE the ORF to/from this neighbor\n"
3690 "Capability to RECEIVE the ORF from this neighbor\n"
3691 "Capability to SEND the ORF to this neighbor\n")
3694 int idx_send_recv
= 5;
3697 if (strmatch (argv
[idx_send_recv
]->text
, "send"))
3698 flag
= PEER_FLAG_ORF_PREFIX_SM
;
3699 else if (strmatch (argv
[idx_send_recv
]->text
, "receive"))
3700 flag
= PEER_FLAG_ORF_PREFIX_RM
;
3701 else if (strmatch (argv
[idx_send_recv
]->text
, "both"))
3702 flag
= PEER_FLAG_ORF_PREFIX_SM
|PEER_FLAG_ORF_PREFIX_RM
;
3706 return peer_af_flag_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
3707 bgp_node_safi (vty
), flag
);
3710 ALIAS_HIDDEN (neighbor_capability_orf_prefix
,
3711 neighbor_capability_orf_prefix_hidden_cmd
,
3712 "neighbor <A.B.C.D|X:X::X:X|WORD> capability orf prefix-list <both|send|receive>",
3715 "Advertise capability to the peer\n"
3716 "Advertise ORF capability to the peer\n"
3717 "Advertise prefixlist ORF capability to this neighbor\n"
3718 "Capability to SEND and RECEIVE the ORF to/from this neighbor\n"
3719 "Capability to RECEIVE the ORF from this neighbor\n"
3720 "Capability to SEND the ORF to this neighbor\n")
3722 DEFUN (no_neighbor_capability_orf_prefix
,
3723 no_neighbor_capability_orf_prefix_cmd
,
3724 "no neighbor <A.B.C.D|X:X::X:X|WORD> capability orf prefix-list <both|send|receive>",
3728 "Advertise capability to the peer\n"
3729 "Advertise ORF capability to the peer\n"
3730 "Advertise prefixlist ORF capability to this neighbor\n"
3731 "Capability to SEND and RECEIVE the ORF to/from this neighbor\n"
3732 "Capability to RECEIVE the ORF from this neighbor\n"
3733 "Capability to SEND the ORF to this neighbor\n")
3736 int idx_send_recv
= 6;
3739 if (strmatch (argv
[idx_send_recv
]->text
, "send"))
3740 flag
= PEER_FLAG_ORF_PREFIX_SM
;
3741 else if (strmatch (argv
[idx_send_recv
]->text
, "receive"))
3742 flag
= PEER_FLAG_ORF_PREFIX_RM
;
3743 else if (strmatch (argv
[idx_send_recv
]->text
, "both"))
3744 flag
= PEER_FLAG_ORF_PREFIX_SM
|PEER_FLAG_ORF_PREFIX_RM
;
3748 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
3749 bgp_node_safi (vty
), flag
);
3752 ALIAS_HIDDEN (no_neighbor_capability_orf_prefix
,
3753 no_neighbor_capability_orf_prefix_hidden_cmd
,
3754 "no neighbor <A.B.C.D|X:X::X:X|WORD> capability orf prefix-list <both|send|receive>",
3758 "Advertise capability to the peer\n"
3759 "Advertise ORF capability to the peer\n"
3760 "Advertise prefixlist ORF capability to this neighbor\n"
3761 "Capability to SEND and RECEIVE the ORF to/from this neighbor\n"
3762 "Capability to RECEIVE the ORF from this neighbor\n"
3763 "Capability to SEND the ORF to this neighbor\n")
3765 /* neighbor next-hop-self. */
3766 DEFUN (neighbor_nexthop_self
,
3767 neighbor_nexthop_self_cmd
,
3768 "neighbor <A.B.C.D|X:X::X:X|WORD> next-hop-self",
3771 "Disable the next hop calculation for this neighbor\n")
3774 return peer_af_flag_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
3775 bgp_node_safi (vty
), PEER_FLAG_NEXTHOP_SELF
);
3778 ALIAS_HIDDEN (neighbor_nexthop_self
,
3779 neighbor_nexthop_self_hidden_cmd
,
3780 "neighbor <A.B.C.D|X:X::X:X|WORD> next-hop-self",
3783 "Disable the next hop calculation for this neighbor\n")
3785 /* neighbor next-hop-self. */
3786 DEFUN (neighbor_nexthop_self_force
,
3787 neighbor_nexthop_self_force_cmd
,
3788 "neighbor <A.B.C.D|X:X::X:X|WORD> next-hop-self force",
3791 "Disable the next hop calculation for this neighbor\n"
3792 "Set the next hop to self for reflected routes\n")
3795 return peer_af_flag_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
3796 bgp_node_safi (vty
),
3797 PEER_FLAG_FORCE_NEXTHOP_SELF
);
3800 ALIAS_HIDDEN (neighbor_nexthop_self_force
,
3801 neighbor_nexthop_self_force_hidden_cmd
,
3802 "neighbor <A.B.C.D|X:X::X:X|WORD> next-hop-self force",
3805 "Disable the next hop calculation for this neighbor\n"
3806 "Set the next hop to self for reflected routes\n")
3808 DEFUN (no_neighbor_nexthop_self
,
3809 no_neighbor_nexthop_self_cmd
,
3810 "no neighbor <A.B.C.D|X:X::X:X|WORD> next-hop-self",
3814 "Disable the next hop calculation for this neighbor\n")
3817 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
3818 bgp_node_safi (vty
),
3819 PEER_FLAG_NEXTHOP_SELF
);
3822 ALIAS_HIDDEN (no_neighbor_nexthop_self
,
3823 no_neighbor_nexthop_self_hidden_cmd
,
3824 "no neighbor <A.B.C.D|X:X::X:X|WORD> next-hop-self",
3828 "Disable the next hop calculation for this neighbor\n")
3830 DEFUN (no_neighbor_nexthop_self_force
,
3831 no_neighbor_nexthop_self_force_cmd
,
3832 "no neighbor <A.B.C.D|X:X::X:X|WORD> next-hop-self force",
3836 "Disable the next hop calculation for this neighbor\n"
3837 "Set the next hop to self for reflected routes\n")
3840 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
3841 bgp_node_safi (vty
),
3842 PEER_FLAG_FORCE_NEXTHOP_SELF
);
3845 ALIAS_HIDDEN (no_neighbor_nexthop_self_force
,
3846 no_neighbor_nexthop_self_force_hidden_cmd
,
3847 "no neighbor <A.B.C.D|X:X::X:X|WORD> next-hop-self force",
3851 "Disable the next hop calculation for this neighbor\n"
3852 "Set the next hop to self for reflected routes\n")
3854 /* neighbor as-override */
3855 DEFUN (neighbor_as_override
,
3856 neighbor_as_override_cmd
,
3857 "neighbor <A.B.C.D|X:X::X:X|WORD> as-override",
3860 "Override ASNs in outbound updates if aspath equals remote-as\n")
3863 return peer_af_flag_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
3864 bgp_node_safi (vty
),
3865 PEER_FLAG_AS_OVERRIDE
);
3868 ALIAS_HIDDEN (neighbor_as_override
,
3869 neighbor_as_override_hidden_cmd
,
3870 "neighbor <A.B.C.D|X:X::X:X|WORD> as-override",
3873 "Override ASNs in outbound updates if aspath equals remote-as\n")
3875 DEFUN (no_neighbor_as_override
,
3876 no_neighbor_as_override_cmd
,
3877 "no neighbor <A.B.C.D|X:X::X:X|WORD> as-override",
3881 "Override ASNs in outbound updates if aspath equals remote-as\n")
3884 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
3885 bgp_node_safi (vty
),
3886 PEER_FLAG_AS_OVERRIDE
);
3889 ALIAS_HIDDEN (no_neighbor_as_override
,
3890 no_neighbor_as_override_hidden_cmd
,
3891 "no neighbor <A.B.C.D|X:X::X:X|WORD> as-override",
3895 "Override ASNs in outbound updates if aspath equals remote-as\n")
3897 /* neighbor remove-private-AS. */
3898 DEFUN (neighbor_remove_private_as
,
3899 neighbor_remove_private_as_cmd
,
3900 "neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS",
3903 "Remove private ASNs in outbound updates\n")
3906 return peer_af_flag_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
3907 bgp_node_safi (vty
),
3908 PEER_FLAG_REMOVE_PRIVATE_AS
);
3911 ALIAS_HIDDEN (neighbor_remove_private_as
,
3912 neighbor_remove_private_as_hidden_cmd
,
3913 "neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS",
3916 "Remove private ASNs in outbound updates\n")
3918 DEFUN (neighbor_remove_private_as_all
,
3919 neighbor_remove_private_as_all_cmd
,
3920 "neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS all",
3923 "Remove private ASNs in outbound updates\n"
3924 "Apply to all AS numbers")
3927 return peer_af_flag_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
3928 bgp_node_safi (vty
),
3929 PEER_FLAG_REMOVE_PRIVATE_AS_ALL
);
3932 ALIAS_HIDDEN (neighbor_remove_private_as_all
,
3933 neighbor_remove_private_as_all_hidden_cmd
,
3934 "neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS all",
3937 "Remove private ASNs in outbound updates\n"
3938 "Apply to all AS numbers")
3940 DEFUN (neighbor_remove_private_as_replace_as
,
3941 neighbor_remove_private_as_replace_as_cmd
,
3942 "neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS replace-AS",
3945 "Remove private ASNs in outbound updates\n"
3946 "Replace private ASNs with our ASN in outbound updates\n")
3949 return peer_af_flag_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
3950 bgp_node_safi (vty
),
3951 PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE
);
3954 ALIAS_HIDDEN (neighbor_remove_private_as_replace_as
,
3955 neighbor_remove_private_as_replace_as_hidden_cmd
,
3956 "neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS replace-AS",
3959 "Remove private ASNs in outbound updates\n"
3960 "Replace private ASNs with our ASN in outbound updates\n")
3962 DEFUN (neighbor_remove_private_as_all_replace_as
,
3963 neighbor_remove_private_as_all_replace_as_cmd
,
3964 "neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS all replace-AS",
3967 "Remove private ASNs in outbound updates\n"
3968 "Apply to all AS numbers\n"
3969 "Replace private ASNs with our ASN in outbound updates\n")
3972 return peer_af_flag_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
3973 bgp_node_safi (vty
),
3974 PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE
);
3977 ALIAS_HIDDEN (neighbor_remove_private_as_all_replace_as
,
3978 neighbor_remove_private_as_all_replace_as_hidden_cmd
,
3979 "neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS all replace-AS",
3982 "Remove private ASNs in outbound updates\n"
3983 "Apply to all AS numbers\n"
3984 "Replace private ASNs with our ASN in outbound updates\n")
3986 DEFUN (no_neighbor_remove_private_as
,
3987 no_neighbor_remove_private_as_cmd
,
3988 "no neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS",
3992 "Remove private ASNs in outbound updates\n")
3995 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
3996 bgp_node_safi (vty
),
3997 PEER_FLAG_REMOVE_PRIVATE_AS
);
4000 ALIAS_HIDDEN (no_neighbor_remove_private_as
,
4001 no_neighbor_remove_private_as_hidden_cmd
,
4002 "no neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS",
4006 "Remove private ASNs in outbound updates\n")
4008 DEFUN (no_neighbor_remove_private_as_all
,
4009 no_neighbor_remove_private_as_all_cmd
,
4010 "no neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS all",
4014 "Remove private ASNs in outbound updates\n"
4015 "Apply to all AS numbers\n")
4018 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4019 bgp_node_safi (vty
),
4020 PEER_FLAG_REMOVE_PRIVATE_AS_ALL
);
4023 ALIAS_HIDDEN (no_neighbor_remove_private_as_all
,
4024 no_neighbor_remove_private_as_all_hidden_cmd
,
4025 "no neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS all",
4029 "Remove private ASNs in outbound updates\n"
4030 "Apply to all AS numbers\n")
4032 DEFUN (no_neighbor_remove_private_as_replace_as
,
4033 no_neighbor_remove_private_as_replace_as_cmd
,
4034 "no neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS replace-AS",
4038 "Remove private ASNs in outbound updates\n"
4039 "Replace private ASNs with our ASN in outbound updates\n")
4042 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4043 bgp_node_safi (vty
),
4044 PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE
);
4047 ALIAS_HIDDEN (no_neighbor_remove_private_as_replace_as
,
4048 no_neighbor_remove_private_as_replace_as_hidden_cmd
,
4049 "no neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS replace-AS",
4053 "Remove private ASNs in outbound updates\n"
4054 "Replace private ASNs with our ASN in outbound updates\n")
4056 DEFUN (no_neighbor_remove_private_as_all_replace_as
,
4057 no_neighbor_remove_private_as_all_replace_as_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 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4068 bgp_node_safi (vty
),
4069 PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE
);
4072 ALIAS_HIDDEN (no_neighbor_remove_private_as_all_replace_as
,
4073 no_neighbor_remove_private_as_all_replace_as_hidden_cmd
,
4074 "no neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS all replace-AS",
4078 "Remove private ASNs in outbound updates\n"
4079 "Apply to all AS numbers\n"
4080 "Replace private ASNs with our ASN in outbound updates\n")
4083 /* neighbor send-community. */
4084 DEFUN (neighbor_send_community
,
4085 neighbor_send_community_cmd
,
4086 "neighbor <A.B.C.D|X:X::X:X|WORD> send-community",
4089 "Send Community attribute to this neighbor\n")
4092 return peer_af_flag_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4093 bgp_node_safi (vty
),
4094 PEER_FLAG_SEND_COMMUNITY
);
4097 ALIAS_HIDDEN (neighbor_send_community
,
4098 neighbor_send_community_hidden_cmd
,
4099 "neighbor <A.B.C.D|X:X::X:X|WORD> send-community",
4102 "Send Community attribute to this neighbor\n")
4104 DEFUN (no_neighbor_send_community
,
4105 no_neighbor_send_community_cmd
,
4106 "no neighbor <A.B.C.D|X:X::X:X|WORD> send-community",
4110 "Send Community attribute to this neighbor\n")
4113 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4114 bgp_node_safi (vty
),
4115 PEER_FLAG_SEND_COMMUNITY
);
4118 ALIAS_HIDDEN (no_neighbor_send_community
,
4119 no_neighbor_send_community_hidden_cmd
,
4120 "no neighbor <A.B.C.D|X:X::X:X|WORD> send-community",
4124 "Send Community attribute to this neighbor\n")
4126 /* neighbor send-community extended. */
4127 DEFUN (neighbor_send_community_type
,
4128 neighbor_send_community_type_cmd
,
4129 "neighbor <A.B.C.D|X:X::X:X|WORD> send-community <both|all|extended|standard|large>",
4132 "Send Community attribute to this neighbor\n"
4133 "Send Standard and Extended Community attributes\n"
4134 "Send Standard, Large and Extended Community attributes\n"
4135 "Send Extended Community attributes\n"
4136 "Send Standard Community attributes\n"
4137 "Send Large Community attributes\n")
4142 char *peer
= argv
[1]->arg
;
4144 if (argv_find (argv
, argc
, "standard", &idx
))
4145 SET_FLAG (flag
, PEER_FLAG_SEND_COMMUNITY
);
4146 else if (argv_find (argv
, argc
, "extended", &idx
))
4147 SET_FLAG (flag
, PEER_FLAG_SEND_EXT_COMMUNITY
);
4148 else if (argv_find (argv
, argc
, "large", &idx
))
4149 SET_FLAG (flag
, PEER_FLAG_SEND_LARGE_COMMUNITY
);
4150 else if (argv_find (argv
, argc
, "both", &idx
))
4152 SET_FLAG (flag
, PEER_FLAG_SEND_COMMUNITY
);
4153 SET_FLAG (flag
, PEER_FLAG_SEND_EXT_COMMUNITY
);
4157 SET_FLAG (flag
, PEER_FLAG_SEND_COMMUNITY
);
4158 SET_FLAG (flag
, PEER_FLAG_SEND_EXT_COMMUNITY
);
4159 SET_FLAG (flag
, PEER_FLAG_SEND_LARGE_COMMUNITY
);
4162 return peer_af_flag_set_vty (vty
, peer
, bgp_node_afi (vty
), bgp_node_safi (vty
), flag
);
4165 ALIAS_HIDDEN (neighbor_send_community_type
,
4166 neighbor_send_community_type_hidden_cmd
,
4167 "neighbor <A.B.C.D|X:X::X:X|WORD> send-community <both|all|extended|standard|large>",
4170 "Send Community attribute to this neighbor\n"
4171 "Send Standard and Extended Community attributes\n"
4172 "Send Standard, Large and Extended Community attributes\n"
4173 "Send Extended Community attributes\n"
4174 "Send Standard Community attributes\n"
4175 "Send Large Community attributes\n")
4177 DEFUN (no_neighbor_send_community_type
,
4178 no_neighbor_send_community_type_cmd
,
4179 "no neighbor <A.B.C.D|X:X::X:X|WORD> send-community <both|all|extended|standard|large>",
4183 "Send Community attribute to this neighbor\n"
4184 "Send Standard and Extended Community attributes\n"
4185 "Send Standard, Large and Extended Community attributes\n"
4186 "Send Extended Community attributes\n"
4187 "Send Standard Community attributes\n"
4188 "Send Large Community attributes\n")
4192 const char *type
= argv
[argc
- 1]->text
;
4194 if (strmatch (type
, "standard"))
4195 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4196 bgp_node_safi (vty
),
4197 PEER_FLAG_SEND_COMMUNITY
);
4198 if (strmatch (type
, "extended"))
4199 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4200 bgp_node_safi (vty
),
4201 PEER_FLAG_SEND_EXT_COMMUNITY
);
4202 if (strmatch (type
, "large"))
4203 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4204 bgp_node_safi (vty
),
4205 PEER_FLAG_SEND_LARGE_COMMUNITY
);
4206 if (strmatch (type
, "both"))
4207 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4208 bgp_node_safi (vty
),
4209 PEER_FLAG_SEND_COMMUNITY
|
4210 PEER_FLAG_SEND_EXT_COMMUNITY
);
4212 /* if (strmatch (type, "all")) */
4213 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4214 bgp_node_safi (vty
),
4215 (PEER_FLAG_SEND_COMMUNITY
|
4216 PEER_FLAG_SEND_EXT_COMMUNITY
|
4217 PEER_FLAG_SEND_LARGE_COMMUNITY
));
4220 ALIAS_HIDDEN (no_neighbor_send_community_type
,
4221 no_neighbor_send_community_type_hidden_cmd
,
4222 "no neighbor <A.B.C.D|X:X::X:X|WORD> send-community <both|all|extended|standard|large>",
4226 "Send Community attribute to this neighbor\n"
4227 "Send Standard and Extended Community attributes\n"
4228 "Send Standard, Large and Extended Community attributes\n"
4229 "Send Extended Community attributes\n"
4230 "Send Standard Community attributes\n"
4231 "Send Large Community attributes\n")
4233 /* neighbor soft-reconfig. */
4234 DEFUN (neighbor_soft_reconfiguration
,
4235 neighbor_soft_reconfiguration_cmd
,
4236 "neighbor <A.B.C.D|X:X::X:X|WORD> soft-reconfiguration inbound",
4239 "Per neighbor soft reconfiguration\n"
4240 "Allow inbound soft reconfiguration for this neighbor\n")
4243 return peer_af_flag_set_vty (vty
, argv
[idx_peer
]->arg
,
4244 bgp_node_afi (vty
), bgp_node_safi (vty
),
4245 PEER_FLAG_SOFT_RECONFIG
);
4248 ALIAS_HIDDEN (neighbor_soft_reconfiguration
,
4249 neighbor_soft_reconfiguration_hidden_cmd
,
4250 "neighbor <A.B.C.D|X:X::X:X|WORD> soft-reconfiguration inbound",
4253 "Per neighbor soft reconfiguration\n"
4254 "Allow inbound soft reconfiguration for this neighbor\n")
4256 DEFUN (no_neighbor_soft_reconfiguration
,
4257 no_neighbor_soft_reconfiguration_cmd
,
4258 "no neighbor <A.B.C.D|X:X::X:X|WORD> soft-reconfiguration inbound",
4262 "Per neighbor soft reconfiguration\n"
4263 "Allow inbound soft reconfiguration for this neighbor\n")
4266 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
,
4267 bgp_node_afi (vty
), bgp_node_safi (vty
),
4268 PEER_FLAG_SOFT_RECONFIG
);
4271 ALIAS_HIDDEN (no_neighbor_soft_reconfiguration
,
4272 no_neighbor_soft_reconfiguration_hidden_cmd
,
4273 "no neighbor <A.B.C.D|X:X::X:X|WORD> soft-reconfiguration inbound",
4277 "Per neighbor soft reconfiguration\n"
4278 "Allow inbound soft reconfiguration for this neighbor\n")
4280 DEFUN (neighbor_route_reflector_client
,
4281 neighbor_route_reflector_client_cmd
,
4282 "neighbor <A.B.C.D|X:X::X:X|WORD> route-reflector-client",
4285 "Configure a neighbor as Route Reflector client\n")
4291 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
4295 return peer_af_flag_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4296 bgp_node_safi (vty
),
4297 PEER_FLAG_REFLECTOR_CLIENT
);
4300 ALIAS_HIDDEN (neighbor_route_reflector_client
,
4301 neighbor_route_reflector_client_hidden_cmd
,
4302 "neighbor <A.B.C.D|X:X::X:X|WORD> route-reflector-client",
4305 "Configure a neighbor as Route Reflector client\n")
4307 DEFUN (no_neighbor_route_reflector_client
,
4308 no_neighbor_route_reflector_client_cmd
,
4309 "no neighbor <A.B.C.D|X:X::X:X|WORD> route-reflector-client",
4313 "Configure a neighbor as Route Reflector client\n")
4316 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4317 bgp_node_safi (vty
),
4318 PEER_FLAG_REFLECTOR_CLIENT
);
4321 ALIAS_HIDDEN (no_neighbor_route_reflector_client
,
4322 no_neighbor_route_reflector_client_hidden_cmd
,
4323 "no neighbor <A.B.C.D|X:X::X:X|WORD> route-reflector-client",
4327 "Configure a neighbor as Route Reflector client\n")
4329 /* neighbor route-server-client. */
4330 DEFUN (neighbor_route_server_client
,
4331 neighbor_route_server_client_cmd
,
4332 "neighbor <A.B.C.D|X:X::X:X|WORD> route-server-client",
4335 "Configure a neighbor as Route Server client\n")
4340 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
4343 return peer_af_flag_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4344 bgp_node_safi (vty
),
4345 PEER_FLAG_RSERVER_CLIENT
);
4348 ALIAS_HIDDEN (neighbor_route_server_client
,
4349 neighbor_route_server_client_hidden_cmd
,
4350 "neighbor <A.B.C.D|X:X::X:X|WORD> route-server-client",
4353 "Configure a neighbor as Route Server client\n")
4355 DEFUN (no_neighbor_route_server_client
,
4356 no_neighbor_route_server_client_cmd
,
4357 "no neighbor <A.B.C.D|X:X::X:X|WORD> route-server-client",
4361 "Configure a neighbor as Route Server client\n")
4364 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4365 bgp_node_safi (vty
),
4366 PEER_FLAG_RSERVER_CLIENT
);
4369 ALIAS_HIDDEN (no_neighbor_route_server_client
,
4370 no_neighbor_route_server_client_hidden_cmd
,
4371 "no neighbor <A.B.C.D|X:X::X:X|WORD> route-server-client",
4375 "Configure a neighbor as Route Server client\n")
4377 DEFUN (neighbor_nexthop_local_unchanged
,
4378 neighbor_nexthop_local_unchanged_cmd
,
4379 "neighbor <A.B.C.D|X:X::X:X|WORD> nexthop-local unchanged",
4382 "Configure treatment of outgoing link-local nexthop attribute\n"
4383 "Leave link-local nexthop unchanged for this peer\n")
4386 return peer_af_flag_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4387 bgp_node_safi (vty
),
4388 PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED
);
4391 DEFUN (no_neighbor_nexthop_local_unchanged
,
4392 no_neighbor_nexthop_local_unchanged_cmd
,
4393 "no neighbor <A.B.C.D|X:X::X:X|WORD> nexthop-local unchanged",
4397 "Configure treatment of outgoing link-local-nexthop attribute\n"
4398 "Leave link-local nexthop unchanged for this peer\n")
4401 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4402 bgp_node_safi (vty
),
4403 PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED
);
4406 DEFUN (neighbor_attr_unchanged
,
4407 neighbor_attr_unchanged_cmd
,
4408 "neighbor <A.B.C.D|X:X::X:X|WORD> attribute-unchanged [{as-path|next-hop|med}]",
4411 "BGP attribute is propagated unchanged to this neighbor\n"
4412 "As-path attribute\n"
4413 "Nexthop attribute\n"
4417 char *peer
= argv
[1]->arg
;
4418 u_int16_t flags
= 0;
4420 if (argv_find (argv
, argc
, "as-path", &idx
))
4421 SET_FLAG (flags
, PEER_FLAG_AS_PATH_UNCHANGED
);
4423 if (argv_find (argv
, argc
, "next-hop", &idx
))
4424 SET_FLAG (flags
, PEER_FLAG_NEXTHOP_UNCHANGED
);
4426 if (argv_find (argv
, argc
, "med", &idx
))
4427 SET_FLAG (flags
, PEER_FLAG_MED_UNCHANGED
);
4429 if (!flags
) // no flags means all of them!
4431 SET_FLAG (flags
, PEER_FLAG_AS_PATH_UNCHANGED
);
4432 SET_FLAG (flags
, PEER_FLAG_NEXTHOP_UNCHANGED
);
4433 SET_FLAG (flags
, PEER_FLAG_MED_UNCHANGED
);
4436 return peer_af_flag_set_vty (vty
, peer
, bgp_node_afi (vty
), bgp_node_safi (vty
), flags
);
4439 ALIAS_HIDDEN (neighbor_attr_unchanged
,
4440 neighbor_attr_unchanged_hidden_cmd
,
4441 "neighbor <A.B.C.D|X:X::X:X|WORD> attribute-unchanged [{as-path|next-hop|med}]",
4444 "BGP attribute is propagated unchanged to this neighbor\n"
4445 "As-path attribute\n"
4446 "Nexthop attribute\n"
4449 DEFUN (no_neighbor_attr_unchanged
,
4450 no_neighbor_attr_unchanged_cmd
,
4451 "no neighbor <A.B.C.D|X:X::X:X|WORD> attribute-unchanged [{as-path|next-hop|med}]",
4455 "BGP attribute is propagated unchanged to this neighbor\n"
4456 "As-path attribute\n"
4457 "Nexthop attribute\n"
4461 char *peer
= argv
[2]->arg
;
4462 u_int16_t flags
= 0;
4464 if (argv_find (argv
, argc
, "as-path", &idx
))
4465 SET_FLAG (flags
, PEER_FLAG_AS_PATH_UNCHANGED
);
4467 if (argv_find (argv
, argc
, "next-hop", &idx
))
4468 SET_FLAG (flags
, PEER_FLAG_NEXTHOP_UNCHANGED
);
4470 if (argv_find (argv
, argc
, "med", &idx
))
4471 SET_FLAG (flags
, PEER_FLAG_MED_UNCHANGED
);
4473 if (!flags
) // no flags means all of them!
4475 SET_FLAG (flags
, PEER_FLAG_AS_PATH_UNCHANGED
);
4476 SET_FLAG (flags
, PEER_FLAG_NEXTHOP_UNCHANGED
);
4477 SET_FLAG (flags
, PEER_FLAG_MED_UNCHANGED
);
4480 return peer_af_flag_unset_vty (vty
, peer
, bgp_node_afi (vty
), bgp_node_safi (vty
), flags
);
4483 ALIAS_HIDDEN (no_neighbor_attr_unchanged
,
4484 no_neighbor_attr_unchanged_hidden_cmd
,
4485 "no neighbor <A.B.C.D|X:X::X:X|WORD> attribute-unchanged [{as-path|next-hop|med}]",
4489 "BGP attribute is propagated unchanged to this neighbor\n"
4490 "As-path attribute\n"
4491 "Nexthop attribute\n"
4494 /* EBGP multihop configuration. */
4496 peer_ebgp_multihop_set_vty (struct vty
*vty
, const char *ip_str
,
4497 const char *ttl_str
)
4502 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
4507 return bgp_vty_return (vty
, BGP_ERR_INVALID_FOR_DIRECT_PEER
);
4512 VTY_GET_INTEGER_RANGE ("TTL", ttl
, ttl_str
, 1, MAXTTL
);
4514 return bgp_vty_return (vty
, peer_ebgp_multihop_set (peer
, ttl
));
4518 peer_ebgp_multihop_unset_vty (struct vty
*vty
, const char *ip_str
)
4522 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
4526 return bgp_vty_return (vty
, peer_ebgp_multihop_unset (peer
));
4529 /* neighbor ebgp-multihop. */
4530 DEFUN (neighbor_ebgp_multihop
,
4531 neighbor_ebgp_multihop_cmd
,
4532 "neighbor <A.B.C.D|X:X::X:X|WORD> ebgp-multihop",
4535 "Allow EBGP neighbors not on directly connected networks\n")
4538 return peer_ebgp_multihop_set_vty (vty
, argv
[idx_peer
]->arg
, NULL
);
4541 DEFUN (neighbor_ebgp_multihop_ttl
,
4542 neighbor_ebgp_multihop_ttl_cmd
,
4543 "neighbor <A.B.C.D|X:X::X:X|WORD> ebgp-multihop (1-255)",
4546 "Allow EBGP neighbors not on directly connected networks\n"
4547 "maximum hop count\n")
4551 return peer_ebgp_multihop_set_vty (vty
, argv
[idx_peer
]->arg
, argv
[idx_number
]->arg
);
4554 DEFUN (no_neighbor_ebgp_multihop
,
4555 no_neighbor_ebgp_multihop_cmd
,
4556 "no neighbor <A.B.C.D|X:X::X:X|WORD> ebgp-multihop [(1-255)]",
4560 "Allow EBGP neighbors not on directly connected networks\n"
4561 "maximum hop count\n")
4564 return peer_ebgp_multihop_unset_vty (vty
, argv
[idx_peer
]->arg
);
4568 /* disable-connected-check */
4569 DEFUN (neighbor_disable_connected_check
,
4570 neighbor_disable_connected_check_cmd
,
4571 "neighbor <A.B.C.D|X:X::X:X|WORD> <disable-connected-check|enforce-multihop>",
4574 "one-hop away EBGP peer using loopback address\n"
4575 "Enforce EBGP neighbors perform multihop\n")
4578 return peer_flag_set_vty (vty
, argv
[idx_peer
]->arg
, PEER_FLAG_DISABLE_CONNECTED_CHECK
);
4581 DEFUN (no_neighbor_disable_connected_check
,
4582 no_neighbor_disable_connected_check_cmd
,
4583 "no neighbor <A.B.C.D|X:X::X:X|WORD> <disable-connected-check|enforce-multihop>",
4587 "one-hop away EBGP peer using loopback address\n"
4588 "Enforce EBGP neighbors perform multihop\n")
4591 return peer_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, PEER_FLAG_DISABLE_CONNECTED_CHECK
);
4594 DEFUN (neighbor_description
,
4595 neighbor_description_cmd
,
4596 "neighbor <A.B.C.D|X:X::X:X|WORD> description LINE...",
4599 "Neighbor specific description\n"
4600 "Up to 80 characters describing this neighbor\n")
4607 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
4611 str
= argv_concat(argv
, argc
, idx_line
);
4613 peer_description_set (peer
, str
);
4615 XFREE (MTYPE_TMP
, str
);
4620 DEFUN (no_neighbor_description
,
4621 no_neighbor_description_cmd
,
4622 "no neighbor <A.B.C.D|X:X::X:X|WORD> description [LINE]",
4626 "Neighbor specific description\n"
4627 "Up to 80 characters describing this neighbor\n")
4632 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
4636 peer_description_unset (peer
);
4642 /* Neighbor update-source. */
4644 peer_update_source_vty (struct vty
*vty
, const char *peer_str
,
4645 const char *source_str
)
4650 peer
= peer_and_group_lookup_vty (vty
, peer_str
);
4660 int ret
= str2sockunion (source_str
, &su
);
4663 peer_update_source_addr_set (peer
, &su
);
4666 if (str2prefix (source_str
, &p
))
4668 vty_out (vty
, "%% Invalid update-source, remove prefix length %s",
4673 peer_update_source_if_set (peer
, source_str
);
4677 peer_update_source_unset (peer
);
4682 #define BGP_UPDATE_SOURCE_HELP_STR \
4685 "Interface name (requires zebra to be running)\n"
4687 DEFUN (neighbor_update_source
,
4688 neighbor_update_source_cmd
,
4689 "neighbor <A.B.C.D|X:X::X:X|WORD> update-source <A.B.C.D|X:X::X:X|WORD>",
4692 "Source of routing updates\n"
4693 BGP_UPDATE_SOURCE_HELP_STR
)
4697 return peer_update_source_vty (vty
, argv
[idx_peer
]->arg
, argv
[idx_peer_2
]->arg
);
4700 DEFUN (no_neighbor_update_source
,
4701 no_neighbor_update_source_cmd
,
4702 "no neighbor <A.B.C.D|X:X::X:X|WORD> update-source [<A.B.C.D|X:X::X:X|WORD>]",
4706 "Source of routing updates\n"
4707 BGP_UPDATE_SOURCE_HELP_STR
)
4710 return peer_update_source_vty (vty
, argv
[idx_peer
]->arg
, NULL
);
4714 peer_default_originate_set_vty (struct vty
*vty
, const char *peer_str
,
4715 afi_t afi
, safi_t safi
,
4716 const char *rmap
, int set
)
4721 peer
= peer_and_group_lookup_vty (vty
, peer_str
);
4726 ret
= peer_default_originate_set (peer
, afi
, safi
, rmap
);
4728 ret
= peer_default_originate_unset (peer
, afi
, safi
);
4730 return bgp_vty_return (vty
, ret
);
4733 /* neighbor default-originate. */
4734 DEFUN (neighbor_default_originate
,
4735 neighbor_default_originate_cmd
,
4736 "neighbor <A.B.C.D|X:X::X:X|WORD> default-originate",
4739 "Originate default route to this neighbor\n")
4742 return peer_default_originate_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4743 bgp_node_safi (vty
), NULL
, 1);
4746 ALIAS_HIDDEN (neighbor_default_originate
,
4747 neighbor_default_originate_hidden_cmd
,
4748 "neighbor <A.B.C.D|X:X::X:X|WORD> default-originate",
4751 "Originate default route to this neighbor\n")
4753 DEFUN (neighbor_default_originate_rmap
,
4754 neighbor_default_originate_rmap_cmd
,
4755 "neighbor <A.B.C.D|X:X::X:X|WORD> default-originate route-map WORD",
4758 "Originate default route to this neighbor\n"
4759 "Route-map to specify criteria to originate default\n"
4764 return peer_default_originate_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4765 bgp_node_safi (vty
), argv
[idx_word
]->arg
, 1);
4768 ALIAS_HIDDEN (neighbor_default_originate_rmap
,
4769 neighbor_default_originate_rmap_hidden_cmd
,
4770 "neighbor <A.B.C.D|X:X::X:X|WORD> default-originate route-map WORD",
4773 "Originate default route to this neighbor\n"
4774 "Route-map to specify criteria to originate default\n"
4777 DEFUN (no_neighbor_default_originate
,
4778 no_neighbor_default_originate_cmd
,
4779 "no neighbor <A.B.C.D|X:X::X:X|WORD> default-originate [route-map WORD]",
4783 "Originate default route to this neighbor\n"
4784 "Route-map to specify criteria to originate default\n"
4788 return peer_default_originate_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4789 bgp_node_safi (vty
), NULL
, 0);
4792 ALIAS_HIDDEN (no_neighbor_default_originate
,
4793 no_neighbor_default_originate_hidden_cmd
,
4794 "no neighbor <A.B.C.D|X:X::X:X|WORD> default-originate [route-map WORD]",
4798 "Originate default route to this neighbor\n"
4799 "Route-map to specify criteria to originate default\n"
4803 /* Set neighbor's BGP port. */
4805 peer_port_vty (struct vty
*vty
, const char *ip_str
, int afi
,
4806 const char *port_str
)
4812 peer
= peer_lookup_vty (vty
, ip_str
);
4818 sp
= getservbyname ("bgp", "tcp");
4819 port
= (sp
== NULL
) ? BGP_PORT_DEFAULT
: ntohs (sp
->s_port
);
4823 VTY_GET_INTEGER("port", port
, port_str
);
4826 peer_port_set (peer
, port
);
4831 /* Set specified peer's BGP port. */
4832 DEFUN (neighbor_port
,
4834 "neighbor <A.B.C.D|X:X::X:X> port (0-65535)",
4837 "Neighbor's BGP port\n"
4838 "TCP port number\n")
4842 return peer_port_vty (vty
, argv
[idx_ip
]->arg
, AFI_IP
, argv
[idx_number
]->arg
);
4845 DEFUN (no_neighbor_port
,
4846 no_neighbor_port_cmd
,
4847 "no neighbor <A.B.C.D|X:X::X:X> port [(0-65535)]",
4851 "Neighbor's BGP port\n"
4852 "TCP port number\n")
4855 return peer_port_vty (vty
, argv
[idx_ip
]->arg
, AFI_IP
, NULL
);
4859 /* neighbor weight. */
4861 peer_weight_set_vty (struct vty
*vty
, const char *ip_str
,
4862 afi_t afi
, safi_t safi
,
4863 const char *weight_str
)
4867 unsigned long weight
;
4869 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
4873 VTY_GET_INTEGER_RANGE("weight", weight
, weight_str
, 0, 65535);
4875 ret
= peer_weight_set (peer
, afi
, safi
, weight
);
4876 return bgp_vty_return (vty
, ret
);
4880 peer_weight_unset_vty (struct vty
*vty
, const char *ip_str
,
4881 afi_t afi
, safi_t safi
)
4886 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
4890 ret
= peer_weight_unset (peer
, afi
, safi
);
4891 return bgp_vty_return (vty
, ret
);
4894 DEFUN (neighbor_weight
,
4895 neighbor_weight_cmd
,
4896 "neighbor <A.B.C.D|X:X::X:X|WORD> weight (0-65535)",
4899 "Set default weight for routes from this neighbor\n"
4904 return peer_weight_set_vty (vty
,
4905 argv
[idx_peer
]->arg
,
4907 bgp_node_safi (vty
),
4908 argv
[idx_number
]->arg
);
4911 ALIAS_HIDDEN (neighbor_weight
,
4912 neighbor_weight_hidden_cmd
,
4913 "neighbor <A.B.C.D|X:X::X:X|WORD> weight (0-65535)",
4916 "Set default weight for routes from this neighbor\n"
4919 DEFUN (no_neighbor_weight
,
4920 no_neighbor_weight_cmd
,
4921 "no neighbor <A.B.C.D|X:X::X:X|WORD> weight [(0-65535)]",
4925 "Set default weight for routes from this neighbor\n"
4929 return peer_weight_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
), bgp_node_safi (vty
));
4932 ALIAS_HIDDEN (no_neighbor_weight
,
4933 no_neighbor_weight_hidden_cmd
,
4934 "no neighbor <A.B.C.D|X:X::X:X|WORD> weight [(0-65535)]",
4938 "Set default weight for routes from this neighbor\n"
4942 /* Override capability negotiation. */
4943 DEFUN (neighbor_override_capability
,
4944 neighbor_override_capability_cmd
,
4945 "neighbor <A.B.C.D|X:X::X:X|WORD> override-capability",
4948 "Override capability negotiation result\n")
4951 return peer_flag_set_vty (vty
, argv
[idx_peer
]->arg
, PEER_FLAG_OVERRIDE_CAPABILITY
);
4954 DEFUN (no_neighbor_override_capability
,
4955 no_neighbor_override_capability_cmd
,
4956 "no neighbor <A.B.C.D|X:X::X:X|WORD> override-capability",
4960 "Override capability negotiation result\n")
4963 return peer_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, PEER_FLAG_OVERRIDE_CAPABILITY
);
4966 DEFUN (neighbor_strict_capability
,
4967 neighbor_strict_capability_cmd
,
4968 "neighbor <A.B.C.D|X:X::X:X> strict-capability-match",
4971 "Strict capability negotiation match\n")
4974 return peer_flag_set_vty (vty
, argv
[idx_ip
]->arg
, PEER_FLAG_STRICT_CAP_MATCH
);
4977 DEFUN (no_neighbor_strict_capability
,
4978 no_neighbor_strict_capability_cmd
,
4979 "no neighbor <A.B.C.D|X:X::X:X> strict-capability-match",
4983 "Strict capability negotiation match\n")
4986 return peer_flag_unset_vty (vty
, argv
[idx_ip
]->arg
, PEER_FLAG_STRICT_CAP_MATCH
);
4990 peer_timers_set_vty (struct vty
*vty
, const char *ip_str
,
4991 const char *keep_str
, const char *hold_str
)
4995 u_int32_t keepalive
;
4998 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
5002 VTY_GET_INTEGER_RANGE ("Keepalive", keepalive
, keep_str
, 0, 65535);
5003 VTY_GET_INTEGER_RANGE ("Holdtime", holdtime
, hold_str
, 0, 65535);
5005 ret
= peer_timers_set (peer
, keepalive
, holdtime
);
5007 return bgp_vty_return (vty
, ret
);
5011 peer_timers_unset_vty (struct vty
*vty
, const char *ip_str
)
5016 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
5020 ret
= peer_timers_unset (peer
);
5022 return bgp_vty_return (vty
, ret
);
5025 DEFUN (neighbor_timers
,
5026 neighbor_timers_cmd
,
5027 "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"
5036 int idx_number_2
= 4;
5037 return peer_timers_set_vty (vty
, argv
[idx_peer
]->arg
, argv
[idx_number
]->arg
, argv
[idx_number_2
]->arg
);
5040 DEFUN (no_neighbor_timers
,
5041 no_neighbor_timers_cmd
,
5042 "no neighbor <A.B.C.D|X:X::X:X|WORD> timers [(0-65535) (0-65535)]",
5046 "BGP per neighbor timers\n"
5047 "Keepalive interval\n"
5051 return peer_timers_unset_vty (vty
, argv
[idx_peer
]->arg
);
5056 peer_timers_connect_set_vty (struct vty
*vty
, const char *ip_str
,
5057 const char *time_str
)
5063 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
5067 VTY_GET_INTEGER_RANGE ("Connect time", connect
, time_str
, 0, 65535);
5069 ret
= peer_timers_connect_set (peer
, connect
);
5071 return bgp_vty_return (vty
, ret
);
5075 peer_timers_connect_unset_vty (struct vty
*vty
, const char *ip_str
)
5080 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
5084 ret
= peer_timers_connect_unset (peer
);
5086 return bgp_vty_return (vty
, ret
);
5089 DEFUN (neighbor_timers_connect
,
5090 neighbor_timers_connect_cmd
,
5091 "neighbor <A.B.C.D|X:X::X:X|WORD> timers connect (1-65535)",
5094 "BGP per neighbor timers\n"
5095 "BGP connect timer\n"
5100 return peer_timers_connect_set_vty (vty
, argv
[idx_peer
]->arg
, argv
[idx_number
]->arg
);
5103 DEFUN (no_neighbor_timers_connect
,
5104 no_neighbor_timers_connect_cmd
,
5105 "no neighbor <A.B.C.D|X:X::X:X|WORD> timers connect [(1-65535)]",
5109 "BGP per neighbor timers\n"
5110 "BGP connect timer\n"
5114 return peer_timers_connect_unset_vty (vty
, argv
[idx_peer
]->arg
);
5119 peer_advertise_interval_vty (struct vty
*vty
, const char *ip_str
,
5120 const char *time_str
, int set
)
5124 u_int32_t routeadv
= 0;
5126 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
5131 VTY_GET_INTEGER_RANGE ("advertise interval", routeadv
, time_str
, 0, 600);
5134 ret
= peer_advertise_interval_set (peer
, routeadv
);
5136 ret
= peer_advertise_interval_unset (peer
);
5138 return bgp_vty_return (vty
, ret
);
5141 DEFUN (neighbor_advertise_interval
,
5142 neighbor_advertise_interval_cmd
,
5143 "neighbor <A.B.C.D|X:X::X:X|WORD> advertisement-interval (0-600)",
5146 "Minimum interval between sending BGP routing updates\n"
5147 "time in seconds\n")
5151 return peer_advertise_interval_vty (vty
, argv
[idx_peer
]->arg
, argv
[idx_number
]->arg
, 1);
5154 DEFUN (no_neighbor_advertise_interval
,
5155 no_neighbor_advertise_interval_cmd
,
5156 "no neighbor <A.B.C.D|X:X::X:X|WORD> advertisement-interval [(0-600)]",
5160 "Minimum interval between sending BGP routing updates\n"
5161 "time in seconds\n")
5164 return peer_advertise_interval_vty (vty
, argv
[idx_peer
]->arg
, NULL
, 0);
5168 /* Time to wait before processing route-map updates */
5169 DEFUN (bgp_set_route_map_delay_timer
,
5170 bgp_set_route_map_delay_timer_cmd
,
5171 "bgp route-map delay-timer (0-600)",
5173 "BGP route-map delay timer\n"
5174 "Time in secs to wait before processing route-map changes\n"
5175 "0 disables the timer, no route updates happen when route-maps change\n")
5178 u_int32_t rmap_delay_timer
;
5180 if (argv
[idx_number
]->arg
)
5182 VTY_GET_INTEGER_RANGE ("delay-timer", rmap_delay_timer
, argv
[idx_number
]->arg
, 0, 600);
5183 bm
->rmap_update_timer
= rmap_delay_timer
;
5185 /* if the dynamic update handling is being disabled, and a timer is
5186 * running, stop the timer and act as if the timer has already fired.
5188 if (!rmap_delay_timer
&& bm
->t_rmap_update
)
5190 BGP_TIMER_OFF(bm
->t_rmap_update
);
5191 thread_execute (bm
->master
, bgp_route_map_update_timer
, NULL
, 0);
5199 DEFUN (no_bgp_set_route_map_delay_timer
,
5200 no_bgp_set_route_map_delay_timer_cmd
,
5201 "no bgp route-map delay-timer [(0-600)]",
5204 "Default BGP route-map delay timer\n"
5205 "Reset to default time to wait for processing route-map changes\n"
5206 "0 disables the timer, no route updates happen when route-maps change\n")
5209 bm
->rmap_update_timer
= RMAP_DEFAULT_UPDATE_TIMER
;
5215 /* neighbor interface */
5217 peer_interface_vty (struct vty
*vty
, const char *ip_str
, const char *str
)
5221 peer
= peer_lookup_vty (vty
, ip_str
);
5222 if (! peer
|| peer
->conf_if
)
5226 peer_interface_set (peer
, str
);
5228 peer_interface_unset (peer
);
5233 DEFUN (neighbor_interface
,
5234 neighbor_interface_cmd
,
5235 "neighbor <A.B.C.D|X:X::X:X> interface WORD",
5243 return peer_interface_vty (vty
, argv
[idx_ip
]->arg
, argv
[idx_word
]->arg
);
5246 DEFUN (no_neighbor_interface
,
5247 no_neighbor_interface_cmd
,
5248 "no neighbor <A.B.C.D|X:X::X:X|WORD> interface WORD",
5256 return peer_interface_vty (vty
, argv
[idx_peer
]->arg
, NULL
);
5259 DEFUN (neighbor_distribute_list
,
5260 neighbor_distribute_list_cmd
,
5261 "neighbor <A.B.C.D|X:X::X:X|WORD> distribute-list <(1-199)|(1300-2699)|WORD> <in|out>",
5264 "Filter updates to/from this neighbor\n"
5265 "IP access-list number\n"
5266 "IP access-list number (expanded range)\n"
5267 "IP Access-list name\n"
5268 "Filter incoming updates\n"
5269 "Filter outgoing updates\n")
5276 const char *pstr
= argv
[idx_peer
]->arg
;
5277 const char *acl
= argv
[idx_acl
]->arg
;
5278 const char *inout
= argv
[argc
-1]->text
;
5280 peer
= peer_and_group_lookup_vty (vty
, pstr
);
5284 /* Check filter direction. */
5285 direct
= strmatch (inout
, "in") ? FILTER_IN
: FILTER_OUT
;
5286 ret
= peer_distribute_set (peer
, bgp_node_afi (vty
), bgp_node_safi (vty
), direct
, acl
);
5288 return bgp_vty_return (vty
, ret
);
5291 ALIAS_HIDDEN (neighbor_distribute_list
,
5292 neighbor_distribute_list_hidden_cmd
,
5293 "neighbor <A.B.C.D|X:X::X:X|WORD> distribute-list <(1-199)|(1300-2699)|WORD> <in|out>",
5296 "Filter updates to/from this neighbor\n"
5297 "IP access-list number\n"
5298 "IP access-list number (expanded range)\n"
5299 "IP Access-list name\n"
5300 "Filter incoming updates\n"
5301 "Filter outgoing updates\n")
5303 DEFUN (no_neighbor_distribute_list
,
5304 no_neighbor_distribute_list_cmd
,
5305 "no neighbor <A.B.C.D|X:X::X:X|WORD> distribute-list <(1-199)|(1300-2699)|WORD> <in|out>",
5309 "Filter updates to/from this neighbor\n"
5310 "IP access-list number\n"
5311 "IP access-list number (expanded range)\n"
5312 "IP Access-list name\n"
5313 "Filter incoming updates\n"
5314 "Filter outgoing updates\n")
5320 const char *pstr
= argv
[idx_peer
]->arg
;
5321 const char *inout
= argv
[argc
-1]->text
;
5323 peer
= peer_and_group_lookup_vty (vty
, pstr
);
5327 /* Check filter direction. */
5328 direct
= strmatch (inout
, "in") ? FILTER_IN
: FILTER_OUT
;
5329 ret
= peer_distribute_unset (peer
, bgp_node_afi (vty
), bgp_node_safi (vty
), direct
);
5331 return bgp_vty_return (vty
, ret
);
5334 ALIAS_HIDDEN (no_neighbor_distribute_list
,
5335 no_neighbor_distribute_list_hidden_cmd
,
5336 "no neighbor <A.B.C.D|X:X::X:X|WORD> distribute-list <(1-199)|(1300-2699)|WORD> <in|out>",
5340 "Filter updates to/from this neighbor\n"
5341 "IP access-list number\n"
5342 "IP access-list number (expanded range)\n"
5343 "IP Access-list name\n"
5344 "Filter incoming updates\n"
5345 "Filter outgoing updates\n")
5347 /* Set prefix list to the peer. */
5349 peer_prefix_list_set_vty (struct vty
*vty
, const char *ip_str
, afi_t afi
,
5350 safi_t safi
, const char *name_str
,
5351 const char *direct_str
)
5355 int direct
= FILTER_IN
;
5357 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
5361 /* Check filter direction. */
5362 if (strncmp (direct_str
, "i", 1) == 0)
5364 else if (strncmp (direct_str
, "o", 1) == 0)
5365 direct
= FILTER_OUT
;
5367 ret
= peer_prefix_list_set (peer
, afi
, safi
, direct
, name_str
);
5369 return bgp_vty_return (vty
, ret
);
5373 peer_prefix_list_unset_vty (struct vty
*vty
, const char *ip_str
, afi_t afi
,
5374 safi_t safi
, const char *direct_str
)
5378 int direct
= FILTER_IN
;
5380 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
5384 /* Check filter direction. */
5385 if (strncmp (direct_str
, "i", 1) == 0)
5387 else if (strncmp (direct_str
, "o", 1) == 0)
5388 direct
= FILTER_OUT
;
5390 ret
= peer_prefix_list_unset (peer
, afi
, safi
, direct
);
5392 return bgp_vty_return (vty
, ret
);
5395 DEFUN (neighbor_prefix_list
,
5396 neighbor_prefix_list_cmd
,
5397 "neighbor <A.B.C.D|X:X::X:X|WORD> prefix-list WORD <in|out>",
5400 "Filter updates to/from this neighbor\n"
5401 "Name of a prefix list\n"
5402 "Filter incoming updates\n"
5403 "Filter outgoing updates\n")
5408 return peer_prefix_list_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
5409 bgp_node_safi (vty
), argv
[idx_word
]->arg
, argv
[idx_in_out
]->arg
);
5412 ALIAS_HIDDEN (neighbor_prefix_list
,
5413 neighbor_prefix_list_hidden_cmd
,
5414 "neighbor <A.B.C.D|X:X::X:X|WORD> prefix-list WORD <in|out>",
5417 "Filter updates to/from this neighbor\n"
5418 "Name of a prefix list\n"
5419 "Filter incoming updates\n"
5420 "Filter outgoing updates\n")
5422 DEFUN (no_neighbor_prefix_list
,
5423 no_neighbor_prefix_list_cmd
,
5424 "no neighbor <A.B.C.D|X:X::X:X|WORD> prefix-list WORD <in|out>",
5428 "Filter updates to/from this neighbor\n"
5429 "Name of a prefix list\n"
5430 "Filter incoming updates\n"
5431 "Filter outgoing updates\n")
5435 return peer_prefix_list_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
5436 bgp_node_safi (vty
), argv
[idx_in_out
]->arg
);
5439 ALIAS_HIDDEN (no_neighbor_prefix_list
,
5440 no_neighbor_prefix_list_hidden_cmd
,
5441 "no neighbor <A.B.C.D|X:X::X:X|WORD> prefix-list WORD <in|out>",
5445 "Filter updates to/from this neighbor\n"
5446 "Name of a prefix list\n"
5447 "Filter incoming updates\n"
5448 "Filter outgoing updates\n")
5451 peer_aslist_set_vty (struct vty
*vty
, const char *ip_str
,
5452 afi_t afi
, safi_t safi
,
5453 const char *name_str
, const char *direct_str
)
5457 int direct
= FILTER_IN
;
5459 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
5463 /* Check filter direction. */
5464 if (strncmp (direct_str
, "i", 1) == 0)
5466 else if (strncmp (direct_str
, "o", 1) == 0)
5467 direct
= FILTER_OUT
;
5469 ret
= peer_aslist_set (peer
, afi
, safi
, direct
, name_str
);
5471 return bgp_vty_return (vty
, ret
);
5475 peer_aslist_unset_vty (struct vty
*vty
, const char *ip_str
,
5476 afi_t afi
, safi_t safi
,
5477 const char *direct_str
)
5481 int direct
= FILTER_IN
;
5483 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
5487 /* Check filter direction. */
5488 if (strncmp (direct_str
, "i", 1) == 0)
5490 else if (strncmp (direct_str
, "o", 1) == 0)
5491 direct
= FILTER_OUT
;
5493 ret
= peer_aslist_unset (peer
, afi
, safi
, direct
);
5495 return bgp_vty_return (vty
, ret
);
5498 DEFUN (neighbor_filter_list
,
5499 neighbor_filter_list_cmd
,
5500 "neighbor <A.B.C.D|X:X::X:X|WORD> filter-list WORD <in|out>",
5503 "Establish BGP filters\n"
5504 "AS path access-list name\n"
5505 "Filter incoming routes\n"
5506 "Filter outgoing routes\n")
5511 return peer_aslist_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
5512 bgp_node_safi (vty
), argv
[idx_word
]->arg
, argv
[idx_in_out
]->arg
);
5515 ALIAS_HIDDEN (neighbor_filter_list
,
5516 neighbor_filter_list_hidden_cmd
,
5517 "neighbor <A.B.C.D|X:X::X:X|WORD> filter-list WORD <in|out>",
5520 "Establish BGP filters\n"
5521 "AS path access-list name\n"
5522 "Filter incoming routes\n"
5523 "Filter outgoing routes\n")
5525 DEFUN (no_neighbor_filter_list
,
5526 no_neighbor_filter_list_cmd
,
5527 "no neighbor <A.B.C.D|X:X::X:X|WORD> filter-list WORD <in|out>",
5531 "Establish BGP filters\n"
5532 "AS path access-list name\n"
5533 "Filter incoming routes\n"
5534 "Filter outgoing routes\n")
5538 return peer_aslist_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
5539 bgp_node_safi (vty
), argv
[idx_in_out
]->arg
);
5542 ALIAS_HIDDEN (no_neighbor_filter_list
,
5543 no_neighbor_filter_list_hidden_cmd
,
5544 "no neighbor <A.B.C.D|X:X::X:X|WORD> filter-list WORD <in|out>",
5548 "Establish BGP filters\n"
5549 "AS path access-list name\n"
5550 "Filter incoming routes\n"
5551 "Filter outgoing routes\n")
5553 /* Set route-map to the peer. */
5555 peer_route_map_set_vty (struct vty
*vty
, const char *ip_str
,
5556 afi_t afi
, safi_t safi
,
5557 const char *name_str
, const char *direct_str
)
5561 int direct
= RMAP_IN
;
5563 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
5567 /* Check filter direction. */
5568 if (strncmp (direct_str
, "in", 2) == 0)
5570 else if (strncmp (direct_str
, "o", 1) == 0)
5573 ret
= peer_route_map_set (peer
, afi
, safi
, direct
, name_str
);
5575 return bgp_vty_return (vty
, ret
);
5579 peer_route_map_unset_vty (struct vty
*vty
, const char *ip_str
, afi_t afi
,
5580 safi_t safi
, const char *direct_str
)
5584 int direct
= RMAP_IN
;
5586 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
5590 /* Check filter direction. */
5591 if (strncmp (direct_str
, "in", 2) == 0)
5593 else if (strncmp (direct_str
, "o", 1) == 0)
5596 ret
= peer_route_map_unset (peer
, afi
, safi
, direct
);
5598 return bgp_vty_return (vty
, ret
);
5601 DEFUN (neighbor_route_map
,
5602 neighbor_route_map_cmd
,
5603 "neighbor <A.B.C.D|X:X::X:X|WORD> route-map WORD <in|out>",
5606 "Apply route map to neighbor\n"
5607 "Name of route map\n"
5608 "Apply map to incoming routes\n"
5609 "Apply map to outbound routes\n")
5614 return peer_route_map_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
5615 bgp_node_safi (vty
), argv
[idx_word
]->arg
, argv
[idx_in_out
]->arg
);
5618 ALIAS_HIDDEN (neighbor_route_map
,
5619 neighbor_route_map_hidden_cmd
,
5620 "neighbor <A.B.C.D|X:X::X:X|WORD> route-map WORD <in|out>",
5623 "Apply route map to neighbor\n"
5624 "Name of route map\n"
5625 "Apply map to incoming routes\n"
5626 "Apply map to outbound routes\n")
5628 DEFUN (no_neighbor_route_map
,
5629 no_neighbor_route_map_cmd
,
5630 "no neighbor <A.B.C.D|X:X::X:X|WORD> route-map WORD <in|out>",
5634 "Apply route map to neighbor\n"
5635 "Name of route map\n"
5636 "Apply map to incoming routes\n"
5637 "Apply map to outbound routes\n")
5641 return peer_route_map_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
5642 bgp_node_safi (vty
), argv
[idx_in_out
]->arg
);
5645 ALIAS_HIDDEN (no_neighbor_route_map
,
5646 no_neighbor_route_map_hidden_cmd
,
5647 "no neighbor <A.B.C.D|X:X::X:X|WORD> route-map WORD <in|out>",
5651 "Apply route map to neighbor\n"
5652 "Name of route map\n"
5653 "Apply map to incoming routes\n"
5654 "Apply map to outbound routes\n")
5656 /* Set unsuppress-map to the peer. */
5658 peer_unsuppress_map_set_vty (struct vty
*vty
, const char *ip_str
, afi_t afi
,
5659 safi_t safi
, const char *name_str
)
5664 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
5668 ret
= peer_unsuppress_map_set (peer
, afi
, safi
, name_str
);
5670 return bgp_vty_return (vty
, ret
);
5673 /* Unset route-map from the peer. */
5675 peer_unsuppress_map_unset_vty (struct vty
*vty
, const char *ip_str
, afi_t afi
,
5681 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
5685 ret
= peer_unsuppress_map_unset (peer
, afi
, safi
);
5687 return bgp_vty_return (vty
, ret
);
5690 DEFUN (neighbor_unsuppress_map
,
5691 neighbor_unsuppress_map_cmd
,
5692 "neighbor <A.B.C.D|X:X::X:X|WORD> unsuppress-map WORD",
5695 "Route-map to selectively unsuppress suppressed routes\n"
5696 "Name of route map\n")
5700 return peer_unsuppress_map_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
5701 bgp_node_safi (vty
), argv
[idx_word
]->arg
);
5704 ALIAS_HIDDEN (neighbor_unsuppress_map
,
5705 neighbor_unsuppress_map_hidden_cmd
,
5706 "neighbor <A.B.C.D|X:X::X:X|WORD> unsuppress-map WORD",
5709 "Route-map to selectively unsuppress suppressed routes\n"
5710 "Name of route map\n")
5712 DEFUN (no_neighbor_unsuppress_map
,
5713 no_neighbor_unsuppress_map_cmd
,
5714 "no neighbor <A.B.C.D|X:X::X:X|WORD> unsuppress-map WORD",
5718 "Route-map to selectively unsuppress suppressed routes\n"
5719 "Name of route map\n")
5722 return peer_unsuppress_map_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
5723 bgp_node_safi (vty
));
5726 ALIAS_HIDDEN (no_neighbor_unsuppress_map
,
5727 no_neighbor_unsuppress_map_hidden_cmd
,
5728 "no neighbor <A.B.C.D|X:X::X:X|WORD> unsuppress-map WORD",
5732 "Route-map to selectively unsuppress suppressed routes\n"
5733 "Name of route map\n")
5736 peer_maximum_prefix_set_vty (struct vty
*vty
, const char *ip_str
, afi_t afi
,
5737 safi_t safi
, const char *num_str
,
5738 const char *threshold_str
, int warning
,
5739 const char *restart_str
)
5747 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
5751 VTY_GET_INTEGER ("maximum number", max
, num_str
);
5753 threshold
= atoi (threshold_str
);
5755 threshold
= MAXIMUM_PREFIX_THRESHOLD_DEFAULT
;
5758 restart
= atoi (restart_str
);
5762 ret
= peer_maximum_prefix_set (peer
, afi
, safi
, max
, threshold
, warning
, restart
);
5764 return bgp_vty_return (vty
, ret
);
5768 peer_maximum_prefix_unset_vty (struct vty
*vty
, const char *ip_str
, afi_t afi
,
5774 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
5778 ret
= peer_maximum_prefix_unset (peer
, afi
, safi
);
5780 return bgp_vty_return (vty
, ret
);
5783 /* Maximum number of prefix configuration. prefix count is different
5784 for each peer configuration. So this configuration can be set for
5785 each peer configuration. */
5786 DEFUN (neighbor_maximum_prefix
,
5787 neighbor_maximum_prefix_cmd
,
5788 "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295)",
5791 "Maximum number of prefix accept from this peer\n"
5792 "maximum no. of prefix limit\n")
5796 return peer_maximum_prefix_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
5797 bgp_node_safi (vty
), argv
[idx_number
]->arg
, NULL
, 0,
5801 ALIAS_HIDDEN (neighbor_maximum_prefix
,
5802 neighbor_maximum_prefix_hidden_cmd
,
5803 "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295)",
5806 "Maximum number of prefix accept from this peer\n"
5807 "maximum no. of prefix limit\n")
5809 DEFUN (neighbor_maximum_prefix_threshold
,
5810 neighbor_maximum_prefix_threshold_cmd
,
5811 "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295) (1-100)",
5814 "Maximum number of prefix accept from this peer\n"
5815 "maximum no. of prefix limit\n"
5816 "Threshold value (%) at which to generate a warning msg\n")
5820 int idx_number_2
= 4;
5821 return peer_maximum_prefix_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
5822 bgp_node_safi (vty
), argv
[idx_number
]->arg
, argv
[idx_number_2
]->arg
, 0,
5826 ALIAS_HIDDEN (neighbor_maximum_prefix_threshold
,
5827 neighbor_maximum_prefix_threshold_hidden_cmd
,
5828 "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295) (1-100)",
5831 "Maximum number of prefix accept from this peer\n"
5832 "maximum no. of prefix limit\n"
5833 "Threshold value (%) at which to generate a warning msg\n")
5835 DEFUN (neighbor_maximum_prefix_warning
,
5836 neighbor_maximum_prefix_warning_cmd
,
5837 "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295) warning-only",
5840 "Maximum number of prefix accept from this peer\n"
5841 "maximum no. of prefix limit\n"
5842 "Only give warning message when limit is exceeded\n")
5846 return peer_maximum_prefix_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
5847 bgp_node_safi (vty
), argv
[idx_number
]->arg
, NULL
, 1,
5851 ALIAS_HIDDEN (neighbor_maximum_prefix_warning
,
5852 neighbor_maximum_prefix_warning_hidden_cmd
,
5853 "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295) warning-only",
5856 "Maximum number of prefix accept from this peer\n"
5857 "maximum no. of prefix limit\n"
5858 "Only give warning message when limit is exceeded\n")
5860 DEFUN (neighbor_maximum_prefix_threshold_warning
,
5861 neighbor_maximum_prefix_threshold_warning_cmd
,
5862 "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295) (1-100) warning-only",
5865 "Maximum number of prefix accept from this peer\n"
5866 "maximum no. of prefix limit\n"
5867 "Threshold value (%) at which to generate a warning msg\n"
5868 "Only give warning message when limit is exceeded\n")
5872 int idx_number_2
= 4;
5873 return peer_maximum_prefix_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
5874 bgp_node_safi (vty
), argv
[idx_number
]->arg
, argv
[idx_number_2
]->arg
, 1, NULL
);
5877 ALIAS_HIDDEN (neighbor_maximum_prefix_threshold_warning
,
5878 neighbor_maximum_prefix_threshold_warning_hidden_cmd
,
5879 "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295) (1-100) warning-only",
5882 "Maximum number of prefix accept from this peer\n"
5883 "maximum no. of prefix limit\n"
5884 "Threshold value (%) at which to generate a warning msg\n"
5885 "Only give warning message when limit is exceeded\n")
5887 DEFUN (neighbor_maximum_prefix_restart
,
5888 neighbor_maximum_prefix_restart_cmd
,
5889 "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295) restart (1-65535)",
5892 "Maximum number of prefix accept from this peer\n"
5893 "maximum no. of prefix limit\n"
5894 "Restart bgp connection after limit is exceeded\n"
5895 "Restart interval in minutes")
5899 int idx_number_2
= 5;
5900 return peer_maximum_prefix_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
5901 bgp_node_safi (vty
), argv
[idx_number
]->arg
, NULL
, 0, argv
[idx_number_2
]->arg
);
5904 ALIAS_HIDDEN (neighbor_maximum_prefix_restart
,
5905 neighbor_maximum_prefix_restart_hidden_cmd
,
5906 "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295) restart (1-65535)",
5909 "Maximum number of prefix accept from this peer\n"
5910 "maximum no. of prefix limit\n"
5911 "Restart bgp connection after limit is exceeded\n"
5912 "Restart interval in minutes")
5914 DEFUN (neighbor_maximum_prefix_threshold_restart
,
5915 neighbor_maximum_prefix_threshold_restart_cmd
,
5916 "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295) (1-100) restart (1-65535)",
5919 "Maximum number of prefixes to accept from this peer\n"
5920 "maximum no. of prefix limit\n"
5921 "Threshold value (%) at which to generate a warning msg\n"
5922 "Restart bgp connection after limit is exceeded\n"
5923 "Restart interval in minutes\n")
5927 int idx_number_2
= 4;
5928 int idx_number_3
= 6;
5929 return peer_maximum_prefix_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
5930 bgp_node_safi (vty
), argv
[idx_number
]->arg
, argv
[idx_number_2
]->arg
, 0, argv
[idx_number_3
]->arg
);
5933 ALIAS_HIDDEN (neighbor_maximum_prefix_threshold_restart
,
5934 neighbor_maximum_prefix_threshold_restart_hidden_cmd
,
5935 "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295) (1-100) restart (1-65535)",
5938 "Maximum number of prefixes to accept from this peer\n"
5939 "maximum no. of prefix limit\n"
5940 "Threshold value (%) at which to generate a warning msg\n"
5941 "Restart bgp connection after limit is exceeded\n"
5942 "Restart interval in minutes\n")
5944 DEFUN (no_neighbor_maximum_prefix
,
5945 no_neighbor_maximum_prefix_cmd
,
5946 "no neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix [(1-4294967295) [(1-100)] [restart (1-65535)] [warning-only]]",
5950 "Maximum number of prefixes to accept from this peer\n"
5951 "maximum no. of prefix limit\n"
5952 "Threshold value (%) at which to generate a warning msg\n"
5953 "Restart bgp connection after limit is exceeded\n"
5954 "Restart interval in minutes\n"
5955 "Only give warning message when limit is exceeded\n")
5958 return peer_maximum_prefix_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
5959 bgp_node_safi (vty
));
5962 ALIAS_HIDDEN (no_neighbor_maximum_prefix
,
5963 no_neighbor_maximum_prefix_hidden_cmd
,
5964 "no neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix [(1-4294967295) [(1-100)] [restart (1-65535)] [warning-only]]",
5968 "Maximum number of prefixes to accept from this peer\n"
5969 "maximum no. of prefix limit\n"
5970 "Threshold value (%) at which to generate a warning msg\n"
5971 "Restart bgp connection after limit is exceeded\n"
5972 "Restart interval in minutes\n"
5973 "Only give warning message when limit is exceeded\n")
5976 /* "neighbor allowas-in" */
5977 DEFUN (neighbor_allowas_in
,
5978 neighbor_allowas_in_cmd
,
5979 "neighbor <A.B.C.D|X:X::X:X|WORD> allowas-in [<(1-10)|origin>]",
5982 "Accept as-path with my AS present in it\n"
5983 "Number of occurances of AS number\n"
5984 "Only accept my AS in the as-path if the route was originated in my AS\n")
5987 int idx_number_origin
= 3;
5993 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
5997 if (argc
<= idx_number_origin
)
6001 if (argv
[idx_number_origin
]->type
== WORD_TKN
)
6004 allow_num
= atoi (argv
[idx_number_origin
]->arg
);
6007 ret
= peer_allowas_in_set (peer
, bgp_node_afi (vty
), bgp_node_safi (vty
),
6010 return bgp_vty_return (vty
, ret
);
6013 ALIAS_HIDDEN (neighbor_allowas_in
,
6014 neighbor_allowas_in_hidden_cmd
,
6015 "neighbor <A.B.C.D|X:X::X:X|WORD> allowas-in [<(1-10)|origin>]",
6018 "Accept as-path with my AS present in it\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")
6022 DEFUN (no_neighbor_allowas_in
,
6023 no_neighbor_allowas_in_cmd
,
6024 "no neighbor <A.B.C.D|X:X::X:X|WORD> allowas-in [<(1-10)|origin>]",
6028 "allow local ASN appears in aspath attribute\n"
6029 "Number of occurances of AS number\n"
6030 "Only accept my AS in the as-path if the route was originated in my AS\n")
6036 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
6040 ret
= peer_allowas_in_unset (peer
, bgp_node_afi (vty
), bgp_node_safi (vty
));
6042 return bgp_vty_return (vty
, ret
);
6045 ALIAS_HIDDEN (no_neighbor_allowas_in
,
6046 no_neighbor_allowas_in_hidden_cmd
,
6047 "no neighbor <A.B.C.D|X:X::X:X|WORD> allowas-in [<(1-10)|origin>]",
6051 "allow local ASN appears in aspath attribute\n"
6052 "Number of occurances of AS number\n"
6053 "Only accept my AS in the as-path if the route was originated in my AS\n")
6055 DEFUN (neighbor_ttl_security
,
6056 neighbor_ttl_security_cmd
,
6057 "neighbor <A.B.C.D|X:X::X:X|WORD> ttl-security hops (1-254)",
6060 "BGP ttl-security parameters\n"
6061 "Specify the maximum number of hops to the BGP peer\n"
6062 "Number of hops to BGP peer\n")
6069 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
6073 VTY_GET_INTEGER_RANGE ("", gtsm_hops
, argv
[idx_number
]->arg
, 1, 254);
6076 * If 'neighbor swpX', then this is for directly connected peers,
6077 * we should not accept a ttl-security hops value greater than 1.
6079 if (peer
->conf_if
&& (gtsm_hops
> 1)) {
6080 vty_out (vty
, "%s is directly connected peer, hops cannot exceed 1%s",
6081 argv
[idx_peer
]->arg
, VTY_NEWLINE
);
6085 return bgp_vty_return (vty
, peer_ttl_security_hops_set (peer
, gtsm_hops
));
6088 DEFUN (no_neighbor_ttl_security
,
6089 no_neighbor_ttl_security_cmd
,
6090 "no neighbor <A.B.C.D|X:X::X:X|WORD> ttl-security hops (1-254)",
6094 "BGP ttl-security parameters\n"
6095 "Specify the maximum number of hops to the BGP peer\n"
6096 "Number of hops to BGP peer\n")
6101 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
6105 return bgp_vty_return (vty
, peer_ttl_security_hops_unset (peer
));
6108 DEFUN (neighbor_addpath_tx_all_paths
,
6109 neighbor_addpath_tx_all_paths_cmd
,
6110 "neighbor <A.B.C.D|X:X::X:X|WORD> addpath-tx-all-paths",
6113 "Use addpath to advertise all paths to a neighbor\n")
6118 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
6122 return peer_af_flag_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
6123 bgp_node_safi (vty
),
6124 PEER_FLAG_ADDPATH_TX_ALL_PATHS
);
6127 ALIAS_HIDDEN (neighbor_addpath_tx_all_paths
,
6128 neighbor_addpath_tx_all_paths_hidden_cmd
,
6129 "neighbor <A.B.C.D|X:X::X:X|WORD> addpath-tx-all-paths",
6132 "Use addpath to advertise all paths to a neighbor\n")
6134 DEFUN (no_neighbor_addpath_tx_all_paths
,
6135 no_neighbor_addpath_tx_all_paths_cmd
,
6136 "no neighbor <A.B.C.D|X:X::X:X|WORD> addpath-tx-all-paths",
6140 "Use addpath to advertise all paths to a neighbor\n")
6143 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
6144 bgp_node_safi (vty
),
6145 PEER_FLAG_ADDPATH_TX_ALL_PATHS
);
6148 ALIAS_HIDDEN (no_neighbor_addpath_tx_all_paths
,
6149 no_neighbor_addpath_tx_all_paths_hidden_cmd
,
6150 "no neighbor <A.B.C.D|X:X::X:X|WORD> addpath-tx-all-paths",
6154 "Use addpath to advertise all paths to a neighbor\n")
6156 DEFUN (neighbor_addpath_tx_bestpath_per_as
,
6157 neighbor_addpath_tx_bestpath_per_as_cmd
,
6158 "neighbor <A.B.C.D|X:X::X:X|WORD> addpath-tx-bestpath-per-AS",
6161 "Use addpath to advertise the bestpath per each neighboring AS\n")
6166 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
6170 return peer_af_flag_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
6171 bgp_node_safi (vty
),
6172 PEER_FLAG_ADDPATH_TX_BESTPATH_PER_AS
);
6175 ALIAS_HIDDEN (neighbor_addpath_tx_bestpath_per_as
,
6176 neighbor_addpath_tx_bestpath_per_as_hidden_cmd
,
6177 "neighbor <A.B.C.D|X:X::X:X|WORD> addpath-tx-bestpath-per-AS",
6180 "Use addpath to advertise the bestpath per each neighboring AS\n")
6182 DEFUN (no_neighbor_addpath_tx_bestpath_per_as
,
6183 no_neighbor_addpath_tx_bestpath_per_as_cmd
,
6184 "no neighbor <A.B.C.D|X:X::X:X|WORD> addpath-tx-bestpath-per-AS",
6188 "Use addpath to advertise the bestpath per each neighboring AS\n")
6191 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
6192 bgp_node_safi (vty
),
6193 PEER_FLAG_ADDPATH_TX_BESTPATH_PER_AS
);
6196 ALIAS_HIDDEN (no_neighbor_addpath_tx_bestpath_per_as
,
6197 no_neighbor_addpath_tx_bestpath_per_as_hidden_cmd
,
6198 "no neighbor <A.B.C.D|X:X::X:X|WORD> addpath-tx-bestpath-per-AS",
6202 "Use addpath to advertise the bestpath per each neighboring AS\n")
6204 DEFUN_NOSH (address_family_ipv4_safi
,
6205 address_family_ipv4_safi_cmd
,
6206 "address-family ipv4 [<unicast|multicast|vpn|labeled-unicast>]",
6207 "Enter Address Family command mode\n"
6214 safi_t safi
= bgp_vty_safi_from_str (argv
[2]->text
);
6215 vty
->node
= bgp_node_type(AFI_IP
, safi
);
6218 vty
->node
= BGP_IPV4_NODE
;
6223 DEFUN_NOSH (address_family_ipv6_safi
,
6224 address_family_ipv6_safi_cmd
,
6225 "address-family ipv6 [<unicast|multicast|vpn|labeled-unicast>]",
6226 "Enter Address Family command mode\n"
6232 safi_t safi
= bgp_vty_safi_from_str (argv
[2]->text
);
6233 vty
->node
= bgp_node_type(AFI_IP6
, safi
);
6236 vty
->node
= BGP_IPV6_NODE
;
6241 #ifdef KEEP_OLD_VPN_COMMANDS
6242 DEFUN_NOSH (address_family_vpnv4
,
6243 address_family_vpnv4_cmd
,
6244 "address-family vpnv4 [unicast]",
6245 "Enter Address Family command mode\n"
6247 "Address Family modifier\n")
6249 vty
->node
= BGP_VPNV4_NODE
;
6253 DEFUN_NOSH (address_family_vpnv6
,
6254 address_family_vpnv6_cmd
,
6255 "address-family vpnv6 [unicast]",
6256 "Enter Address Family command mode\n"
6258 "Address Family modifier\n")
6260 vty
->node
= BGP_VPNV6_NODE
;
6265 DEFUN_NOSH (address_family_evpn
,
6266 address_family_evpn_cmd
,
6267 "address-family <l2vpn evpn>",
6268 "Enter Address Family command mode\n"
6269 "EVPN Address family\n"
6270 "Layer2 VPN Address family\n"
6271 "Ethernet Virtual Private Network Subsequent Address Family\n")
6273 vty
->node
= BGP_EVPN_NODE
;
6277 DEFUN_NOSH (exit_address_family
,
6278 exit_address_family_cmd
,
6279 "exit-address-family",
6280 "Exit from Address Family configuration mode\n")
6282 if (vty
->node
== BGP_IPV4_NODE
6283 || vty
->node
== BGP_IPV4M_NODE
6284 || vty
->node
== BGP_IPV4L_NODE
6285 || vty
->node
== BGP_VPNV4_NODE
6286 || vty
->node
== BGP_IPV6_NODE
6287 || vty
->node
== BGP_IPV6M_NODE
6288 || vty
->node
== BGP_IPV6L_NODE
6289 || vty
->node
== BGP_VPNV6_NODE
6290 || vty
->node
== BGP_EVPN_NODE
)
6291 vty
->node
= BGP_NODE
;
6295 /* Recalculate bestpath and re-advertise a prefix */
6297 bgp_clear_prefix (struct vty
*vty
, const char *view_name
, const char *ip_str
,
6298 afi_t afi
, safi_t safi
, struct prefix_rd
*prd
)
6301 struct prefix match
;
6302 struct bgp_node
*rn
;
6303 struct bgp_node
*rm
;
6305 struct bgp_table
*table
;
6306 struct bgp_table
*rib
;
6308 /* BGP structure lookup. */
6311 bgp
= bgp_lookup_by_name (view_name
);
6314 vty_out (vty
, "%% Can't find BGP instance %s%s", view_name
, VTY_NEWLINE
);
6320 bgp
= bgp_get_default ();
6323 vty_out (vty
, "%% No BGP process is configured%s", VTY_NEWLINE
);
6328 /* Check IP address argument. */
6329 ret
= str2prefix (ip_str
, &match
);
6332 vty_out (vty
, "%% address is malformed%s", VTY_NEWLINE
);
6336 match
.family
= afi2family (afi
);
6337 rib
= bgp
->rib
[afi
][safi
];
6339 if (safi
== SAFI_MPLS_VPN
)
6341 for (rn
= bgp_table_top (rib
); rn
; rn
= bgp_route_next (rn
))
6343 if (prd
&& memcmp (rn
->p
.u
.val
, prd
->val
, 8) != 0)
6346 if ((table
= rn
->info
) != NULL
)
6348 if ((rm
= bgp_node_match (table
, &match
)) != NULL
)
6350 if (rm
->p
.prefixlen
== match
.prefixlen
)
6352 SET_FLAG (rn
->flags
, BGP_NODE_USER_CLEAR
);
6353 bgp_process (bgp
, rm
, afi
, safi
);
6355 bgp_unlock_node (rm
);
6362 if ((rn
= bgp_node_match (rib
, &match
)) != NULL
)
6364 if (rn
->p
.prefixlen
== match
.prefixlen
)
6366 SET_FLAG (rn
->flags
, BGP_NODE_USER_CLEAR
);
6367 bgp_process (bgp
, rn
, afi
, safi
);
6369 bgp_unlock_node (rn
);
6376 /* one clear bgp command to rule them all */
6377 DEFUN (clear_ip_bgp_all
,
6378 clear_ip_bgp_all_cmd
,
6379 "clear [ip] bgp [<view|vrf> VIEWVRFNAME] ["BGP_AFI_CMD_STR
" ["BGP_SAFI_CMD_STR
"]] <*|A.B.C.D|X:X::X:X|WORD|(1-4294967295)|external|peer-group WORD> [<soft [<in|out>]|in [prefix-filter]|out>]",
6383 BGP_INSTANCE_HELP_STR
6385 "BGP neighbor address to clear\n"
6386 "BGP IPv6 neighbor to clear\n"
6387 "BGP neighbor on interface to clear\n"
6388 "Clear peers with the AS number\n"
6389 "Clear all external peers\n"
6390 "Clear all members of peer-group\n"
6391 "BGP peer-group name\n"
6398 "Push out prefix-list ORF and do inbound soft reconfig\n"
6403 afi_t afi
= AFI_IP6
;
6404 safi_t safi
= SAFI_UNICAST
;
6405 enum clear_sort clr_sort
= clear_peer
;
6406 enum bgp_clear_type clr_type
;
6407 char *clr_arg
= NULL
;
6411 /* clear [ip] bgp */
6412 if (argv_find (argv
, argc
, "ip", &idx
))
6414 /* [<view|vrf> VIEWVRFNAME] */
6415 if (argv_find (argv
, argc
, "view", &idx
) || argv_find (argv
, argc
, "vrf", &idx
))
6417 vrf
= argv
[idx
+ 1]->arg
;
6420 /* <*|A.B.C.D|X:X::X:X|WORD|(1-4294967295)|external|peer-group WORD> */
6421 if (argv_find (argv
, argc
, "*", &idx
))
6423 clr_sort
= clear_all
;
6425 else if (argv_find (argv
, argc
, "A.B.C.D", &idx
))
6427 clr_sort
= clear_peer
;
6428 clr_arg
= argv
[idx
]->arg
;
6430 else if (argv_find (argv
, argc
, "X:X::X:X", &idx
))
6432 clr_sort
= clear_peer
;
6433 clr_arg
= argv
[idx
]->arg
;
6435 else if (argv_find (argv
, argc
, "peer-group", &idx
))
6437 clr_sort
= clear_group
;
6439 clr_arg
= argv
[idx
]->arg
;
6441 else if (argv_find (argv
, argc
, "WORD", &idx
))
6443 clr_sort
= clear_peer
;
6444 clr_arg
= argv
[idx
]->arg
;
6446 else if (argv_find (argv
, argc
, "(1-4294967295)", &idx
))
6448 clr_sort
= clear_as
;
6449 clr_arg
= argv
[idx
]->arg
;
6451 else if (argv_find (argv
, argc
, "external", &idx
))
6453 clr_sort
= clear_external
;
6455 /* ["BGP_AFI_CMD_STR" ["BGP_SAFI_CMD_STR"]] */
6456 if (argv_find_and_parse_afi (argv
, argc
, &idx
, &afi
))
6458 argv_find_and_parse_safi (argv
, argc
, &idx
, &safi
);
6460 /* [<soft [<in|out>]|in [prefix-filter]|out>] */
6461 if (argv_find (argv
, argc
, "soft", &idx
))
6463 if (argv_find (argv
, argc
, "in", &idx
) || argv_find (argv
, argc
, "out", &idx
))
6464 clr_type
= strmatch (argv
[idx
]->text
, "in") ? BGP_CLEAR_SOFT_IN
: BGP_CLEAR_SOFT_OUT
;
6466 clr_type
= BGP_CLEAR_SOFT_BOTH
;
6468 else if (argv_find (argv
, argc
, "in", &idx
))
6470 clr_type
= argv_find (argv
, argc
, "prefix-filter", &idx
) ? BGP_CLEAR_SOFT_IN_ORF_PREFIX
: BGP_CLEAR_SOFT_IN
;
6472 else if (argv_find (argv
, argc
, "out", &idx
))
6474 clr_type
= BGP_CLEAR_SOFT_OUT
;
6477 clr_type
= BGP_CLEAR_SOFT_NONE
;
6479 return bgp_clear_vty (vty
, vrf
, afi
, safi
, clr_sort
, clr_type
, clr_arg
);
6482 DEFUN (clear_ip_bgp_prefix
,
6483 clear_ip_bgp_prefix_cmd
,
6484 "clear [ip] bgp [<view|vrf> VIEWVRFNAME] prefix A.B.C.D/M",
6488 BGP_INSTANCE_HELP_STR
6489 "Clear bestpath and re-advertise\n"
6493 char *prefix
= NULL
;
6497 /* [<view|vrf> VIEWVRFNAME] */
6498 if (argv_find (argv
, argc
, "WORD", &idx
))
6499 vrf
= argv
[idx
]->arg
;
6501 prefix
= argv
[argc
-1]->arg
;
6503 return bgp_clear_prefix (vty
, vrf
, prefix
, AFI_IP
, SAFI_UNICAST
, NULL
);
6506 DEFUN (clear_bgp_ipv6_safi_prefix
,
6507 clear_bgp_ipv6_safi_prefix_cmd
,
6508 "clear [ip] bgp ipv6 "BGP_SAFI_CMD_STR
" prefix X:X::X:X/M",
6514 "Clear bestpath and re-advertise\n"
6518 int idx_ipv6_prefixlen
= 5;
6519 return bgp_clear_prefix (vty
, NULL
, argv
[idx_ipv6_prefixlen
]->arg
, AFI_IP6
,
6520 bgp_vty_safi_from_str(argv
[idx_safi
]->text
), NULL
);
6523 DEFUN (clear_bgp_instance_ipv6_safi_prefix
,
6524 clear_bgp_instance_ipv6_safi_prefix_cmd
,
6525 "clear [ip] bgp <view|vrf> VIEWVRFNAME ipv6 "BGP_SAFI_CMD_STR
" prefix X:X::X:X/M",
6529 BGP_INSTANCE_HELP_STR
6532 "Clear bestpath and re-advertise\n"
6537 int idx_ipv6_prefixlen
= 7;
6538 return bgp_clear_prefix (vty
, argv
[idx_word
]->arg
, argv
[idx_ipv6_prefixlen
]->arg
, AFI_IP6
,
6539 bgp_vty_safi_from_str(argv
[idx_safi
]->text
), NULL
);
6542 DEFUN (show_bgp_views
,
6544 "show [ip] bgp views",
6548 "Show the defined BGP views\n")
6550 struct list
*inst
= bm
->bgp
;
6551 struct listnode
*node
;
6554 if (!bgp_option_check (BGP_OPT_MULTIPLE_INSTANCE
))
6556 vty_out (vty
, "BGP Multiple Instance is not enabled%s", VTY_NEWLINE
);
6560 vty_out (vty
, "Defined BGP views:%s", VTY_NEWLINE
);
6561 for (ALL_LIST_ELEMENTS_RO(inst
, node
, bgp
))
6564 if (bgp
->inst_type
== BGP_INSTANCE_TYPE_VRF
)
6566 vty_out (vty
, "\t%s (AS%u)%s",
6567 bgp
->name
? bgp
->name
: "(null)",
6568 bgp
->as
, VTY_NEWLINE
);
6574 DEFUN (show_bgp_vrfs
,
6576 "show [ip] bgp vrfs [json]",
6583 struct list
*inst
= bm
->bgp
;
6584 struct listnode
*node
;
6586 u_char uj
= use_json(argc
, argv
);
6587 json_object
*json
= NULL
;
6588 json_object
*json_vrfs
= NULL
;
6590 static char header
[] = "Type Id RouterId #PeersCfg #PeersEstb Name";
6592 if (!bgp_option_check (BGP_OPT_MULTIPLE_INSTANCE
))
6594 vty_out (vty
, "BGP Multiple Instance is not enabled%s", VTY_NEWLINE
);
6600 json
= json_object_new_object();
6601 json_vrfs
= json_object_new_object();
6604 for (ALL_LIST_ELEMENTS_RO(inst
, node
, bgp
))
6606 const char *name
, *type
;
6608 struct listnode
*node
, *nnode
;
6609 int peers_cfg
, peers_estb
;
6610 json_object
*json_vrf
= NULL
;
6614 if (bgp
->inst_type
== BGP_INSTANCE_TYPE_VIEW
)
6618 if (!uj
&& count
== 1)
6619 vty_out (vty
, "%s%s", header
, VTY_NEWLINE
);
6621 peers_cfg
= peers_estb
= 0;
6623 json_vrf
= json_object_new_object();
6626 for (ALL_LIST_ELEMENTS (bgp
->peer
, node
, nnode
, peer
))
6628 if (!CHECK_FLAG(peer
->flags
, PEER_FLAG_CONFIG_NODE
))
6631 if (peer
->status
== Established
)
6635 if (bgp
->inst_type
== BGP_INSTANCE_TYPE_DEFAULT
)
6646 vrf_id_ui
= (bgp
->vrf_id
== VRF_UNKNOWN
) ? -1 : bgp
->vrf_id
;
6649 json_object_string_add(json_vrf
, "type", type
);
6650 json_object_int_add(json_vrf
, "vrfId", vrf_id_ui
);
6651 json_object_string_add(json_vrf
, "routerId", inet_ntoa (bgp
->router_id
));
6652 json_object_int_add(json_vrf
, "numConfiguredPeers", peers_cfg
);
6653 json_object_int_add(json_vrf
, "numEstablishedPeers", peers_estb
);
6655 json_object_object_add(json_vrfs
, name
, json_vrf
);
6658 vty_out (vty
, "%4s %-5d %-16s %9u %10u %s%s",
6659 type
, vrf_id_ui
, inet_ntoa (bgp
->router_id
),
6660 peers_cfg
, peers_estb
, name
,
6666 json_object_object_add(json
, "vrfs", json_vrfs
);
6668 json_object_int_add(json
, "totalVrfs", count
);
6670 vty_out (vty
, "%s%s", json_object_to_json_string_ext(json
, JSON_C_TO_STRING_PRETTY
), VTY_NEWLINE
);
6671 json_object_free(json
);
6676 vty_out (vty
, "%sTotal number of VRFs (including default): %d%s",
6677 VTY_NEWLINE
, count
, VTY_NEWLINE
);
6683 DEFUN (show_bgp_memory
,
6684 show_bgp_memory_cmd
,
6685 "show [ip] bgp memory",
6689 "Global BGP memory statistics\n")
6691 char memstrbuf
[MTYPE_MEMSTR_LEN
];
6692 unsigned long count
;
6694 /* RIB related usage stats */
6695 count
= mtype_stats_alloc (MTYPE_BGP_NODE
);
6696 vty_out (vty
, "%ld RIB nodes, using %s of memory%s", count
,
6697 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6698 count
* sizeof (struct bgp_node
)),
6701 count
= mtype_stats_alloc (MTYPE_BGP_ROUTE
);
6702 vty_out (vty
, "%ld BGP routes, using %s of memory%s", count
,
6703 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6704 count
* sizeof (struct bgp_info
)),
6706 if ((count
= mtype_stats_alloc (MTYPE_BGP_ROUTE_EXTRA
)))
6707 vty_out (vty
, "%ld BGP route ancillaries, using %s of memory%s", count
,
6708 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6709 count
* sizeof (struct bgp_info_extra
)),
6712 if ((count
= mtype_stats_alloc (MTYPE_BGP_STATIC
)))
6713 vty_out (vty
, "%ld Static routes, using %s of memory%s", count
,
6714 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6715 count
* sizeof (struct bgp_static
)),
6718 if ((count
= mtype_stats_alloc (MTYPE_BGP_PACKET
)))
6719 vty_out (vty
, "%ld Packets, using %s of memory%s", count
,
6720 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6721 count
* sizeof (struct bpacket
)),
6725 if ((count
= mtype_stats_alloc (MTYPE_BGP_ADJ_IN
)))
6726 vty_out (vty
, "%ld Adj-In entries, using %s of memory%s", count
,
6727 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6728 count
* sizeof (struct bgp_adj_in
)),
6730 if ((count
= mtype_stats_alloc (MTYPE_BGP_ADJ_OUT
)))
6731 vty_out (vty
, "%ld Adj-Out entries, using %s of memory%s", count
,
6732 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6733 count
* sizeof (struct bgp_adj_out
)),
6736 if ((count
= mtype_stats_alloc (MTYPE_BGP_NEXTHOP_CACHE
)))
6737 vty_out (vty
, "%ld Nexthop cache entries, using %s of memory%s", count
,
6738 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6739 count
* sizeof (struct bgp_nexthop_cache
)),
6742 if ((count
= mtype_stats_alloc (MTYPE_BGP_DAMP_INFO
)))
6743 vty_out (vty
, "%ld Dampening entries, using %s of memory%s", count
,
6744 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6745 count
* sizeof (struct bgp_damp_info
)),
6749 count
= attr_count();
6750 vty_out (vty
, "%ld BGP attributes, using %s of memory%s", count
,
6751 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6752 count
* sizeof(struct attr
)),
6754 if ((count
= mtype_stats_alloc (MTYPE_ATTR_EXTRA
)))
6755 vty_out (vty
, "%ld BGP extra attributes, using %s of memory%s", count
,
6756 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6757 count
* sizeof(struct attr_extra
)),
6760 if ((count
= attr_unknown_count()))
6761 vty_out (vty
, "%ld unknown attributes%s", count
, VTY_NEWLINE
);
6763 /* AS_PATH attributes */
6764 count
= aspath_count ();
6765 vty_out (vty
, "%ld BGP AS-PATH entries, using %s of memory%s", count
,
6766 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6767 count
* sizeof (struct aspath
)),
6770 count
= mtype_stats_alloc (MTYPE_AS_SEG
);
6771 vty_out (vty
, "%ld BGP AS-PATH segments, using %s of memory%s", count
,
6772 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6773 count
* sizeof (struct assegment
)),
6776 /* Other attributes */
6777 if ((count
= community_count ()))
6778 vty_out (vty
, "%ld BGP community entries, using %s of memory%s", count
,
6779 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6780 count
* sizeof (struct community
)),
6782 if ((count
= mtype_stats_alloc (MTYPE_ECOMMUNITY
)))
6783 vty_out (vty
, "%ld BGP community entries, using %s of memory%s", count
,
6784 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6785 count
* sizeof (struct ecommunity
)),
6787 if ((count
= mtype_stats_alloc (MTYPE_LCOMMUNITY
)))
6788 vty_out (vty
, "%ld BGP large-community entries, using %s of memory%s",
6790 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6791 count
* sizeof (struct lcommunity
)),
6794 if ((count
= mtype_stats_alloc (MTYPE_CLUSTER
)))
6795 vty_out (vty
, "%ld Cluster lists, using %s of memory%s", count
,
6796 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6797 count
* sizeof (struct cluster_list
)),
6800 /* Peer related usage */
6801 count
= mtype_stats_alloc (MTYPE_BGP_PEER
);
6802 vty_out (vty
, "%ld peers, using %s of memory%s", count
,
6803 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6804 count
* sizeof (struct peer
)),
6807 if ((count
= mtype_stats_alloc (MTYPE_PEER_GROUP
)))
6808 vty_out (vty
, "%ld peer groups, using %s of memory%s", count
,
6809 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6810 count
* sizeof (struct peer_group
)),
6814 if ((count
= mtype_stats_alloc (MTYPE_HASH
)))
6815 vty_out (vty
, "%ld hash tables, using %s of memory%s", count
,
6816 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6817 count
* sizeof (struct hash
)),
6819 if ((count
= mtype_stats_alloc (MTYPE_HASH_BACKET
)))
6820 vty_out (vty
, "%ld hash buckets, using %s of memory%s", count
,
6821 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6822 count
* sizeof (struct hash_backet
)),
6824 if ((count
= mtype_stats_alloc (MTYPE_BGP_REGEXP
)))
6825 vty_out (vty
, "%ld compiled regexes, using %s of memory%s", count
,
6826 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6827 count
* sizeof (regex_t
)),
6832 /* Show BGP peer's summary information. */
6834 bgp_show_summary (struct vty
*vty
, struct bgp
*bgp
, int afi
, int safi
,
6835 u_char use_json
, json_object
*json
)
6838 struct listnode
*node
, *nnode
;
6839 unsigned int count
= 0, dn_count
= 0;
6840 char timebuf
[BGP_UPTIME_LEN
], dn_flag
[2];
6841 char neighbor_buf
[VTY_BUFSIZ
];
6842 int neighbor_col_default_width
= 16;
6844 int max_neighbor_width
= 0;
6845 json_object
*json_peer
= NULL
;
6846 json_object
*json_peers
= NULL
;
6851 json
= json_object_new_object();
6853 json_peers
= json_object_new_object();
6857 /* Loop over all neighbors that will be displayed to determine how many
6858 * characters are needed for the Neighbor column
6860 for (ALL_LIST_ELEMENTS (bgp
->peer
, node
, nnode
, peer
))
6862 if (!CHECK_FLAG(peer
->flags
, PEER_FLAG_CONFIG_NODE
))
6865 if (peer
->afc
[afi
][safi
])
6867 memset(dn_flag
, '\0', sizeof(dn_flag
));
6868 if (peer_dynamic_neighbor(peer
))
6871 if (peer
->hostname
&& bgp_flag_check(bgp
, BGP_FLAG_SHOW_HOSTNAME
))
6872 sprintf(neighbor_buf
, "%s%s(%s) ", dn_flag
, peer
->hostname
, peer
->host
);
6874 sprintf(neighbor_buf
, "%s%s ", dn_flag
, peer
->host
);
6876 len
= strlen(neighbor_buf
);
6878 if (len
> max_neighbor_width
)
6879 max_neighbor_width
= len
;
6883 /* Originally we displayed the Neighbor column as 16
6884 * characters wide so make that the default
6886 if (max_neighbor_width
< neighbor_col_default_width
)
6887 max_neighbor_width
= neighbor_col_default_width
;
6890 for (ALL_LIST_ELEMENTS (bgp
->peer
, node
, nnode
, peer
))
6892 if (!CHECK_FLAG(peer
->flags
, PEER_FLAG_CONFIG_NODE
))
6895 if (peer
->afc
[afi
][safi
])
6900 char memstrbuf
[MTYPE_MEMSTR_LEN
];
6903 vrf_id_ui
= (bgp
->vrf_id
== VRF_UNKNOWN
) ? -1 : bgp
->vrf_id
;
6905 /* Usage summary and header */
6908 json_object_string_add(json
, "routerId", inet_ntoa (bgp
->router_id
));
6909 json_object_int_add(json
, "as", bgp
->as
);
6910 json_object_int_add(json
, "vrfId", vrf_id_ui
);
6911 json_object_string_add(json
, "vrfName",
6912 (bgp
->inst_type
== BGP_INSTANCE_TYPE_DEFAULT
)
6913 ? "Default" : bgp
->name
);
6918 "BGP router identifier %s, local AS number %u vrf-id %d",
6919 inet_ntoa (bgp
->router_id
), bgp
->as
, vrf_id_ui
);
6920 vty_out (vty
, "%s", VTY_NEWLINE
);
6923 if (bgp_update_delay_configured(bgp
))
6927 json_object_int_add(json
, "updateDelayLimit", bgp
->v_update_delay
);
6929 if (bgp
->v_update_delay
!= bgp
->v_establish_wait
)
6930 json_object_int_add(json
, "updateDelayEstablishWait", bgp
->v_establish_wait
);
6932 if (bgp_update_delay_active(bgp
))
6934 json_object_string_add(json
, "updateDelayFirstNeighbor", bgp
->update_delay_begin_time
);
6935 json_object_boolean_true_add(json
, "updateDelayInProgress");
6939 if (bgp
->update_delay_over
)
6941 json_object_string_add(json
, "updateDelayFirstNeighbor",
6942 bgp
->update_delay_begin_time
);
6943 json_object_string_add(json
, "updateDelayBestpathResumed",
6944 bgp
->update_delay_end_time
);
6945 json_object_string_add(json
, "updateDelayZebraUpdateResume",
6946 bgp
->update_delay_zebra_resume_time
);
6947 json_object_string_add(json
, "updateDelayPeerUpdateResume",
6948 bgp
->update_delay_peers_resume_time
);
6954 vty_out (vty
, "Read-only mode update-delay limit: %d seconds%s",
6955 bgp
->v_update_delay
, VTY_NEWLINE
);
6956 if (bgp
->v_update_delay
!= bgp
->v_establish_wait
)
6957 vty_out (vty
, " Establish wait: %d seconds%s",
6958 bgp
->v_establish_wait
, VTY_NEWLINE
);
6960 if (bgp_update_delay_active(bgp
))
6962 vty_out (vty
, " First neighbor established: %s%s",
6963 bgp
->update_delay_begin_time
, VTY_NEWLINE
);
6964 vty_out (vty
, " Delay in progress%s", VTY_NEWLINE
);
6968 if (bgp
->update_delay_over
)
6970 vty_out (vty
, " First neighbor established: %s%s",
6971 bgp
->update_delay_begin_time
, VTY_NEWLINE
);
6972 vty_out (vty
, " Best-paths resumed: %s%s",
6973 bgp
->update_delay_end_time
, VTY_NEWLINE
);
6974 vty_out (vty
, " zebra update resumed: %s%s",
6975 bgp
->update_delay_zebra_resume_time
, VTY_NEWLINE
);
6976 vty_out (vty
, " peers update resumed: %s%s",
6977 bgp
->update_delay_peers_resume_time
, VTY_NEWLINE
);
6985 if (bgp_maxmed_onstartup_configured(bgp
) && bgp
->maxmed_active
)
6986 json_object_boolean_true_add(json
, "maxMedOnStartup");
6987 if (bgp
->v_maxmed_admin
)
6988 json_object_boolean_true_add(json
, "maxMedAdministrative");
6990 json_object_int_add(json
, "tableVersion", bgp_table_version(bgp
->rib
[afi
][safi
]));
6992 ents
= bgp_table_count (bgp
->rib
[afi
][safi
]);
6993 json_object_int_add(json
, "ribCount", ents
);
6994 json_object_int_add(json
, "ribMemory", ents
* sizeof (struct bgp_node
));
6996 ents
= listcount (bgp
->peer
);
6997 json_object_int_add(json
, "peerCount", ents
);
6998 json_object_int_add(json
, "peerMemory", ents
* sizeof (struct peer
));
7000 if ((ents
= listcount (bgp
->group
)))
7002 json_object_int_add(json
, "peerGroupCount", ents
);
7003 json_object_int_add(json
, "peerGroupMemory", ents
* sizeof (struct peer_group
));
7006 if (CHECK_FLAG (bgp
->af_flags
[afi
][safi
], BGP_CONFIG_DAMPENING
))
7007 json_object_boolean_true_add(json
, "dampeningEnabled");
7011 if (bgp_maxmed_onstartup_configured(bgp
) && bgp
->maxmed_active
)
7012 vty_out (vty
, "Max-med on-startup active%s", VTY_NEWLINE
);
7013 if (bgp
->v_maxmed_admin
)
7014 vty_out (vty
, "Max-med administrative active%s", VTY_NEWLINE
);
7016 vty_out(vty
, "BGP table version %" PRIu64
"%s",
7017 bgp_table_version(bgp
->rib
[afi
][safi
]), VTY_NEWLINE
);
7019 ents
= bgp_table_count (bgp
->rib
[afi
][safi
]);
7020 vty_out (vty
, "RIB entries %ld, using %s of memory%s", ents
,
7021 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
7022 ents
* sizeof (struct bgp_node
)),
7025 /* Peer related usage */
7026 ents
= listcount (bgp
->peer
);
7027 vty_out (vty
, "Peers %ld, using %s of memory%s",
7029 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
7030 ents
* sizeof (struct peer
)),
7033 if ((ents
= listcount (bgp
->group
)))
7034 vty_out (vty
, "Peer groups %ld, using %s of memory%s", ents
,
7035 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
7036 ents
* sizeof (struct peer_group
)),
7039 if (CHECK_FLAG (bgp
->af_flags
[afi
][safi
], BGP_CONFIG_DAMPENING
))
7040 vty_out (vty
, "Dampening enabled.%s", VTY_NEWLINE
);
7041 vty_out (vty
, "%s", VTY_NEWLINE
);
7043 /* Subtract 8 here because 'Neighbor' is 8 characters */
7044 vty_out (vty
, "Neighbor");
7045 vty_out (vty
, "%*s", max_neighbor_width
- 8, " ");
7046 vty_out (vty
, "V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd%s", VTY_NEWLINE
);
7054 json_peer
= json_object_new_object();
7056 if (peer_dynamic_neighbor(peer
))
7057 json_object_boolean_true_add(json_peer
, "dynamicPeer");
7060 json_object_string_add(json_peer
, "hostname", peer
->hostname
);
7062 if (peer
->domainname
)
7063 json_object_string_add(json_peer
, "domainname", peer
->domainname
);
7065 json_object_int_add(json_peer
, "remoteAs", peer
->as
);
7066 json_object_int_add(json_peer
, "version", 4);
7067 json_object_int_add(json_peer
, "msgRcvd",
7068 peer
->open_in
+ peer
->update_in
+ peer
->keepalive_in
7069 + peer
->notify_in
+ peer
->refresh_in
7070 + peer
->dynamic_cap_in
);
7071 json_object_int_add(json_peer
, "msgSent",
7072 peer
->open_out
+ peer
->update_out
+ peer
->keepalive_out
7073 + peer
->notify_out
+ peer
->refresh_out
7074 + peer
->dynamic_cap_out
);
7076 json_object_int_add(json_peer
, "tableVersion", peer
->version
[afi
][safi
]);
7077 json_object_int_add(json_peer
, "outq", peer
->obuf
->count
);
7078 json_object_int_add(json_peer
, "inq", 0);
7079 peer_uptime (peer
->uptime
, timebuf
, BGP_UPTIME_LEN
, use_json
, json_peer
);
7080 json_object_int_add(json_peer
, "prefixReceivedCount", peer
->pcount
[afi
][safi
]);
7082 if (CHECK_FLAG (peer
->flags
, PEER_FLAG_SHUTDOWN
))
7083 json_object_string_add(json_peer
, "state", "Idle (Admin)");
7084 else if (CHECK_FLAG (peer
->sflags
, PEER_STATUS_PREFIX_OVERFLOW
))
7085 json_object_string_add(json_peer
, "state", "Idle (PfxCt)");
7087 json_object_string_add(json_peer
, "state", lookup_msg(bgp_status_msg
, peer
->status
, NULL
));
7090 json_object_string_add(json_peer
, "idType", "interface");
7091 else if (peer
->su
.sa
.sa_family
== AF_INET
)
7092 json_object_string_add(json_peer
, "idType", "ipv4");
7093 else if (peer
->su
.sa
.sa_family
== AF_INET6
)
7094 json_object_string_add(json_peer
, "idType", "ipv6");
7096 json_object_object_add(json_peers
, peer
->host
, json_peer
);
7100 memset(dn_flag
, '\0', sizeof(dn_flag
));
7101 if (peer_dynamic_neighbor(peer
))
7107 if (peer
->hostname
&& bgp_flag_check(bgp
, BGP_FLAG_SHOW_HOSTNAME
))
7108 len
= vty_out (vty
, "%s%s(%s)", dn_flag
, peer
->hostname
,
7111 len
= vty_out (vty
, "%s%s", dn_flag
, peer
->host
);
7113 /* pad the neighbor column with spaces */
7114 if (len
< max_neighbor_width
)
7115 vty_out (vty
, "%*s", max_neighbor_width
- len
, " ");
7117 vty_out (vty
, "4 %10u %7d %7d %8" PRIu64
" %4d %4zd %8s",
7119 peer
->open_in
+ peer
->update_in
+ peer
->keepalive_in
7120 + peer
->notify_in
+ peer
->refresh_in
7121 + peer
->dynamic_cap_in
,
7122 peer
->open_out
+ peer
->update_out
+ peer
->keepalive_out
7123 + peer
->notify_out
+ peer
->refresh_out
7124 + peer
->dynamic_cap_out
,
7125 peer
->version
[afi
][safi
],
7128 peer_uptime (peer
->uptime
, timebuf
, BGP_UPTIME_LEN
, 0, NULL
));
7130 if (peer
->status
== Established
)
7131 vty_out (vty
, " %12ld", peer
->pcount
[afi
][safi
]);
7134 if (CHECK_FLAG (peer
->flags
, PEER_FLAG_SHUTDOWN
))
7135 vty_out (vty
, " Idle (Admin)");
7136 else if (CHECK_FLAG (peer
->sflags
, PEER_STATUS_PREFIX_OVERFLOW
))
7137 vty_out (vty
, " Idle (PfxCt)");
7139 vty_out (vty
, " %12s", lookup_msg(bgp_status_msg
, peer
->status
, NULL
));
7141 vty_out (vty
, "%s", VTY_NEWLINE
);
7148 json_object_object_add(json
, "peers", json_peers
);
7150 json_object_int_add(json
, "totalPeers", count
);
7151 json_object_int_add(json
, "dynamicPeers", dn_count
);
7153 vty_out (vty
, "%s%s", json_object_to_json_string_ext(json
, JSON_C_TO_STRING_PRETTY
), VTY_NEWLINE
);
7154 json_object_free(json
);
7159 vty_out (vty
, "%sTotal number of neighbors %d%s", VTY_NEWLINE
,
7160 count
, VTY_NEWLINE
);
7164 vty_out(vty
, "{\"error\": {\"message\": \"No %s neighbor configured\"}}%s",
7165 afi_safi_print(afi
, safi
), VTY_NEWLINE
);
7167 vty_out (vty
, "No %s neighbor is configured%s",
7168 afi_safi_print(afi
, safi
), VTY_NEWLINE
);
7171 if (dn_count
&& ! use_json
)
7173 vty_out(vty
, "* - dynamic neighbor%s", VTY_NEWLINE
);
7175 "%d dynamic neighbor(s), limit %d%s",
7176 dn_count
, bgp
->dynamic_neighbors_limit
, VTY_NEWLINE
);
7184 * Return if we have a peer configured to use this afi/safi
7187 bgp_show_summary_afi_safi_peer_exists (struct bgp
*bgp
, int afi
, int safi
)
7189 struct listnode
*node
;
7192 for (ALL_LIST_ELEMENTS_RO (bgp
->peer
, node
, peer
))
7194 if (!CHECK_FLAG (peer
->flags
, PEER_FLAG_CONFIG_NODE
))
7197 if (peer
->afc
[afi
][safi
])
7205 bgp_show_summary_afi_safi (struct vty
*vty
, struct bgp
*bgp
, int afi
, int safi
,
7206 u_char use_json
, json_object
*json
)
7209 int afi_wildcard
= (afi
== AFI_MAX
);
7210 int safi_wildcard
= (safi
== SAFI_MAX
);
7211 int is_wildcard
= (afi_wildcard
|| safi_wildcard
);
7212 bool json_output
= false;
7214 if (use_json
&& is_wildcard
)
7215 vty_out (vty
, "{%s", VTY_NEWLINE
);
7217 afi
= 1; /* AFI_IP */
7218 while (afi
< AFI_MAX
)
7221 safi
= 1; /* SAFI_UNICAST */
7222 while (safi
< SAFI_MAX
)
7224 if (bgp_show_summary_afi_safi_peer_exists (bgp
, afi
, safi
))
7230 * So limit output to those afi/safi pairs that
7231 * actualy have something interesting in them
7235 json
= json_object_new_object();
7238 vty_out (vty
, ",%s", VTY_NEWLINE
);
7242 vty_out(vty
, "\"%s\":", afi_safi_json(afi
, safi
));
7246 vty_out (vty
, "%s%s Summary:%s",
7247 VTY_NEWLINE
, afi_safi_print(afi
, safi
), VTY_NEWLINE
);
7250 bgp_show_summary (vty
, bgp
, afi
, safi
, use_json
, json
);
7253 if (safi
== SAFI_RESERVED_4
||
7254 safi
== SAFI_RESERVED_5
) /* handle special cases to match zebra.h */
7256 if (! safi_wildcard
)
7260 if (! afi_wildcard
||
7261 afi
== AFI_L2VPN
) /* special case, not handled yet */
7265 if (use_json
&& is_wildcard
)
7266 vty_out (vty
, "}%s", VTY_NEWLINE
);
7267 else if (use_json
&& !json_output
)
7268 vty_out (vty
, "{}%s", VTY_NEWLINE
);
7272 bgp_show_all_instances_summary_vty (struct vty
*vty
, afi_t afi
, safi_t safi
,
7275 struct listnode
*node
, *nnode
;
7277 json_object
*json
= NULL
;
7281 vty_out (vty
, "{%s", VTY_NEWLINE
);
7283 for (ALL_LIST_ELEMENTS (bm
->bgp
, node
, nnode
, bgp
))
7287 json
= json_object_new_object();
7290 vty_out (vty
, ",%s", VTY_NEWLINE
);
7294 vty_out(vty
, "\"%s\":", (bgp
->inst_type
== BGP_INSTANCE_TYPE_DEFAULT
)
7295 ? "Default" : bgp
->name
);
7299 vty_out (vty
, "%sInstance %s:%s",
7301 (bgp
->inst_type
== BGP_INSTANCE_TYPE_DEFAULT
)
7302 ? "Default" : bgp
->name
, VTY_NEWLINE
);
7304 bgp_show_summary_afi_safi (vty
, bgp
, afi
, safi
, use_json
, json
);
7308 vty_out (vty
, "}%s", VTY_NEWLINE
);
7313 bgp_show_summary_vty (struct vty
*vty
, const char *name
,
7314 afi_t afi
, safi_t safi
, u_char use_json
)
7320 if (strmatch(name
, "all"))
7322 bgp_show_all_instances_summary_vty (vty
, afi
, safi
, use_json
);
7327 bgp
= bgp_lookup_by_name (name
);
7332 vty_out (vty
, "{}%s", VTY_NEWLINE
);
7334 vty_out (vty
, "%% No such BGP instance exist%s", VTY_NEWLINE
);
7338 bgp_show_summary_afi_safi (vty
, bgp
, afi
, safi
, use_json
, NULL
);
7343 bgp
= bgp_get_default ();
7346 bgp_show_summary_afi_safi (vty
, bgp
, afi
, safi
, use_json
, NULL
);
7351 /* `show [ip] bgp summary' commands. */
7352 DEFUN (show_ip_bgp_summary
,
7353 show_ip_bgp_summary_cmd
,
7354 "show [ip] bgp [<view|vrf> VIEWVRFNAME] ["BGP_AFI_CMD_STR
" ["BGP_SAFI_CMD_STR
"]] summary [json]",
7358 BGP_INSTANCE_HELP_STR
7361 "Summary of BGP neighbor status\n"
7365 afi_t afi
= AFI_MAX
;
7366 safi_t safi
= SAFI_MAX
;
7371 if (argv_find (argv
, argc
, "ip", &idx
))
7373 /* [<view|vrf> VIEWVRFNAME] */
7374 if (argv_find (argv
, argc
, "view", &idx
) || argv_find (argv
, argc
, "vrf", &idx
))
7375 vrf
= argv
[++idx
]->arg
;
7376 /* ["BGP_AFI_CMD_STR" ["BGP_SAFI_CMD_STR"]] */
7377 if (argv_find_and_parse_afi (argv
, argc
, &idx
, &afi
))
7379 argv_find_and_parse_safi (argv
, argc
, &idx
, &safi
);
7382 int uj
= use_json (argc
, argv
);
7384 return bgp_show_summary_vty (vty
, vrf
, afi
, safi
, uj
);
7388 afi_safi_print (afi_t afi
, safi_t safi
)
7390 if (afi
== AFI_IP
&& safi
== SAFI_UNICAST
)
7391 return "IPv4 Unicast";
7392 else if (afi
== AFI_IP
&& safi
== SAFI_MULTICAST
)
7393 return "IPv4 Multicast";
7394 else if (afi
== AFI_IP
&& safi
== SAFI_LABELED_UNICAST
)
7395 return "IPv4 labeled-unicast";
7396 else if (afi
== AFI_IP
&& safi
== SAFI_MPLS_VPN
)
7398 else if (afi
== AFI_IP
&& safi
== SAFI_ENCAP
)
7399 return "IPv4 Encap";
7400 else if (afi
== AFI_IP6
&& safi
== SAFI_UNICAST
)
7401 return "IPv6 Unicast";
7402 else if (afi
== AFI_IP6
&& safi
== SAFI_MULTICAST
)
7403 return "IPv6 Multicast";
7404 else if (afi
== AFI_IP6
&& safi
== SAFI_LABELED_UNICAST
)
7405 return "IPv6 labeled-unicast";
7406 else if (afi
== AFI_IP6
&& safi
== SAFI_MPLS_VPN
)
7408 else if (afi
== AFI_IP6
&& safi
== SAFI_ENCAP
)
7409 return "IPv6 Encap";
7410 else if (afi
== AFI_L2VPN
&& safi
== SAFI_EVPN
)
7411 return "L2VPN EVPN";
7417 * Please note that we have intentionally camelCased
7418 * the return strings here. So if you want
7419 * to use this function, please ensure you
7420 * are doing this within json output
7423 afi_safi_json (afi_t afi
, safi_t safi
)
7425 if (afi
== AFI_IP
&& safi
== SAFI_UNICAST
)
7426 return "ipv4Unicast";
7427 else if (afi
== AFI_IP
&& safi
== SAFI_MULTICAST
)
7428 return "ipv4Multicast";
7429 else if (afi
== AFI_IP
&& safi
== SAFI_LABELED_UNICAST
)
7430 return "ipv4LabeledUnicast";
7431 else if (afi
== AFI_IP
&& safi
== SAFI_MPLS_VPN
)
7433 else if (afi
== AFI_IP
&& safi
== SAFI_ENCAP
)
7435 else if (afi
== AFI_IP6
&& safi
== SAFI_UNICAST
)
7436 return "ipv6Unicast";
7437 else if (afi
== AFI_IP6
&& safi
== SAFI_MULTICAST
)
7438 return "ipv6Multicast";
7439 else if (afi
== AFI_IP6
&& safi
== SAFI_LABELED_UNICAST
)
7440 return "ipv6LabeledUnicast";
7441 else if (afi
== AFI_IP6
&& safi
== SAFI_MPLS_VPN
)
7443 else if (afi
== AFI_IP6
&& safi
== SAFI_ENCAP
)
7445 else if (afi
== AFI_L2VPN
&& safi
== SAFI_EVPN
)
7451 /* Show BGP peer's information. */
7459 bgp_show_peer_afi_orf_cap (struct vty
*vty
, struct peer
*p
, afi_t afi
, safi_t safi
,
7460 u_int16_t adv_smcap
, u_int16_t adv_rmcap
, u_int16_t rcv_smcap
,
7461 u_int16_t rcv_rmcap
, u_char use_json
, json_object
*json_pref
)
7464 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], adv_smcap
)
7465 || CHECK_FLAG (p
->af_cap
[afi
][safi
], rcv_smcap
))
7469 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], adv_smcap
) && CHECK_FLAG (p
->af_cap
[afi
][safi
], rcv_smcap
))
7470 json_object_string_add(json_pref
, "sendMode", "advertisedAndReceived");
7471 else if (CHECK_FLAG (p
->af_cap
[afi
][safi
], adv_smcap
))
7472 json_object_string_add(json_pref
, "sendMode", "advertised");
7473 else if (CHECK_FLAG (p
->af_cap
[afi
][safi
], rcv_smcap
))
7474 json_object_string_add(json_pref
, "sendMode", "received");
7478 vty_out (vty
, " Send-mode: ");
7479 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], adv_smcap
))
7480 vty_out (vty
, "advertised");
7481 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], rcv_smcap
))
7482 vty_out (vty
, "%sreceived",
7483 CHECK_FLAG (p
->af_cap
[afi
][safi
], adv_smcap
) ?
7485 vty_out (vty
, "%s", VTY_NEWLINE
);
7490 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], adv_rmcap
)
7491 || CHECK_FLAG (p
->af_cap
[afi
][safi
], rcv_rmcap
))
7495 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], adv_rmcap
) && CHECK_FLAG (p
->af_cap
[afi
][safi
], rcv_rmcap
))
7496 json_object_string_add(json_pref
, "recvMode", "advertisedAndReceived");
7497 else if (CHECK_FLAG (p
->af_cap
[afi
][safi
], adv_rmcap
))
7498 json_object_string_add(json_pref
, "recvMode", "advertised");
7499 else if (CHECK_FLAG (p
->af_cap
[afi
][safi
], rcv_rmcap
))
7500 json_object_string_add(json_pref
, "recvMode", "received");
7504 vty_out (vty
, " Receive-mode: ");
7505 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], adv_rmcap
))
7506 vty_out (vty
, "advertised");
7507 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], rcv_rmcap
))
7508 vty_out (vty
, "%sreceived",
7509 CHECK_FLAG (p
->af_cap
[afi
][safi
], adv_rmcap
) ?
7511 vty_out (vty
, "%s", VTY_NEWLINE
);
7517 bgp_show_peer_afi (struct vty
*vty
, struct peer
*p
, afi_t afi
, safi_t safi
,
7518 u_char use_json
, json_object
*json_neigh
)
7520 struct bgp_filter
*filter
;
7521 struct peer_af
*paf
;
7522 char orf_pfx_name
[BUFSIZ
];
7524 json_object
*json_af
= NULL
;
7525 json_object
*json_prefA
= NULL
;
7526 json_object
*json_prefB
= NULL
;
7527 json_object
*json_addr
= NULL
;
7531 json_addr
= json_object_new_object();
7532 json_af
= json_object_new_object();
7533 filter
= &p
->filter
[afi
][safi
];
7535 if (peer_group_active(p
))
7536 json_object_string_add(json_addr
, "peerGroupMember", p
->group
->name
);
7538 paf
= peer_af_find(p
, afi
, safi
);
7539 if (paf
&& PAF_SUBGRP(paf
))
7541 json_object_int_add(json_addr
, "updateGroupId", PAF_UPDGRP(paf
)->id
);
7542 json_object_int_add(json_addr
, "subGroupId", PAF_SUBGRP(paf
)->id
);
7543 json_object_int_add(json_addr
, "packetQueueLength", bpacket_queue_virtual_length(paf
));
7546 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_ADV
)
7547 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_RCV
)
7548 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_ADV
)
7549 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_RCV
))
7551 json_object_int_add(json_af
, "orfType", ORF_TYPE_PREFIX
);
7552 json_prefA
= json_object_new_object();
7553 bgp_show_peer_afi_orf_cap (vty
, p
, afi
, safi
,
7554 PEER_CAP_ORF_PREFIX_SM_ADV
,
7555 PEER_CAP_ORF_PREFIX_RM_ADV
,
7556 PEER_CAP_ORF_PREFIX_SM_RCV
,
7557 PEER_CAP_ORF_PREFIX_RM_RCV
, use_json
, json_prefA
);
7558 json_object_object_add(json_af
, "orfPrefixList", json_prefA
);
7561 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_ADV
)
7562 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_OLD_RCV
)
7563 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_ADV
)
7564 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_OLD_RCV
))
7566 json_object_int_add(json_af
, "orfOldType", ORF_TYPE_PREFIX_OLD
);
7567 json_prefB
= json_object_new_object();
7568 bgp_show_peer_afi_orf_cap (vty
, p
, afi
, safi
,
7569 PEER_CAP_ORF_PREFIX_SM_ADV
,
7570 PEER_CAP_ORF_PREFIX_RM_ADV
,
7571 PEER_CAP_ORF_PREFIX_SM_OLD_RCV
,
7572 PEER_CAP_ORF_PREFIX_RM_OLD_RCV
, use_json
, json_prefB
);
7573 json_object_object_add(json_af
, "orfOldPrefixList", json_prefB
);
7576 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_ADV
)
7577 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_RCV
)
7578 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_OLD_RCV
)
7579 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_ADV
)
7580 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_RCV
)
7581 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_OLD_RCV
))
7582 json_object_object_add(json_addr
, "afDependentCap", json_af
);
7584 json_object_free(json_af
);
7586 sprintf (orf_pfx_name
, "%s.%d.%d", p
->host
, afi
, safi
);
7587 orf_pfx_count
= prefix_bgp_show_prefix_list (NULL
, afi
, orf_pfx_name
, use_json
);
7589 if (CHECK_FLAG (p
->af_sflags
[afi
][safi
], PEER_STATUS_ORF_PREFIX_SEND
)
7592 if (CHECK_FLAG (p
->af_sflags
[afi
][safi
], PEER_STATUS_ORF_PREFIX_SEND
))
7593 json_object_boolean_true_add(json_neigh
, "orfSent");
7595 json_object_int_add(json_addr
, "orfRecvCounter", orf_pfx_count
);
7597 if (CHECK_FLAG (p
->af_sflags
[afi
][safi
], PEER_STATUS_ORF_WAIT_REFRESH
))
7598 json_object_string_add(json_addr
, "orfFirstUpdate", "deferredUntilORFOrRouteRefreshRecvd");
7600 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_REFLECTOR_CLIENT
))
7601 json_object_boolean_true_add(json_addr
, "routeReflectorClient");
7602 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_RSERVER_CLIENT
))
7603 json_object_boolean_true_add(json_addr
, "routeServerClient");
7604 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_SOFT_RECONFIG
))
7605 json_object_boolean_true_add(json_addr
, "inboundSoftConfigPermit");
7607 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE
))
7608 json_object_boolean_true_add(json_addr
, "privateAsNumsAllReplacedInUpdatesToNbr");
7609 else if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE
))
7610 json_object_boolean_true_add(json_addr
, "privateAsNumsReplacedInUpdatesToNbr");
7611 else if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_REMOVE_PRIVATE_AS_ALL
))
7612 json_object_boolean_true_add(json_addr
, "privateAsNumsAllRemovedInUpdatesToNbr");
7613 else if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_REMOVE_PRIVATE_AS
))
7614 json_object_boolean_true_add(json_addr
, "privateAsNumsRemovedInUpdatesToNbr");
7616 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_ADDPATH_TX_ALL_PATHS
))
7617 json_object_boolean_true_add(json_addr
, "addpathTxAllPaths");
7619 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_ADDPATH_TX_BESTPATH_PER_AS
))
7620 json_object_boolean_true_add(json_addr
, "addpathTxBestpathPerAS");
7622 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_AS_OVERRIDE
))
7623 json_object_string_add(json_addr
, "overrideASNsInOutboundUpdates", "ifAspathEqualRemoteAs");
7625 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_NEXTHOP_SELF
) ||
7626 CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_FORCE_NEXTHOP_SELF
))
7627 json_object_boolean_true_add(json_addr
, "routerAlwaysNextHop");
7628 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_AS_PATH_UNCHANGED
))
7629 json_object_boolean_true_add(json_addr
, "unchangedAsPathPropogatedToNbr");
7630 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_NEXTHOP_UNCHANGED
))
7631 json_object_boolean_true_add(json_addr
, "unchangedNextHopPropogatedToNbr");
7632 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_MED_UNCHANGED
))
7633 json_object_boolean_true_add(json_addr
, "unchangedMedPropogatedToNbr");
7634 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_SEND_COMMUNITY
)
7635 || CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_SEND_EXT_COMMUNITY
))
7637 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_SEND_COMMUNITY
)
7638 && CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_SEND_EXT_COMMUNITY
))
7639 json_object_string_add(json_addr
, "commAttriSentToNbr", "extendedAndStandard");
7640 else if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_SEND_EXT_COMMUNITY
))
7641 json_object_string_add(json_addr
, "commAttriSentToNbr", "extended");
7643 json_object_string_add(json_addr
, "commAttriSentToNbr", "standard");
7645 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_DEFAULT_ORIGINATE
))
7647 if (p
->default_rmap
[afi
][safi
].name
)
7648 json_object_string_add(json_addr
, "defaultRouteMap", p
->default_rmap
[afi
][safi
].name
);
7650 if (paf
&& PAF_SUBGRP(paf
) && CHECK_FLAG(PAF_SUBGRP(paf
)->sflags
, SUBGRP_STATUS_DEFAULT_ORIGINATE
))
7651 json_object_boolean_true_add(json_addr
, "defaultSent");
7653 json_object_boolean_true_add(json_addr
, "defaultNotSent");
7656 if (filter
->plist
[FILTER_IN
].name
7657 || filter
->dlist
[FILTER_IN
].name
7658 || filter
->aslist
[FILTER_IN
].name
7659 || filter
->map
[RMAP_IN
].name
)
7660 json_object_boolean_true_add(json_addr
, "inboundPathPolicyConfig");
7661 if (filter
->plist
[FILTER_OUT
].name
7662 || filter
->dlist
[FILTER_OUT
].name
7663 || filter
->aslist
[FILTER_OUT
].name
7664 || filter
->map
[RMAP_OUT
].name
7665 || filter
->usmap
.name
)
7666 json_object_boolean_true_add(json_addr
, "outboundPathPolicyConfig");
7669 if (filter
->plist
[FILTER_IN
].name
)
7670 json_object_string_add(json_addr
, "incomingUpdatePrefixFilterList", filter
->plist
[FILTER_IN
].name
);
7671 if (filter
->plist
[FILTER_OUT
].name
)
7672 json_object_string_add(json_addr
, "outgoingUpdatePrefixFilterList", filter
->plist
[FILTER_OUT
].name
);
7674 /* distribute-list */
7675 if (filter
->dlist
[FILTER_IN
].name
)
7676 json_object_string_add(json_addr
, "incomingUpdateNetworkFilterList", filter
->dlist
[FILTER_IN
].name
);
7677 if (filter
->dlist
[FILTER_OUT
].name
)
7678 json_object_string_add(json_addr
, "outgoingUpdateNetworkFilterList", filter
->dlist
[FILTER_OUT
].name
);
7681 if (filter
->aslist
[FILTER_IN
].name
)
7682 json_object_string_add(json_addr
, "incomingUpdateAsPathFilterList", filter
->aslist
[FILTER_IN
].name
);
7683 if (filter
->aslist
[FILTER_OUT
].name
)
7684 json_object_string_add(json_addr
, "outgoingUpdateAsPathFilterList", filter
->aslist
[FILTER_OUT
].name
);
7687 if (filter
->map
[RMAP_IN
].name
)
7688 json_object_string_add(json_addr
, "routeMapForIncomingAdvertisements", filter
->map
[RMAP_IN
].name
);
7689 if (filter
->map
[RMAP_OUT
].name
)
7690 json_object_string_add(json_addr
, "routeMapForOutgoingAdvertisements", filter
->map
[RMAP_OUT
].name
);
7692 /* unsuppress-map */
7693 if (filter
->usmap
.name
)
7694 json_object_string_add(json_addr
, "selectiveUnsuppressRouteMap", filter
->usmap
.name
);
7696 /* Receive prefix count */
7697 json_object_int_add(json_addr
, "acceptedPrefixCounter", p
->pcount
[afi
][safi
]);
7699 /* Maximum prefix */
7700 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_MAX_PREFIX
))
7702 json_object_int_add(json_addr
, "prefixAllowedMax", p
->pmax
[afi
][safi
]);
7703 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_MAX_PREFIX_WARNING
))
7704 json_object_boolean_true_add(json_addr
, "prefixAllowedMaxWarning");
7705 json_object_int_add(json_addr
, "prefixAllowedWarningThresh", p
->pmax_threshold
[afi
][safi
]);
7706 if (p
->pmax_restart
[afi
][safi
])
7707 json_object_int_add(json_addr
, "prefixAllowedRestartIntervalMsecs", p
->pmax_restart
[afi
][safi
] * 60000);
7709 json_object_object_add(json_neigh
, afi_safi_print (afi
, safi
), json_addr
);
7714 filter
= &p
->filter
[afi
][safi
];
7716 vty_out (vty
, " For address family: %s%s", afi_safi_print (afi
, safi
),
7719 if (peer_group_active(p
))
7720 vty_out (vty
, " %s peer-group member%s", p
->group
->name
, VTY_NEWLINE
);
7722 paf
= peer_af_find(p
, afi
, safi
);
7723 if (paf
&& PAF_SUBGRP(paf
))
7725 vty_out (vty
, " Update group %" PRIu64
", subgroup %" PRIu64
"%s",
7726 PAF_UPDGRP(paf
)->id
, PAF_SUBGRP(paf
)->id
, VTY_NEWLINE
);
7727 vty_out (vty
, " Packet Queue length %d%s",
7728 bpacket_queue_virtual_length(paf
), VTY_NEWLINE
);
7732 vty_out(vty
, " Not part of any update group%s", VTY_NEWLINE
);
7734 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_ADV
)
7735 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_RCV
)
7736 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_OLD_RCV
)
7737 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_ADV
)
7738 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_RCV
)
7739 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_OLD_RCV
))
7740 vty_out (vty
, " AF-dependant capabilities:%s", VTY_NEWLINE
);
7742 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_ADV
)
7743 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_RCV
)
7744 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_ADV
)
7745 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_RCV
))
7747 vty_out (vty
, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s",
7748 ORF_TYPE_PREFIX
, VTY_NEWLINE
);
7749 bgp_show_peer_afi_orf_cap (vty
, p
, afi
, safi
,
7750 PEER_CAP_ORF_PREFIX_SM_ADV
,
7751 PEER_CAP_ORF_PREFIX_RM_ADV
,
7752 PEER_CAP_ORF_PREFIX_SM_RCV
,
7753 PEER_CAP_ORF_PREFIX_RM_RCV
, use_json
, NULL
);
7755 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_ADV
)
7756 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_OLD_RCV
)
7757 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_ADV
)
7758 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_OLD_RCV
))
7760 vty_out (vty
, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s",
7761 ORF_TYPE_PREFIX_OLD
, VTY_NEWLINE
);
7762 bgp_show_peer_afi_orf_cap (vty
, p
, afi
, safi
,
7763 PEER_CAP_ORF_PREFIX_SM_ADV
,
7764 PEER_CAP_ORF_PREFIX_RM_ADV
,
7765 PEER_CAP_ORF_PREFIX_SM_OLD_RCV
,
7766 PEER_CAP_ORF_PREFIX_RM_OLD_RCV
, use_json
, NULL
);
7769 sprintf (orf_pfx_name
, "%s.%d.%d", p
->host
, afi
, safi
);
7770 orf_pfx_count
= prefix_bgp_show_prefix_list (NULL
, afi
, orf_pfx_name
, use_json
);
7772 if (CHECK_FLAG (p
->af_sflags
[afi
][safi
], PEER_STATUS_ORF_PREFIX_SEND
)
7775 vty_out (vty
, " Outbound Route Filter (ORF):");
7776 if (CHECK_FLAG (p
->af_sflags
[afi
][safi
], PEER_STATUS_ORF_PREFIX_SEND
))
7777 vty_out (vty
, " sent;");
7779 vty_out (vty
, " received (%d entries)", orf_pfx_count
);
7780 vty_out (vty
, "%s", VTY_NEWLINE
);
7782 if (CHECK_FLAG (p
->af_sflags
[afi
][safi
], PEER_STATUS_ORF_WAIT_REFRESH
))
7783 vty_out (vty
, " First update is deferred until ORF or ROUTE-REFRESH is received%s", VTY_NEWLINE
);
7785 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_REFLECTOR_CLIENT
))
7786 vty_out (vty
, " Route-Reflector Client%s", VTY_NEWLINE
);
7787 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_RSERVER_CLIENT
))
7788 vty_out (vty
, " Route-Server Client%s", VTY_NEWLINE
);
7789 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_SOFT_RECONFIG
))
7790 vty_out (vty
, " Inbound soft reconfiguration allowed%s", VTY_NEWLINE
);
7792 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE
))
7793 vty_out (vty
, " Private AS numbers (all) replaced in updates to this neighbor%s", VTY_NEWLINE
);
7794 else if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE
))
7795 vty_out (vty
, " Private AS numbers replaced in updates to this neighbor%s", VTY_NEWLINE
);
7796 else if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_REMOVE_PRIVATE_AS_ALL
))
7797 vty_out (vty
, " Private AS numbers (all) removed in updates to this neighbor%s", VTY_NEWLINE
);
7798 else if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_REMOVE_PRIVATE_AS
))
7799 vty_out (vty
, " Private AS numbers removed in updates to this neighbor%s", VTY_NEWLINE
);
7801 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_ADDPATH_TX_ALL_PATHS
))
7802 vty_out (vty
, " Advertise all paths via addpath%s", VTY_NEWLINE
);
7804 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_ADDPATH_TX_BESTPATH_PER_AS
))
7805 vty_out (vty
, " Advertise bestpath per AS via addpath%s", VTY_NEWLINE
);
7807 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_AS_OVERRIDE
))
7808 vty_out (vty
, " Override ASNs in outbound updates if aspath equals remote-as%s", VTY_NEWLINE
);
7810 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_NEXTHOP_SELF
) ||
7811 CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_FORCE_NEXTHOP_SELF
))
7812 vty_out (vty
, " NEXT_HOP is always this router%s", VTY_NEWLINE
);
7813 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_AS_PATH_UNCHANGED
))
7814 vty_out (vty
, " AS_PATH is propagated unchanged to this neighbor%s", VTY_NEWLINE
);
7815 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_NEXTHOP_UNCHANGED
))
7816 vty_out (vty
, " NEXT_HOP is propagated unchanged to this neighbor%s", VTY_NEWLINE
);
7817 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_MED_UNCHANGED
))
7818 vty_out (vty
, " MED is propagated unchanged to this neighbor%s", VTY_NEWLINE
);
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
))
7823 vty_out (vty
, " Community attribute sent to this neighbor");
7824 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_SEND_COMMUNITY
)
7825 && CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_SEND_EXT_COMMUNITY
)
7826 && CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_SEND_LARGE_COMMUNITY
))
7827 vty_out (vty
, "(all)%s", VTY_NEWLINE
);
7828 else if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_SEND_LARGE_COMMUNITY
))
7829 vty_out (vty
, "(large)%s", VTY_NEWLINE
);
7830 else if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_SEND_EXT_COMMUNITY
))
7831 vty_out (vty
, "(extended)%s", VTY_NEWLINE
);
7833 vty_out (vty
, "(standard)%s", VTY_NEWLINE
);
7835 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_DEFAULT_ORIGINATE
))
7837 vty_out (vty
, " Default information originate,");
7839 if (p
->default_rmap
[afi
][safi
].name
)
7840 vty_out (vty
, " default route-map %s%s,",
7841 p
->default_rmap
[afi
][safi
].map
? "*" : "",
7842 p
->default_rmap
[afi
][safi
].name
);
7843 if (paf
&& PAF_SUBGRP(paf
) && CHECK_FLAG(PAF_SUBGRP(paf
)->sflags
, SUBGRP_STATUS_DEFAULT_ORIGINATE
))
7844 vty_out (vty
, " default sent%s", VTY_NEWLINE
);
7846 vty_out (vty
, " default not sent%s", VTY_NEWLINE
);
7849 if (filter
->plist
[FILTER_IN
].name
7850 || filter
->dlist
[FILTER_IN
].name
7851 || filter
->aslist
[FILTER_IN
].name
7852 || filter
->map
[RMAP_IN
].name
)
7853 vty_out (vty
, " Inbound path policy configured%s", VTY_NEWLINE
);
7854 if (filter
->plist
[FILTER_OUT
].name
7855 || filter
->dlist
[FILTER_OUT
].name
7856 || filter
->aslist
[FILTER_OUT
].name
7857 || filter
->map
[RMAP_OUT
].name
7858 || filter
->usmap
.name
)
7859 vty_out (vty
, " Outbound path policy configured%s", VTY_NEWLINE
);
7862 if (filter
->plist
[FILTER_IN
].name
)
7863 vty_out (vty
, " Incoming update prefix filter list is %s%s%s",
7864 filter
->plist
[FILTER_IN
].plist
? "*" : "",
7865 filter
->plist
[FILTER_IN
].name
,
7867 if (filter
->plist
[FILTER_OUT
].name
)
7868 vty_out (vty
, " Outgoing update prefix filter list is %s%s%s",
7869 filter
->plist
[FILTER_OUT
].plist
? "*" : "",
7870 filter
->plist
[FILTER_OUT
].name
,
7873 /* distribute-list */
7874 if (filter
->dlist
[FILTER_IN
].name
)
7875 vty_out (vty
, " Incoming update network filter list is %s%s%s",
7876 filter
->dlist
[FILTER_IN
].alist
? "*" : "",
7877 filter
->dlist
[FILTER_IN
].name
,
7879 if (filter
->dlist
[FILTER_OUT
].name
)
7880 vty_out (vty
, " Outgoing update network filter list is %s%s%s",
7881 filter
->dlist
[FILTER_OUT
].alist
? "*" : "",
7882 filter
->dlist
[FILTER_OUT
].name
,
7886 if (filter
->aslist
[FILTER_IN
].name
)
7887 vty_out (vty
, " Incoming update AS path filter list is %s%s%s",
7888 filter
->aslist
[FILTER_IN
].aslist
? "*" : "",
7889 filter
->aslist
[FILTER_IN
].name
,
7891 if (filter
->aslist
[FILTER_OUT
].name
)
7892 vty_out (vty
, " Outgoing update AS path filter list is %s%s%s",
7893 filter
->aslist
[FILTER_OUT
].aslist
? "*" : "",
7894 filter
->aslist
[FILTER_OUT
].name
,
7898 if (filter
->map
[RMAP_IN
].name
)
7899 vty_out (vty
, " Route map for incoming advertisements is %s%s%s",
7900 filter
->map
[RMAP_IN
].map
? "*" : "",
7901 filter
->map
[RMAP_IN
].name
,
7903 if (filter
->map
[RMAP_OUT
].name
)
7904 vty_out (vty
, " Route map for outgoing advertisements is %s%s%s",
7905 filter
->map
[RMAP_OUT
].map
? "*" : "",
7906 filter
->map
[RMAP_OUT
].name
,
7909 /* unsuppress-map */
7910 if (filter
->usmap
.name
)
7911 vty_out (vty
, " Route map for selective unsuppress is %s%s%s",
7912 filter
->usmap
.map
? "*" : "",
7913 filter
->usmap
.name
, VTY_NEWLINE
);
7915 /* Receive prefix count */
7916 vty_out (vty
, " %ld accepted prefixes%s", p
->pcount
[afi
][safi
], VTY_NEWLINE
);
7918 /* Maximum prefix */
7919 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_MAX_PREFIX
))
7921 vty_out (vty
, " Maximum prefixes allowed %ld%s%s", p
->pmax
[afi
][safi
],
7922 CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_MAX_PREFIX_WARNING
)
7923 ? " (warning-only)" : "", VTY_NEWLINE
);
7924 vty_out (vty
, " Threshold for warning message %d%%",
7925 p
->pmax_threshold
[afi
][safi
]);
7926 if (p
->pmax_restart
[afi
][safi
])
7927 vty_out (vty
, ", restart interval %d min", p
->pmax_restart
[afi
][safi
]);
7928 vty_out (vty
, "%s", VTY_NEWLINE
);
7931 vty_out (vty
, "%s", VTY_NEWLINE
);
7936 bgp_show_peer (struct vty
*vty
, struct peer
*p
, u_char use_json
, json_object
*json
)
7939 char buf1
[PREFIX2STR_BUFFER
], buf
[SU_ADDRSTRLEN
];
7940 char timebuf
[BGP_UPTIME_LEN
];
7942 const char *subcode_str
;
7943 const char *code_str
;
7948 json_object
*json_neigh
= NULL
;
7954 json_neigh
= json_object_new_object();
7956 memset (dn_flag
, '\0', sizeof (dn_flag
));
7957 if (!p
->conf_if
&& peer_dynamic_neighbor (p
))
7962 if (p
->conf_if
) /* Configured interface name. */
7963 vty_out (vty
, "BGP neighbor on %s: %s, ", p
->conf_if
,
7964 BGP_PEER_SU_UNSPEC(p
) ? "None" :
7965 sockunion2str (&p
->su
, buf
, SU_ADDRSTRLEN
));
7966 else /* Configured IP address. */
7967 vty_out (vty
, "BGP neighbor is %s%s, ", dn_flag
, p
->host
);
7972 if (p
->conf_if
&& BGP_PEER_SU_UNSPEC(p
))
7973 json_object_string_add(json_neigh
, "bgpNeighborAddr", "none");
7974 else if (p
->conf_if
&& !BGP_PEER_SU_UNSPEC(p
))
7975 json_object_string_add(json_neigh
, "bgpNeighborAddr", sockunion2str (&p
->su
, buf
, SU_ADDRSTRLEN
));
7977 json_object_int_add(json_neigh
, "remoteAs", p
->as
);
7979 if (p
->change_local_as
)
7980 json_object_int_add(json_neigh
, "localAs", p
->change_local_as
);
7982 json_object_int_add(json_neigh
, "localAs", p
->local_as
);
7984 if (CHECK_FLAG (p
->flags
, PEER_FLAG_LOCAL_AS_NO_PREPEND
))
7985 json_object_boolean_true_add(json_neigh
, "localAsNoPrepend");
7987 if (CHECK_FLAG (p
->flags
, PEER_FLAG_LOCAL_AS_REPLACE_AS
))
7988 json_object_boolean_true_add(json_neigh
, "localAsReplaceAs");
7992 if ((p
->as_type
== AS_SPECIFIED
) ||
7993 (p
->as_type
== AS_EXTERNAL
) ||
7994 (p
->as_type
== AS_INTERNAL
))
7995 vty_out (vty
, "remote AS %u, ", p
->as
);
7997 vty_out (vty
, "remote AS Unspecified, ");
7998 vty_out (vty
, "local AS %u%s%s, ",
7999 p
->change_local_as
? p
->change_local_as
: p
->local_as
,
8000 CHECK_FLAG (p
->flags
, PEER_FLAG_LOCAL_AS_NO_PREPEND
) ?
8002 CHECK_FLAG (p
->flags
, PEER_FLAG_LOCAL_AS_REPLACE_AS
) ?
8003 " replace-as" : "");
8005 /* peer type internal, external, confed-internal or confed-external */
8006 if (p
->as
== p
->local_as
)
8010 if (CHECK_FLAG(bgp
->config
, BGP_CONFIG_CONFEDERATION
))
8011 json_object_boolean_true_add(json_neigh
, "nbrConfedInternalLink");
8013 json_object_boolean_true_add(json_neigh
, "nbrInternalLink");
8017 if (CHECK_FLAG(bgp
->config
, BGP_CONFIG_CONFEDERATION
))
8018 vty_out (vty
, "confed-internal link%s", VTY_NEWLINE
);
8020 vty_out (vty
, "internal link%s", VTY_NEWLINE
);
8027 if (CHECK_FLAG(bgp
->config
, BGP_CONFIG_CONFEDERATION
))
8028 json_object_boolean_true_add(json_neigh
, "nbrConfedExternalLink");
8030 json_object_boolean_true_add(json_neigh
, "nbrExternalLink");
8034 if (bgp_confederation_peers_check(bgp
, p
->as
))
8035 vty_out (vty
, "confed-external link%s", VTY_NEWLINE
);
8037 vty_out (vty
, "external link%s", VTY_NEWLINE
);
8045 json_object_string_add(json_neigh
, "nbrDesc", p
->desc
);
8047 vty_out (vty
, " Description: %s%s", p
->desc
, VTY_NEWLINE
);
8055 json_object_string_add(json_neigh
, "hostname", p
->hostname
);
8058 json_object_string_add(json_neigh
, "domainname", p
->domainname
);
8062 if (p
->domainname
&& (p
->domainname
[0] != '\0'))
8063 vty_out(vty
, "Hostname: %s.%s%s", p
->hostname
, p
->domainname
,
8066 vty_out(vty
, "Hostname: %s%s", p
->hostname
, VTY_NEWLINE
);
8076 json_object_string_add(json_neigh
, "peerGroup", p
->group
->name
);
8080 struct prefix prefix
, *range
= NULL
;
8082 sockunion2hostprefix(&(p
->su
), &prefix
);
8083 range
= peer_group_lookup_dynamic_neighbor_range (p
->group
, &prefix
);
8087 prefix2str(range
, buf1
, sizeof(buf1
));
8088 json_object_string_add(json_neigh
, "peerSubnetRangeGroup", buf1
);
8094 vty_out (vty
, " Member of peer-group %s for session parameters%s",
8095 p
->group
->name
, VTY_NEWLINE
);
8099 struct prefix prefix
, *range
= NULL
;
8101 sockunion2hostprefix(&(p
->su
), &prefix
);
8102 range
= peer_group_lookup_dynamic_neighbor_range (p
->group
, &prefix
);
8106 prefix2str(range
, buf1
, sizeof(buf1
));
8107 vty_out (vty
, " Belongs to the subnet range group: %s%s", buf1
, VTY_NEWLINE
);
8115 /* Administrative shutdown. */
8116 if (CHECK_FLAG (p
->flags
, PEER_FLAG_SHUTDOWN
))
8117 json_object_boolean_true_add(json_neigh
, "adminShutDown");
8120 json_object_int_add(json_neigh
, "bgpVersion", 4);
8121 json_object_string_add(json_neigh
, "remoteRouterId",
8122 inet_ntop (AF_INET
, &p
->remote_id
, buf1
, sizeof(buf1
)));
8125 if (CHECK_FLAG (bgp
->config
, BGP_CONFIG_CONFEDERATION
) && bgp_confederation_peers_check (bgp
, p
->as
))
8126 json_object_boolean_true_add(json_neigh
, "nbrCommonAdmin");
8129 json_object_string_add(json_neigh
, "bgpState", lookup_msg(bgp_status_msg
, p
->status
, NULL
));
8131 if (p
->status
== Established
)
8136 uptime
= bgp_clock();
8137 uptime
-= p
->uptime
;
8138 tm
= gmtime(&uptime
);
8139 epoch_tbuf
= time(NULL
) - uptime
;
8141 json_object_int_add(json_neigh
, "bgpTimerUp", (tm
->tm_sec
* 1000) + (tm
->tm_min
* 60000) + (tm
->tm_hour
* 3600000));
8142 json_object_string_add(json_neigh
, "bgpTimerUpString", peer_uptime (p
->uptime
, timebuf
, BGP_UPTIME_LEN
, 0, NULL
));
8143 json_object_int_add(json_neigh
, "bgpTimerUpEstablishedEpoch", epoch_tbuf
);
8146 else if (p
->status
== Active
)
8148 if (CHECK_FLAG (p
->flags
, PEER_FLAG_PASSIVE
))
8149 json_object_string_add(json_neigh
, "bgpStateIs", "passive");
8150 else if (CHECK_FLAG (p
->sflags
, PEER_STATUS_NSF_WAIT
))
8151 json_object_string_add(json_neigh
, "bgpStateIs", "passiveNSF");
8158 uptime
= bgp_clock();
8159 uptime
-= p
->readtime
;
8160 tm
= gmtime(&uptime
);
8161 json_object_int_add(json_neigh
, "bgpTimerLastRead", (tm
->tm_sec
* 1000) + (tm
->tm_min
* 60000) + (tm
->tm_hour
* 3600000));
8163 uptime
= bgp_clock();
8164 uptime
-= p
->last_write
;
8165 tm
= gmtime(&uptime
);
8166 json_object_int_add(json_neigh
, "bgpTimerLastWrite", (tm
->tm_sec
* 1000) + (tm
->tm_min
* 60000) + (tm
->tm_hour
* 3600000));
8168 uptime
= bgp_clock();
8169 uptime
-= p
->update_time
;
8170 tm
= gmtime(&uptime
);
8171 json_object_int_add(json_neigh
, "bgpInUpdateElapsedTimeMsecs",
8172 (tm
->tm_sec
* 1000) + (tm
->tm_min
* 60000) + (tm
->tm_hour
* 3600000));
8174 /* Configured timer values. */
8175 json_object_int_add(json_neigh
, "bgpTimerHoldTimeMsecs", p
->v_holdtime
* 1000);
8176 json_object_int_add(json_neigh
, "bgpTimerKeepAliveIntervalMsecs", p
->v_keepalive
* 1000);
8178 if (CHECK_FLAG (p
->config
, PEER_CONFIG_TIMER
))
8180 json_object_int_add(json_neigh
, "bgpTimerConfiguredHoldTimeMsecs", p
->holdtime
* 1000);
8181 json_object_int_add(json_neigh
, "bgpTimerConfiguredKeepAliveIntervalMsecs", p
->keepalive
* 1000);
8186 /* Administrative shutdown. */
8187 if (CHECK_FLAG (p
->flags
, PEER_FLAG_SHUTDOWN
))
8188 vty_out (vty
, " Administratively shut down%s", VTY_NEWLINE
);
8191 vty_out (vty
, " BGP version 4");
8192 vty_out (vty
, ", remote router ID %s%s",
8193 inet_ntop (AF_INET
, &p
->remote_id
, buf1
, sizeof(buf1
)),
8197 if (CHECK_FLAG (bgp
->config
, BGP_CONFIG_CONFEDERATION
)
8198 && bgp_confederation_peers_check (bgp
, p
->as
))
8199 vty_out (vty
, " Neighbor under common administration%s", VTY_NEWLINE
);
8202 vty_out (vty
, " BGP state = %s", lookup_msg(bgp_status_msg
, p
->status
, NULL
));
8204 if (p
->status
== Established
)
8205 vty_out (vty
, ", up for %8s", peer_uptime (p
->uptime
, timebuf
, BGP_UPTIME_LEN
, 0, NULL
));
8207 else if (p
->status
== Active
)
8209 if (CHECK_FLAG (p
->flags
, PEER_FLAG_PASSIVE
))
8210 vty_out (vty
, " (passive)");
8211 else if (CHECK_FLAG (p
->sflags
, PEER_STATUS_NSF_WAIT
))
8212 vty_out (vty
, " (NSF passive)");
8214 vty_out (vty
, "%s", VTY_NEWLINE
);
8217 vty_out (vty
, " Last read %s", peer_uptime (p
->readtime
, timebuf
, BGP_UPTIME_LEN
, 0, NULL
));
8218 vty_out (vty
, ", Last write %s%s",
8219 peer_uptime (p
->last_write
, timebuf
, BGP_UPTIME_LEN
, 0, NULL
), VTY_NEWLINE
);
8221 /* Configured timer values. */
8222 vty_out (vty
, " Hold time is %d, keepalive interval is %d seconds%s",
8223 p
->v_holdtime
, p
->v_keepalive
, VTY_NEWLINE
);
8224 if (CHECK_FLAG (p
->config
, PEER_CONFIG_TIMER
))
8226 vty_out (vty
, " Configured hold time is %d", p
->holdtime
);
8227 vty_out (vty
, ", keepalive interval is %d seconds%s",
8228 p
->keepalive
, VTY_NEWLINE
);
8232 if (p
->status
== Established
)
8235 || p
->afc_adv
[AFI_IP
][SAFI_UNICAST
]
8236 || p
->afc_recv
[AFI_IP
][SAFI_UNICAST
]
8237 || p
->afc_adv
[AFI_IP
][SAFI_MULTICAST
]
8238 || p
->afc_recv
[AFI_IP
][SAFI_MULTICAST
]
8239 || p
->afc_adv
[AFI_IP6
][SAFI_UNICAST
]
8240 || p
->afc_recv
[AFI_IP6
][SAFI_UNICAST
]
8241 || p
->afc_adv
[AFI_IP6
][SAFI_MULTICAST
]
8242 || p
->afc_recv
[AFI_IP6
][SAFI_MULTICAST
]
8243 || p
->afc_adv
[AFI_IP6
][SAFI_MPLS_VPN
]
8244 || p
->afc_recv
[AFI_IP6
][SAFI_MPLS_VPN
]
8245 || p
->afc_adv
[AFI_IP6
][SAFI_ENCAP
]
8246 || p
->afc_recv
[AFI_IP6
][SAFI_ENCAP
]
8247 || p
->afc_adv
[AFI_IP
][SAFI_ENCAP
]
8248 || p
->afc_recv
[AFI_IP
][SAFI_ENCAP
]
8249 || p
->afc_adv
[AFI_IP
][SAFI_MPLS_VPN
]
8250 || p
->afc_recv
[AFI_IP
][SAFI_MPLS_VPN
])
8254 json_object
*json_cap
= NULL
;
8256 json_cap
= json_object_new_object();
8259 if (CHECK_FLAG (p
->cap
, PEER_CAP_AS4_RCV
)
8260 || CHECK_FLAG (p
->cap
, PEER_CAP_AS4_ADV
))
8262 if (CHECK_FLAG (p
->cap
, PEER_CAP_AS4_ADV
) && CHECK_FLAG (p
->cap
, PEER_CAP_AS4_RCV
))
8263 json_object_string_add(json_cap
, "4byteAs", "advertisedAndReceived");
8264 else if (CHECK_FLAG (p
->cap
, PEER_CAP_AS4_ADV
))
8265 json_object_string_add(json_cap
, "4byteAs", "advertised");
8266 else if (CHECK_FLAG (p
->cap
, PEER_CAP_AS4_RCV
))
8267 json_object_string_add(json_cap
, "4byteAs", "received");
8271 if (CHECK_FLAG (p
->cap
, PEER_CAP_ADDPATH_RCV
)
8272 || CHECK_FLAG (p
->cap
, PEER_CAP_ADDPATH_ADV
))
8274 json_object
*json_add
= NULL
;
8275 const char *print_store
;
8277 json_add
= json_object_new_object();
8279 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
8280 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
8282 json_object
*json_sub
= NULL
;
8283 json_sub
= json_object_new_object();
8284 print_store
= afi_safi_print (afi
, safi
);
8286 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_TX_ADV
) ||
8287 CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_TX_RCV
))
8289 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
))
8290 json_object_boolean_true_add(json_sub
, "txAdvertisedAndReceived");
8291 else if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_TX_ADV
))
8292 json_object_boolean_true_add(json_sub
, "txAdvertised");
8293 else if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_TX_RCV
))
8294 json_object_boolean_true_add(json_sub
, "txReceived");
8297 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_RX_ADV
) ||
8298 CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_RX_RCV
))
8300 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
))
8301 json_object_boolean_true_add(json_sub
, "rxAdvertisedAndReceived");
8302 else if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_RX_ADV
))
8303 json_object_boolean_true_add(json_sub
, "rxAdvertised");
8304 else if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_RX_RCV
))
8305 json_object_boolean_true_add(json_sub
, "rxReceived");
8308 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_TX_ADV
) ||
8309 CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_TX_RCV
) ||
8310 CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_RX_ADV
) ||
8311 CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_RX_RCV
))
8312 json_object_object_add(json_add
, print_store
, json_sub
);
8314 json_object_free(json_sub
);
8317 json_object_object_add(json_cap
, "addPath", json_add
);
8321 if (CHECK_FLAG (p
->cap
, PEER_CAP_DYNAMIC_RCV
)
8322 || CHECK_FLAG (p
->cap
, PEER_CAP_DYNAMIC_ADV
))
8324 if (CHECK_FLAG (p
->cap
, PEER_CAP_DYNAMIC_ADV
) && CHECK_FLAG (p
->cap
, PEER_CAP_DYNAMIC_RCV
))
8325 json_object_string_add(json_cap
, "dynamic", "advertisedAndReceived");
8326 else if (CHECK_FLAG (p
->cap
, PEER_CAP_DYNAMIC_ADV
))
8327 json_object_string_add(json_cap
, "dynamic", "advertised");
8328 else if (CHECK_FLAG (p
->cap
, PEER_CAP_DYNAMIC_RCV
))
8329 json_object_string_add(json_cap
, "dynamic", "received");
8332 /* Extended nexthop */
8333 if (CHECK_FLAG (p
->cap
, PEER_CAP_ENHE_RCV
)
8334 || CHECK_FLAG (p
->cap
, PEER_CAP_ENHE_ADV
))
8336 json_object
*json_nxt
= NULL
;
8337 const char *print_store
;
8340 if (CHECK_FLAG (p
->cap
, PEER_CAP_ENHE_ADV
) && CHECK_FLAG (p
->cap
, PEER_CAP_ENHE_RCV
))
8341 json_object_string_add(json_cap
, "extendedNexthop", "advertisedAndReceived");
8342 else if (CHECK_FLAG (p
->cap
, PEER_CAP_ENHE_ADV
))
8343 json_object_string_add(json_cap
, "extendedNexthop", "advertised");
8344 else if (CHECK_FLAG (p
->cap
, PEER_CAP_ENHE_RCV
))
8345 json_object_string_add(json_cap
, "extendedNexthop", "received");
8347 if (CHECK_FLAG (p
->cap
, PEER_CAP_ENHE_RCV
))
8349 json_nxt
= json_object_new_object();
8351 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
8353 if (CHECK_FLAG (p
->af_cap
[AFI_IP
][safi
], PEER_CAP_ENHE_AF_RCV
))
8355 print_store
= afi_safi_print (AFI_IP
, safi
);
8356 json_object_string_add(json_nxt
, print_store
, "recieved");
8359 json_object_object_add(json_cap
, "extendedNexthopFamililesByPeer", json_nxt
);
8364 if (CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_ADV
)
8365 || CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_NEW_RCV
)
8366 || CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_OLD_RCV
))
8368 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
)))
8370 if (CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_OLD_RCV
) && CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_NEW_RCV
))
8371 json_object_string_add(json_cap
, "routeRefresh", "advertisedAndReceivedOldNew");
8374 if (CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_OLD_RCV
))
8375 json_object_string_add(json_cap
, "routeRefresh", "advertisedAndReceivedOld");
8377 json_object_string_add(json_cap
, "routeRefresh", "advertisedAndReceivedNew");
8380 else if (CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_ADV
))
8381 json_object_string_add(json_cap
, "routeRefresh", "advertised");
8382 else if (CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_NEW_RCV
) || CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_OLD_RCV
))
8383 json_object_string_add(json_cap
, "routeRefresh", "received");
8386 /* Multiprotocol Extensions */
8387 json_object
*json_multi
= NULL
;
8388 json_multi
= json_object_new_object();
8390 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
8392 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
8394 if (p
->afc_adv
[afi
][safi
] || p
->afc_recv
[afi
][safi
])
8396 json_object
*json_exten
= NULL
;
8397 json_exten
= json_object_new_object();
8399 if (p
->afc_adv
[afi
][safi
] && p
->afc_recv
[afi
][safi
])
8400 json_object_boolean_true_add(json_exten
, "advertisedAndReceived");
8401 else if (p
->afc_adv
[afi
][safi
])
8402 json_object_boolean_true_add(json_exten
, "advertised");
8403 else if (p
->afc_recv
[afi
][safi
])
8404 json_object_boolean_true_add(json_exten
, "received");
8406 json_object_object_add(json_multi
, afi_safi_print (afi
, safi
), json_exten
);
8410 json_object_object_add(json_cap
, "multiprotocolExtensions", json_multi
);
8412 /* Gracefull Restart */
8413 if (CHECK_FLAG (p
->cap
, PEER_CAP_RESTART_RCV
)
8414 || CHECK_FLAG (p
->cap
, PEER_CAP_RESTART_ADV
))
8416 if (CHECK_FLAG (p
->cap
, PEER_CAP_RESTART_ADV
) && CHECK_FLAG (p
->cap
, PEER_CAP_RESTART_RCV
))
8417 json_object_string_add(json_cap
, "gracefulRestart", "advertisedAndReceived");
8418 else if (CHECK_FLAG (p
->cap
, PEER_CAP_RESTART_ADV
))
8419 json_object_string_add(json_cap
, "gracefulRestartCapability", "advertised");
8420 else if (CHECK_FLAG (p
->cap
, PEER_CAP_RESTART_RCV
))
8421 json_object_string_add(json_cap
, "gracefulRestartCapability", "received");
8423 if (CHECK_FLAG (p
->cap
, PEER_CAP_RESTART_RCV
))
8425 int restart_af_count
= 0;
8426 json_object
*json_restart
= NULL
;
8427 json_restart
= json_object_new_object();
8429 json_object_int_add(json_cap
, "gracefulRestartRemoteTimerMsecs", p
->v_gr_restart
* 1000);
8431 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
8433 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
8435 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_RESTART_AF_RCV
))
8437 json_object
*json_sub
= NULL
;
8438 json_sub
= json_object_new_object();
8440 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_RESTART_AF_PRESERVE_RCV
))
8441 json_object_boolean_true_add(json_sub
, "preserved");
8443 json_object_object_add(json_restart
, afi_safi_print (afi
, safi
), json_sub
);
8447 if (! restart_af_count
)
8449 json_object_string_add(json_cap
, "addressFamiliesByPeer", "none");
8450 json_object_free(json_restart
);
8453 json_object_object_add(json_cap
, "addressFamiliesByPeer", json_restart
);
8456 json_object_object_add(json_neigh
, "neighborCapabilities", json_cap
);
8460 vty_out (vty
, " Neighbor capabilities:%s", VTY_NEWLINE
);
8463 if (CHECK_FLAG (p
->cap
, PEER_CAP_AS4_RCV
)
8464 || CHECK_FLAG (p
->cap
, PEER_CAP_AS4_ADV
))
8466 vty_out (vty
, " 4 Byte AS:");
8467 if (CHECK_FLAG (p
->cap
, PEER_CAP_AS4_ADV
))
8468 vty_out (vty
, " advertised");
8469 if (CHECK_FLAG (p
->cap
, PEER_CAP_AS4_RCV
))
8470 vty_out (vty
, " %sreceived",
8471 CHECK_FLAG (p
->cap
, PEER_CAP_AS4_ADV
) ? "and " : "");
8472 vty_out (vty
, "%s", VTY_NEWLINE
);
8476 if (CHECK_FLAG (p
->cap
, PEER_CAP_ADDPATH_RCV
)
8477 || CHECK_FLAG (p
->cap
, PEER_CAP_ADDPATH_ADV
))
8479 vty_out (vty
, " AddPath:%s", VTY_NEWLINE
);
8481 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
8482 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
8484 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_TX_ADV
) ||
8485 CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_TX_RCV
))
8487 vty_out (vty
, " %s: TX ", afi_safi_print (afi
, safi
));
8489 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_TX_ADV
))
8490 vty_out (vty
, "advertised %s", afi_safi_print (afi
, safi
));
8492 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_TX_RCV
))
8493 vty_out (vty
, "%sreceived", CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_TX_ADV
) ? " and " : "" );
8495 vty_out (vty
, "%s", VTY_NEWLINE
);
8498 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_RX_ADV
) ||
8499 CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_RX_RCV
))
8501 vty_out (vty
, " %s: RX ", afi_safi_print (afi
, safi
));
8503 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_RX_ADV
))
8504 vty_out (vty
, "advertised %s", afi_safi_print (afi
, safi
));
8506 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_RX_RCV
))
8507 vty_out (vty
, "%sreceived", CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_RX_ADV
) ? " and " : "" );
8509 vty_out (vty
, "%s", VTY_NEWLINE
);
8515 if (CHECK_FLAG (p
->cap
, PEER_CAP_DYNAMIC_RCV
)
8516 || CHECK_FLAG (p
->cap
, PEER_CAP_DYNAMIC_ADV
))
8518 vty_out (vty
, " Dynamic:");
8519 if (CHECK_FLAG (p
->cap
, PEER_CAP_DYNAMIC_ADV
))
8520 vty_out (vty
, " advertised");
8521 if (CHECK_FLAG (p
->cap
, PEER_CAP_DYNAMIC_RCV
))
8522 vty_out (vty
, " %sreceived",
8523 CHECK_FLAG (p
->cap
, PEER_CAP_DYNAMIC_ADV
) ? "and " : "");
8524 vty_out (vty
, "%s", VTY_NEWLINE
);
8527 /* Extended nexthop */
8528 if (CHECK_FLAG (p
->cap
, PEER_CAP_ENHE_RCV
)
8529 || CHECK_FLAG (p
->cap
, PEER_CAP_ENHE_ADV
))
8531 vty_out (vty
, " Extended nexthop:");
8532 if (CHECK_FLAG (p
->cap
, PEER_CAP_ENHE_ADV
))
8533 vty_out (vty
, " advertised");
8534 if (CHECK_FLAG (p
->cap
, PEER_CAP_ENHE_RCV
))
8535 vty_out (vty
, " %sreceived",
8536 CHECK_FLAG (p
->cap
, PEER_CAP_ENHE_ADV
) ? "and " : "");
8537 vty_out (vty
, "%s", VTY_NEWLINE
);
8539 if (CHECK_FLAG (p
->cap
, PEER_CAP_ENHE_RCV
))
8541 vty_out (vty
, " Address families by peer:%s ", VTY_NEWLINE
);
8542 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
8543 if (CHECK_FLAG (p
->af_cap
[AFI_IP
][safi
], PEER_CAP_ENHE_AF_RCV
))
8544 vty_out (vty
, " %s%s",
8545 afi_safi_print (AFI_IP
, safi
), VTY_NEWLINE
);
8550 if (CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_ADV
)
8551 || CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_NEW_RCV
)
8552 || CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_OLD_RCV
))
8554 vty_out (vty
, " Route refresh:");
8555 if (CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_ADV
))
8556 vty_out (vty
, " advertised");
8557 if (CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_NEW_RCV
)
8558 || CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_OLD_RCV
))
8559 vty_out (vty
, " %sreceived(%s)",
8560 CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_ADV
) ? "and " : "",
8561 (CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_OLD_RCV
)
8562 && CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_NEW_RCV
)) ?
8563 "old & new" : CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_OLD_RCV
) ? "old" : "new");
8565 vty_out (vty
, "%s", VTY_NEWLINE
);
8568 /* Multiprotocol Extensions */
8569 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
8570 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
8571 if (p
->afc_adv
[afi
][safi
] || p
->afc_recv
[afi
][safi
])
8573 vty_out (vty
, " Address Family %s:", afi_safi_print (afi
, safi
));
8574 if (p
->afc_adv
[afi
][safi
])
8575 vty_out (vty
, " advertised");
8576 if (p
->afc_recv
[afi
][safi
])
8577 vty_out (vty
, " %sreceived", p
->afc_adv
[afi
][safi
] ? "and " : "");
8578 vty_out (vty
, "%s", VTY_NEWLINE
);
8581 /* Hostname capability */
8582 if (CHECK_FLAG(p
->cap
, PEER_CAP_HOSTNAME_ADV
) ||
8583 CHECK_FLAG(p
->cap
, PEER_CAP_HOSTNAME_RCV
))
8585 vty_out (vty
, " Hostname Capability:");
8586 if (CHECK_FLAG (p
->cap
, PEER_CAP_HOSTNAME_ADV
))
8587 vty_out (vty
, " advertised");
8588 if (CHECK_FLAG (p
->cap
, PEER_CAP_HOSTNAME_RCV
))
8589 vty_out (vty
, " %sreceived",
8590 CHECK_FLAG (p
->cap
, PEER_CAP_HOSTNAME_ADV
) ? "and " : "");
8591 vty_out (vty
, "%s", VTY_NEWLINE
);
8594 /* Gracefull Restart */
8595 if (CHECK_FLAG (p
->cap
, PEER_CAP_RESTART_RCV
)
8596 || CHECK_FLAG (p
->cap
, PEER_CAP_RESTART_ADV
))
8598 vty_out (vty
, " Graceful Restart Capabilty:");
8599 if (CHECK_FLAG (p
->cap
, PEER_CAP_RESTART_ADV
))
8600 vty_out (vty
, " advertised");
8601 if (CHECK_FLAG (p
->cap
, PEER_CAP_RESTART_RCV
))
8602 vty_out (vty
, " %sreceived",
8603 CHECK_FLAG (p
->cap
, PEER_CAP_RESTART_ADV
) ? "and " : "");
8604 vty_out (vty
, "%s", VTY_NEWLINE
);
8606 if (CHECK_FLAG (p
->cap
, PEER_CAP_RESTART_RCV
))
8608 int restart_af_count
= 0;
8610 vty_out (vty
, " Remote Restart timer is %d seconds%s",
8611 p
->v_gr_restart
, VTY_NEWLINE
);
8612 vty_out (vty
, " Address families by peer:%s ", VTY_NEWLINE
);
8614 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
8615 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
8616 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_RESTART_AF_RCV
))
8618 vty_out (vty
, "%s%s(%s)", restart_af_count
? ", " : "",
8619 afi_safi_print (afi
, safi
),
8620 CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_RESTART_AF_PRESERVE_RCV
) ?
8621 "preserved" : "not preserved");
8624 if (! restart_af_count
)
8625 vty_out (vty
, "none");
8626 vty_out (vty
, "%s", VTY_NEWLINE
);
8633 /* graceful restart information */
8634 if (CHECK_FLAG (p
->cap
, PEER_CAP_RESTART_RCV
)
8638 json_object
*json_grace
= NULL
;
8639 json_object
*json_grace_send
= NULL
;
8640 json_object
*json_grace_recv
= NULL
;
8641 int eor_send_af_count
= 0;
8642 int eor_receive_af_count
= 0;
8646 json_grace
= json_object_new_object();
8647 json_grace_send
= json_object_new_object();
8648 json_grace_recv
= json_object_new_object();
8650 if (p
->status
== Established
)
8652 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
8654 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
8656 if (CHECK_FLAG (p
->af_sflags
[afi
][safi
], PEER_STATUS_EOR_SEND
))
8658 json_object_boolean_true_add(json_grace_send
, afi_safi_print (afi
, safi
));
8659 eor_send_af_count
++;
8663 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
8665 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
8667 if (CHECK_FLAG (p
->af_sflags
[afi
][safi
], PEER_STATUS_EOR_RECEIVED
))
8669 json_object_boolean_true_add(json_grace_recv
, afi_safi_print (afi
, safi
));
8670 eor_receive_af_count
++;
8676 json_object_object_add(json_grace
, "endOfRibSend", json_grace_send
);
8677 json_object_object_add(json_grace
, "endOfRibRecv", json_grace_recv
);
8679 if (p
->t_gr_restart
)
8680 json_object_int_add(json_grace
, "gracefulRestartTimerMsecs", thread_timer_remain_second (p
->t_gr_restart
) * 1000);
8683 json_object_int_add(json_grace
, "gracefulStalepathTimerMsecs", thread_timer_remain_second (p
->t_gr_stale
) * 1000);
8685 json_object_object_add(json_neigh
, "gracefulRestartInfo", json_grace
);
8689 vty_out (vty
, " Graceful restart informations:%s", VTY_NEWLINE
);
8690 if (p
->status
== Established
)
8692 vty_out (vty
, " End-of-RIB send: ");
8693 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
8695 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
8697 if (CHECK_FLAG (p
->af_sflags
[afi
][safi
], PEER_STATUS_EOR_SEND
))
8699 vty_out (vty
, "%s%s", eor_send_af_count
? ", " : "",
8700 afi_safi_print (afi
, safi
));
8701 eor_send_af_count
++;
8705 vty_out (vty
, "%s", VTY_NEWLINE
);
8706 vty_out (vty
, " End-of-RIB received: ");
8707 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
8709 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
8711 if (CHECK_FLAG (p
->af_sflags
[afi
][safi
], PEER_STATUS_EOR_RECEIVED
))
8713 vty_out (vty
, "%s%s", eor_receive_af_count
? ", " : "",
8714 afi_safi_print (afi
, safi
));
8715 eor_receive_af_count
++;
8719 vty_out (vty
, "%s", VTY_NEWLINE
);
8722 if (p
->t_gr_restart
)
8723 vty_out (vty
, " The remaining time of restart timer is %ld%s",
8724 thread_timer_remain_second (p
->t_gr_restart
), VTY_NEWLINE
);
8727 vty_out (vty
, " The remaining time of stalepath timer is %ld%s",
8728 thread_timer_remain_second (p
->t_gr_stale
), VTY_NEWLINE
);
8733 json_object
*json_stat
= NULL
;
8734 json_stat
= json_object_new_object();
8735 /* Packet counts. */
8736 json_object_int_add(json_stat
, "depthInq", 0);
8737 json_object_int_add(json_stat
, "depthOutq", (unsigned long) p
->obuf
->count
);
8738 json_object_int_add(json_stat
, "opensSent", p
->open_out
);
8739 json_object_int_add(json_stat
, "opensRecv", p
->open_in
);
8740 json_object_int_add(json_stat
, "notificationsSent", p
->notify_out
);
8741 json_object_int_add(json_stat
, "notificationsRecv", p
->notify_in
);
8742 json_object_int_add(json_stat
, "updatesSent", p
->update_out
);
8743 json_object_int_add(json_stat
, "updatesRecv", p
->update_in
);
8744 json_object_int_add(json_stat
, "keepalivesSent", p
->keepalive_out
);
8745 json_object_int_add(json_stat
, "keepalivesRecv", p
->keepalive_in
);
8746 json_object_int_add(json_stat
, "routeRefreshSent", p
->refresh_out
);
8747 json_object_int_add(json_stat
, "routeRefreshRecv", p
->refresh_in
);
8748 json_object_int_add(json_stat
, "capabilitySent", p
->dynamic_cap_out
);
8749 json_object_int_add(json_stat
, "capabilityRecv", p
->dynamic_cap_in
);
8750 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
);
8751 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
);
8752 json_object_object_add(json_neigh
, "messageStats", json_stat
);
8756 /* Packet counts. */
8757 vty_out (vty
, " Message statistics:%s", VTY_NEWLINE
);
8758 vty_out (vty
, " Inq depth is 0%s", VTY_NEWLINE
);
8759 vty_out (vty
, " Outq depth is %lu%s", (unsigned long) p
->obuf
->count
, VTY_NEWLINE
);
8760 vty_out (vty
, " Sent Rcvd%s", VTY_NEWLINE
);
8761 vty_out (vty
, " Opens: %10d %10d%s", p
->open_out
, p
->open_in
, VTY_NEWLINE
);
8762 vty_out (vty
, " Notifications: %10d %10d%s", p
->notify_out
, p
->notify_in
, VTY_NEWLINE
);
8763 vty_out (vty
, " Updates: %10d %10d%s", p
->update_out
, p
->update_in
, VTY_NEWLINE
);
8764 vty_out (vty
, " Keepalives: %10d %10d%s", p
->keepalive_out
, p
->keepalive_in
, VTY_NEWLINE
);
8765 vty_out (vty
, " Route Refresh: %10d %10d%s", p
->refresh_out
, p
->refresh_in
, VTY_NEWLINE
);
8766 vty_out (vty
, " Capability: %10d %10d%s", p
->dynamic_cap_out
, p
->dynamic_cap_in
, VTY_NEWLINE
);
8767 vty_out (vty
, " Total: %10d %10d%s", p
->open_out
+ p
->notify_out
+
8768 p
->update_out
+ p
->keepalive_out
+ p
->refresh_out
+ p
->dynamic_cap_out
,
8769 p
->open_in
+ p
->notify_in
+ p
->update_in
+ p
->keepalive_in
+ p
->refresh_in
+
8770 p
->dynamic_cap_in
, VTY_NEWLINE
);
8775 /* advertisement-interval */
8776 json_object_int_add(json_neigh
, "minBtwnAdvertisementRunsTimerMsecs", p
->v_routeadv
* 1000);
8778 /* Update-source. */
8779 if (p
->update_if
|| p
->update_source
)
8782 json_object_string_add(json_neigh
, "updateSource", p
->update_if
);
8783 else if (p
->update_source
)
8784 json_object_string_add(json_neigh
, "updateSource", sockunion2str (p
->update_source
, buf1
, SU_ADDRSTRLEN
));
8789 /* advertisement-interval */
8790 vty_out (vty
, " Minimum time between advertisement runs is %d seconds%s",
8791 p
->v_routeadv
, VTY_NEWLINE
);
8793 /* Update-source. */
8794 if (p
->update_if
|| p
->update_source
)
8796 vty_out (vty
, " Update source is ");
8798 vty_out (vty
, "%s", p
->update_if
);
8799 else if (p
->update_source
)
8800 vty_out (vty
, "%s", sockunion2str (p
->update_source
, buf1
, SU_ADDRSTRLEN
));
8801 vty_out (vty
, "%s", VTY_NEWLINE
);
8804 vty_out (vty
, "%s", VTY_NEWLINE
);
8807 /* Address Family Information */
8808 json_object
*json_hold
= NULL
;
8811 json_hold
= json_object_new_object();
8813 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
8814 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
8815 if (p
->afc
[afi
][safi
])
8816 bgp_show_peer_afi (vty
, p
, afi
, safi
, use_json
, json_hold
);
8820 json_object_object_add(json_neigh
, "addressFamilyInfo", json_hold
);
8821 json_object_int_add(json_neigh
, "connectionsEstablished", p
->established
);
8822 json_object_int_add(json_neigh
, "connectionsDropped", p
->dropped
);
8825 vty_out (vty
, " Connections established %d; dropped %d%s", p
->established
, p
->dropped
,
8828 if (! p
->last_reset
)
8831 json_object_string_add(json_neigh
, "lastReset", "never");
8833 vty_out (vty
, " Last reset never%s", VTY_NEWLINE
);
8842 uptime
= bgp_clock();
8843 uptime
-= p
->resettime
;
8844 tm
= gmtime(&uptime
);
8845 json_object_int_add(json_neigh
, "lastResetTimerMsecs", (tm
->tm_sec
* 1000) + (tm
->tm_min
* 60000) + (tm
->tm_hour
* 3600000));
8846 json_object_string_add(json_neigh
, "lastResetDueTo", peer_down_str
[(int) p
->last_reset
]);
8847 if (p
->last_reset
== PEER_DOWN_NOTIFY_SEND
||
8848 p
->last_reset
== PEER_DOWN_NOTIFY_RECEIVED
)
8850 char errorcodesubcode_hexstr
[5];
8851 char errorcodesubcode_str
[256];
8853 code_str
= bgp_notify_code_str(p
->notify
.code
);
8854 subcode_str
= bgp_notify_subcode_str(p
->notify
.code
, p
->notify
.subcode
);
8856 sprintf(errorcodesubcode_hexstr
, "%02X%02X", p
->notify
.code
, p
->notify
.subcode
);
8857 json_object_string_add(json_neigh
, "lastErrorCodeSubcode", errorcodesubcode_hexstr
);
8858 snprintf(errorcodesubcode_str
, 255, "%s%s", code_str
, subcode_str
);
8859 json_object_string_add(json_neigh
, "lastNotificationReason", errorcodesubcode_str
);
8860 if (p
->last_reset
== PEER_DOWN_NOTIFY_RECEIVED
8861 && p
->notify
.code
== BGP_NOTIFY_CEASE
8862 && (p
->notify
.subcode
== BGP_NOTIFY_CEASE_ADMIN_SHUTDOWN
8863 || p
->notify
.subcode
== BGP_NOTIFY_CEASE_ADMIN_RESET
)
8864 && p
->notify
.length
)
8867 const char *msg_str
;
8869 msg_str
= bgp_notify_admin_message(msgbuf
, sizeof(msgbuf
),
8870 (u_char
*)p
->notify
.data
, p
->notify
.length
);
8872 json_object_string_add(json_neigh
, "lastShutdownDescription", msg_str
);
8878 vty_out (vty
, " Last reset %s, ",
8879 peer_uptime (p
->resettime
, timebuf
, BGP_UPTIME_LEN
, 0, NULL
));
8881 if (p
->last_reset
== PEER_DOWN_NOTIFY_SEND
||
8882 p
->last_reset
== PEER_DOWN_NOTIFY_RECEIVED
)
8884 code_str
= bgp_notify_code_str(p
->notify
.code
);
8885 subcode_str
= bgp_notify_subcode_str(p
->notify
.code
, p
->notify
.subcode
);
8886 vty_out (vty
, "due to NOTIFICATION %s (%s%s)%s",
8887 p
->last_reset
== PEER_DOWN_NOTIFY_SEND
? "sent" : "received",
8888 code_str
, subcode_str
, VTY_NEWLINE
);
8889 if (p
->last_reset
== PEER_DOWN_NOTIFY_RECEIVED
8890 && p
->notify
.code
== BGP_NOTIFY_CEASE
8891 && (p
->notify
.subcode
== BGP_NOTIFY_CEASE_ADMIN_SHUTDOWN
8892 || p
->notify
.subcode
== BGP_NOTIFY_CEASE_ADMIN_RESET
)
8893 && p
->notify
.length
)
8896 const char *msg_str
;
8898 msg_str
= bgp_notify_admin_message(msgbuf
, sizeof(msgbuf
),
8899 (u_char
*)p
->notify
.data
, p
->notify
.length
);
8901 vty_out (vty
, " Message: \"%s\"%s", msg_str
, VTY_NEWLINE
);
8906 vty_out (vty
, "due to %s%s",
8907 peer_down_str
[(int) p
->last_reset
], VTY_NEWLINE
);
8910 if (p
->last_reset_cause_size
)
8912 msg
= p
->last_reset_cause
;
8913 vty_out(vty
, " Message received that caused BGP to send a NOTIFICATION:%s ", VTY_NEWLINE
);
8914 for (i
= 1; i
<= p
->last_reset_cause_size
; i
++)
8916 vty_out(vty
, "%02X", *msg
++);
8918 if (i
!= p
->last_reset_cause_size
)
8922 vty_out(vty
, "%s ", VTY_NEWLINE
);
8924 else if (i
% 4 == 0)
8930 vty_out(vty
, "%s", VTY_NEWLINE
);
8935 if (CHECK_FLAG (p
->sflags
, PEER_STATUS_PREFIX_OVERFLOW
))
8938 json_object_boolean_true_add(json_neigh
, "prefixesConfigExceedMax");
8940 vty_out (vty
, " Peer had exceeded the max. no. of prefixes configured.%s", VTY_NEWLINE
);
8942 if (p
->t_pmax_restart
)
8946 json_object_boolean_true_add(json_neigh
, "reducePrefixNumFrom");
8947 json_object_int_add(json_neigh
, "restartInTimerMsec", thread_timer_remain_second (p
->t_pmax_restart
) * 1000);
8950 vty_out (vty
, " Reduce the no. of prefix from %s, will restart in %ld seconds%s",
8951 p
->host
, thread_timer_remain_second (p
->t_pmax_restart
),
8957 json_object_boolean_true_add(json_neigh
, "reducePrefixNumAndClearIpBgp");
8959 vty_out (vty
, " Reduce the no. of prefix and clear ip bgp %s to restore peering%s",
8960 p
->host
, VTY_NEWLINE
);
8964 /* EBGP Multihop and GTSM */
8965 if (p
->sort
!= BGP_PEER_IBGP
)
8969 if (p
->gtsm_hops
> 0)
8970 json_object_int_add(json_neigh
, "externalBgpNbrMaxHopsAway", p
->gtsm_hops
);
8971 else if (p
->ttl
> 1)
8972 json_object_int_add(json_neigh
, "externalBgpNbrMaxHopsAway", p
->ttl
);
8976 if (p
->gtsm_hops
> 0)
8977 vty_out (vty
, " External BGP neighbor may be up to %d hops away.%s",
8978 p
->gtsm_hops
, VTY_NEWLINE
);
8979 else if (p
->ttl
> 1)
8980 vty_out (vty
, " External BGP neighbor may be up to %d hops away.%s",
8981 p
->ttl
, VTY_NEWLINE
);
8986 if (p
->gtsm_hops
> 0)
8989 json_object_int_add(json_neigh
, "internalBgpNbrMaxHopsAway", p
->gtsm_hops
);
8991 vty_out (vty
, " Internal BGP neighbor may be up to %d hops away.%s",
8992 p
->gtsm_hops
, VTY_NEWLINE
);
8996 /* Local address. */
9001 json_object_string_add(json_neigh
, "hostLocal", sockunion2str (p
->su_local
, buf1
, SU_ADDRSTRLEN
));
9002 json_object_int_add(json_neigh
, "portLocal", ntohs (p
->su_local
->sin
.sin_port
));
9005 vty_out (vty
, "Local host: %s, Local port: %d%s",
9006 sockunion2str (p
->su_local
, buf1
, SU_ADDRSTRLEN
),
9007 ntohs (p
->su_local
->sin
.sin_port
),
9011 /* Remote address. */
9016 json_object_string_add(json_neigh
, "hostForeign", sockunion2str (p
->su_remote
, buf1
, SU_ADDRSTRLEN
));
9017 json_object_int_add(json_neigh
, "portForeign", ntohs (p
->su_remote
->sin
.sin_port
));
9020 vty_out (vty
, "Foreign host: %s, Foreign port: %d%s",
9021 sockunion2str (p
->su_remote
, buf1
, SU_ADDRSTRLEN
),
9022 ntohs (p
->su_remote
->sin
.sin_port
),
9026 /* Nexthop display. */
9031 json_object_string_add(json_neigh
, "nexthop",
9032 inet_ntop (AF_INET
, &p
->nexthop
.v4
, buf1
, sizeof(buf1
)));
9033 json_object_string_add(json_neigh
, "nexthopGlobal",
9034 inet_ntop (AF_INET6
, &p
->nexthop
.v6_global
, buf1
, sizeof(buf1
)));
9035 json_object_string_add(json_neigh
, "nexthopLocal",
9036 inet_ntop (AF_INET6
, &p
->nexthop
.v6_local
, buf1
, sizeof(buf1
)));
9037 if (p
->shared_network
)
9038 json_object_string_add(json_neigh
, "bgpConnection", "sharedNetwork");
9040 json_object_string_add(json_neigh
, "bgpConnection", "nonSharedNetwork");
9044 vty_out (vty
, "Nexthop: %s%s",
9045 inet_ntop (AF_INET
, &p
->nexthop
.v4
, buf1
, sizeof(buf1
)),
9047 vty_out (vty
, "Nexthop global: %s%s",
9048 inet_ntop (AF_INET6
, &p
->nexthop
.v6_global
, buf1
, sizeof(buf1
)),
9050 vty_out (vty
, "Nexthop local: %s%s",
9051 inet_ntop (AF_INET6
, &p
->nexthop
.v6_local
, buf1
, sizeof(buf1
)),
9053 vty_out (vty
, "BGP connection: %s%s",
9054 p
->shared_network
? "shared network" : "non shared network",
9059 /* Timer information. */
9062 json_object_int_add(json_neigh
, "connectRetryTimer", p
->v_connect
);
9063 if (p
->status
== Established
&& p
->rtt
)
9064 json_object_int_add(json_neigh
, "estimatedRttInMsecs", p
->rtt
);
9066 json_object_int_add(json_neigh
, "nextStartTimerDueInMsecs", thread_timer_remain_second (p
->t_start
) * 1000);
9068 json_object_int_add(json_neigh
, "nextConnectTimerDueInMsecs", thread_timer_remain_second (p
->t_connect
) * 1000);
9071 json_object_int_add(json_neigh
, "mraiInterval", p
->v_routeadv
);
9072 json_object_int_add(json_neigh
, "mraiTimerExpireInMsecs", thread_timer_remain_second (p
->t_routeadv
) * 1000);
9075 json_object_int_add(json_neigh
, "authenticationEnabled", 1);
9078 json_object_string_add(json_neigh
, "readThread", "on");
9080 json_object_string_add(json_neigh
, "readThread", "off");
9082 json_object_string_add(json_neigh
, "writeThread", "on");
9084 json_object_string_add(json_neigh
, "writeThread", "off");
9088 vty_out (vty
, "BGP Connect Retry Timer in Seconds: %d%s",
9089 p
->v_connect
, VTY_NEWLINE
);
9090 if (p
->status
== Established
&& p
->rtt
)
9091 vty_out (vty
, "Estimated round trip time: %d ms%s",
9092 p
->rtt
, VTY_NEWLINE
);
9094 vty_out (vty
, "Next start timer due in %ld seconds%s",
9095 thread_timer_remain_second (p
->t_start
), VTY_NEWLINE
);
9097 vty_out (vty
, "Next connect timer due in %ld seconds%s",
9098 thread_timer_remain_second (p
->t_connect
), VTY_NEWLINE
);
9100 vty_out (vty
, "MRAI (interval %u) timer expires in %ld seconds%s",
9101 p
->v_routeadv
, thread_timer_remain_second (p
->t_routeadv
),
9104 vty_out (vty
, "Peer Authentication Enabled%s", VTY_NEWLINE
);
9106 vty_out (vty
, "Read thread: %s Write thread: %s%s",
9107 p
->t_read
? "on" : "off",
9108 p
->t_write
? "on" : "off",
9112 if (p
->notify
.code
== BGP_NOTIFY_OPEN_ERR
9113 && p
->notify
.subcode
== BGP_NOTIFY_OPEN_UNSUP_CAPBL
)
9114 bgp_capability_vty_out (vty
, p
, use_json
, json_neigh
);
9117 vty_out (vty
, "%s", VTY_NEWLINE
);
9119 /* BFD information. */
9120 bgp_bfd_show_info(vty
, p
, use_json
, json_neigh
);
9124 if (p
->conf_if
) /* Configured interface name. */
9125 json_object_object_add(json
, p
->conf_if
, json_neigh
);
9126 else /* Configured IP address. */
9127 json_object_object_add(json
, p
->host
, json_neigh
);
9132 bgp_show_neighbor (struct vty
*vty
, struct bgp
*bgp
, enum show_type type
,
9133 union sockunion
*su
, const char *conf_if
, u_char use_json
, json_object
*json
)
9135 struct listnode
*node
, *nnode
;
9139 for (ALL_LIST_ELEMENTS (bgp
->peer
, node
, nnode
, peer
))
9141 if (!CHECK_FLAG(peer
->flags
, PEER_FLAG_CONFIG_NODE
))
9147 bgp_show_peer (vty
, peer
, use_json
, json
);
9152 if ((peer
->conf_if
&& !strcmp(peer
->conf_if
, conf_if
)) ||
9153 (peer
->hostname
&& !strcmp(peer
->hostname
, conf_if
)))
9156 bgp_show_peer (vty
, peer
, use_json
, json
);
9161 if (sockunion_same (&peer
->su
, su
))
9164 bgp_show_peer (vty
, peer
, use_json
, json
);
9171 if (type
== show_peer
&& ! find
)
9174 json_object_boolean_true_add(json
, "bgpNoSuchNeighbor");
9176 vty_out (vty
, "%% No such neighbor%s", VTY_NEWLINE
);
9181 vty_out (vty
, "%s%s", json_object_to_json_string_ext(json
, JSON_C_TO_STRING_PRETTY
), VTY_NEWLINE
);
9182 json_object_free(json
);
9186 vty_out (vty
, "%s", VTY_NEWLINE
);
9193 bgp_show_all_instances_neighbors_vty (struct vty
*vty
, u_char use_json
)
9195 struct listnode
*node
, *nnode
;
9197 json_object
*json
= NULL
;
9201 vty_out (vty
, "{%s", VTY_NEWLINE
);
9203 for (ALL_LIST_ELEMENTS (bm
->bgp
, node
, nnode
, bgp
))
9207 if (!(json
= json_object_new_object()))
9209 zlog_err("Unable to allocate memory for JSON object");
9211 "{\"error\": {\"message:\": \"Unable to allocate memory for JSON object\"}}}%s",
9216 json_object_int_add(json
, "vrfId",
9217 (bgp
->vrf_id
== VRF_UNKNOWN
)
9218 ? -1 : bgp
->vrf_id
);
9219 json_object_string_add(json
, "vrfName",
9220 (bgp
->inst_type
== BGP_INSTANCE_TYPE_DEFAULT
)
9221 ? "Default" : bgp
->name
);
9224 vty_out (vty
, ",%s", VTY_NEWLINE
);
9228 vty_out(vty
, "\"%s\":", (bgp
->inst_type
== BGP_INSTANCE_TYPE_DEFAULT
)
9229 ? "Default" : bgp
->name
);
9233 vty_out (vty
, "%sInstance %s:%s",
9235 (bgp
->inst_type
== BGP_INSTANCE_TYPE_DEFAULT
)
9236 ? "Default" : bgp
->name
,
9239 bgp_show_neighbor (vty
, bgp
, show_all
, NULL
, NULL
, use_json
, json
);
9243 vty_out (vty
, "}%s", VTY_NEWLINE
);
9247 bgp_show_neighbor_vty (struct vty
*vty
, const char *name
,
9248 enum show_type type
, const char *ip_str
, u_char use_json
)
9253 json_object
*json
= NULL
;
9257 if (strmatch(name
, "all"))
9259 bgp_show_all_instances_neighbors_vty (vty
, use_json
);
9264 bgp
= bgp_lookup_by_name (name
);
9269 json
= json_object_new_object();
9270 json_object_boolean_true_add(json
, "bgpNoSuchInstance");
9271 vty_out (vty
, "%s%s", json_object_to_json_string_ext(json
, JSON_C_TO_STRING_PRETTY
), VTY_NEWLINE
);
9272 json_object_free(json
);
9275 vty_out (vty
, "%% No such BGP instance exist%s", VTY_NEWLINE
);
9283 bgp
= bgp_get_default ();
9288 json
= json_object_new_object();
9291 ret
= str2sockunion (ip_str
, &su
);
9293 bgp_show_neighbor (vty
, bgp
, type
, NULL
, ip_str
, use_json
, json
);
9295 bgp_show_neighbor (vty
, bgp
, type
, &su
, NULL
, use_json
, json
);
9299 bgp_show_neighbor (vty
, bgp
, type
, NULL
, NULL
, use_json
, json
);
9301 json_object_free (json
);
9307 /* "show [ip] bgp neighbors" commands. */
9308 DEFUN (show_ip_bgp_neighbors
,
9309 show_ip_bgp_neighbors_cmd
,
9310 "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]",
9314 BGP_INSTANCE_HELP_STR
9318 "Display information about all VPNv4 NLRIs\n"
9319 "Display information for a route distinguisher\n"
9320 "VPN Route Distinguisher\n"
9321 "Detailed information on TCP and BGP neighbor connections\n"
9322 "Neighbor to display information about\n"
9323 "Neighbor to display information about\n"
9324 "Neighbor on BGP configured interface\n"
9328 char *sh_arg
= NULL
;
9329 enum show_type sh_type
;
9331 u_char uj
= use_json(argc
, argv
);
9335 if (argv_find (argv
, argc
, "view", &idx
) ||
9336 argv_find (argv
, argc
, "vrf", &idx
))
9337 vrf
= argv
[idx
+1]->arg
;
9340 if (argv_find (argv
, argc
, "A.B.C.D", &idx
) ||
9341 argv_find (argv
, argc
, "X:X::X:X", &idx
) ||
9342 argv_find (argv
, argc
, "WORD", &idx
))
9344 sh_type
= show_peer
;
9345 sh_arg
= argv
[idx
]->arg
;
9350 return bgp_show_neighbor_vty (vty
, vrf
, sh_type
, sh_arg
, uj
);
9353 /* Show BGP's AS paths internal data. There are both `show [ip] bgp
9354 paths' and `show ip mbgp paths'. Those functions results are the
9356 DEFUN (show_ip_bgp_paths
,
9357 show_ip_bgp_paths_cmd
,
9358 "show [ip] bgp ["BGP_SAFI_CMD_STR
"] paths",
9363 "Path information\n")
9365 vty_out (vty
, "Address Refcnt Path%s", VTY_NEWLINE
);
9366 aspath_print_all_vty (vty
);
9373 community_show_all_iterator (struct hash_backet
*backet
, struct vty
*vty
)
9375 struct community
*com
;
9377 com
= (struct community
*) backet
->data
;
9378 vty_out (vty
, "[%p] (%ld) %s%s", (void *)backet
, com
->refcnt
,
9379 community_str (com
), VTY_NEWLINE
);
9382 /* Show BGP's community internal data. */
9383 DEFUN (show_ip_bgp_community_info
,
9384 show_ip_bgp_community_info_cmd
,
9385 "show [ip] bgp community-info",
9389 "List all bgp community information\n")
9391 vty_out (vty
, "Address Refcnt Community%s", VTY_NEWLINE
);
9393 hash_iterate (community_hash (),
9394 (void (*) (struct hash_backet
*, void *))
9395 community_show_all_iterator
,
9402 lcommunity_show_all_iterator (struct hash_backet
*backet
, struct vty
*vty
)
9404 struct lcommunity
*lcom
;
9406 lcom
= (struct lcommunity
*) backet
->data
;
9407 vty_out (vty
, "[%p] (%ld) %s%s", (void *)backet
, lcom
->refcnt
,
9408 lcommunity_str (lcom
), VTY_NEWLINE
);
9411 /* Show BGP's community internal data. */
9412 DEFUN (show_ip_bgp_lcommunity_info
,
9413 show_ip_bgp_lcommunity_info_cmd
,
9414 "show ip bgp large-community-info",
9418 "List all bgp large-community information\n")
9420 vty_out (vty
, "Address Refcnt Large-community%s", VTY_NEWLINE
);
9422 hash_iterate (lcommunity_hash (),
9423 (void (*) (struct hash_backet
*, void *))
9424 lcommunity_show_all_iterator
,
9431 DEFUN (show_ip_bgp_attr_info
,
9432 show_ip_bgp_attr_info_cmd
,
9433 "show [ip] bgp attribute-info",
9437 "List all bgp attribute information\n")
9439 attr_show_all (vty
);
9444 bgp_show_all_instances_updgrps_vty (struct vty
*vty
, afi_t afi
, safi_t safi
)
9446 struct listnode
*node
, *nnode
;
9449 for (ALL_LIST_ELEMENTS (bm
->bgp
, node
, nnode
, bgp
))
9451 vty_out (vty
, "%sInstance %s:%s",
9453 (bgp
->inst_type
== BGP_INSTANCE_TYPE_DEFAULT
) ? "Default" : bgp
->name
,
9455 update_group_show(bgp
, afi
, safi
, vty
, 0);
9460 bgp_show_update_groups(struct vty
*vty
, const char *name
,
9468 if (strmatch (name
, "all"))
9470 bgp_show_all_instances_updgrps_vty (vty
, afi
, safi
);
9475 bgp
= bgp_lookup_by_name (name
);
9480 bgp
= bgp_get_default ();
9484 update_group_show(bgp
, afi
, safi
, vty
, subgrp_id
);
9488 DEFUN (show_ip_bgp_updgrps
,
9489 show_ip_bgp_updgrps_cmd
,
9490 "show [ip] bgp [<view|vrf> VIEWVRFNAME] ["BGP_AFI_CMD_STR
" ["BGP_SAFI_CMD_STR
"]] update-groups [SUBGROUP-ID]",
9494 BGP_INSTANCE_HELP_STR
9497 "Detailed info about dynamic update groups\n"
9498 "Specific subgroup to display detailed info for\n")
9501 afi_t afi
= AFI_IP6
;
9502 safi_t safi
= SAFI_UNICAST
;
9503 uint64_t subgrp_id
= 0;
9508 if (argv_find (argv
, argc
, "ip", &idx
))
9510 /* [<view|vrf> VIEWVRFNAME] */
9511 if (argv_find (argv
, argc
, "view", &idx
) || argv_find (argv
, argc
, "vrf", &idx
))
9512 vrf
= argv
[++idx
]->arg
;
9513 /* ["BGP_AFI_CMD_STR" ["BGP_SAFI_CMD_STR"]] */
9514 if (argv_find_and_parse_afi (argv
, argc
, &idx
, &afi
))
9516 argv_find_and_parse_safi (argv
, argc
, &idx
, &safi
);
9519 /* get subgroup id, if provided */
9521 if (argv
[idx
]->type
== VARIABLE_TKN
)
9522 VTY_GET_ULL("subgroup-id", subgrp_id
, argv
[idx
]->arg
);
9524 return (bgp_show_update_groups(vty
, vrf
, afi
, safi
, subgrp_id
));
9527 DEFUN (show_bgp_instance_all_ipv6_updgrps
,
9528 show_bgp_instance_all_ipv6_updgrps_cmd
,
9529 "show [ip] bgp <view|vrf> all update-groups",
9533 BGP_INSTANCE_ALL_HELP_STR
9534 "Detailed info about dynamic update groups\n")
9536 bgp_show_all_instances_updgrps_vty (vty
, AFI_IP6
, SAFI_UNICAST
);
9540 DEFUN (show_bgp_updgrps_stats
,
9541 show_bgp_updgrps_stats_cmd
,
9542 "show [ip] bgp update-groups statistics",
9546 "Detailed info about dynamic update groups\n"
9551 bgp
= bgp_get_default();
9553 update_group_show_stats(bgp
, vty
);
9558 DEFUN (show_bgp_instance_updgrps_stats
,
9559 show_bgp_instance_updgrps_stats_cmd
,
9560 "show [ip] bgp <view|vrf> VIEWVRFNAME update-groups statistics",
9564 BGP_INSTANCE_HELP_STR
9565 "Detailed info about dynamic update groups\n"
9571 bgp
= bgp_lookup_by_name (argv
[idx_word
]->arg
);
9573 update_group_show_stats(bgp
, vty
);
9579 show_bgp_updgrps_adj_info_aux (struct vty
*vty
, const char *name
,
9580 afi_t afi
, safi_t safi
,
9581 const char *what
, uint64_t subgrp_id
)
9586 bgp
= bgp_lookup_by_name (name
);
9588 bgp
= bgp_get_default ();
9592 if (!strcmp(what
, "advertise-queue"))
9593 update_group_show_adj_queue(bgp
, afi
, safi
, vty
, subgrp_id
);
9594 else if (!strcmp(what
, "advertised-routes"))
9595 update_group_show_advertised(bgp
, afi
, safi
, vty
, subgrp_id
);
9596 else if (!strcmp(what
, "packet-queue"))
9597 update_group_show_packet_queue(bgp
, afi
, safi
, vty
, subgrp_id
);
9601 DEFUN (show_ip_bgp_updgrps_adj
,
9602 show_ip_bgp_updgrps_adj_cmd
,
9603 "show [ip] bgp update-groups <advertise-queue|advertised-routes|packet-queue>",
9607 "Detailed info about dynamic update groups\n"
9608 "Advertisement queue\n"
9609 "Announced routes\n"
9614 show_bgp_updgrps_adj_info_aux(vty
, NULL
, AFI_IP
, SAFI_UNICAST
, argv
[idx_type
]->arg
, 0);
9618 DEFUN (show_ip_bgp_instance_updgrps_adj
,
9619 show_ip_bgp_instance_updgrps_adj_cmd
,
9620 "show [ip] bgp <view|vrf> VIEWVRFNAME update-groups <advertise-queue|advertised-routes|packet-queue>",
9624 BGP_INSTANCE_HELP_STR
9625 "Detailed info about dynamic update groups\n"
9626 "Advertisement queue\n"
9627 "Announced routes\n"
9633 show_bgp_updgrps_adj_info_aux(vty
, argv
[idx_word
]->arg
, AFI_IP
, SAFI_UNICAST
, argv
[idx_type
]->arg
, 0);
9637 DEFUN (show_bgp_updgrps_afi_adj
,
9638 show_bgp_updgrps_afi_adj_cmd
,
9639 "show [ip] bgp "BGP_AFI_SAFI_CMD_STR
" update-groups <advertise-queue|advertised-routes|packet-queue>",
9643 BGP_AFI_SAFI_HELP_STR
9644 "Detailed info about dynamic update groups\n"
9645 "Advertisement queue\n"
9646 "Announced routes\n"
9648 "Specific subgroup info wanted for\n")
9653 show_bgp_updgrps_adj_info_aux(vty
, NULL
,
9654 bgp_vty_afi_from_str(argv
[idx_afi
]->text
),
9655 bgp_vty_safi_from_str(argv
[idx_safi
]->text
),
9656 argv
[idx_type
]->arg
, 0);
9660 DEFUN (show_bgp_updgrps_adj
,
9661 show_bgp_updgrps_adj_cmd
,
9662 "show [ip] bgp update-groups <advertise-queue|advertised-routes|packet-queue>",
9666 "Detailed info about dynamic update groups\n"
9667 "Advertisement queue\n"
9668 "Announced routes\n"
9672 show_bgp_updgrps_adj_info_aux(vty
, NULL
, AFI_IP6
, SAFI_UNICAST
, argv
[idx_type
]->arg
, 0);
9676 DEFUN (show_bgp_instance_updgrps_adj
,
9677 show_bgp_instance_updgrps_adj_cmd
,
9678 "show [ip] bgp <view|vrf> VIEWVRFNAME update-groups <advertise-queue|advertised-routes|packet-queue>",
9682 BGP_INSTANCE_HELP_STR
9683 "Detailed info about dynamic update groups\n"
9684 "Advertisement queue\n"
9685 "Announced routes\n"
9690 show_bgp_updgrps_adj_info_aux(vty
, argv
[idx_word
]->arg
, AFI_IP6
, SAFI_UNICAST
, argv
[idx_type
]->arg
, 0);
9694 DEFUN (show_ip_bgp_updgrps_adj_s
,
9695 show_ip_bgp_updgrps_adj_s_cmd
,
9696 "show [ip] bgp update-groups SUBGROUP-ID <advertise-queue|advertised-routes|packet-queue>",
9700 "Detailed info about dynamic update groups\n"
9701 "Specific subgroup to display info for\n"
9702 "Advertisement queue\n"
9703 "Announced routes\n"
9707 int idx_subgroup_id
= 4;
9711 VTY_GET_ULL("subgroup-id", subgrp_id
, argv
[idx_subgroup_id
]->arg
);
9713 show_bgp_updgrps_adj_info_aux(vty
, NULL
, AFI_IP
, SAFI_UNICAST
, argv
[idx_type
]->arg
, subgrp_id
);
9717 DEFUN (show_ip_bgp_instance_updgrps_adj_s
,
9718 show_ip_bgp_instance_updgrps_adj_s_cmd
,
9719 "show [ip] bgp <view|vrf> VIEWVRFNAME update-groups SUBGROUP-ID <advertise-queue|advertised-routes|packet-queue>",
9723 BGP_INSTANCE_HELP_STR
9724 "Detailed info about dynamic update groups\n"
9725 "Specific subgroup to display info for\n"
9726 "Advertisement queue\n"
9727 "Announced routes\n"
9732 int idx_subgroup_id
= 6;
9736 VTY_GET_ULL("subgroup-id", subgrp_id
, argv
[idx_subgroup_id
]->arg
);
9738 show_bgp_updgrps_adj_info_aux(vty
, argv
[idx_vrf
]->arg
, AFI_IP
, SAFI_UNICAST
, argv
[idx_type
]->arg
, subgrp_id
);
9742 DEFUN (show_bgp_updgrps_afi_adj_s
,
9743 show_bgp_updgrps_afi_adj_s_cmd
,
9744 "show [ip] bgp "BGP_AFI_SAFI_CMD_STR
" update-groups SUBGROUP-ID <advertise-queue|advertised-routes|packet-queue>",
9748 BGP_AFI_SAFI_HELP_STR
9749 "Detailed info about dynamic update groups\n"
9750 "Specific subgroup to display info for\n"
9751 "Advertisement queue\n"
9752 "Announced routes\n"
9754 "Specific subgroup info wanted for\n")
9758 int idx_subgroup_id
= 5;
9762 VTY_GET_ULL("subgroup-id", subgrp_id
, argv
[idx_subgroup_id
]->arg
);
9764 show_bgp_updgrps_adj_info_aux(vty
, NULL
,
9765 bgp_vty_afi_from_str(argv
[idx_afi
]->text
),
9766 bgp_vty_safi_from_str(argv
[idx_safi
]->text
),
9767 argv
[idx_type
]->arg
, subgrp_id
);
9771 DEFUN (show_bgp_updgrps_adj_s
,
9772 show_bgp_updgrps_adj_s_cmd
,
9773 "show [ip] bgp update-groups SUBGROUP-ID <advertise-queue|advertised-routes|packet-queue>",
9777 "Detailed info about dynamic update groups\n"
9778 "Specific subgroup to display info for\n"
9779 "Advertisement queue\n"
9780 "Announced routes\n"
9783 int idx_subgroup_id
= 3;
9787 VTY_GET_ULL("subgroup-id", subgrp_id
, argv
[idx_subgroup_id
]->arg
);
9789 show_bgp_updgrps_adj_info_aux(vty
, NULL
, AFI_IP6
, SAFI_UNICAST
, argv
[idx_type
]->arg
, subgrp_id
);
9793 DEFUN (show_bgp_instance_updgrps_adj_s
,
9794 show_bgp_instance_updgrps_adj_s_cmd
,
9795 "show [ip] bgp <view|vrf> VIEWVRFNAME update-groups SUBGROUP-ID <advertise-queue|advertised-routes|packet-queue>",
9799 BGP_INSTANCE_HELP_STR
9800 "Detailed info about dynamic update groups\n"
9801 "Specific subgroup to display info for\n"
9802 "Advertisement queue\n"
9803 "Announced routes\n"
9807 int idx_subgroup_id
= 5;
9811 VTY_GET_ULL("subgroup-id", subgrp_id
, argv
[idx_subgroup_id
]->arg
);
9813 show_bgp_updgrps_adj_info_aux(vty
, argv
[idx_vrf
]->arg
, AFI_IP6
, SAFI_UNICAST
, argv
[idx_type
]->arg
, subgrp_id
);
9820 bgp_show_one_peer_group (struct vty
*vty
, struct peer_group
*group
)
9822 struct listnode
*node
, *nnode
;
9823 struct prefix
*range
;
9826 char buf
[PREFIX2STR_BUFFER
];
9829 const char *peer_status
;
9837 if (conf
->as_type
== AS_SPECIFIED
||
9838 conf
->as_type
== AS_EXTERNAL
) {
9839 vty_out (vty
, "%sBGP peer-group %s, remote AS %d%s",
9840 VTY_NEWLINE
, group
->name
, conf
->as
, VTY_NEWLINE
);
9841 } else if (conf
->as_type
== AS_INTERNAL
) {
9842 vty_out (vty
, "%sBGP peer-group %s, remote AS %d%s",
9843 VTY_NEWLINE
, group
->name
, group
->bgp
->as
, VTY_NEWLINE
);
9845 vty_out (vty
, "%sBGP peer-group %s%s",
9846 VTY_NEWLINE
, group
->name
, VTY_NEWLINE
);
9849 if ((group
->bgp
->as
== conf
->as
) || (conf
->as_type
== AS_INTERNAL
))
9850 vty_out (vty
, " Peer-group type is internal%s", VTY_NEWLINE
);
9852 vty_out (vty
, " Peer-group type is external%s", VTY_NEWLINE
);
9854 /* Display AFs configured. */
9855 vty_out (vty
, " Configured address-families:");
9856 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
9857 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
9859 if (conf
->afc
[afi
][safi
])
9862 vty_out (vty
, " %s;", afi_safi_print(afi
, safi
));
9866 vty_out (vty
, " none%s", VTY_NEWLINE
);
9868 vty_out (vty
, "%s", VTY_NEWLINE
);
9870 /* Display listen ranges (for dynamic neighbors), if any */
9871 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
9875 else if (afi
== AFI_IP6
)
9879 lr_count
= listcount(group
->listen_range
[afi
]);
9883 " %d %s listen range(s)%s",
9884 lr_count
, af_str
, VTY_NEWLINE
);
9887 for (ALL_LIST_ELEMENTS (group
->listen_range
[afi
], node
,
9890 prefix2str(range
, buf
, sizeof(buf
));
9891 vty_out(vty
, " %s%s", buf
, VTY_NEWLINE
);
9896 /* Display group members and their status */
9897 if (listcount(group
->peer
))
9899 vty_out (vty
, " Peer-group members:%s", VTY_NEWLINE
);
9900 for (ALL_LIST_ELEMENTS (group
->peer
, node
, nnode
, peer
))
9902 if (CHECK_FLAG (peer
->flags
, PEER_FLAG_SHUTDOWN
))
9903 peer_status
= "Idle (Admin)";
9904 else if (CHECK_FLAG (peer
->sflags
, PEER_STATUS_PREFIX_OVERFLOW
))
9905 peer_status
= "Idle (PfxCt)";
9907 peer_status
= lookup_msg(bgp_status_msg
, peer
->status
, NULL
);
9909 dynamic
= peer_dynamic_neighbor(peer
);
9910 vty_out (vty
, " %s %s %s %s",
9911 peer
->host
, dynamic
? "(dynamic)" : "",
9912 peer_status
, VTY_NEWLINE
);
9919 /* Show BGP peer group's information. */
9920 enum show_group_type
9927 bgp_show_peer_group (struct vty
*vty
, struct bgp
*bgp
,
9928 enum show_group_type type
, const char *group_name
)
9930 struct listnode
*node
, *nnode
;
9931 struct peer_group
*group
;
9934 for (ALL_LIST_ELEMENTS (bgp
->group
, node
, nnode
, group
))
9938 case show_all_groups
:
9939 bgp_show_one_peer_group (vty
, group
);
9941 case show_peer_group
:
9942 if (group_name
&& (strcmp(group
->name
, group_name
) == 0))
9945 bgp_show_one_peer_group (vty
, group
);
9951 if (type
== show_peer_group
&& ! find
)
9952 vty_out (vty
, "%% No such peer-group%s", VTY_NEWLINE
);
9958 bgp_show_peer_group_vty (struct vty
*vty
, const char *name
,
9959 enum show_group_type type
, const char *group_name
)
9962 int ret
= CMD_SUCCESS
;
9965 bgp
= bgp_lookup_by_name (name
);
9967 bgp
= bgp_get_default ();
9971 vty_out (vty
, "%% No such BGP instance exist%s", VTY_NEWLINE
);
9975 ret
= bgp_show_peer_group (vty
, bgp
, type
, group_name
);
9980 DEFUN (show_ip_bgp_peer_groups
,
9981 show_ip_bgp_peer_groups_cmd
,
9982 "show [ip] bgp [<view|vrf> VIEWVRFNAME] peer-group [PGNAME]",
9986 BGP_INSTANCE_HELP_STR
9987 "Detailed information on BGP peer groups\n"
9988 "Peer group name\n")
9994 vrf
= argv_find (argv
, argc
, "WORD", &idx
) ? argv
[idx
]->arg
: NULL
;
9995 pg
= argv_find (argv
, argc
, "PGNAME", &idx
) ? argv
[idx
]->arg
: NULL
;
9997 return bgp_show_peer_group_vty (vty
, vrf
, show_all_groups
, pg
);
10001 /* Redistribute VTY commands. */
10003 DEFUN (bgp_redistribute_ipv4
,
10004 bgp_redistribute_ipv4_cmd
,
10005 "redistribute " FRR_IP_REDIST_STR_BGPD
,
10006 "Redistribute information from another routing protocol\n"
10007 FRR_IP_REDIST_HELP_STR_BGPD
)
10009 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
10010 int idx_protocol
= 1;
10013 type
= proto_redistnum (AFI_IP
, argv
[idx_protocol
]->text
);
10016 vty_out (vty
, "%% Invalid route type%s", VTY_NEWLINE
);
10017 return CMD_WARNING
;
10019 bgp_redist_add(bgp
, AFI_IP
, type
, 0);
10020 return bgp_redistribute_set (bgp
, AFI_IP
, type
, 0);
10023 ALIAS_HIDDEN (bgp_redistribute_ipv4
,
10024 bgp_redistribute_ipv4_hidden_cmd
,
10025 "redistribute " FRR_IP_REDIST_STR_BGPD
,
10026 "Redistribute information from another routing protocol\n"
10027 FRR_IP_REDIST_HELP_STR_BGPD
)
10029 DEFUN (bgp_redistribute_ipv4_rmap
,
10030 bgp_redistribute_ipv4_rmap_cmd
,
10031 "redistribute " FRR_IP_REDIST_STR_BGPD
" route-map WORD",
10032 "Redistribute information from another routing protocol\n"
10033 FRR_IP_REDIST_HELP_STR_BGPD
10034 "Route map reference\n"
10035 "Pointer to route-map entries\n")
10037 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
10038 int idx_protocol
= 1;
10041 struct bgp_redist
*red
;
10043 type
= proto_redistnum (AFI_IP
, argv
[idx_protocol
]->text
);
10046 vty_out (vty
, "%% Invalid route type%s", VTY_NEWLINE
);
10047 return CMD_WARNING
;
10050 red
= bgp_redist_add(bgp
, AFI_IP
, type
, 0);
10051 bgp_redistribute_rmap_set (red
, argv
[idx_word
]->arg
);
10052 return bgp_redistribute_set (bgp
, AFI_IP
, type
, 0);
10055 ALIAS_HIDDEN (bgp_redistribute_ipv4_rmap
,
10056 bgp_redistribute_ipv4_rmap_hidden_cmd
,
10057 "redistribute " FRR_IP_REDIST_STR_BGPD
" route-map WORD",
10058 "Redistribute information from another routing protocol\n"
10059 FRR_IP_REDIST_HELP_STR_BGPD
10060 "Route map reference\n"
10061 "Pointer to route-map entries\n")
10063 DEFUN (bgp_redistribute_ipv4_metric
,
10064 bgp_redistribute_ipv4_metric_cmd
,
10065 "redistribute " FRR_IP_REDIST_STR_BGPD
" metric (0-4294967295)",
10066 "Redistribute information from another routing protocol\n"
10067 FRR_IP_REDIST_HELP_STR_BGPD
10068 "Metric for redistributed routes\n"
10069 "Default metric\n")
10071 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
10072 int idx_protocol
= 1;
10073 int idx_number
= 3;
10076 struct bgp_redist
*red
;
10078 type
= proto_redistnum (AFI_IP
, argv
[idx_protocol
]->text
);
10081 vty_out (vty
, "%% Invalid route type%s", VTY_NEWLINE
);
10082 return CMD_WARNING
;
10084 VTY_GET_INTEGER ("metric", metric
, argv
[idx_number
]->arg
);
10086 red
= bgp_redist_add(bgp
, AFI_IP
, type
, 0);
10087 bgp_redistribute_metric_set(bgp
, red
, AFI_IP
, type
, metric
);
10088 return bgp_redistribute_set (bgp
, AFI_IP
, type
, 0);
10091 ALIAS_HIDDEN (bgp_redistribute_ipv4_metric
,
10092 bgp_redistribute_ipv4_metric_hidden_cmd
,
10093 "redistribute " FRR_IP_REDIST_STR_BGPD
" metric (0-4294967295)",
10094 "Redistribute information from another routing protocol\n"
10095 FRR_IP_REDIST_HELP_STR_BGPD
10096 "Metric for redistributed routes\n"
10097 "Default metric\n")
10099 DEFUN (bgp_redistribute_ipv4_rmap_metric
,
10100 bgp_redistribute_ipv4_rmap_metric_cmd
,
10101 "redistribute " FRR_IP_REDIST_STR_BGPD
" route-map WORD metric (0-4294967295)",
10102 "Redistribute information from another routing protocol\n"
10103 FRR_IP_REDIST_HELP_STR_BGPD
10104 "Route map reference\n"
10105 "Pointer to route-map entries\n"
10106 "Metric for redistributed routes\n"
10107 "Default metric\n")
10109 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
10110 int idx_protocol
= 1;
10112 int idx_number
= 5;
10115 struct bgp_redist
*red
;
10117 type
= proto_redistnum (AFI_IP
, argv
[idx_protocol
]->text
);
10120 vty_out (vty
, "%% Invalid route type%s", VTY_NEWLINE
);
10121 return CMD_WARNING
;
10123 VTY_GET_INTEGER ("metric", metric
, argv
[idx_number
]->arg
);
10125 red
= bgp_redist_add(bgp
, AFI_IP
, type
, 0);
10126 bgp_redistribute_rmap_set (red
, argv
[idx_word
]->arg
);
10127 bgp_redistribute_metric_set(bgp
, red
, AFI_IP
, type
, metric
);
10128 return bgp_redistribute_set (bgp
, AFI_IP
, type
, 0);
10131 ALIAS_HIDDEN (bgp_redistribute_ipv4_rmap_metric
,
10132 bgp_redistribute_ipv4_rmap_metric_hidden_cmd
,
10133 "redistribute " FRR_IP_REDIST_STR_BGPD
" route-map WORD metric (0-4294967295)",
10134 "Redistribute information from another routing protocol\n"
10135 FRR_IP_REDIST_HELP_STR_BGPD
10136 "Route map reference\n"
10137 "Pointer to route-map entries\n"
10138 "Metric for redistributed routes\n"
10139 "Default metric\n")
10141 DEFUN (bgp_redistribute_ipv4_metric_rmap
,
10142 bgp_redistribute_ipv4_metric_rmap_cmd
,
10143 "redistribute " FRR_IP_REDIST_STR_BGPD
" metric (0-4294967295) route-map WORD",
10144 "Redistribute information from another routing protocol\n"
10145 FRR_IP_REDIST_HELP_STR_BGPD
10146 "Metric for redistributed routes\n"
10148 "Route map reference\n"
10149 "Pointer to route-map entries\n")
10151 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
10152 int idx_protocol
= 1;
10153 int idx_number
= 3;
10157 struct bgp_redist
*red
;
10159 type
= proto_redistnum (AFI_IP
, argv
[idx_protocol
]->text
);
10162 vty_out (vty
, "%% Invalid route type%s", VTY_NEWLINE
);
10163 return CMD_WARNING
;
10165 VTY_GET_INTEGER ("metric", metric
, argv
[idx_number
]->arg
);
10167 red
= bgp_redist_add(bgp
, AFI_IP
, type
, 0);
10168 bgp_redistribute_metric_set(bgp
, red
, AFI_IP
, type
, metric
);
10169 bgp_redistribute_rmap_set (red
, argv
[idx_word
]->arg
);
10170 return bgp_redistribute_set (bgp
, AFI_IP
, type
, 0);
10173 ALIAS_HIDDEN (bgp_redistribute_ipv4_metric_rmap
,
10174 bgp_redistribute_ipv4_metric_rmap_hidden_cmd
,
10175 "redistribute " FRR_IP_REDIST_STR_BGPD
" metric (0-4294967295) route-map WORD",
10176 "Redistribute information from another routing protocol\n"
10177 FRR_IP_REDIST_HELP_STR_BGPD
10178 "Metric for redistributed routes\n"
10180 "Route map reference\n"
10181 "Pointer to route-map entries\n")
10183 DEFUN (bgp_redistribute_ipv4_ospf
,
10184 bgp_redistribute_ipv4_ospf_cmd
,
10185 "redistribute <ospf|table> (1-65535)",
10186 "Redistribute information from another routing protocol\n"
10187 "Open Shortest Path First (OSPFv2)\n"
10188 "Non-main Kernel Routing Table\n"
10189 "Instance ID/Table ID\n")
10191 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
10192 int idx_ospf_table
= 1;
10193 int idx_number
= 2;
10197 VTY_GET_INTEGER ("Instance ID", instance
, argv
[idx_number
]->arg
);
10199 if (strncmp(argv
[idx_ospf_table
]->arg
, "o", 1) == 0)
10200 protocol
= ZEBRA_ROUTE_OSPF
;
10202 protocol
= ZEBRA_ROUTE_TABLE
;
10204 bgp_redist_add(bgp
, AFI_IP
, protocol
, instance
);
10205 return bgp_redistribute_set (bgp
, AFI_IP
, protocol
, instance
);
10208 ALIAS_HIDDEN (bgp_redistribute_ipv4_ospf
,
10209 bgp_redistribute_ipv4_ospf_hidden_cmd
,
10210 "redistribute <ospf|table> (1-65535)",
10211 "Redistribute information from another routing protocol\n"
10212 "Open Shortest Path First (OSPFv2)\n"
10213 "Non-main Kernel Routing Table\n"
10214 "Instance ID/Table ID\n")
10216 DEFUN (bgp_redistribute_ipv4_ospf_rmap
,
10217 bgp_redistribute_ipv4_ospf_rmap_cmd
,
10218 "redistribute <ospf|table> (1-65535) route-map WORD",
10219 "Redistribute information from another routing protocol\n"
10220 "Open Shortest Path First (OSPFv2)\n"
10221 "Non-main Kernel Routing Table\n"
10222 "Instance ID/Table ID\n"
10223 "Route map reference\n"
10224 "Pointer to route-map entries\n")
10226 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
10227 int idx_ospf_table
= 1;
10228 int idx_number
= 2;
10230 struct bgp_redist
*red
;
10234 if (strncmp(argv
[idx_ospf_table
]->arg
, "o", 1) == 0)
10235 protocol
= ZEBRA_ROUTE_OSPF
;
10237 protocol
= ZEBRA_ROUTE_TABLE
;
10239 VTY_GET_INTEGER ("Instance ID", instance
, argv
[idx_number
]->arg
);
10240 red
= bgp_redist_add(bgp
, AFI_IP
, protocol
, instance
);
10241 bgp_redistribute_rmap_set (red
, argv
[idx_word
]->arg
);
10242 return bgp_redistribute_set (bgp
, AFI_IP
, protocol
, instance
);
10245 ALIAS_HIDDEN (bgp_redistribute_ipv4_ospf_rmap
,
10246 bgp_redistribute_ipv4_ospf_rmap_hidden_cmd
,
10247 "redistribute <ospf|table> (1-65535) route-map WORD",
10248 "Redistribute information from another routing protocol\n"
10249 "Open Shortest Path First (OSPFv2)\n"
10250 "Non-main Kernel Routing Table\n"
10251 "Instance ID/Table ID\n"
10252 "Route map reference\n"
10253 "Pointer to route-map entries\n")
10255 DEFUN (bgp_redistribute_ipv4_ospf_metric
,
10256 bgp_redistribute_ipv4_ospf_metric_cmd
,
10257 "redistribute <ospf|table> (1-65535) metric (0-4294967295)",
10258 "Redistribute information from another routing protocol\n"
10259 "Open Shortest Path First (OSPFv2)\n"
10260 "Non-main Kernel Routing Table\n"
10261 "Instance ID/Table ID\n"
10262 "Metric for redistributed routes\n"
10263 "Default metric\n")
10265 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
10266 int idx_ospf_table
= 1;
10267 int idx_number
= 2;
10268 int idx_number_2
= 4;
10270 struct bgp_redist
*red
;
10274 if (strncmp(argv
[idx_ospf_table
]->arg
, "o", 1) == 0)
10275 protocol
= ZEBRA_ROUTE_OSPF
;
10277 protocol
= ZEBRA_ROUTE_TABLE
;
10279 VTY_GET_INTEGER ("Instance ID", instance
, argv
[idx_number
]->arg
);
10280 VTY_GET_INTEGER ("metric", metric
, argv
[idx_number_2
]->arg
);
10282 red
= bgp_redist_add(bgp
, AFI_IP
, protocol
, instance
);
10283 bgp_redistribute_metric_set(bgp
, red
, AFI_IP
, protocol
, metric
);
10284 return bgp_redistribute_set (bgp
, AFI_IP
, protocol
, instance
);
10287 ALIAS_HIDDEN (bgp_redistribute_ipv4_ospf_metric
,
10288 bgp_redistribute_ipv4_ospf_metric_hidden_cmd
,
10289 "redistribute <ospf|table> (1-65535) metric (0-4294967295)",
10290 "Redistribute information from another routing protocol\n"
10291 "Open Shortest Path First (OSPFv2)\n"
10292 "Non-main Kernel Routing Table\n"
10293 "Instance ID/Table ID\n"
10294 "Metric for redistributed routes\n"
10295 "Default metric\n")
10297 DEFUN (bgp_redistribute_ipv4_ospf_rmap_metric
,
10298 bgp_redistribute_ipv4_ospf_rmap_metric_cmd
,
10299 "redistribute <ospf|table> (1-65535) route-map WORD metric (0-4294967295)",
10300 "Redistribute information from another routing protocol\n"
10301 "Open Shortest Path First (OSPFv2)\n"
10302 "Non-main Kernel Routing Table\n"
10303 "Instance ID/Table ID\n"
10304 "Route map reference\n"
10305 "Pointer to route-map entries\n"
10306 "Metric for redistributed routes\n"
10307 "Default metric\n")
10309 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
10310 int idx_ospf_table
= 1;
10311 int idx_number
= 2;
10313 int idx_number_2
= 6;
10315 struct bgp_redist
*red
;
10319 if (strncmp(argv
[idx_ospf_table
]->arg
, "o", 1) == 0)
10320 protocol
= ZEBRA_ROUTE_OSPF
;
10322 protocol
= ZEBRA_ROUTE_TABLE
;
10324 VTY_GET_INTEGER ("Instance ID", instance
, argv
[idx_number
]->arg
);
10325 VTY_GET_INTEGER ("metric", metric
, argv
[idx_number_2
]->arg
);
10327 red
= bgp_redist_add(bgp
, AFI_IP
, protocol
, instance
);
10328 bgp_redistribute_rmap_set (red
, argv
[idx_word
]->arg
);
10329 bgp_redistribute_metric_set(bgp
, red
, AFI_IP
, protocol
, metric
);
10330 return bgp_redistribute_set (bgp
, AFI_IP
, protocol
, instance
);
10333 ALIAS_HIDDEN (bgp_redistribute_ipv4_ospf_rmap_metric
,
10334 bgp_redistribute_ipv4_ospf_rmap_metric_hidden_cmd
,
10335 "redistribute <ospf|table> (1-65535) route-map WORD metric (0-4294967295)",
10336 "Redistribute information from another routing protocol\n"
10337 "Open Shortest Path First (OSPFv2)\n"
10338 "Non-main Kernel Routing Table\n"
10339 "Instance ID/Table ID\n"
10340 "Route map reference\n"
10341 "Pointer to route-map entries\n"
10342 "Metric for redistributed routes\n"
10343 "Default metric\n")
10345 DEFUN (bgp_redistribute_ipv4_ospf_metric_rmap
,
10346 bgp_redistribute_ipv4_ospf_metric_rmap_cmd
,
10347 "redistribute <ospf|table> (1-65535) metric (0-4294967295) route-map WORD",
10348 "Redistribute information from another routing protocol\n"
10349 "Open Shortest Path First (OSPFv2)\n"
10350 "Non-main Kernel Routing Table\n"
10351 "Instance ID/Table ID\n"
10352 "Metric for redistributed routes\n"
10354 "Route map reference\n"
10355 "Pointer to route-map entries\n")
10357 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
10358 int idx_ospf_table
= 1;
10359 int idx_number
= 2;
10360 int idx_number_2
= 4;
10363 struct bgp_redist
*red
;
10367 if (strncmp(argv
[idx_ospf_table
]->arg
, "o", 1) == 0)
10368 protocol
= ZEBRA_ROUTE_OSPF
;
10370 protocol
= ZEBRA_ROUTE_TABLE
;
10372 VTY_GET_INTEGER ("Instance ID", instance
, argv
[idx_number
]->arg
);
10373 VTY_GET_INTEGER ("metric", metric
, argv
[idx_number_2
]->arg
);
10375 red
= bgp_redist_add(bgp
, AFI_IP
, protocol
, instance
);
10376 bgp_redistribute_metric_set(bgp
, red
, AFI_IP
, protocol
, metric
);
10377 bgp_redistribute_rmap_set (red
, argv
[idx_word
]->arg
);
10378 return bgp_redistribute_set (bgp
, AFI_IP
, protocol
, instance
);
10381 ALIAS_HIDDEN (bgp_redistribute_ipv4_ospf_metric_rmap
,
10382 bgp_redistribute_ipv4_ospf_metric_rmap_hidden_cmd
,
10383 "redistribute <ospf|table> (1-65535) metric (0-4294967295) route-map WORD",
10384 "Redistribute information from another routing protocol\n"
10385 "Open Shortest Path First (OSPFv2)\n"
10386 "Non-main Kernel Routing Table\n"
10387 "Instance ID/Table ID\n"
10388 "Metric for redistributed routes\n"
10390 "Route map reference\n"
10391 "Pointer to route-map entries\n")
10393 DEFUN (no_bgp_redistribute_ipv4_ospf
,
10394 no_bgp_redistribute_ipv4_ospf_cmd
,
10395 "no redistribute <ospf|table> (1-65535) [metric (0-4294967295)] [route-map WORD]",
10397 "Redistribute information from another routing protocol\n"
10398 "Open Shortest Path First (OSPFv2)\n"
10399 "Non-main Kernel Routing Table\n"
10400 "Instance ID/Table ID\n"
10401 "Metric for redistributed routes\n"
10403 "Route map reference\n"
10404 "Pointer to route-map entries\n")
10406 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
10407 int idx_ospf_table
= 2;
10408 int idx_number
= 3;
10412 if (strncmp(argv
[idx_ospf_table
]->arg
, "o", 1) == 0)
10413 protocol
= ZEBRA_ROUTE_OSPF
;
10415 protocol
= ZEBRA_ROUTE_TABLE
;
10417 VTY_GET_INTEGER ("Instance ID", instance
, argv
[idx_number
]->arg
);
10418 return bgp_redistribute_unset (bgp
, AFI_IP
, protocol
, instance
);
10421 ALIAS_HIDDEN (no_bgp_redistribute_ipv4_ospf
,
10422 no_bgp_redistribute_ipv4_ospf_hidden_cmd
,
10423 "no redistribute <ospf|table> (1-65535) [metric (0-4294967295)] [route-map WORD]",
10425 "Redistribute information from another routing protocol\n"
10426 "Open Shortest Path First (OSPFv2)\n"
10427 "Non-main Kernel Routing Table\n"
10428 "Instance ID/Table ID\n"
10429 "Metric for redistributed routes\n"
10431 "Route map reference\n"
10432 "Pointer to route-map entries\n")
10434 DEFUN (no_bgp_redistribute_ipv4
,
10435 no_bgp_redistribute_ipv4_cmd
,
10436 "no redistribute " FRR_IP_REDIST_STR_BGPD
" [metric (0-4294967295)] [route-map WORD]",
10438 "Redistribute information from another routing protocol\n"
10439 FRR_IP_REDIST_HELP_STR_BGPD
10440 "Metric for redistributed routes\n"
10442 "Route map reference\n"
10443 "Pointer to route-map entries\n")
10445 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
10446 int idx_protocol
= 2;
10449 type
= proto_redistnum (AFI_IP
, argv
[idx_protocol
]->text
);
10452 vty_out (vty
, "%% Invalid route type%s", VTY_NEWLINE
);
10453 return CMD_WARNING
;
10455 return bgp_redistribute_unset (bgp
, AFI_IP
, type
, 0);
10458 ALIAS_HIDDEN (no_bgp_redistribute_ipv4
,
10459 no_bgp_redistribute_ipv4_hidden_cmd
,
10460 "no redistribute " FRR_IP_REDIST_STR_BGPD
" [metric (0-4294967295)] [route-map WORD]",
10462 "Redistribute information from another routing protocol\n"
10463 FRR_IP_REDIST_HELP_STR_BGPD
10464 "Metric for redistributed routes\n"
10466 "Route map reference\n"
10467 "Pointer to route-map entries\n")
10469 DEFUN (bgp_redistribute_ipv6
,
10470 bgp_redistribute_ipv6_cmd
,
10471 "redistribute " FRR_IP6_REDIST_STR_BGPD
,
10472 "Redistribute information from another routing protocol\n"
10473 FRR_IP6_REDIST_HELP_STR_BGPD
)
10475 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
10476 int idx_protocol
= 1;
10479 type
= proto_redistnum (AFI_IP6
, argv
[idx_protocol
]->text
);
10482 vty_out (vty
, "%% Invalid route type%s", VTY_NEWLINE
);
10483 return CMD_WARNING
;
10486 bgp_redist_add(bgp
, AFI_IP6
, type
, 0);
10487 return bgp_redistribute_set (bgp
, AFI_IP6
, type
, 0);
10490 DEFUN (bgp_redistribute_ipv6_rmap
,
10491 bgp_redistribute_ipv6_rmap_cmd
,
10492 "redistribute " FRR_IP6_REDIST_STR_BGPD
" route-map WORD",
10493 "Redistribute information from another routing protocol\n"
10494 FRR_IP6_REDIST_HELP_STR_BGPD
10495 "Route map reference\n"
10496 "Pointer to route-map entries\n")
10498 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
10499 int idx_protocol
= 1;
10502 struct bgp_redist
*red
;
10504 type
= proto_redistnum (AFI_IP6
, argv
[idx_protocol
]->text
);
10507 vty_out (vty
, "%% Invalid route type%s", VTY_NEWLINE
);
10508 return CMD_WARNING
;
10511 red
= bgp_redist_add(bgp
, AFI_IP6
, type
, 0);
10512 bgp_redistribute_rmap_set (red
, argv
[idx_word
]->arg
);
10513 return bgp_redistribute_set (bgp
, AFI_IP6
, type
, 0);
10516 DEFUN (bgp_redistribute_ipv6_metric
,
10517 bgp_redistribute_ipv6_metric_cmd
,
10518 "redistribute " FRR_IP6_REDIST_STR_BGPD
" metric (0-4294967295)",
10519 "Redistribute information from another routing protocol\n"
10520 FRR_IP6_REDIST_HELP_STR_BGPD
10521 "Metric for redistributed routes\n"
10522 "Default metric\n")
10524 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
10525 int idx_protocol
= 1;
10526 int idx_number
= 3;
10529 struct bgp_redist
*red
;
10531 type
= proto_redistnum (AFI_IP6
, argv
[idx_protocol
]->text
);
10534 vty_out (vty
, "%% Invalid route type%s", VTY_NEWLINE
);
10535 return CMD_WARNING
;
10537 VTY_GET_INTEGER ("metric", metric
, argv
[idx_number
]->arg
);
10539 red
= bgp_redist_add(bgp
, AFI_IP6
, type
, 0);
10540 bgp_redistribute_metric_set(bgp
, red
, AFI_IP6
, type
, metric
);
10541 return bgp_redistribute_set (bgp
, AFI_IP6
, type
, 0);
10544 DEFUN (bgp_redistribute_ipv6_rmap_metric
,
10545 bgp_redistribute_ipv6_rmap_metric_cmd
,
10546 "redistribute " FRR_IP6_REDIST_STR_BGPD
" route-map WORD metric (0-4294967295)",
10547 "Redistribute information from another routing protocol\n"
10548 FRR_IP6_REDIST_HELP_STR_BGPD
10549 "Route map reference\n"
10550 "Pointer to route-map entries\n"
10551 "Metric for redistributed routes\n"
10552 "Default metric\n")
10554 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
10555 int idx_protocol
= 1;
10557 int idx_number
= 5;
10560 struct bgp_redist
*red
;
10562 type
= proto_redistnum (AFI_IP6
, argv
[idx_protocol
]->text
);
10565 vty_out (vty
, "%% Invalid route type%s", VTY_NEWLINE
);
10566 return CMD_WARNING
;
10568 VTY_GET_INTEGER ("metric", metric
, argv
[idx_number
]->arg
);
10570 red
= bgp_redist_add(bgp
, AFI_IP6
, type
, 0);
10571 bgp_redistribute_rmap_set (red
, argv
[idx_word
]->arg
);
10572 bgp_redistribute_metric_set(bgp
, red
, AFI_IP6
, type
, metric
);
10573 return bgp_redistribute_set (bgp
, AFI_IP6
, type
, 0);
10576 DEFUN (bgp_redistribute_ipv6_metric_rmap
,
10577 bgp_redistribute_ipv6_metric_rmap_cmd
,
10578 "redistribute " FRR_IP6_REDIST_STR_BGPD
" metric (0-4294967295) route-map WORD",
10579 "Redistribute information from another routing protocol\n"
10580 FRR_IP6_REDIST_HELP_STR_BGPD
10581 "Metric for redistributed routes\n"
10583 "Route map reference\n"
10584 "Pointer to route-map entries\n")
10586 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
10587 int idx_protocol
= 1;
10588 int idx_number
= 3;
10592 struct bgp_redist
*red
;
10594 type
= proto_redistnum (AFI_IP6
, argv
[idx_protocol
]->text
);
10597 vty_out (vty
, "%% Invalid route type%s", VTY_NEWLINE
);
10598 return CMD_WARNING
;
10600 VTY_GET_INTEGER ("metric", metric
, argv
[idx_number
]->arg
);
10602 red
= bgp_redist_add(bgp
, AFI_IP6
, type
, 0);
10603 bgp_redistribute_metric_set(bgp
, red
, AFI_IP6
, SAFI_UNICAST
, metric
);
10604 bgp_redistribute_rmap_set (red
, argv
[idx_word
]->arg
);
10605 return bgp_redistribute_set (bgp
, AFI_IP6
, type
, 0);
10608 DEFUN (no_bgp_redistribute_ipv6
,
10609 no_bgp_redistribute_ipv6_cmd
,
10610 "no redistribute " FRR_IP6_REDIST_STR_BGPD
" [metric (0-4294967295)] [route-map WORD]",
10612 "Redistribute information from another routing protocol\n"
10613 FRR_IP6_REDIST_HELP_STR_BGPD
10614 "Metric for redistributed routes\n"
10616 "Route map reference\n"
10617 "Pointer to route-map entries\n")
10619 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
10620 int idx_protocol
= 2;
10623 type
= proto_redistnum (AFI_IP6
, argv
[idx_protocol
]->text
);
10626 vty_out (vty
, "%% Invalid route type%s", VTY_NEWLINE
);
10627 return CMD_WARNING
;
10630 return bgp_redistribute_unset (bgp
, AFI_IP6
, type
, 0);
10634 bgp_config_write_redistribute (struct vty
*vty
, struct bgp
*bgp
, afi_t afi
,
10635 safi_t safi
, int *write
)
10639 /* Unicast redistribution only. */
10640 if (safi
!= SAFI_UNICAST
)
10643 for (i
= 0; i
< ZEBRA_ROUTE_MAX
; i
++)
10645 /* Redistribute BGP does not make sense. */
10646 if (i
!= ZEBRA_ROUTE_BGP
)
10648 struct list
*red_list
;
10649 struct listnode
*node
;
10650 struct bgp_redist
*red
;
10652 red_list
= bgp
->redist
[afi
][i
];
10656 for (ALL_LIST_ELEMENTS_RO(red_list
, node
, red
))
10658 /* Display "address-family" when it is not yet diplayed. */
10659 bgp_config_write_family_header (vty
, afi
, safi
, write
);
10661 /* "redistribute" configuration. */
10662 vty_out (vty
, " redistribute %s", zebra_route_string(i
));
10664 vty_out (vty
, " %d", red
->instance
);
10665 if (red
->redist_metric_flag
)
10666 vty_out (vty
, " metric %u", red
->redist_metric
);
10667 if (red
->rmap
.name
)
10668 vty_out (vty
, " route-map %s", red
->rmap
.name
);
10669 vty_out (vty
, "%s", VTY_NEWLINE
);
10676 /* BGP node structure. */
10677 static struct cmd_node bgp_node
=
10680 "%s(config-router)# ",
10684 static struct cmd_node bgp_ipv4_unicast_node
=
10687 "%s(config-router-af)# ",
10691 static struct cmd_node bgp_ipv4_multicast_node
=
10694 "%s(config-router-af)# ",
10698 static struct cmd_node bgp_ipv4_labeled_unicast_node
=
10701 "%s(config-router-af)# ",
10705 static struct cmd_node bgp_ipv6_unicast_node
=
10708 "%s(config-router-af)# ",
10712 static struct cmd_node bgp_ipv6_multicast_node
=
10715 "%s(config-router-af)# ",
10719 static struct cmd_node bgp_ipv6_labeled_unicast_node
=
10722 "%s(config-router-af)# ",
10726 static struct cmd_node bgp_vpnv4_node
=
10729 "%s(config-router-af)# ",
10733 static struct cmd_node bgp_vpnv6_node
=
10736 "%s(config-router-af-vpnv6)# ",
10740 static struct cmd_node bgp_evpn_node
=
10743 "%s(config-router-evpn)# ",
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
);
10817 /* Install default VTY commands to new nodes. */
10818 install_default (BGP_NODE
);
10819 install_default (BGP_IPV4_NODE
);
10820 install_default (BGP_IPV4M_NODE
);
10821 install_default (BGP_IPV4L_NODE
);
10822 install_default (BGP_IPV6_NODE
);
10823 install_default (BGP_IPV6M_NODE
);
10824 install_default (BGP_IPV6L_NODE
);
10825 install_default (BGP_VPNV4_NODE
);
10826 install_default (BGP_VPNV6_NODE
);
10827 install_default (BGP_EVPN_NODE
);
10829 /* "bgp multiple-instance" commands. */
10830 install_element (CONFIG_NODE
, &bgp_multiple_instance_cmd
);
10831 install_element (CONFIG_NODE
, &no_bgp_multiple_instance_cmd
);
10833 /* "bgp config-type" commands. */
10834 install_element (CONFIG_NODE
, &bgp_config_type_cmd
);
10835 install_element (CONFIG_NODE
, &no_bgp_config_type_cmd
);
10837 /* bgp route-map delay-timer commands. */
10838 install_element (CONFIG_NODE
, &bgp_set_route_map_delay_timer_cmd
);
10839 install_element (CONFIG_NODE
, &no_bgp_set_route_map_delay_timer_cmd
);
10841 /* Dummy commands (Currently not supported) */
10842 install_element (BGP_NODE
, &no_synchronization_cmd
);
10843 install_element (BGP_NODE
, &no_auto_summary_cmd
);
10845 /* "router bgp" commands. */
10846 install_element (CONFIG_NODE
, &router_bgp_cmd
);
10848 /* "no router bgp" commands. */
10849 install_element (CONFIG_NODE
, &no_router_bgp_cmd
);
10851 /* "bgp router-id" commands. */
10852 install_element (BGP_NODE
, &bgp_router_id_cmd
);
10853 install_element (BGP_NODE
, &no_bgp_router_id_cmd
);
10855 /* "bgp cluster-id" commands. */
10856 install_element (BGP_NODE
, &bgp_cluster_id_cmd
);
10857 install_element (BGP_NODE
, &no_bgp_cluster_id_cmd
);
10859 /* "bgp confederation" commands. */
10860 install_element (BGP_NODE
, &bgp_confederation_identifier_cmd
);
10861 install_element (BGP_NODE
, &no_bgp_confederation_identifier_cmd
);
10863 /* "bgp confederation peers" commands. */
10864 install_element (BGP_NODE
, &bgp_confederation_peers_cmd
);
10865 install_element (BGP_NODE
, &no_bgp_confederation_peers_cmd
);
10867 /* bgp max-med command */
10868 install_element (BGP_NODE
, &bgp_maxmed_admin_cmd
);
10869 install_element (BGP_NODE
, &no_bgp_maxmed_admin_cmd
);
10870 install_element (BGP_NODE
, &bgp_maxmed_admin_medv_cmd
);
10871 install_element (BGP_NODE
, &bgp_maxmed_onstartup_cmd
);
10872 install_element (BGP_NODE
, &no_bgp_maxmed_onstartup_cmd
);
10874 /* bgp disable-ebgp-connected-nh-check */
10875 install_element (BGP_NODE
, &bgp_disable_connected_route_check_cmd
);
10876 install_element (BGP_NODE
, &no_bgp_disable_connected_route_check_cmd
);
10878 /* bgp update-delay command */
10879 install_element (BGP_NODE
, &bgp_update_delay_cmd
);
10880 install_element (BGP_NODE
, &no_bgp_update_delay_cmd
);
10881 install_element (BGP_NODE
, &bgp_update_delay_establish_wait_cmd
);
10883 install_element (BGP_NODE
, &bgp_wpkt_quanta_cmd
);
10884 install_element (BGP_NODE
, &no_bgp_wpkt_quanta_cmd
);
10886 install_element (BGP_NODE
, &bgp_coalesce_time_cmd
);
10887 install_element (BGP_NODE
, &no_bgp_coalesce_time_cmd
);
10889 /* "maximum-paths" commands. */
10890 install_element (BGP_NODE
, &bgp_maxpaths_hidden_cmd
);
10891 install_element (BGP_NODE
, &no_bgp_maxpaths_hidden_cmd
);
10892 install_element (BGP_IPV4_NODE
, &bgp_maxpaths_cmd
);
10893 install_element (BGP_IPV4_NODE
, &no_bgp_maxpaths_cmd
);
10894 install_element (BGP_IPV6_NODE
, &bgp_maxpaths_cmd
);
10895 install_element (BGP_IPV6_NODE
, &no_bgp_maxpaths_cmd
);
10896 install_element (BGP_NODE
, &bgp_maxpaths_ibgp_hidden_cmd
);
10897 install_element (BGP_NODE
, &bgp_maxpaths_ibgp_cluster_hidden_cmd
);
10898 install_element (BGP_NODE
, &no_bgp_maxpaths_ibgp_hidden_cmd
);
10899 install_element (BGP_IPV4_NODE
, &bgp_maxpaths_ibgp_cmd
);
10900 install_element (BGP_IPV4_NODE
, &bgp_maxpaths_ibgp_cluster_cmd
);
10901 install_element (BGP_IPV4_NODE
, &no_bgp_maxpaths_ibgp_cmd
);
10902 install_element (BGP_IPV6_NODE
, &bgp_maxpaths_ibgp_cmd
);
10903 install_element (BGP_IPV6_NODE
, &bgp_maxpaths_ibgp_cluster_cmd
);
10904 install_element (BGP_IPV6_NODE
, &no_bgp_maxpaths_ibgp_cmd
);
10906 install_element (BGP_IPV4L_NODE
, &bgp_maxpaths_cmd
);
10907 install_element (BGP_IPV4L_NODE
, &no_bgp_maxpaths_cmd
);
10908 install_element (BGP_IPV6L_NODE
, &bgp_maxpaths_cmd
);
10909 install_element (BGP_IPV6L_NODE
, &no_bgp_maxpaths_cmd
);
10911 install_element (BGP_IPV4L_NODE
, &bgp_maxpaths_ibgp_cmd
);
10912 install_element (BGP_IPV4L_NODE
, &bgp_maxpaths_ibgp_cluster_cmd
);
10913 install_element (BGP_IPV4L_NODE
, &no_bgp_maxpaths_ibgp_cmd
);
10914 install_element (BGP_IPV6L_NODE
, &bgp_maxpaths_ibgp_cmd
);
10915 install_element (BGP_IPV6L_NODE
, &bgp_maxpaths_ibgp_cluster_cmd
);
10916 install_element (BGP_IPV6L_NODE
, &no_bgp_maxpaths_ibgp_cmd
);
10918 /* "timers bgp" commands. */
10919 install_element (BGP_NODE
, &bgp_timers_cmd
);
10920 install_element (BGP_NODE
, &no_bgp_timers_cmd
);
10922 /* route-map delay-timer commands - per instance for backwards compat. */
10923 install_element (BGP_NODE
, &bgp_set_route_map_delay_timer_cmd
);
10924 install_element (BGP_NODE
, &no_bgp_set_route_map_delay_timer_cmd
);
10926 /* "bgp client-to-client reflection" commands */
10927 install_element (BGP_NODE
, &no_bgp_client_to_client_reflection_cmd
);
10928 install_element (BGP_NODE
, &bgp_client_to_client_reflection_cmd
);
10930 /* "bgp always-compare-med" commands */
10931 install_element (BGP_NODE
, &bgp_always_compare_med_cmd
);
10932 install_element (BGP_NODE
, &no_bgp_always_compare_med_cmd
);
10934 /* "bgp deterministic-med" commands */
10935 install_element (BGP_NODE
, &bgp_deterministic_med_cmd
);
10936 install_element (BGP_NODE
, &no_bgp_deterministic_med_cmd
);
10938 /* "bgp graceful-restart" commands */
10939 install_element (BGP_NODE
, &bgp_graceful_restart_cmd
);
10940 install_element (BGP_NODE
, &no_bgp_graceful_restart_cmd
);
10941 install_element (BGP_NODE
, &bgp_graceful_restart_stalepath_time_cmd
);
10942 install_element (BGP_NODE
, &no_bgp_graceful_restart_stalepath_time_cmd
);
10943 install_element (BGP_NODE
, &bgp_graceful_restart_restart_time_cmd
);
10944 install_element (BGP_NODE
, &no_bgp_graceful_restart_restart_time_cmd
);
10946 install_element (BGP_NODE
, &bgp_graceful_restart_preserve_fw_cmd
);
10947 install_element (BGP_NODE
, &no_bgp_graceful_restart_preserve_fw_cmd
);
10949 /* "bgp fast-external-failover" commands */
10950 install_element (BGP_NODE
, &bgp_fast_external_failover_cmd
);
10951 install_element (BGP_NODE
, &no_bgp_fast_external_failover_cmd
);
10953 /* "bgp enforce-first-as" commands */
10954 install_element (BGP_NODE
, &bgp_enforce_first_as_cmd
);
10955 install_element (BGP_NODE
, &no_bgp_enforce_first_as_cmd
);
10957 /* "bgp bestpath compare-routerid" commands */
10958 install_element (BGP_NODE
, &bgp_bestpath_compare_router_id_cmd
);
10959 install_element (BGP_NODE
, &no_bgp_bestpath_compare_router_id_cmd
);
10961 /* "bgp bestpath as-path ignore" commands */
10962 install_element (BGP_NODE
, &bgp_bestpath_aspath_ignore_cmd
);
10963 install_element (BGP_NODE
, &no_bgp_bestpath_aspath_ignore_cmd
);
10965 /* "bgp bestpath as-path confed" commands */
10966 install_element (BGP_NODE
, &bgp_bestpath_aspath_confed_cmd
);
10967 install_element (BGP_NODE
, &no_bgp_bestpath_aspath_confed_cmd
);
10969 /* "bgp bestpath as-path multipath-relax" commands */
10970 install_element (BGP_NODE
, &bgp_bestpath_aspath_multipath_relax_cmd
);
10971 install_element (BGP_NODE
, &no_bgp_bestpath_aspath_multipath_relax_cmd
);
10973 /* "bgp log-neighbor-changes" commands */
10974 install_element (BGP_NODE
, &bgp_log_neighbor_changes_cmd
);
10975 install_element (BGP_NODE
, &no_bgp_log_neighbor_changes_cmd
);
10977 /* "bgp bestpath med" commands */
10978 install_element (BGP_NODE
, &bgp_bestpath_med_cmd
);
10979 install_element (BGP_NODE
, &no_bgp_bestpath_med_cmd
);
10981 /* "no bgp default ipv4-unicast" commands. */
10982 install_element (BGP_NODE
, &no_bgp_default_ipv4_unicast_cmd
);
10983 install_element (BGP_NODE
, &bgp_default_ipv4_unicast_cmd
);
10985 /* "bgp network import-check" commands. */
10986 install_element (BGP_NODE
, &bgp_network_import_check_cmd
);
10987 install_element (BGP_NODE
, &bgp_network_import_check_exact_cmd
);
10988 install_element (BGP_NODE
, &no_bgp_network_import_check_cmd
);
10990 /* "bgp default local-preference" commands. */
10991 install_element (BGP_NODE
, &bgp_default_local_preference_cmd
);
10992 install_element (BGP_NODE
, &no_bgp_default_local_preference_cmd
);
10994 /* bgp default show-hostname */
10995 install_element (BGP_NODE
, &bgp_default_show_hostname_cmd
);
10996 install_element (BGP_NODE
, &no_bgp_default_show_hostname_cmd
);
10998 /* "bgp default subgroup-pkt-queue-max" commands. */
10999 install_element (BGP_NODE
, &bgp_default_subgroup_pkt_queue_max_cmd
);
11000 install_element (BGP_NODE
, &no_bgp_default_subgroup_pkt_queue_max_cmd
);
11002 /* bgp ibgp-allow-policy-mods command */
11003 install_element (BGP_NODE
, &bgp_rr_allow_outbound_policy_cmd
);
11004 install_element (BGP_NODE
, &no_bgp_rr_allow_outbound_policy_cmd
);
11006 /* "bgp listen limit" commands. */
11007 install_element (BGP_NODE
, &bgp_listen_limit_cmd
);
11008 install_element (BGP_NODE
, &no_bgp_listen_limit_cmd
);
11010 /* "bgp listen range" commands. */
11011 install_element (BGP_NODE
, &bgp_listen_range_cmd
);
11012 install_element (BGP_NODE
, &no_bgp_listen_range_cmd
);
11014 /* "neighbor remote-as" commands. */
11015 install_element (BGP_NODE
, &neighbor_remote_as_cmd
);
11016 install_element (BGP_NODE
, &neighbor_interface_config_cmd
);
11017 install_element (BGP_NODE
, &neighbor_interface_config_v6only_cmd
);
11018 install_element (BGP_NODE
, &neighbor_interface_config_remote_as_cmd
);
11019 install_element (BGP_NODE
, &neighbor_interface_v6only_config_remote_as_cmd
);
11020 install_element (BGP_NODE
, &no_neighbor_cmd
);
11021 install_element (BGP_NODE
, &no_neighbor_interface_config_cmd
);
11023 /* "neighbor peer-group" commands. */
11024 install_element (BGP_NODE
, &neighbor_peer_group_cmd
);
11025 install_element (BGP_NODE
, &no_neighbor_peer_group_cmd
);
11026 install_element (BGP_NODE
, &no_neighbor_interface_peer_group_remote_as_cmd
);
11028 /* "neighbor local-as" commands. */
11029 install_element (BGP_NODE
, &neighbor_local_as_cmd
);
11030 install_element (BGP_NODE
, &neighbor_local_as_no_prepend_cmd
);
11031 install_element (BGP_NODE
, &neighbor_local_as_no_prepend_replace_as_cmd
);
11032 install_element (BGP_NODE
, &no_neighbor_local_as_cmd
);
11034 /* "neighbor solo" commands. */
11035 install_element (BGP_NODE
, &neighbor_solo_cmd
);
11036 install_element (BGP_NODE
, &no_neighbor_solo_cmd
);
11038 /* "neighbor password" commands. */
11039 install_element (BGP_NODE
, &neighbor_password_cmd
);
11040 install_element (BGP_NODE
, &no_neighbor_password_cmd
);
11042 /* "neighbor activate" commands. */
11043 install_element (BGP_NODE
, &neighbor_activate_hidden_cmd
);
11044 install_element (BGP_IPV4_NODE
, &neighbor_activate_cmd
);
11045 install_element (BGP_IPV4M_NODE
, &neighbor_activate_cmd
);
11046 install_element (BGP_IPV4L_NODE
, &neighbor_activate_cmd
);
11047 install_element (BGP_IPV6_NODE
, &neighbor_activate_cmd
);
11048 install_element (BGP_IPV6M_NODE
, &neighbor_activate_cmd
);
11049 install_element (BGP_IPV6L_NODE
, &neighbor_activate_cmd
);
11050 install_element (BGP_VPNV4_NODE
, &neighbor_activate_cmd
);
11051 install_element (BGP_VPNV6_NODE
, &neighbor_activate_cmd
);
11052 install_element (BGP_EVPN_NODE
, &neighbor_activate_cmd
);
11054 /* "no neighbor activate" commands. */
11055 install_element (BGP_NODE
, &no_neighbor_activate_hidden_cmd
);
11056 install_element (BGP_IPV4_NODE
, &no_neighbor_activate_cmd
);
11057 install_element (BGP_IPV4M_NODE
, &no_neighbor_activate_cmd
);
11058 install_element (BGP_IPV4L_NODE
, &no_neighbor_activate_cmd
);
11059 install_element (BGP_IPV6_NODE
, &no_neighbor_activate_cmd
);
11060 install_element (BGP_IPV6M_NODE
, &no_neighbor_activate_cmd
);
11061 install_element (BGP_IPV6L_NODE
, &no_neighbor_activate_cmd
);
11062 install_element (BGP_VPNV4_NODE
, &no_neighbor_activate_cmd
);
11063 install_element (BGP_VPNV6_NODE
, &no_neighbor_activate_cmd
);
11064 install_element (BGP_EVPN_NODE
, &no_neighbor_activate_cmd
);
11066 /* "neighbor peer-group" set commands. */
11067 install_element (BGP_NODE
, &neighbor_set_peer_group_cmd
);
11068 install_element (BGP_IPV4_NODE
, &neighbor_set_peer_group_hidden_cmd
);
11069 install_element (BGP_IPV4M_NODE
, &neighbor_set_peer_group_hidden_cmd
);
11070 install_element (BGP_IPV4L_NODE
, &neighbor_set_peer_group_hidden_cmd
);
11071 install_element (BGP_IPV6_NODE
, &neighbor_set_peer_group_hidden_cmd
);
11072 install_element (BGP_IPV6M_NODE
, &neighbor_set_peer_group_hidden_cmd
);
11073 install_element (BGP_IPV6L_NODE
, &neighbor_set_peer_group_hidden_cmd
);
11074 install_element (BGP_VPNV4_NODE
, &neighbor_set_peer_group_hidden_cmd
);
11075 install_element (BGP_VPNV6_NODE
, &neighbor_set_peer_group_hidden_cmd
);
11077 /* "no neighbor peer-group unset" commands. */
11078 install_element (BGP_NODE
, &no_neighbor_set_peer_group_cmd
);
11079 install_element (BGP_IPV4_NODE
, &no_neighbor_set_peer_group_hidden_cmd
);
11080 install_element (BGP_IPV4M_NODE
, &no_neighbor_set_peer_group_hidden_cmd
);
11081 install_element (BGP_IPV4L_NODE
, &no_neighbor_set_peer_group_hidden_cmd
);
11082 install_element (BGP_IPV6_NODE
, &no_neighbor_set_peer_group_hidden_cmd
);
11083 install_element (BGP_IPV6M_NODE
, &no_neighbor_set_peer_group_hidden_cmd
);
11084 install_element (BGP_IPV6L_NODE
, &no_neighbor_set_peer_group_hidden_cmd
);
11085 install_element (BGP_VPNV4_NODE
, &no_neighbor_set_peer_group_hidden_cmd
);
11086 install_element (BGP_VPNV6_NODE
, &no_neighbor_set_peer_group_hidden_cmd
);
11088 /* "neighbor softreconfiguration inbound" commands.*/
11089 install_element (BGP_NODE
, &neighbor_soft_reconfiguration_hidden_cmd
);
11090 install_element (BGP_NODE
, &no_neighbor_soft_reconfiguration_hidden_cmd
);
11091 install_element (BGP_IPV4_NODE
, &neighbor_soft_reconfiguration_cmd
);
11092 install_element (BGP_IPV4_NODE
, &no_neighbor_soft_reconfiguration_cmd
);
11093 install_element (BGP_IPV4L_NODE
, &neighbor_soft_reconfiguration_cmd
);
11094 install_element (BGP_IPV4L_NODE
, &no_neighbor_soft_reconfiguration_cmd
);
11095 install_element (BGP_IPV4M_NODE
, &neighbor_soft_reconfiguration_cmd
);
11096 install_element (BGP_IPV4M_NODE
, &no_neighbor_soft_reconfiguration_cmd
);
11097 install_element (BGP_IPV6_NODE
, &neighbor_soft_reconfiguration_cmd
);
11098 install_element (BGP_IPV6_NODE
, &no_neighbor_soft_reconfiguration_cmd
);
11099 install_element (BGP_IPV6M_NODE
, &neighbor_soft_reconfiguration_cmd
);
11100 install_element (BGP_IPV6M_NODE
, &no_neighbor_soft_reconfiguration_cmd
);
11101 install_element (BGP_IPV6L_NODE
, &neighbor_soft_reconfiguration_cmd
);
11102 install_element (BGP_IPV6L_NODE
, &no_neighbor_soft_reconfiguration_cmd
);
11103 install_element (BGP_VPNV4_NODE
, &neighbor_soft_reconfiguration_cmd
);
11104 install_element (BGP_VPNV4_NODE
, &no_neighbor_soft_reconfiguration_cmd
);
11105 install_element (BGP_VPNV6_NODE
, &neighbor_soft_reconfiguration_cmd
);
11106 install_element (BGP_VPNV6_NODE
, &no_neighbor_soft_reconfiguration_cmd
);
11108 /* "neighbor attribute-unchanged" commands. */
11109 install_element (BGP_NODE
, &neighbor_attr_unchanged_hidden_cmd
);
11110 install_element (BGP_NODE
, &no_neighbor_attr_unchanged_hidden_cmd
);
11111 install_element (BGP_IPV4_NODE
, &neighbor_attr_unchanged_cmd
);
11112 install_element (BGP_IPV4_NODE
, &no_neighbor_attr_unchanged_cmd
);
11113 install_element (BGP_IPV4M_NODE
, &neighbor_attr_unchanged_cmd
);
11114 install_element (BGP_IPV4M_NODE
, &no_neighbor_attr_unchanged_cmd
);
11115 install_element (BGP_IPV4L_NODE
, &neighbor_attr_unchanged_cmd
);
11116 install_element (BGP_IPV4L_NODE
, &no_neighbor_attr_unchanged_cmd
);
11117 install_element (BGP_IPV6_NODE
, &neighbor_attr_unchanged_cmd
);
11118 install_element (BGP_IPV6_NODE
, &no_neighbor_attr_unchanged_cmd
);
11119 install_element (BGP_IPV6M_NODE
, &neighbor_attr_unchanged_cmd
);
11120 install_element (BGP_IPV6M_NODE
, &no_neighbor_attr_unchanged_cmd
);
11121 install_element (BGP_IPV6L_NODE
, &neighbor_attr_unchanged_cmd
);
11122 install_element (BGP_IPV6L_NODE
, &no_neighbor_attr_unchanged_cmd
);
11123 install_element (BGP_VPNV4_NODE
, &neighbor_attr_unchanged_cmd
);
11124 install_element (BGP_VPNV4_NODE
, &no_neighbor_attr_unchanged_cmd
);
11125 install_element (BGP_VPNV6_NODE
, &neighbor_attr_unchanged_cmd
);
11126 install_element (BGP_VPNV6_NODE
, &no_neighbor_attr_unchanged_cmd
);
11128 install_element (BGP_EVPN_NODE
, &neighbor_attr_unchanged_cmd
);
11129 install_element (BGP_EVPN_NODE
, &no_neighbor_attr_unchanged_cmd
);
11131 /* "nexthop-local unchanged" commands */
11132 install_element (BGP_IPV6_NODE
, &neighbor_nexthop_local_unchanged_cmd
);
11133 install_element (BGP_IPV6_NODE
, &no_neighbor_nexthop_local_unchanged_cmd
);
11135 /* "neighbor next-hop-self" commands. */
11136 install_element (BGP_NODE
, &neighbor_nexthop_self_hidden_cmd
);
11137 install_element (BGP_NODE
, &no_neighbor_nexthop_self_hidden_cmd
);
11138 install_element (BGP_IPV4_NODE
, &neighbor_nexthop_self_cmd
);
11139 install_element (BGP_IPV4_NODE
, &no_neighbor_nexthop_self_cmd
);
11140 install_element (BGP_IPV4M_NODE
, &neighbor_nexthop_self_cmd
);
11141 install_element (BGP_IPV4M_NODE
, &no_neighbor_nexthop_self_cmd
);
11142 install_element (BGP_IPV4L_NODE
, &neighbor_nexthop_self_cmd
);
11143 install_element (BGP_IPV4L_NODE
, &no_neighbor_nexthop_self_cmd
);
11144 install_element (BGP_IPV6_NODE
, &neighbor_nexthop_self_cmd
);
11145 install_element (BGP_IPV6_NODE
, &no_neighbor_nexthop_self_cmd
);
11146 install_element (BGP_IPV6M_NODE
, &neighbor_nexthop_self_cmd
);
11147 install_element (BGP_IPV6M_NODE
, &no_neighbor_nexthop_self_cmd
);
11148 install_element (BGP_IPV6L_NODE
, &neighbor_nexthop_self_cmd
);
11149 install_element (BGP_IPV6L_NODE
, &no_neighbor_nexthop_self_cmd
);
11150 install_element (BGP_VPNV4_NODE
, &neighbor_nexthop_self_cmd
);
11151 install_element (BGP_VPNV4_NODE
, &no_neighbor_nexthop_self_cmd
);
11152 install_element (BGP_VPNV6_NODE
, &neighbor_nexthop_self_cmd
);
11153 install_element (BGP_VPNV6_NODE
, &no_neighbor_nexthop_self_cmd
);
11155 /* "neighbor next-hop-self force" commands. */
11156 install_element (BGP_NODE
, &neighbor_nexthop_self_force_hidden_cmd
);
11157 install_element (BGP_NODE
, &no_neighbor_nexthop_self_force_hidden_cmd
);
11158 install_element (BGP_IPV4_NODE
, &neighbor_nexthop_self_force_cmd
);
11159 install_element (BGP_IPV4_NODE
, &no_neighbor_nexthop_self_force_cmd
);
11160 install_element (BGP_IPV4M_NODE
, &neighbor_nexthop_self_force_cmd
);
11161 install_element (BGP_IPV4M_NODE
, &no_neighbor_nexthop_self_force_cmd
);
11162 install_element (BGP_IPV4L_NODE
, &neighbor_nexthop_self_force_cmd
);
11163 install_element (BGP_IPV4L_NODE
, &no_neighbor_nexthop_self_force_cmd
);
11164 install_element (BGP_IPV6_NODE
, &neighbor_nexthop_self_force_cmd
);
11165 install_element (BGP_IPV6_NODE
, &no_neighbor_nexthop_self_force_cmd
);
11166 install_element (BGP_IPV6M_NODE
, &neighbor_nexthop_self_force_cmd
);
11167 install_element (BGP_IPV6M_NODE
, &no_neighbor_nexthop_self_force_cmd
);
11168 install_element (BGP_IPV6L_NODE
, &neighbor_nexthop_self_force_cmd
);
11169 install_element (BGP_IPV6L_NODE
, &no_neighbor_nexthop_self_force_cmd
);
11170 install_element (BGP_VPNV4_NODE
, &neighbor_nexthop_self_force_cmd
);
11171 install_element (BGP_VPNV4_NODE
, &no_neighbor_nexthop_self_force_cmd
);
11172 install_element (BGP_VPNV6_NODE
, &neighbor_nexthop_self_force_cmd
);
11173 install_element (BGP_VPNV6_NODE
, &no_neighbor_nexthop_self_force_cmd
);
11175 /* "neighbor as-override" commands. */
11176 install_element (BGP_NODE
, &neighbor_as_override_hidden_cmd
);
11177 install_element (BGP_NODE
, &no_neighbor_as_override_hidden_cmd
);
11178 install_element (BGP_IPV4_NODE
, &neighbor_as_override_cmd
);
11179 install_element (BGP_IPV4_NODE
, &no_neighbor_as_override_cmd
);
11180 install_element (BGP_IPV4M_NODE
, &neighbor_as_override_cmd
);
11181 install_element (BGP_IPV4M_NODE
, &no_neighbor_as_override_cmd
);
11182 install_element (BGP_IPV4L_NODE
, &neighbor_as_override_cmd
);
11183 install_element (BGP_IPV4L_NODE
, &no_neighbor_as_override_cmd
);
11184 install_element (BGP_IPV6_NODE
, &neighbor_as_override_cmd
);
11185 install_element (BGP_IPV6_NODE
, &no_neighbor_as_override_cmd
);
11186 install_element (BGP_IPV6M_NODE
, &neighbor_as_override_cmd
);
11187 install_element (BGP_IPV6M_NODE
, &no_neighbor_as_override_cmd
);
11188 install_element (BGP_IPV6L_NODE
, &neighbor_as_override_cmd
);
11189 install_element (BGP_IPV6L_NODE
, &no_neighbor_as_override_cmd
);
11190 install_element (BGP_VPNV4_NODE
, &neighbor_as_override_cmd
);
11191 install_element (BGP_VPNV4_NODE
, &no_neighbor_as_override_cmd
);
11192 install_element (BGP_VPNV6_NODE
, &neighbor_as_override_cmd
);
11193 install_element (BGP_VPNV6_NODE
, &no_neighbor_as_override_cmd
);
11195 /* "neighbor remove-private-AS" commands. */
11196 install_element (BGP_NODE
, &neighbor_remove_private_as_hidden_cmd
);
11197 install_element (BGP_NODE
, &no_neighbor_remove_private_as_hidden_cmd
);
11198 install_element (BGP_NODE
, &neighbor_remove_private_as_all_hidden_cmd
);
11199 install_element (BGP_NODE
, &no_neighbor_remove_private_as_all_hidden_cmd
);
11200 install_element (BGP_NODE
, &neighbor_remove_private_as_replace_as_hidden_cmd
);
11201 install_element (BGP_NODE
, &no_neighbor_remove_private_as_replace_as_hidden_cmd
);
11202 install_element (BGP_NODE
, &neighbor_remove_private_as_all_replace_as_hidden_cmd
);
11203 install_element (BGP_NODE
, &no_neighbor_remove_private_as_all_replace_as_hidden_cmd
);
11204 install_element (BGP_IPV4_NODE
, &neighbor_remove_private_as_cmd
);
11205 install_element (BGP_IPV4_NODE
, &no_neighbor_remove_private_as_cmd
);
11206 install_element (BGP_IPV4_NODE
, &neighbor_remove_private_as_all_cmd
);
11207 install_element (BGP_IPV4_NODE
, &no_neighbor_remove_private_as_all_cmd
);
11208 install_element (BGP_IPV4_NODE
, &neighbor_remove_private_as_replace_as_cmd
);
11209 install_element (BGP_IPV4_NODE
, &no_neighbor_remove_private_as_replace_as_cmd
);
11210 install_element (BGP_IPV4_NODE
, &neighbor_remove_private_as_all_replace_as_cmd
);
11211 install_element (BGP_IPV4_NODE
, &no_neighbor_remove_private_as_all_replace_as_cmd
);
11212 install_element (BGP_IPV4M_NODE
, &neighbor_remove_private_as_cmd
);
11213 install_element (BGP_IPV4M_NODE
, &no_neighbor_remove_private_as_cmd
);
11214 install_element (BGP_IPV4M_NODE
, &neighbor_remove_private_as_all_cmd
);
11215 install_element (BGP_IPV4M_NODE
, &no_neighbor_remove_private_as_all_cmd
);
11216 install_element (BGP_IPV4M_NODE
, &neighbor_remove_private_as_replace_as_cmd
);
11217 install_element (BGP_IPV4M_NODE
, &no_neighbor_remove_private_as_replace_as_cmd
);
11218 install_element (BGP_IPV4M_NODE
, &neighbor_remove_private_as_all_replace_as_cmd
);
11219 install_element (BGP_IPV4M_NODE
, &no_neighbor_remove_private_as_all_replace_as_cmd
);
11220 install_element (BGP_IPV4L_NODE
, &neighbor_remove_private_as_cmd
);
11221 install_element (BGP_IPV4L_NODE
, &no_neighbor_remove_private_as_cmd
);
11222 install_element (BGP_IPV4L_NODE
, &neighbor_remove_private_as_all_cmd
);
11223 install_element (BGP_IPV4L_NODE
, &no_neighbor_remove_private_as_all_cmd
);
11224 install_element (BGP_IPV4L_NODE
, &neighbor_remove_private_as_replace_as_cmd
);
11225 install_element (BGP_IPV4L_NODE
, &no_neighbor_remove_private_as_replace_as_cmd
);
11226 install_element (BGP_IPV4L_NODE
, &neighbor_remove_private_as_all_replace_as_cmd
);
11227 install_element (BGP_IPV4L_NODE
, &no_neighbor_remove_private_as_all_replace_as_cmd
);
11228 install_element (BGP_IPV6_NODE
, &neighbor_remove_private_as_cmd
);
11229 install_element (BGP_IPV6_NODE
, &no_neighbor_remove_private_as_cmd
);
11230 install_element (BGP_IPV6_NODE
, &neighbor_remove_private_as_all_cmd
);
11231 install_element (BGP_IPV6_NODE
, &no_neighbor_remove_private_as_all_cmd
);
11232 install_element (BGP_IPV6_NODE
, &neighbor_remove_private_as_replace_as_cmd
);
11233 install_element (BGP_IPV6_NODE
, &no_neighbor_remove_private_as_replace_as_cmd
);
11234 install_element (BGP_IPV6_NODE
, &neighbor_remove_private_as_all_replace_as_cmd
);
11235 install_element (BGP_IPV6_NODE
, &no_neighbor_remove_private_as_all_replace_as_cmd
);
11236 install_element (BGP_IPV6M_NODE
, &neighbor_remove_private_as_cmd
);
11237 install_element (BGP_IPV6M_NODE
, &no_neighbor_remove_private_as_cmd
);
11238 install_element (BGP_IPV6M_NODE
, &neighbor_remove_private_as_all_cmd
);
11239 install_element (BGP_IPV6M_NODE
, &no_neighbor_remove_private_as_all_cmd
);
11240 install_element (BGP_IPV6M_NODE
, &neighbor_remove_private_as_replace_as_cmd
);
11241 install_element (BGP_IPV6M_NODE
, &no_neighbor_remove_private_as_replace_as_cmd
);
11242 install_element (BGP_IPV6M_NODE
, &neighbor_remove_private_as_all_replace_as_cmd
);
11243 install_element (BGP_IPV6M_NODE
, &no_neighbor_remove_private_as_all_replace_as_cmd
);
11244 install_element (BGP_IPV6L_NODE
, &neighbor_remove_private_as_cmd
);
11245 install_element (BGP_IPV6L_NODE
, &no_neighbor_remove_private_as_cmd
);
11246 install_element (BGP_IPV6L_NODE
, &neighbor_remove_private_as_all_cmd
);
11247 install_element (BGP_IPV6L_NODE
, &no_neighbor_remove_private_as_all_cmd
);
11248 install_element (BGP_IPV6L_NODE
, &neighbor_remove_private_as_replace_as_cmd
);
11249 install_element (BGP_IPV6L_NODE
, &no_neighbor_remove_private_as_replace_as_cmd
);
11250 install_element (BGP_IPV6L_NODE
, &neighbor_remove_private_as_all_replace_as_cmd
);
11251 install_element (BGP_IPV6L_NODE
, &no_neighbor_remove_private_as_all_replace_as_cmd
);
11252 install_element (BGP_VPNV4_NODE
, &neighbor_remove_private_as_cmd
);
11253 install_element (BGP_VPNV4_NODE
, &no_neighbor_remove_private_as_cmd
);
11254 install_element (BGP_VPNV4_NODE
, &neighbor_remove_private_as_all_cmd
);
11255 install_element (BGP_VPNV4_NODE
, &no_neighbor_remove_private_as_all_cmd
);
11256 install_element (BGP_VPNV4_NODE
, &neighbor_remove_private_as_replace_as_cmd
);
11257 install_element (BGP_VPNV4_NODE
, &no_neighbor_remove_private_as_replace_as_cmd
);
11258 install_element (BGP_VPNV4_NODE
, &neighbor_remove_private_as_all_replace_as_cmd
);
11259 install_element (BGP_VPNV4_NODE
, &no_neighbor_remove_private_as_all_replace_as_cmd
);
11260 install_element (BGP_VPNV6_NODE
, &neighbor_remove_private_as_cmd
);
11261 install_element (BGP_VPNV6_NODE
, &no_neighbor_remove_private_as_cmd
);
11262 install_element (BGP_VPNV6_NODE
, &neighbor_remove_private_as_all_cmd
);
11263 install_element (BGP_VPNV6_NODE
, &no_neighbor_remove_private_as_all_cmd
);
11264 install_element (BGP_VPNV6_NODE
, &neighbor_remove_private_as_replace_as_cmd
);
11265 install_element (BGP_VPNV6_NODE
, &no_neighbor_remove_private_as_replace_as_cmd
);
11266 install_element (BGP_VPNV6_NODE
, &neighbor_remove_private_as_all_replace_as_cmd
);
11267 install_element (BGP_VPNV6_NODE
, &no_neighbor_remove_private_as_all_replace_as_cmd
);
11269 /* "neighbor send-community" commands.*/
11270 install_element (BGP_NODE
, &neighbor_send_community_hidden_cmd
);
11271 install_element (BGP_NODE
, &neighbor_send_community_type_hidden_cmd
);
11272 install_element (BGP_NODE
, &no_neighbor_send_community_hidden_cmd
);
11273 install_element (BGP_NODE
, &no_neighbor_send_community_type_hidden_cmd
);
11274 install_element (BGP_IPV4_NODE
, &neighbor_send_community_cmd
);
11275 install_element (BGP_IPV4_NODE
, &neighbor_send_community_type_cmd
);
11276 install_element (BGP_IPV4_NODE
, &no_neighbor_send_community_cmd
);
11277 install_element (BGP_IPV4_NODE
, &no_neighbor_send_community_type_cmd
);
11278 install_element (BGP_IPV4M_NODE
, &neighbor_send_community_cmd
);
11279 install_element (BGP_IPV4M_NODE
, &neighbor_send_community_type_cmd
);
11280 install_element (BGP_IPV4M_NODE
, &no_neighbor_send_community_cmd
);
11281 install_element (BGP_IPV4M_NODE
, &no_neighbor_send_community_type_cmd
);
11282 install_element (BGP_IPV4L_NODE
, &neighbor_send_community_cmd
);
11283 install_element (BGP_IPV4L_NODE
, &neighbor_send_community_type_cmd
);
11284 install_element (BGP_IPV4L_NODE
, &no_neighbor_send_community_cmd
);
11285 install_element (BGP_IPV4L_NODE
, &no_neighbor_send_community_type_cmd
);
11286 install_element (BGP_IPV6_NODE
, &neighbor_send_community_cmd
);
11287 install_element (BGP_IPV6_NODE
, &neighbor_send_community_type_cmd
);
11288 install_element (BGP_IPV6_NODE
, &no_neighbor_send_community_cmd
);
11289 install_element (BGP_IPV6_NODE
, &no_neighbor_send_community_type_cmd
);
11290 install_element (BGP_IPV6M_NODE
, &neighbor_send_community_cmd
);
11291 install_element (BGP_IPV6M_NODE
, &neighbor_send_community_type_cmd
);
11292 install_element (BGP_IPV6M_NODE
, &no_neighbor_send_community_cmd
);
11293 install_element (BGP_IPV6M_NODE
, &no_neighbor_send_community_type_cmd
);
11294 install_element (BGP_IPV6L_NODE
, &neighbor_send_community_cmd
);
11295 install_element (BGP_IPV6L_NODE
, &neighbor_send_community_type_cmd
);
11296 install_element (BGP_IPV6L_NODE
, &no_neighbor_send_community_cmd
);
11297 install_element (BGP_IPV6L_NODE
, &no_neighbor_send_community_type_cmd
);
11298 install_element (BGP_VPNV4_NODE
, &neighbor_send_community_cmd
);
11299 install_element (BGP_VPNV4_NODE
, &neighbor_send_community_type_cmd
);
11300 install_element (BGP_VPNV4_NODE
, &no_neighbor_send_community_cmd
);
11301 install_element (BGP_VPNV4_NODE
, &no_neighbor_send_community_type_cmd
);
11302 install_element (BGP_VPNV6_NODE
, &neighbor_send_community_cmd
);
11303 install_element (BGP_VPNV6_NODE
, &neighbor_send_community_type_cmd
);
11304 install_element (BGP_VPNV6_NODE
, &no_neighbor_send_community_cmd
);
11305 install_element (BGP_VPNV6_NODE
, &no_neighbor_send_community_type_cmd
);
11307 /* "neighbor route-reflector" commands.*/
11308 install_element (BGP_NODE
, &neighbor_route_reflector_client_hidden_cmd
);
11309 install_element (BGP_NODE
, &no_neighbor_route_reflector_client_hidden_cmd
);
11310 install_element (BGP_IPV4_NODE
, &neighbor_route_reflector_client_cmd
);
11311 install_element (BGP_IPV4_NODE
, &no_neighbor_route_reflector_client_cmd
);
11312 install_element (BGP_IPV4M_NODE
, &neighbor_route_reflector_client_cmd
);
11313 install_element (BGP_IPV4M_NODE
, &no_neighbor_route_reflector_client_cmd
);
11314 install_element (BGP_IPV4L_NODE
, &neighbor_route_reflector_client_cmd
);
11315 install_element (BGP_IPV4L_NODE
, &no_neighbor_route_reflector_client_cmd
);
11316 install_element (BGP_IPV6_NODE
, &neighbor_route_reflector_client_cmd
);
11317 install_element (BGP_IPV6_NODE
, &no_neighbor_route_reflector_client_cmd
);
11318 install_element (BGP_IPV6M_NODE
, &neighbor_route_reflector_client_cmd
);
11319 install_element (BGP_IPV6M_NODE
, &no_neighbor_route_reflector_client_cmd
);
11320 install_element (BGP_IPV6L_NODE
, &neighbor_route_reflector_client_cmd
);
11321 install_element (BGP_IPV6L_NODE
, &no_neighbor_route_reflector_client_cmd
);
11322 install_element (BGP_VPNV4_NODE
, &neighbor_route_reflector_client_cmd
);
11323 install_element (BGP_VPNV4_NODE
, &no_neighbor_route_reflector_client_cmd
);
11324 install_element (BGP_VPNV6_NODE
, &neighbor_route_reflector_client_cmd
);
11325 install_element (BGP_VPNV6_NODE
, &no_neighbor_route_reflector_client_cmd
);
11327 /* "neighbor route-server" commands.*/
11328 install_element (BGP_NODE
, &neighbor_route_server_client_hidden_cmd
);
11329 install_element (BGP_NODE
, &no_neighbor_route_server_client_hidden_cmd
);
11330 install_element (BGP_IPV4_NODE
, &neighbor_route_server_client_cmd
);
11331 install_element (BGP_IPV4_NODE
, &no_neighbor_route_server_client_cmd
);
11332 install_element (BGP_IPV4M_NODE
, &neighbor_route_server_client_cmd
);
11333 install_element (BGP_IPV4M_NODE
, &no_neighbor_route_server_client_cmd
);
11334 install_element (BGP_IPV4L_NODE
, &neighbor_route_server_client_cmd
);
11335 install_element (BGP_IPV4L_NODE
, &no_neighbor_route_server_client_cmd
);
11336 install_element (BGP_IPV6_NODE
, &neighbor_route_server_client_cmd
);
11337 install_element (BGP_IPV6_NODE
, &no_neighbor_route_server_client_cmd
);
11338 install_element (BGP_IPV6M_NODE
, &neighbor_route_server_client_cmd
);
11339 install_element (BGP_IPV6M_NODE
, &no_neighbor_route_server_client_cmd
);
11340 install_element (BGP_IPV6L_NODE
, &neighbor_route_server_client_cmd
);
11341 install_element (BGP_IPV6L_NODE
, &no_neighbor_route_server_client_cmd
);
11342 install_element (BGP_VPNV4_NODE
, &neighbor_route_server_client_cmd
);
11343 install_element (BGP_VPNV4_NODE
, &no_neighbor_route_server_client_cmd
);
11344 install_element (BGP_VPNV6_NODE
, &neighbor_route_server_client_cmd
);
11345 install_element (BGP_VPNV6_NODE
, &no_neighbor_route_server_client_cmd
);
11347 /* "neighbor addpath-tx-all-paths" commands.*/
11348 install_element (BGP_NODE
, &neighbor_addpath_tx_all_paths_hidden_cmd
);
11349 install_element (BGP_NODE
, &no_neighbor_addpath_tx_all_paths_hidden_cmd
);
11350 install_element (BGP_IPV4_NODE
, &neighbor_addpath_tx_all_paths_cmd
);
11351 install_element (BGP_IPV4_NODE
, &no_neighbor_addpath_tx_all_paths_cmd
);
11352 install_element (BGP_IPV4M_NODE
, &neighbor_addpath_tx_all_paths_cmd
);
11353 install_element (BGP_IPV4M_NODE
, &no_neighbor_addpath_tx_all_paths_cmd
);
11354 install_element (BGP_IPV4L_NODE
, &neighbor_addpath_tx_all_paths_cmd
);
11355 install_element (BGP_IPV4L_NODE
, &no_neighbor_addpath_tx_all_paths_cmd
);
11356 install_element (BGP_IPV6_NODE
, &neighbor_addpath_tx_all_paths_cmd
);
11357 install_element (BGP_IPV6_NODE
, &no_neighbor_addpath_tx_all_paths_cmd
);
11358 install_element (BGP_IPV6M_NODE
, &neighbor_addpath_tx_all_paths_cmd
);
11359 install_element (BGP_IPV6M_NODE
, &no_neighbor_addpath_tx_all_paths_cmd
);
11360 install_element (BGP_IPV6L_NODE
, &neighbor_addpath_tx_all_paths_cmd
);
11361 install_element (BGP_IPV6L_NODE
, &no_neighbor_addpath_tx_all_paths_cmd
);
11362 install_element (BGP_VPNV4_NODE
, &neighbor_addpath_tx_all_paths_cmd
);
11363 install_element (BGP_VPNV4_NODE
, &no_neighbor_addpath_tx_all_paths_cmd
);
11364 install_element (BGP_VPNV6_NODE
, &neighbor_addpath_tx_all_paths_cmd
);
11365 install_element (BGP_VPNV6_NODE
, &no_neighbor_addpath_tx_all_paths_cmd
);
11367 /* "neighbor addpath-tx-bestpath-per-AS" commands.*/
11368 install_element (BGP_NODE
, &neighbor_addpath_tx_bestpath_per_as_hidden_cmd
);
11369 install_element (BGP_NODE
, &no_neighbor_addpath_tx_bestpath_per_as_hidden_cmd
);
11370 install_element (BGP_IPV4_NODE
, &neighbor_addpath_tx_bestpath_per_as_cmd
);
11371 install_element (BGP_IPV4_NODE
, &no_neighbor_addpath_tx_bestpath_per_as_cmd
);
11372 install_element (BGP_IPV4M_NODE
, &neighbor_addpath_tx_bestpath_per_as_cmd
);
11373 install_element (BGP_IPV4M_NODE
, &no_neighbor_addpath_tx_bestpath_per_as_cmd
);
11374 install_element (BGP_IPV4L_NODE
, &neighbor_addpath_tx_bestpath_per_as_cmd
);
11375 install_element (BGP_IPV4L_NODE
, &no_neighbor_addpath_tx_bestpath_per_as_cmd
);
11376 install_element (BGP_IPV6_NODE
, &neighbor_addpath_tx_bestpath_per_as_cmd
);
11377 install_element (BGP_IPV6_NODE
, &no_neighbor_addpath_tx_bestpath_per_as_cmd
);
11378 install_element (BGP_IPV6M_NODE
, &neighbor_addpath_tx_bestpath_per_as_cmd
);
11379 install_element (BGP_IPV6M_NODE
, &no_neighbor_addpath_tx_bestpath_per_as_cmd
);
11380 install_element (BGP_IPV6L_NODE
, &neighbor_addpath_tx_bestpath_per_as_cmd
);
11381 install_element (BGP_IPV6L_NODE
, &no_neighbor_addpath_tx_bestpath_per_as_cmd
);
11382 install_element (BGP_VPNV4_NODE
, &neighbor_addpath_tx_bestpath_per_as_cmd
);
11383 install_element (BGP_VPNV4_NODE
, &no_neighbor_addpath_tx_bestpath_per_as_cmd
);
11384 install_element (BGP_VPNV6_NODE
, &neighbor_addpath_tx_bestpath_per_as_cmd
);
11385 install_element (BGP_VPNV6_NODE
, &no_neighbor_addpath_tx_bestpath_per_as_cmd
);
11387 /* "neighbor passive" commands. */
11388 install_element (BGP_NODE
, &neighbor_passive_cmd
);
11389 install_element (BGP_NODE
, &no_neighbor_passive_cmd
);
11392 /* "neighbor shutdown" commands. */
11393 install_element (BGP_NODE
, &neighbor_shutdown_cmd
);
11394 install_element (BGP_NODE
, &no_neighbor_shutdown_cmd
);
11395 install_element (BGP_NODE
, &neighbor_shutdown_msg_cmd
);
11396 install_element (BGP_NODE
, &no_neighbor_shutdown_msg_cmd
);
11398 /* "neighbor capability extended-nexthop" commands.*/
11399 install_element (BGP_NODE
, &neighbor_capability_enhe_cmd
);
11400 install_element (BGP_NODE
, &no_neighbor_capability_enhe_cmd
);
11402 /* "neighbor capability orf prefix-list" commands.*/
11403 install_element (BGP_NODE
, &neighbor_capability_orf_prefix_hidden_cmd
);
11404 install_element (BGP_NODE
, &no_neighbor_capability_orf_prefix_hidden_cmd
);
11405 install_element (BGP_IPV4_NODE
, &neighbor_capability_orf_prefix_cmd
);
11406 install_element (BGP_IPV4_NODE
, &no_neighbor_capability_orf_prefix_cmd
);
11407 install_element (BGP_IPV4M_NODE
, &neighbor_capability_orf_prefix_cmd
);
11408 install_element (BGP_IPV4M_NODE
, &no_neighbor_capability_orf_prefix_cmd
);
11409 install_element (BGP_IPV4L_NODE
, &neighbor_capability_orf_prefix_cmd
);
11410 install_element (BGP_IPV4L_NODE
, &no_neighbor_capability_orf_prefix_cmd
);
11411 install_element (BGP_IPV6_NODE
, &neighbor_capability_orf_prefix_cmd
);
11412 install_element (BGP_IPV6_NODE
, &no_neighbor_capability_orf_prefix_cmd
);
11413 install_element (BGP_IPV6M_NODE
, &neighbor_capability_orf_prefix_cmd
);
11414 install_element (BGP_IPV6M_NODE
, &no_neighbor_capability_orf_prefix_cmd
);
11415 install_element (BGP_IPV6L_NODE
, &neighbor_capability_orf_prefix_cmd
);
11416 install_element (BGP_IPV6L_NODE
, &no_neighbor_capability_orf_prefix_cmd
);
11418 /* "neighbor capability dynamic" commands.*/
11419 install_element (BGP_NODE
, &neighbor_capability_dynamic_cmd
);
11420 install_element (BGP_NODE
, &no_neighbor_capability_dynamic_cmd
);
11422 /* "neighbor dont-capability-negotiate" commands. */
11423 install_element (BGP_NODE
, &neighbor_dont_capability_negotiate_cmd
);
11424 install_element (BGP_NODE
, &no_neighbor_dont_capability_negotiate_cmd
);
11426 /* "neighbor ebgp-multihop" commands. */
11427 install_element (BGP_NODE
, &neighbor_ebgp_multihop_cmd
);
11428 install_element (BGP_NODE
, &neighbor_ebgp_multihop_ttl_cmd
);
11429 install_element (BGP_NODE
, &no_neighbor_ebgp_multihop_cmd
);
11431 /* "neighbor disable-connected-check" commands. */
11432 install_element (BGP_NODE
, &neighbor_disable_connected_check_cmd
);
11433 install_element (BGP_NODE
, &no_neighbor_disable_connected_check_cmd
);
11435 /* "neighbor description" commands. */
11436 install_element (BGP_NODE
, &neighbor_description_cmd
);
11437 install_element (BGP_NODE
, &no_neighbor_description_cmd
);
11439 /* "neighbor update-source" commands. "*/
11440 install_element (BGP_NODE
, &neighbor_update_source_cmd
);
11441 install_element (BGP_NODE
, &no_neighbor_update_source_cmd
);
11443 /* "neighbor default-originate" commands. */
11444 install_element (BGP_NODE
, &neighbor_default_originate_hidden_cmd
);
11445 install_element (BGP_NODE
, &neighbor_default_originate_rmap_hidden_cmd
);
11446 install_element (BGP_NODE
, &no_neighbor_default_originate_hidden_cmd
);
11447 install_element (BGP_IPV4_NODE
, &neighbor_default_originate_cmd
);
11448 install_element (BGP_IPV4_NODE
, &neighbor_default_originate_rmap_cmd
);
11449 install_element (BGP_IPV4_NODE
, &no_neighbor_default_originate_cmd
);
11450 install_element (BGP_IPV4M_NODE
, &neighbor_default_originate_cmd
);
11451 install_element (BGP_IPV4M_NODE
, &neighbor_default_originate_rmap_cmd
);
11452 install_element (BGP_IPV4M_NODE
, &no_neighbor_default_originate_cmd
);
11453 install_element (BGP_IPV4L_NODE
, &neighbor_default_originate_cmd
);
11454 install_element (BGP_IPV4L_NODE
, &neighbor_default_originate_rmap_cmd
);
11455 install_element (BGP_IPV4L_NODE
, &no_neighbor_default_originate_cmd
);
11456 install_element (BGP_IPV6_NODE
, &neighbor_default_originate_cmd
);
11457 install_element (BGP_IPV6_NODE
, &neighbor_default_originate_rmap_cmd
);
11458 install_element (BGP_IPV6_NODE
, &no_neighbor_default_originate_cmd
);
11459 install_element (BGP_IPV6M_NODE
, &neighbor_default_originate_cmd
);
11460 install_element (BGP_IPV6M_NODE
, &neighbor_default_originate_rmap_cmd
);
11461 install_element (BGP_IPV6M_NODE
, &no_neighbor_default_originate_cmd
);
11462 install_element (BGP_IPV6L_NODE
, &neighbor_default_originate_cmd
);
11463 install_element (BGP_IPV6L_NODE
, &neighbor_default_originate_rmap_cmd
);
11464 install_element (BGP_IPV6L_NODE
, &no_neighbor_default_originate_cmd
);
11466 /* "neighbor port" commands. */
11467 install_element (BGP_NODE
, &neighbor_port_cmd
);
11468 install_element (BGP_NODE
, &no_neighbor_port_cmd
);
11470 /* "neighbor weight" commands. */
11471 install_element (BGP_NODE
, &neighbor_weight_hidden_cmd
);
11472 install_element (BGP_NODE
, &no_neighbor_weight_hidden_cmd
);
11474 install_element (BGP_IPV4_NODE
, &neighbor_weight_cmd
);
11475 install_element (BGP_IPV4_NODE
, &no_neighbor_weight_cmd
);
11476 install_element (BGP_IPV4M_NODE
, &neighbor_weight_cmd
);
11477 install_element (BGP_IPV4M_NODE
, &no_neighbor_weight_cmd
);
11478 install_element (BGP_IPV4L_NODE
, &neighbor_weight_cmd
);
11479 install_element (BGP_IPV4L_NODE
, &no_neighbor_weight_cmd
);
11480 install_element (BGP_IPV6_NODE
, &neighbor_weight_cmd
);
11481 install_element (BGP_IPV6_NODE
, &no_neighbor_weight_cmd
);
11482 install_element (BGP_IPV6M_NODE
, &neighbor_weight_cmd
);
11483 install_element (BGP_IPV6M_NODE
, &no_neighbor_weight_cmd
);
11484 install_element (BGP_IPV6L_NODE
, &neighbor_weight_cmd
);
11485 install_element (BGP_IPV6L_NODE
, &no_neighbor_weight_cmd
);
11486 install_element (BGP_VPNV4_NODE
, &neighbor_weight_cmd
);
11487 install_element (BGP_VPNV4_NODE
, &no_neighbor_weight_cmd
);
11488 install_element (BGP_VPNV6_NODE
, &neighbor_weight_cmd
);
11489 install_element (BGP_VPNV6_NODE
, &no_neighbor_weight_cmd
);
11491 /* "neighbor override-capability" commands. */
11492 install_element (BGP_NODE
, &neighbor_override_capability_cmd
);
11493 install_element (BGP_NODE
, &no_neighbor_override_capability_cmd
);
11495 /* "neighbor strict-capability-match" commands. */
11496 install_element (BGP_NODE
, &neighbor_strict_capability_cmd
);
11497 install_element (BGP_NODE
, &no_neighbor_strict_capability_cmd
);
11499 /* "neighbor timers" commands. */
11500 install_element (BGP_NODE
, &neighbor_timers_cmd
);
11501 install_element (BGP_NODE
, &no_neighbor_timers_cmd
);
11503 /* "neighbor timers connect" commands. */
11504 install_element (BGP_NODE
, &neighbor_timers_connect_cmd
);
11505 install_element (BGP_NODE
, &no_neighbor_timers_connect_cmd
);
11507 /* "neighbor advertisement-interval" commands. */
11508 install_element (BGP_NODE
, &neighbor_advertise_interval_cmd
);
11509 install_element (BGP_NODE
, &no_neighbor_advertise_interval_cmd
);
11511 /* "neighbor interface" commands. */
11512 install_element (BGP_NODE
, &neighbor_interface_cmd
);
11513 install_element (BGP_NODE
, &no_neighbor_interface_cmd
);
11515 /* "neighbor distribute" commands. */
11516 install_element (BGP_NODE
, &neighbor_distribute_list_hidden_cmd
);
11517 install_element (BGP_NODE
, &no_neighbor_distribute_list_hidden_cmd
);
11518 install_element (BGP_IPV4_NODE
, &neighbor_distribute_list_cmd
);
11519 install_element (BGP_IPV4_NODE
, &no_neighbor_distribute_list_cmd
);
11520 install_element (BGP_IPV4M_NODE
, &neighbor_distribute_list_cmd
);
11521 install_element (BGP_IPV4M_NODE
, &no_neighbor_distribute_list_cmd
);
11522 install_element (BGP_IPV4L_NODE
, &neighbor_distribute_list_cmd
);
11523 install_element (BGP_IPV4L_NODE
, &no_neighbor_distribute_list_cmd
);
11524 install_element (BGP_IPV6_NODE
, &neighbor_distribute_list_cmd
);
11525 install_element (BGP_IPV6_NODE
, &no_neighbor_distribute_list_cmd
);
11526 install_element (BGP_IPV6M_NODE
, &neighbor_distribute_list_cmd
);
11527 install_element (BGP_IPV6M_NODE
, &no_neighbor_distribute_list_cmd
);
11528 install_element (BGP_IPV6L_NODE
, &neighbor_distribute_list_cmd
);
11529 install_element (BGP_IPV6L_NODE
, &no_neighbor_distribute_list_cmd
);
11530 install_element (BGP_VPNV4_NODE
, &neighbor_distribute_list_cmd
);
11531 install_element (BGP_VPNV4_NODE
, &no_neighbor_distribute_list_cmd
);
11532 install_element (BGP_VPNV6_NODE
, &neighbor_distribute_list_cmd
);
11533 install_element (BGP_VPNV6_NODE
, &no_neighbor_distribute_list_cmd
);
11535 /* "neighbor prefix-list" commands. */
11536 install_element (BGP_NODE
, &neighbor_prefix_list_hidden_cmd
);
11537 install_element (BGP_NODE
, &no_neighbor_prefix_list_hidden_cmd
);
11538 install_element (BGP_IPV4_NODE
, &neighbor_prefix_list_cmd
);
11539 install_element (BGP_IPV4_NODE
, &no_neighbor_prefix_list_cmd
);
11540 install_element (BGP_IPV4M_NODE
, &neighbor_prefix_list_cmd
);
11541 install_element (BGP_IPV4M_NODE
, &no_neighbor_prefix_list_cmd
);
11542 install_element (BGP_IPV4L_NODE
, &neighbor_prefix_list_cmd
);
11543 install_element (BGP_IPV4L_NODE
, &no_neighbor_prefix_list_cmd
);
11544 install_element (BGP_IPV6_NODE
, &neighbor_prefix_list_cmd
);
11545 install_element (BGP_IPV6_NODE
, &no_neighbor_prefix_list_cmd
);
11546 install_element (BGP_IPV6M_NODE
, &neighbor_prefix_list_cmd
);
11547 install_element (BGP_IPV6M_NODE
, &no_neighbor_prefix_list_cmd
);
11548 install_element (BGP_IPV6L_NODE
, &neighbor_prefix_list_cmd
);
11549 install_element (BGP_IPV6L_NODE
, &no_neighbor_prefix_list_cmd
);
11550 install_element (BGP_VPNV4_NODE
, &neighbor_prefix_list_cmd
);
11551 install_element (BGP_VPNV4_NODE
, &no_neighbor_prefix_list_cmd
);
11552 install_element (BGP_VPNV6_NODE
, &neighbor_prefix_list_cmd
);
11553 install_element (BGP_VPNV6_NODE
, &no_neighbor_prefix_list_cmd
);
11555 /* "neighbor filter-list" commands. */
11556 install_element (BGP_NODE
, &neighbor_filter_list_hidden_cmd
);
11557 install_element (BGP_NODE
, &no_neighbor_filter_list_hidden_cmd
);
11558 install_element (BGP_IPV4_NODE
, &neighbor_filter_list_cmd
);
11559 install_element (BGP_IPV4_NODE
, &no_neighbor_filter_list_cmd
);
11560 install_element (BGP_IPV4M_NODE
, &neighbor_filter_list_cmd
);
11561 install_element (BGP_IPV4M_NODE
, &no_neighbor_filter_list_cmd
);
11562 install_element (BGP_IPV4L_NODE
, &neighbor_filter_list_cmd
);
11563 install_element (BGP_IPV4L_NODE
, &no_neighbor_filter_list_cmd
);
11564 install_element (BGP_IPV6_NODE
, &neighbor_filter_list_cmd
);
11565 install_element (BGP_IPV6_NODE
, &no_neighbor_filter_list_cmd
);
11566 install_element (BGP_IPV6M_NODE
, &neighbor_filter_list_cmd
);
11567 install_element (BGP_IPV6M_NODE
, &no_neighbor_filter_list_cmd
);
11568 install_element (BGP_IPV6L_NODE
, &neighbor_filter_list_cmd
);
11569 install_element (BGP_IPV6L_NODE
, &no_neighbor_filter_list_cmd
);
11570 install_element (BGP_VPNV4_NODE
, &neighbor_filter_list_cmd
);
11571 install_element (BGP_VPNV4_NODE
, &no_neighbor_filter_list_cmd
);
11572 install_element (BGP_VPNV6_NODE
, &neighbor_filter_list_cmd
);
11573 install_element (BGP_VPNV6_NODE
, &no_neighbor_filter_list_cmd
);
11575 /* "neighbor route-map" commands. */
11576 install_element (BGP_NODE
, &neighbor_route_map_hidden_cmd
);
11577 install_element (BGP_NODE
, &no_neighbor_route_map_hidden_cmd
);
11578 install_element (BGP_IPV4_NODE
, &neighbor_route_map_cmd
);
11579 install_element (BGP_IPV4_NODE
, &no_neighbor_route_map_cmd
);
11580 install_element (BGP_IPV4M_NODE
, &neighbor_route_map_cmd
);
11581 install_element (BGP_IPV4M_NODE
, &no_neighbor_route_map_cmd
);
11582 install_element (BGP_IPV4L_NODE
, &neighbor_route_map_cmd
);
11583 install_element (BGP_IPV4L_NODE
, &no_neighbor_route_map_cmd
);
11584 install_element (BGP_IPV6_NODE
, &neighbor_route_map_cmd
);
11585 install_element (BGP_IPV6_NODE
, &no_neighbor_route_map_cmd
);
11586 install_element (BGP_IPV6M_NODE
, &neighbor_route_map_cmd
);
11587 install_element (BGP_IPV6M_NODE
, &no_neighbor_route_map_cmd
);
11588 install_element (BGP_IPV6L_NODE
, &neighbor_route_map_cmd
);
11589 install_element (BGP_IPV6L_NODE
, &no_neighbor_route_map_cmd
);
11590 install_element (BGP_VPNV4_NODE
, &neighbor_route_map_cmd
);
11591 install_element (BGP_VPNV4_NODE
, &no_neighbor_route_map_cmd
);
11592 install_element (BGP_VPNV6_NODE
, &neighbor_route_map_cmd
);
11593 install_element (BGP_VPNV6_NODE
, &no_neighbor_route_map_cmd
);
11595 /* "neighbor unsuppress-map" commands. */
11596 install_element (BGP_NODE
, &neighbor_unsuppress_map_hidden_cmd
);
11597 install_element (BGP_NODE
, &no_neighbor_unsuppress_map_hidden_cmd
);
11598 install_element (BGP_IPV4_NODE
, &neighbor_unsuppress_map_cmd
);
11599 install_element (BGP_IPV4_NODE
, &no_neighbor_unsuppress_map_cmd
);
11600 install_element (BGP_IPV4M_NODE
, &neighbor_unsuppress_map_cmd
);
11601 install_element (BGP_IPV4M_NODE
, &no_neighbor_unsuppress_map_cmd
);
11602 install_element (BGP_IPV4L_NODE
, &neighbor_unsuppress_map_cmd
);
11603 install_element (BGP_IPV4L_NODE
, &no_neighbor_unsuppress_map_cmd
);
11604 install_element (BGP_IPV6_NODE
, &neighbor_unsuppress_map_cmd
);
11605 install_element (BGP_IPV6_NODE
, &no_neighbor_unsuppress_map_cmd
);
11606 install_element (BGP_IPV6M_NODE
, &neighbor_unsuppress_map_cmd
);
11607 install_element (BGP_IPV6M_NODE
, &no_neighbor_unsuppress_map_cmd
);
11608 install_element (BGP_IPV6L_NODE
, &neighbor_unsuppress_map_cmd
);
11609 install_element (BGP_IPV6L_NODE
, &no_neighbor_unsuppress_map_cmd
);
11610 install_element (BGP_VPNV4_NODE
, &neighbor_unsuppress_map_cmd
);
11611 install_element (BGP_VPNV4_NODE
, &no_neighbor_unsuppress_map_cmd
);
11612 install_element (BGP_VPNV6_NODE
, &neighbor_unsuppress_map_cmd
);
11613 install_element (BGP_VPNV6_NODE
, &no_neighbor_unsuppress_map_cmd
);
11615 /* "neighbor maximum-prefix" commands. */
11616 install_element (BGP_NODE
, &neighbor_maximum_prefix_hidden_cmd
);
11617 install_element (BGP_NODE
, &neighbor_maximum_prefix_threshold_hidden_cmd
);
11618 install_element (BGP_NODE
, &neighbor_maximum_prefix_warning_hidden_cmd
);
11619 install_element (BGP_NODE
, &neighbor_maximum_prefix_threshold_warning_hidden_cmd
);
11620 install_element (BGP_NODE
, &neighbor_maximum_prefix_restart_hidden_cmd
);
11621 install_element (BGP_NODE
, &neighbor_maximum_prefix_threshold_restart_hidden_cmd
);
11622 install_element (BGP_NODE
, &no_neighbor_maximum_prefix_hidden_cmd
);
11623 install_element (BGP_IPV4_NODE
, &neighbor_maximum_prefix_cmd
);
11624 install_element (BGP_IPV4_NODE
, &neighbor_maximum_prefix_threshold_cmd
);
11625 install_element (BGP_IPV4_NODE
, &neighbor_maximum_prefix_warning_cmd
);
11626 install_element (BGP_IPV4_NODE
, &neighbor_maximum_prefix_threshold_warning_cmd
);
11627 install_element (BGP_IPV4_NODE
, &neighbor_maximum_prefix_restart_cmd
);
11628 install_element (BGP_IPV4_NODE
, &neighbor_maximum_prefix_threshold_restart_cmd
);
11629 install_element (BGP_IPV4_NODE
, &no_neighbor_maximum_prefix_cmd
);
11630 install_element (BGP_IPV4M_NODE
, &neighbor_maximum_prefix_cmd
);
11631 install_element (BGP_IPV4M_NODE
, &neighbor_maximum_prefix_threshold_cmd
);
11632 install_element (BGP_IPV4M_NODE
, &neighbor_maximum_prefix_warning_cmd
);
11633 install_element (BGP_IPV4M_NODE
, &neighbor_maximum_prefix_threshold_warning_cmd
);
11634 install_element (BGP_IPV4M_NODE
, &neighbor_maximum_prefix_restart_cmd
);
11635 install_element (BGP_IPV4M_NODE
, &neighbor_maximum_prefix_threshold_restart_cmd
);
11636 install_element (BGP_IPV4M_NODE
, &no_neighbor_maximum_prefix_cmd
);
11637 install_element (BGP_IPV4L_NODE
, &neighbor_maximum_prefix_cmd
);
11638 install_element (BGP_IPV4L_NODE
, &neighbor_maximum_prefix_threshold_cmd
);
11639 install_element (BGP_IPV4L_NODE
, &neighbor_maximum_prefix_warning_cmd
);
11640 install_element (BGP_IPV4L_NODE
, &neighbor_maximum_prefix_threshold_warning_cmd
);
11641 install_element (BGP_IPV4L_NODE
, &neighbor_maximum_prefix_restart_cmd
);
11642 install_element (BGP_IPV4L_NODE
, &neighbor_maximum_prefix_threshold_restart_cmd
);
11643 install_element (BGP_IPV4L_NODE
, &no_neighbor_maximum_prefix_cmd
);
11644 install_element (BGP_IPV6_NODE
, &neighbor_maximum_prefix_cmd
);
11645 install_element (BGP_IPV6_NODE
, &neighbor_maximum_prefix_threshold_cmd
);
11646 install_element (BGP_IPV6_NODE
, &neighbor_maximum_prefix_warning_cmd
);
11647 install_element (BGP_IPV6_NODE
, &neighbor_maximum_prefix_threshold_warning_cmd
);
11648 install_element (BGP_IPV6_NODE
, &neighbor_maximum_prefix_restart_cmd
);
11649 install_element (BGP_IPV6_NODE
, &neighbor_maximum_prefix_threshold_restart_cmd
);
11650 install_element (BGP_IPV6_NODE
, &no_neighbor_maximum_prefix_cmd
);
11651 install_element (BGP_IPV6M_NODE
, &neighbor_maximum_prefix_cmd
);
11652 install_element (BGP_IPV6M_NODE
, &neighbor_maximum_prefix_threshold_cmd
);
11653 install_element (BGP_IPV6M_NODE
, &neighbor_maximum_prefix_warning_cmd
);
11654 install_element (BGP_IPV6M_NODE
, &neighbor_maximum_prefix_threshold_warning_cmd
);
11655 install_element (BGP_IPV6M_NODE
, &neighbor_maximum_prefix_restart_cmd
);
11656 install_element (BGP_IPV6M_NODE
, &neighbor_maximum_prefix_threshold_restart_cmd
);
11657 install_element (BGP_IPV6M_NODE
, &no_neighbor_maximum_prefix_cmd
);
11658 install_element (BGP_IPV6L_NODE
, &neighbor_maximum_prefix_cmd
);
11659 install_element (BGP_IPV6L_NODE
, &neighbor_maximum_prefix_threshold_cmd
);
11660 install_element (BGP_IPV6L_NODE
, &neighbor_maximum_prefix_warning_cmd
);
11661 install_element (BGP_IPV6L_NODE
, &neighbor_maximum_prefix_threshold_warning_cmd
);
11662 install_element (BGP_IPV6L_NODE
, &neighbor_maximum_prefix_restart_cmd
);
11663 install_element (BGP_IPV6L_NODE
, &neighbor_maximum_prefix_threshold_restart_cmd
);
11664 install_element (BGP_IPV6L_NODE
, &no_neighbor_maximum_prefix_cmd
);
11665 install_element (BGP_VPNV4_NODE
, &neighbor_maximum_prefix_cmd
);
11666 install_element (BGP_VPNV4_NODE
, &neighbor_maximum_prefix_threshold_cmd
);
11667 install_element (BGP_VPNV4_NODE
, &neighbor_maximum_prefix_warning_cmd
);
11668 install_element (BGP_VPNV4_NODE
, &neighbor_maximum_prefix_threshold_warning_cmd
);
11669 install_element (BGP_VPNV4_NODE
, &neighbor_maximum_prefix_restart_cmd
);
11670 install_element (BGP_VPNV4_NODE
, &neighbor_maximum_prefix_threshold_restart_cmd
);
11671 install_element (BGP_VPNV4_NODE
, &no_neighbor_maximum_prefix_cmd
);
11672 install_element (BGP_VPNV6_NODE
, &neighbor_maximum_prefix_cmd
);
11673 install_element (BGP_VPNV6_NODE
, &neighbor_maximum_prefix_threshold_cmd
);
11674 install_element (BGP_VPNV6_NODE
, &neighbor_maximum_prefix_warning_cmd
);
11675 install_element (BGP_VPNV6_NODE
, &neighbor_maximum_prefix_threshold_warning_cmd
);
11676 install_element (BGP_VPNV6_NODE
, &neighbor_maximum_prefix_restart_cmd
);
11677 install_element (BGP_VPNV6_NODE
, &neighbor_maximum_prefix_threshold_restart_cmd
);
11678 install_element (BGP_VPNV6_NODE
, &no_neighbor_maximum_prefix_cmd
);
11680 /* "neighbor allowas-in" */
11681 install_element (BGP_NODE
, &neighbor_allowas_in_hidden_cmd
);
11682 install_element (BGP_NODE
, &no_neighbor_allowas_in_hidden_cmd
);
11683 install_element (BGP_IPV4_NODE
, &neighbor_allowas_in_cmd
);
11684 install_element (BGP_IPV4_NODE
, &no_neighbor_allowas_in_cmd
);
11685 install_element (BGP_IPV4M_NODE
, &neighbor_allowas_in_cmd
);
11686 install_element (BGP_IPV4M_NODE
, &no_neighbor_allowas_in_cmd
);
11687 install_element (BGP_IPV4L_NODE
, &neighbor_allowas_in_cmd
);
11688 install_element (BGP_IPV4L_NODE
, &no_neighbor_allowas_in_cmd
);
11689 install_element (BGP_IPV6_NODE
, &neighbor_allowas_in_cmd
);
11690 install_element (BGP_IPV6_NODE
, &no_neighbor_allowas_in_cmd
);
11691 install_element (BGP_IPV6M_NODE
, &neighbor_allowas_in_cmd
);
11692 install_element (BGP_IPV6M_NODE
, &no_neighbor_allowas_in_cmd
);
11693 install_element (BGP_IPV6L_NODE
, &neighbor_allowas_in_cmd
);
11694 install_element (BGP_IPV6L_NODE
, &no_neighbor_allowas_in_cmd
);
11695 install_element (BGP_VPNV4_NODE
, &neighbor_allowas_in_cmd
);
11696 install_element (BGP_VPNV4_NODE
, &no_neighbor_allowas_in_cmd
);
11697 install_element (BGP_VPNV6_NODE
, &neighbor_allowas_in_cmd
);
11698 install_element (BGP_VPNV6_NODE
, &no_neighbor_allowas_in_cmd
);
11700 /* address-family commands. */
11701 install_element (BGP_NODE
, &address_family_ipv4_safi_cmd
);
11702 install_element (BGP_NODE
, &address_family_ipv6_safi_cmd
);
11703 #ifdef KEEP_OLD_VPN_COMMANDS
11704 install_element (BGP_NODE
, &address_family_vpnv4_cmd
);
11705 install_element (BGP_NODE
, &address_family_vpnv6_cmd
);
11706 #endif /* KEEP_OLD_VPN_COMMANDS */
11708 install_element (BGP_NODE
, &address_family_evpn_cmd
);
11710 /* "exit-address-family" command. */
11711 install_element (BGP_IPV4_NODE
, &exit_address_family_cmd
);
11712 install_element (BGP_IPV4M_NODE
, &exit_address_family_cmd
);
11713 install_element (BGP_IPV4L_NODE
, &exit_address_family_cmd
);
11714 install_element (BGP_IPV6_NODE
, &exit_address_family_cmd
);
11715 install_element (BGP_IPV6M_NODE
, &exit_address_family_cmd
);
11716 install_element (BGP_IPV6L_NODE
, &exit_address_family_cmd
);
11717 install_element (BGP_VPNV4_NODE
, &exit_address_family_cmd
);
11718 install_element (BGP_VPNV6_NODE
, &exit_address_family_cmd
);
11719 install_element (BGP_EVPN_NODE
, &exit_address_family_cmd
);
11721 /* "clear ip bgp commands" */
11722 install_element (ENABLE_NODE
, &clear_ip_bgp_all_cmd
);
11724 /* clear ip bgp prefix */
11725 install_element (ENABLE_NODE
, &clear_ip_bgp_prefix_cmd
);
11726 install_element (ENABLE_NODE
, &clear_bgp_ipv6_safi_prefix_cmd
);
11727 install_element (ENABLE_NODE
, &clear_bgp_instance_ipv6_safi_prefix_cmd
);
11729 /* "show [ip] bgp summary" commands. */
11730 install_element (VIEW_NODE
, &show_bgp_instance_all_ipv6_updgrps_cmd
);
11731 install_element (VIEW_NODE
, &show_bgp_instance_updgrps_adj_cmd
);
11732 install_element (VIEW_NODE
, &show_bgp_instance_updgrps_adj_s_cmd
);
11733 install_element (VIEW_NODE
, &show_bgp_instance_updgrps_stats_cmd
);
11734 install_element (VIEW_NODE
, &show_bgp_updgrps_adj_cmd
);
11735 install_element (VIEW_NODE
, &show_bgp_updgrps_adj_s_cmd
);
11736 install_element (VIEW_NODE
, &show_bgp_updgrps_afi_adj_cmd
);
11737 install_element (VIEW_NODE
, &show_bgp_updgrps_afi_adj_s_cmd
);
11738 install_element (VIEW_NODE
, &show_bgp_updgrps_stats_cmd
);
11739 install_element (VIEW_NODE
, &show_ip_bgp_instance_updgrps_adj_cmd
);
11740 install_element (VIEW_NODE
, &show_ip_bgp_instance_updgrps_adj_s_cmd
);
11741 install_element (VIEW_NODE
, &show_ip_bgp_summary_cmd
);
11742 install_element (VIEW_NODE
, &show_ip_bgp_updgrps_adj_cmd
);
11743 install_element (VIEW_NODE
, &show_ip_bgp_updgrps_adj_s_cmd
);
11744 install_element (VIEW_NODE
, &show_ip_bgp_updgrps_cmd
);
11746 /* "show [ip] bgp neighbors" commands. */
11747 install_element (VIEW_NODE
, &show_ip_bgp_neighbors_cmd
);
11749 /* "show [ip] bgp peer-group" commands. */
11750 install_element (VIEW_NODE
, &show_ip_bgp_peer_groups_cmd
);
11752 /* "show [ip] bgp paths" commands. */
11753 install_element (VIEW_NODE
, &show_ip_bgp_paths_cmd
);
11755 /* "show [ip] bgp community" commands. */
11756 install_element (VIEW_NODE
, &show_ip_bgp_community_info_cmd
);
11758 /* "show ip bgp large-community" commands. */
11759 install_element (VIEW_NODE
, &show_ip_bgp_lcommunity_info_cmd
);
11760 /* "show [ip] bgp attribute-info" commands. */
11761 install_element (VIEW_NODE
, &show_ip_bgp_attr_info_cmd
);
11763 /* "redistribute" commands. */
11764 install_element (BGP_NODE
, &bgp_redistribute_ipv4_hidden_cmd
);
11765 install_element (BGP_NODE
, &no_bgp_redistribute_ipv4_hidden_cmd
);
11766 install_element (BGP_NODE
, &bgp_redistribute_ipv4_rmap_hidden_cmd
);
11767 install_element (BGP_NODE
, &bgp_redistribute_ipv4_metric_hidden_cmd
);
11768 install_element (BGP_NODE
, &bgp_redistribute_ipv4_rmap_metric_hidden_cmd
);
11769 install_element (BGP_NODE
, &bgp_redistribute_ipv4_metric_rmap_hidden_cmd
);
11770 install_element (BGP_NODE
, &bgp_redistribute_ipv4_ospf_hidden_cmd
);
11771 install_element (BGP_NODE
, &no_bgp_redistribute_ipv4_ospf_hidden_cmd
);
11772 install_element (BGP_NODE
, &bgp_redistribute_ipv4_ospf_rmap_hidden_cmd
);
11773 install_element (BGP_NODE
, &bgp_redistribute_ipv4_ospf_metric_hidden_cmd
);
11774 install_element (BGP_NODE
, &bgp_redistribute_ipv4_ospf_rmap_metric_hidden_cmd
);
11775 install_element (BGP_NODE
, &bgp_redistribute_ipv4_ospf_metric_rmap_hidden_cmd
);
11776 install_element (BGP_IPV4_NODE
, &bgp_redistribute_ipv4_cmd
);
11777 install_element (BGP_IPV4_NODE
, &no_bgp_redistribute_ipv4_cmd
);
11778 install_element (BGP_IPV4_NODE
, &bgp_redistribute_ipv4_rmap_cmd
);
11779 install_element (BGP_IPV4_NODE
, &bgp_redistribute_ipv4_metric_cmd
);
11780 install_element (BGP_IPV4_NODE
, &bgp_redistribute_ipv4_rmap_metric_cmd
);
11781 install_element (BGP_IPV4_NODE
, &bgp_redistribute_ipv4_metric_rmap_cmd
);
11782 install_element (BGP_IPV4_NODE
, &bgp_redistribute_ipv4_ospf_cmd
);
11783 install_element (BGP_IPV4_NODE
, &no_bgp_redistribute_ipv4_ospf_cmd
);
11784 install_element (BGP_IPV4_NODE
, &bgp_redistribute_ipv4_ospf_rmap_cmd
);
11785 install_element (BGP_IPV4_NODE
, &bgp_redistribute_ipv4_ospf_metric_cmd
);
11786 install_element (BGP_IPV4_NODE
, &bgp_redistribute_ipv4_ospf_rmap_metric_cmd
);
11787 install_element (BGP_IPV4_NODE
, &bgp_redistribute_ipv4_ospf_metric_rmap_cmd
);
11788 install_element (BGP_IPV6_NODE
, &bgp_redistribute_ipv6_cmd
);
11789 install_element (BGP_IPV6_NODE
, &no_bgp_redistribute_ipv6_cmd
);
11790 install_element (BGP_IPV6_NODE
, &bgp_redistribute_ipv6_rmap_cmd
);
11791 install_element (BGP_IPV6_NODE
, &bgp_redistribute_ipv6_metric_cmd
);
11792 install_element (BGP_IPV6_NODE
, &bgp_redistribute_ipv6_rmap_metric_cmd
);
11793 install_element (BGP_IPV6_NODE
, &bgp_redistribute_ipv6_metric_rmap_cmd
);
11795 /* ttl_security commands */
11796 install_element (BGP_NODE
, &neighbor_ttl_security_cmd
);
11797 install_element (BGP_NODE
, &no_neighbor_ttl_security_cmd
);
11799 /* "show [ip] bgp memory" commands. */
11800 install_element (VIEW_NODE
, &show_bgp_memory_cmd
);
11802 /* "show [ip] bgp views" commands. */
11803 install_element (VIEW_NODE
, &show_bgp_views_cmd
);
11805 /* "show [ip] bgp vrfs" commands. */
11806 install_element (VIEW_NODE
, &show_bgp_vrfs_cmd
);
11808 /* Community-list. */
11809 community_list_vty ();
11812 #include "memory.h"
11813 #include "bgp_regex.h"
11814 #include "bgp_clist.h"
11815 #include "bgp_ecommunity.h"
11817 /* VTY functions. */
11819 /* Direction value to string conversion. */
11820 static const char *
11821 community_direct_str (int direct
)
11825 case COMMUNITY_DENY
:
11827 case COMMUNITY_PERMIT
:
11834 /* Display error string. */
11836 community_list_perror (struct vty
*vty
, int ret
)
11840 case COMMUNITY_LIST_ERR_CANT_FIND_LIST
:
11841 vty_out (vty
, "%% Can't find community-list%s", VTY_NEWLINE
);
11843 case COMMUNITY_LIST_ERR_MALFORMED_VAL
:
11844 vty_out (vty
, "%% Malformed community-list value%s", VTY_NEWLINE
);
11846 case COMMUNITY_LIST_ERR_STANDARD_CONFLICT
:
11847 vty_out (vty
, "%% Community name conflict, previously defined as standard community%s", VTY_NEWLINE
);
11849 case COMMUNITY_LIST_ERR_EXPANDED_CONFLICT
:
11850 vty_out (vty
, "%% Community name conflict, previously defined as expanded community%s", VTY_NEWLINE
);
11855 /* "community-list" keyword help string. */
11856 #define COMMUNITY_LIST_STR "Add a community list entry\n"
11859 /* ip community-list standard */
11860 DEFUN (ip_community_list_standard
,
11861 ip_community_list_standard_cmd
,
11862 "ip community-list <(1-99)|standard WORD> <deny|permit> AA:NN...",
11865 "Community list number (standard)\n"
11866 "Add an standard community-list entry\n"
11867 "Community list name\n"
11868 "Specify community to reject\n"
11869 "Specify community to accept\n"
11872 char *cl_name_or_number
= NULL
;
11874 int style
= COMMUNITY_LIST_STANDARD
;
11877 argv_find (argv
, argc
, "(1-99)", &idx
);
11878 argv_find (argv
, argc
, "WORD", &idx
);
11879 cl_name_or_number
= argv
[idx
]->arg
;
11880 direct
= argv_find (argv
, argc
, "permit", &idx
) ? COMMUNITY_PERMIT
: COMMUNITY_DENY
;
11881 argv_find (argv
, argc
, "AA:NN", &idx
);
11882 char *str
= argv_concat (argv
, argc
, idx
);
11884 int ret
= community_list_set (bgp_clist
, cl_name_or_number
, str
, direct
, style
);
11886 XFREE (MTYPE_TMP
, str
);
11890 /* Display error string. */
11891 community_list_perror (vty
, ret
);
11892 return CMD_WARNING
;
11895 return CMD_SUCCESS
;
11898 DEFUN (no_ip_community_list_standard_all
,
11899 no_ip_community_list_standard_all_cmd
,
11900 "no ip community-list <(1-99)|standard WORD> <deny|permit> AA:NN...",
11904 "Community list number (standard)\n"
11905 "Add an standard community-list entry\n"
11906 "Community list name\n"
11907 "Specify community to reject\n"
11908 "Specify community to accept\n"
11911 int delete_all
= 0;
11913 char *cl_name_or_number
= NULL
;
11915 int style
= COMMUNITY_LIST_STANDARD
;
11918 argv_find (argv
, argc
, "(1-99)", &idx
);
11919 argv_find (argv
, argc
, "WORD", &idx
);
11920 cl_name_or_number
= argv
[idx
]->arg
;
11921 direct
= argv_find (argv
, argc
, "permit", &idx
) ? COMMUNITY_PERMIT
: COMMUNITY_DENY
;
11922 argv_find (argv
, argc
, "AA:NN", &idx
);
11923 char *str
= argv_concat (argv
, argc
, idx
);
11925 int ret
= community_list_unset (bgp_clist
, cl_name_or_number
, str
, direct
, style
, delete_all
);
11927 XFREE (MTYPE_TMP
, str
);
11931 community_list_perror (vty
, ret
);
11932 return CMD_WARNING
;
11935 return CMD_SUCCESS
;
11938 /* ip community-list expanded */
11939 DEFUN (ip_community_list_expanded_all
,
11940 ip_community_list_expanded_all_cmd
,
11941 "ip community-list <(100-500)|expanded WORD> <deny|permit> AA:NN...",
11944 "Community list number (expanded)\n"
11945 "Add an expanded community-list entry\n"
11946 "Community list name\n"
11947 "Specify community to reject\n"
11948 "Specify community to accept\n"
11951 char *cl_name_or_number
= NULL
;
11953 int style
= COMMUNITY_LIST_EXPANDED
;
11956 argv_find (argv
, argc
, "(100-500)", &idx
);
11957 argv_find (argv
, argc
, "WORD", &idx
);
11958 cl_name_or_number
= argv
[idx
]->arg
;
11959 direct
= argv_find (argv
, argc
, "permit", &idx
) ? COMMUNITY_PERMIT
: COMMUNITY_DENY
;
11960 argv_find (argv
, argc
, "AA:NN", &idx
);
11961 char *str
= argv_concat (argv
, argc
, idx
);
11963 int ret
= community_list_set (bgp_clist
, cl_name_or_number
, str
, direct
, style
);
11965 XFREE (MTYPE_TMP
, str
);
11969 /* Display error string. */
11970 community_list_perror (vty
, ret
);
11971 return CMD_WARNING
;
11974 return CMD_SUCCESS
;
11977 DEFUN (no_ip_community_list_expanded_all
,
11978 no_ip_community_list_expanded_all_cmd
,
11979 "no ip community-list <(100-500)|expanded WORD> <deny|permit> AA:NN...",
11983 "Community list number (expanded)\n"
11984 "Add an expanded community-list entry\n"
11985 "Community list name\n"
11986 "Specify community to reject\n"
11987 "Specify community to accept\n"
11990 int delete_all
= 0;
11992 char *cl_name_or_number
= NULL
;
11994 int style
= COMMUNITY_LIST_EXPANDED
;
11997 argv_find (argv
, argc
, "(100-500)", &idx
);
11998 argv_find (argv
, argc
, "WORD", &idx
);
11999 cl_name_or_number
= argv
[idx
]->arg
;
12000 direct
= argv_find (argv
, argc
, "permit", &idx
) ? COMMUNITY_PERMIT
: COMMUNITY_DENY
;
12001 argv_find (argv
, argc
, "AA:NN", &idx
);
12002 char *str
= argv_concat (argv
, argc
, idx
);
12004 int ret
= community_list_unset (bgp_clist
, cl_name_or_number
, str
, direct
, style
, delete_all
);
12006 XFREE (MTYPE_TMP
, str
);
12010 community_list_perror (vty
, ret
);
12011 return CMD_WARNING
;
12014 return CMD_SUCCESS
;
12018 community_list_show (struct vty
*vty
, struct community_list
*list
)
12020 struct community_entry
*entry
;
12022 for (entry
= list
->head
; entry
; entry
= entry
->next
)
12024 if (entry
== list
->head
)
12026 if (all_digit (list
->name
))
12027 vty_out (vty
, "Community %s list %s%s",
12028 entry
->style
== COMMUNITY_LIST_STANDARD
?
12029 "standard" : "(expanded) access",
12030 list
->name
, VTY_NEWLINE
);
12032 vty_out (vty
, "Named Community %s list %s%s",
12033 entry
->style
== COMMUNITY_LIST_STANDARD
?
12034 "standard" : "expanded",
12035 list
->name
, VTY_NEWLINE
);
12038 vty_out (vty
, " %s%s",
12039 community_direct_str (entry
->direct
), VTY_NEWLINE
);
12041 vty_out (vty
, " %s %s%s",
12042 community_direct_str (entry
->direct
),
12043 entry
->style
== COMMUNITY_LIST_STANDARD
12044 ? community_str (entry
->u
.com
) : entry
->config
,
12049 DEFUN (show_ip_community_list
,
12050 show_ip_community_list_cmd
,
12051 "show ip community-list",
12054 "List community-list\n")
12056 struct community_list
*list
;
12057 struct community_list_master
*cm
;
12059 cm
= community_list_master_lookup (bgp_clist
, COMMUNITY_LIST_MASTER
);
12061 return CMD_SUCCESS
;
12063 for (list
= cm
->num
.head
; list
; list
= list
->next
)
12064 community_list_show (vty
, list
);
12066 for (list
= cm
->str
.head
; list
; list
= list
->next
)
12067 community_list_show (vty
, list
);
12069 return CMD_SUCCESS
;
12072 DEFUN (show_ip_community_list_arg
,
12073 show_ip_community_list_arg_cmd
,
12074 "show ip community-list <(1-500)|WORD>",
12077 "List community-list\n"
12078 "Community-list number\n"
12079 "Community-list name\n")
12081 int idx_comm_list
= 3;
12082 struct community_list
*list
;
12084 list
= community_list_lookup (bgp_clist
, argv
[idx_comm_list
]->arg
, COMMUNITY_LIST_MASTER
);
12087 vty_out (vty
, "%% Can't find community-list%s", VTY_NEWLINE
);
12088 return CMD_WARNING
;
12091 community_list_show (vty
, list
);
12093 return CMD_SUCCESS
;
12097 * Large Community code.
12100 lcommunity_list_set_vty (struct vty
*vty
, int argc
, struct cmd_token
**argv
,
12101 int style
, int reject_all_digit_name
)
12109 direct
= argv_find (argv
, argc
, "permit", &idx
) ? COMMUNITY_PERMIT
: COMMUNITY_DENY
;
12111 /* All digit name check. */
12113 argv_find (argv
, argc
, "WORD", &idx
);
12114 argv_find (argv
, argc
, "(1-99)", &idx
);
12115 argv_find (argv
, argc
, "(100-500)", &idx
);
12116 cl_name
= argv
[idx
]->arg
;
12117 if (reject_all_digit_name
&& all_digit (cl_name
))
12119 vty_out (vty
, "%% Community name cannot have all digits%s", VTY_NEWLINE
);
12120 return CMD_WARNING
;
12124 argv_find (argv
, argc
, "AA:BB:CC", &idx
);
12125 argv_find (argv
, argc
, "LINE", &idx
);
12126 /* Concat community string argument. */
12128 str
= argv_concat (argv
, argc
, idx
);
12132 ret
= lcommunity_list_set (bgp_clist
, cl_name
, str
, direct
, style
);
12134 /* Free temporary community list string allocated by
12137 XFREE (MTYPE_TMP
, str
);
12141 community_list_perror (vty
, ret
);
12142 return CMD_WARNING
;
12144 return CMD_SUCCESS
;
12148 lcommunity_list_unset_vty (struct vty
*vty
, int argc
, struct cmd_token
**argv
,
12156 argv_find (argv
, argc
, "permit", &idx
);
12157 argv_find (argv
, argc
, "deny", &idx
);
12161 /* Check the list direct. */
12162 if (strncmp (argv
[idx
]->arg
, "p", 1) == 0)
12163 direct
= COMMUNITY_PERMIT
;
12165 direct
= COMMUNITY_DENY
;
12168 argv_find (argv
, argc
, "LINE", &idx
);
12169 argv_find (argv
, argc
, "AA:AA:NN", &idx
);
12170 /* Concat community string argument. */
12171 str
= argv_concat (argv
, argc
, idx
);
12175 argv_find (argv
, argc
, "(1-99)", &idx
);
12176 argv_find (argv
, argc
, "(100-500)", &idx
);
12177 argv_find (argv
, argc
, "WORD", &idx
);
12179 /* Unset community list. */
12180 ret
= lcommunity_list_unset (bgp_clist
, argv
[idx
]->arg
, str
, direct
, style
);
12182 /* Free temporary community list string allocated by
12185 XFREE (MTYPE_TMP
, str
);
12189 community_list_perror (vty
, ret
);
12190 return CMD_WARNING
;
12193 return CMD_SUCCESS
;
12196 /* "large-community-list" keyword help string. */
12197 #define LCOMMUNITY_LIST_STR "Add a large community list entry\n"
12198 #define LCOMMUNITY_VAL_STR "large community in 'aa:bb:cc' format\n"
12200 DEFUN (ip_lcommunity_list_standard
,
12201 ip_lcommunity_list_standard_cmd
,
12202 "ip large-community-list (1-99) <deny|permit>",
12204 LCOMMUNITY_LIST_STR
12205 "Large Community list number (standard)\n"
12206 "Specify large community to reject\n"
12207 "Specify large community to accept\n"
12208 LCOMMUNITY_VAL_STR
)
12210 return lcommunity_list_set_vty (vty
, argc
, argv
, LARGE_COMMUNITY_LIST_STANDARD
, 0);
12213 DEFUN (ip_lcommunity_list_standard1
,
12214 ip_lcommunity_list_standard1_cmd
,
12215 "ip large-community-list (1-99) <deny|permit> AA:BB:CC...",
12217 LCOMMUNITY_LIST_STR
12218 "Large Community list number (standard)\n"
12219 "Specify large community to reject\n"
12220 "Specify large community to accept\n"
12221 LCOMMUNITY_VAL_STR
)
12223 return lcommunity_list_set_vty (vty
, argc
, argv
, LARGE_COMMUNITY_LIST_STANDARD
, 0);
12226 DEFUN (ip_lcommunity_list_expanded
,
12227 ip_lcommunity_list_expanded_cmd
,
12228 "ip large-community-list (100-500) <deny|permit> LINE...",
12230 LCOMMUNITY_LIST_STR
12231 "Large Community list number (expanded)\n"
12232 "Specify large community to reject\n"
12233 "Specify large community to accept\n"
12234 "An ordered list as a regular-expression\n")
12236 return lcommunity_list_set_vty (vty
, argc
, argv
, LARGE_COMMUNITY_LIST_EXPANDED
, 0);
12239 DEFUN (ip_lcommunity_list_name_standard
,
12240 ip_lcommunity_list_name_standard_cmd
,
12241 "ip large-community-list standard WORD <deny|permit>",
12243 LCOMMUNITY_LIST_STR
12244 "Specify standard large-community-list\n"
12245 "Large Community list name\n"
12246 "Specify large community to reject\n"
12247 "Specify large community to accept\n")
12249 return lcommunity_list_set_vty (vty
, argc
, argv
, LARGE_COMMUNITY_LIST_STANDARD
, 1);
12252 DEFUN (ip_lcommunity_list_name_standard1
,
12253 ip_lcommunity_list_name_standard1_cmd
,
12254 "ip large-community-list standard WORD <deny|permit> AA:BB:CC...",
12256 LCOMMUNITY_LIST_STR
12257 "Specify standard large-community-list\n"
12258 "Large Community list name\n"
12259 "Specify large community to reject\n"
12260 "Specify large community to accept\n"
12261 LCOMMUNITY_VAL_STR
)
12263 return lcommunity_list_set_vty (vty
, argc
, argv
, LARGE_COMMUNITY_LIST_STANDARD
, 1);
12266 DEFUN (ip_lcommunity_list_name_expanded
,
12267 ip_lcommunity_list_name_expanded_cmd
,
12268 "ip large-community-list expanded WORD <deny|permit> LINE...",
12270 LCOMMUNITY_LIST_STR
12271 "Specify expanded large-community-list\n"
12272 "Large Community list name\n"
12273 "Specify large community to reject\n"
12274 "Specify large community to accept\n"
12275 "An ordered list as a regular-expression\n")
12277 return lcommunity_list_set_vty (vty
, argc
, argv
, LARGE_COMMUNITY_LIST_EXPANDED
, 1);
12280 DEFUN (no_ip_lcommunity_list_standard_all
,
12281 no_ip_lcommunity_list_standard_all_cmd
,
12282 "no ip large-community-list <(1-99)|(100-500)|WORD>",
12285 LCOMMUNITY_LIST_STR
12286 "Large Community list number (standard)\n"
12287 "Large Community list number (expanded)\n"
12288 "Large Community list name\n")
12290 return lcommunity_list_unset_vty (vty
, argc
, argv
, LARGE_COMMUNITY_LIST_STANDARD
);
12293 DEFUN (no_ip_lcommunity_list_name_expanded_all
,
12294 no_ip_lcommunity_list_name_expanded_all_cmd
,
12295 "no ip large-community-list expanded WORD",
12298 LCOMMUNITY_LIST_STR
12299 "Specify expanded large-community-list\n"
12300 "Large Community list name\n")
12302 return lcommunity_list_unset_vty (vty
, argc
, argv
, LARGE_COMMUNITY_LIST_EXPANDED
);
12305 DEFUN (no_ip_lcommunity_list_standard
,
12306 no_ip_lcommunity_list_standard_cmd
,
12307 "no ip large-community-list (1-99) <deny|permit> AA:AA:NN...",
12310 LCOMMUNITY_LIST_STR
12311 "Large Community list number (standard)\n"
12312 "Specify large community to reject\n"
12313 "Specify large community to accept\n"
12314 LCOMMUNITY_VAL_STR
)
12316 return lcommunity_list_unset_vty (vty
, argc
, argv
, LARGE_COMMUNITY_LIST_STANDARD
);
12319 DEFUN (no_ip_lcommunity_list_expanded
,
12320 no_ip_lcommunity_list_expanded_cmd
,
12321 "no ip large-community-list (100-500) <deny|permit> LINE...",
12324 LCOMMUNITY_LIST_STR
12325 "Large Community list number (expanded)\n"
12326 "Specify large community to reject\n"
12327 "Specify large community to accept\n"
12328 "An ordered list as a regular-expression\n")
12330 return lcommunity_list_unset_vty (vty
, argc
, argv
, LARGE_COMMUNITY_LIST_EXPANDED
);
12333 DEFUN (no_ip_lcommunity_list_name_standard
,
12334 no_ip_lcommunity_list_name_standard_cmd
,
12335 "no ip large-community-list standard WORD <deny|permit> AA:AA:NN...",
12338 LCOMMUNITY_LIST_STR
12339 "Specify standard large-community-list\n"
12340 "Large Community list name\n"
12341 "Specify large community to reject\n"
12342 "Specify large community to accept\n"
12343 LCOMMUNITY_VAL_STR
)
12345 return lcommunity_list_unset_vty (vty
, argc
, argv
, LARGE_COMMUNITY_LIST_STANDARD
);
12348 DEFUN (no_ip_lcommunity_list_name_expanded
,
12349 no_ip_lcommunity_list_name_expanded_cmd
,
12350 "no ip large-community-list expanded WORD <deny|permit> LINE...",
12353 LCOMMUNITY_LIST_STR
12354 "Specify expanded large-community-list\n"
12355 "Large community list name\n"
12356 "Specify large community to reject\n"
12357 "Specify large community to accept\n"
12358 "An ordered list as a regular-expression\n")
12360 return lcommunity_list_unset_vty (vty
, argc
, argv
, LARGE_COMMUNITY_LIST_EXPANDED
);
12364 lcommunity_list_show (struct vty
*vty
, struct community_list
*list
)
12366 struct community_entry
*entry
;
12368 for (entry
= list
->head
; entry
; entry
= entry
->next
)
12370 if (entry
== list
->head
)
12372 if (all_digit (list
->name
))
12373 vty_out (vty
, "Large community %s list %s%s",
12374 entry
->style
== EXTCOMMUNITY_LIST_STANDARD
?
12375 "standard" : "(expanded) access",
12376 list
->name
, VTY_NEWLINE
);
12378 vty_out (vty
, "Named large community %s list %s%s",
12379 entry
->style
== EXTCOMMUNITY_LIST_STANDARD
?
12380 "standard" : "expanded",
12381 list
->name
, VTY_NEWLINE
);
12384 vty_out (vty
, " %s%s",
12385 community_direct_str (entry
->direct
), VTY_NEWLINE
);
12387 vty_out (vty
, " %s %s%s",
12388 community_direct_str (entry
->direct
),
12389 entry
->style
== EXTCOMMUNITY_LIST_STANDARD
?
12390 entry
->u
.ecom
->str
: entry
->config
,
12395 DEFUN (show_ip_lcommunity_list
,
12396 show_ip_lcommunity_list_cmd
,
12397 "show ip large-community-list",
12400 "List large-community list\n")
12402 struct community_list
*list
;
12403 struct community_list_master
*cm
;
12405 cm
= community_list_master_lookup (bgp_clist
, LARGE_COMMUNITY_LIST_MASTER
);
12407 return CMD_SUCCESS
;
12409 for (list
= cm
->num
.head
; list
; list
= list
->next
)
12410 lcommunity_list_show (vty
, list
);
12412 for (list
= cm
->str
.head
; list
; list
= list
->next
)
12413 lcommunity_list_show (vty
, list
);
12415 return CMD_SUCCESS
;
12418 DEFUN (show_ip_lcommunity_list_arg
,
12419 show_ip_lcommunity_list_arg_cmd
,
12420 "show ip large-community-list <(1-500)|WORD>",
12423 "List large-community list\n"
12424 "large-community-list number\n"
12425 "large-community-list name\n")
12427 struct community_list
*list
;
12429 list
= community_list_lookup (bgp_clist
, argv
[3]->arg
, LARGE_COMMUNITY_LIST_MASTER
);
12432 vty_out (vty
, "%% Can't find extcommunity-list%s", VTY_NEWLINE
);
12433 return CMD_WARNING
;
12436 lcommunity_list_show (vty
, list
);
12438 return CMD_SUCCESS
;
12441 /* "extcommunity-list" keyword help string. */
12442 #define EXTCOMMUNITY_LIST_STR "Add a extended community list entry\n"
12443 #define EXTCOMMUNITY_VAL_STR "Extended community attribute in 'rt aa:nn_or_IPaddr:nn' OR 'soo aa:nn_or_IPaddr:nn' format\n"
12445 DEFUN (ip_extcommunity_list_standard
,
12446 ip_extcommunity_list_standard_cmd
,
12447 "ip extcommunity-list <(1-99)|standard WORD> <deny|permit> AA:NN...",
12449 EXTCOMMUNITY_LIST_STR
12450 "Extended Community list number (standard)\n"
12451 "Specify standard extcommunity-list\n"
12452 "Community list name\n"
12453 "Specify community to reject\n"
12454 "Specify community to accept\n"
12455 EXTCOMMUNITY_VAL_STR
)
12457 int style
= EXTCOMMUNITY_LIST_STANDARD
;
12459 char *cl_number_or_name
= NULL
;
12462 argv_find (argv
, argc
, "(1-99)", &idx
);
12463 argv_find (argv
, argc
, "WORD", &idx
);
12464 cl_number_or_name
= argv
[idx
]->arg
;
12465 direct
= argv_find (argv
, argc
, "permit", &idx
) ? COMMUNITY_PERMIT
: COMMUNITY_DENY
;
12466 argv_find (argv
, argc
, "AA:NN", &idx
);
12467 char *str
= argv_concat (argv
, argc
, idx
);
12469 int ret
= extcommunity_list_set (bgp_clist
, cl_number_or_name
, str
, direct
, style
);
12471 XFREE (MTYPE_TMP
, str
);
12475 community_list_perror (vty
, ret
);
12476 return CMD_WARNING
;
12479 return CMD_SUCCESS
;
12482 DEFUN (ip_extcommunity_list_name_expanded
,
12483 ip_extcommunity_list_name_expanded_cmd
,
12484 "ip extcommunity-list <(100-500)|expanded WORD> <deny|permit> LINE...",
12486 EXTCOMMUNITY_LIST_STR
12487 "Extended Community list number (expanded)\n"
12488 "Specify expanded extcommunity-list\n"
12489 "Extended Community list name\n"
12490 "Specify community to reject\n"
12491 "Specify community to accept\n"
12492 "An ordered list as a regular-expression\n")
12494 int style
= EXTCOMMUNITY_LIST_EXPANDED
;
12496 char *cl_number_or_name
= NULL
;
12499 argv_find (argv
, argc
, "(100-500)", &idx
);
12500 argv_find (argv
, argc
, "WORD", &idx
);
12501 cl_number_or_name
= argv
[idx
]->arg
;
12502 direct
= argv_find (argv
, argc
, "permit", &idx
) ? COMMUNITY_PERMIT
: COMMUNITY_DENY
;
12503 argv_find (argv
, argc
, "LINE", &idx
);
12504 char *str
= argv_concat (argv
, argc
, idx
);
12506 int ret
= extcommunity_list_set (bgp_clist
, cl_number_or_name
, str
, direct
, style
);
12508 XFREE (MTYPE_TMP
, str
);
12512 community_list_perror (vty
, ret
);
12513 return CMD_WARNING
;
12516 return CMD_SUCCESS
;
12519 DEFUN (no_ip_extcommunity_list_standard_all
,
12520 no_ip_extcommunity_list_standard_all_cmd
,
12521 "no ip extcommunity-list <(1-99)|standard WORD> <deny|permit> AA:NN...",
12524 EXTCOMMUNITY_LIST_STR
12525 "Extended Community list number (standard)\n"
12526 "Specify standard extcommunity-list\n"
12527 "Community list name\n"
12528 "Specify community to reject\n"
12529 "Specify community to accept\n"
12530 EXTCOMMUNITY_VAL_STR
)
12534 int style
= EXTCOMMUNITY_LIST_STANDARD
;
12536 char *cl_number_or_name
= NULL
;
12539 argv_find (argv
, argc
, "(1-99)", &idx
);
12540 argv_find (argv
, argc
, "WORD", &idx
);
12541 cl_number_or_name
= argv
[idx
]->arg
;
12542 direct
= argv_find (argv
, argc
, "permit", &idx
) ? COMMUNITY_PERMIT
: COMMUNITY_DENY
;
12543 argv_find (argv
, argc
, "AA:NN", &idx
);
12544 char *str
= argv_concat (argv
, argc
, idx
);
12546 int ret
= extcommunity_list_unset (bgp_clist
, cl_number_or_name
, str
, direct
, style
, deleteall
);
12548 XFREE (MTYPE_TMP
, str
);
12552 community_list_perror (vty
, ret
);
12553 return CMD_WARNING
;
12556 return CMD_SUCCESS
;
12559 DEFUN (no_ip_extcommunity_list_expanded_all
,
12560 no_ip_extcommunity_list_expanded_all_cmd
,
12561 "no ip extcommunity-list <(100-500)|expanded WORD> <deny|permit> LINE...",
12564 EXTCOMMUNITY_LIST_STR
12565 "Extended Community list number (expanded)\n"
12566 "Specify expanded extcommunity-list\n"
12567 "Extended Community list name\n"
12568 "Specify community to reject\n"
12569 "Specify community to accept\n"
12570 "An ordered list as a regular-expression\n")
12574 int style
= EXTCOMMUNITY_LIST_EXPANDED
;
12576 char *cl_number_or_name
= NULL
;
12579 argv_find (argv
, argc
, "(100-500)", &idx
);
12580 argv_find (argv
, argc
, "WORD", &idx
);
12581 cl_number_or_name
= argv
[idx
]->arg
;
12582 direct
= argv_find (argv
, argc
, "permit", &idx
) ? COMMUNITY_PERMIT
: COMMUNITY_DENY
;
12583 argv_find (argv
, argc
, "LINE", &idx
);
12584 char *str
= argv_concat (argv
, argc
, idx
);
12586 int ret
= extcommunity_list_unset (bgp_clist
, cl_number_or_name
, str
, direct
, style
, deleteall
);
12588 XFREE (MTYPE_TMP
, str
);
12592 community_list_perror (vty
, ret
);
12593 return CMD_WARNING
;
12596 return CMD_SUCCESS
;
12600 extcommunity_list_show (struct vty
*vty
, struct community_list
*list
)
12602 struct community_entry
*entry
;
12604 for (entry
= list
->head
; entry
; entry
= entry
->next
)
12606 if (entry
== list
->head
)
12608 if (all_digit (list
->name
))
12609 vty_out (vty
, "Extended community %s list %s%s",
12610 entry
->style
== EXTCOMMUNITY_LIST_STANDARD
?
12611 "standard" : "(expanded) access",
12612 list
->name
, VTY_NEWLINE
);
12614 vty_out (vty
, "Named extended community %s list %s%s",
12615 entry
->style
== EXTCOMMUNITY_LIST_STANDARD
?
12616 "standard" : "expanded",
12617 list
->name
, VTY_NEWLINE
);
12620 vty_out (vty
, " %s%s",
12621 community_direct_str (entry
->direct
), VTY_NEWLINE
);
12623 vty_out (vty
, " %s %s%s",
12624 community_direct_str (entry
->direct
),
12625 entry
->style
== EXTCOMMUNITY_LIST_STANDARD
?
12626 entry
->u
.ecom
->str
: entry
->config
,
12631 DEFUN (show_ip_extcommunity_list
,
12632 show_ip_extcommunity_list_cmd
,
12633 "show ip extcommunity-list",
12636 "List extended-community list\n")
12638 struct community_list
*list
;
12639 struct community_list_master
*cm
;
12641 cm
= community_list_master_lookup (bgp_clist
, EXTCOMMUNITY_LIST_MASTER
);
12643 return CMD_SUCCESS
;
12645 for (list
= cm
->num
.head
; list
; list
= list
->next
)
12646 extcommunity_list_show (vty
, list
);
12648 for (list
= cm
->str
.head
; list
; list
= list
->next
)
12649 extcommunity_list_show (vty
, list
);
12651 return CMD_SUCCESS
;
12654 DEFUN (show_ip_extcommunity_list_arg
,
12655 show_ip_extcommunity_list_arg_cmd
,
12656 "show ip extcommunity-list <(1-500)|WORD>",
12659 "List extended-community list\n"
12660 "Extcommunity-list number\n"
12661 "Extcommunity-list name\n")
12663 int idx_comm_list
= 3;
12664 struct community_list
*list
;
12666 list
= community_list_lookup (bgp_clist
, argv
[idx_comm_list
]->arg
, EXTCOMMUNITY_LIST_MASTER
);
12669 vty_out (vty
, "%% Can't find extcommunity-list%s", VTY_NEWLINE
);
12670 return CMD_WARNING
;
12673 extcommunity_list_show (vty
, list
);
12675 return CMD_SUCCESS
;
12678 /* Return configuration string of community-list entry. */
12679 static const char *
12680 community_list_config_str (struct community_entry
*entry
)
12688 if (entry
->style
== COMMUNITY_LIST_STANDARD
)
12689 str
= community_str (entry
->u
.com
);
12691 str
= entry
->config
;
12696 /* Display community-list and extcommunity-list configuration. */
12698 community_list_config_write (struct vty
*vty
)
12700 struct community_list
*list
;
12701 struct community_entry
*entry
;
12702 struct community_list_master
*cm
;
12705 /* Community-list. */
12706 cm
= community_list_master_lookup (bgp_clist
, COMMUNITY_LIST_MASTER
);
12708 for (list
= cm
->num
.head
; list
; list
= list
->next
)
12709 for (entry
= list
->head
; entry
; entry
= entry
->next
)
12711 vty_out (vty
, "ip community-list %s %s %s%s",
12712 list
->name
, community_direct_str (entry
->direct
),
12713 community_list_config_str (entry
),
12717 for (list
= cm
->str
.head
; list
; list
= list
->next
)
12718 for (entry
= list
->head
; entry
; entry
= entry
->next
)
12720 vty_out (vty
, "ip community-list %s %s %s %s%s",
12721 entry
->style
== COMMUNITY_LIST_STANDARD
12722 ? "standard" : "expanded",
12723 list
->name
, community_direct_str (entry
->direct
),
12724 community_list_config_str (entry
),
12729 /* Extcommunity-list. */
12730 cm
= community_list_master_lookup (bgp_clist
, EXTCOMMUNITY_LIST_MASTER
);
12732 for (list
= cm
->num
.head
; list
; list
= list
->next
)
12733 for (entry
= list
->head
; entry
; entry
= entry
->next
)
12735 vty_out (vty
, "ip extcommunity-list %s %s %s%s",
12736 list
->name
, community_direct_str (entry
->direct
),
12737 community_list_config_str (entry
), VTY_NEWLINE
);
12740 for (list
= cm
->str
.head
; list
; list
= list
->next
)
12741 for (entry
= list
->head
; entry
; entry
= entry
->next
)
12743 vty_out (vty
, "ip extcommunity-list %s %s %s %s%s",
12744 entry
->style
== EXTCOMMUNITY_LIST_STANDARD
12745 ? "standard" : "expanded",
12746 list
->name
, community_direct_str (entry
->direct
),
12747 community_list_config_str (entry
), VTY_NEWLINE
);
12752 /* lcommunity-list. */
12753 cm
= community_list_master_lookup (bgp_clist
, LARGE_COMMUNITY_LIST_MASTER
);
12755 for (list
= cm
->num
.head
; list
; list
= list
->next
)
12756 for (entry
= list
->head
; entry
; entry
= entry
->next
)
12758 vty_out (vty
, "ip large-community-list %s %s %s%s",
12759 list
->name
, community_direct_str (entry
->direct
),
12760 community_list_config_str (entry
), VTY_NEWLINE
);
12763 for (list
= cm
->str
.head
; list
; list
= list
->next
)
12764 for (entry
= list
->head
; entry
; entry
= entry
->next
)
12766 vty_out (vty
, "ip large-community-list %s %s %s %s%s",
12767 entry
->style
== LARGE_COMMUNITY_LIST_STANDARD
12768 ? "standard" : "expanded",
12769 list
->name
, community_direct_str (entry
->direct
),
12770 community_list_config_str (entry
), VTY_NEWLINE
);
12777 static struct cmd_node community_list_node
=
12779 COMMUNITY_LIST_NODE
,
12781 1 /* Export to vtysh. */
12785 community_list_vty (void)
12787 install_node (&community_list_node
, community_list_config_write
);
12789 /* Community-list. */
12790 install_element (CONFIG_NODE
, &ip_community_list_standard_cmd
);
12791 install_element (CONFIG_NODE
, &ip_community_list_expanded_all_cmd
);
12792 install_element (CONFIG_NODE
, &no_ip_community_list_standard_all_cmd
);
12793 install_element (CONFIG_NODE
, &no_ip_community_list_expanded_all_cmd
);
12794 install_element (VIEW_NODE
, &show_ip_community_list_cmd
);
12795 install_element (VIEW_NODE
, &show_ip_community_list_arg_cmd
);
12797 /* Extcommunity-list. */
12798 install_element (CONFIG_NODE
, &ip_extcommunity_list_standard_cmd
);
12799 install_element (CONFIG_NODE
, &ip_extcommunity_list_name_expanded_cmd
);
12800 install_element (CONFIG_NODE
, &no_ip_extcommunity_list_standard_all_cmd
);
12801 install_element (CONFIG_NODE
, &no_ip_extcommunity_list_expanded_all_cmd
);
12802 install_element (VIEW_NODE
, &show_ip_extcommunity_list_cmd
);
12803 install_element (VIEW_NODE
, &show_ip_extcommunity_list_arg_cmd
);
12805 /* Large Community List */
12806 install_element (CONFIG_NODE
, &ip_lcommunity_list_standard_cmd
);
12807 install_element (CONFIG_NODE
, &ip_lcommunity_list_standard1_cmd
);
12808 install_element (CONFIG_NODE
, &ip_lcommunity_list_expanded_cmd
);
12809 install_element (CONFIG_NODE
, &ip_lcommunity_list_name_standard_cmd
);
12810 install_element (CONFIG_NODE
, &ip_lcommunity_list_name_standard1_cmd
);
12811 install_element (CONFIG_NODE
, &ip_lcommunity_list_name_expanded_cmd
);
12812 install_element (CONFIG_NODE
, &no_ip_lcommunity_list_standard_all_cmd
);
12813 install_element (CONFIG_NODE
, &no_ip_lcommunity_list_name_expanded_all_cmd
);
12814 install_element (CONFIG_NODE
, &no_ip_lcommunity_list_standard_cmd
);
12815 install_element (CONFIG_NODE
, &no_ip_lcommunity_list_expanded_cmd
);
12816 install_element (CONFIG_NODE
, &no_ip_lcommunity_list_name_standard_cmd
);
12817 install_element (CONFIG_NODE
, &no_ip_lcommunity_list_name_expanded_cmd
);
12818 install_element (VIEW_NODE
, &show_ip_lcommunity_list_cmd
);
12819 install_element (VIEW_NODE
, &show_ip_lcommunity_list_arg_cmd
);