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"
39 #include "bgpd/bgpd.h"
40 #include "bgpd/bgp_advertise.h"
41 #include "bgpd/bgp_attr.h"
42 #include "bgpd/bgp_aspath.h"
43 #include "bgpd/bgp_community.h"
44 #include "bgpd/bgp_ecommunity.h"
45 #include "bgpd/bgp_lcommunity.h"
46 #include "bgpd/bgp_damp.h"
47 #include "bgpd/bgp_debug.h"
48 #include "bgpd/bgp_errors.h"
49 #include "bgpd/bgp_fsm.h"
50 #include "bgpd/bgp_nexthop.h"
51 #include "bgpd/bgp_open.h"
52 #include "bgpd/bgp_regex.h"
53 #include "bgpd/bgp_route.h"
54 #include "bgpd/bgp_mplsvpn.h"
55 #include "bgpd/bgp_zebra.h"
56 #include "bgpd/bgp_table.h"
57 #include "bgpd/bgp_vty.h"
58 #include "bgpd/bgp_mpath.h"
59 #include "bgpd/bgp_packet.h"
60 #include "bgpd/bgp_updgrp.h"
61 #include "bgpd/bgp_bfd.h"
62 #include "bgpd/bgp_io.h"
63 #include "bgpd/bgp_evpn.h"
64 #include "bgpd/bgp_addpath.h"
66 static struct peer_group
*listen_range_exists(struct bgp
*bgp
,
67 struct prefix
*range
, int exact
);
69 static enum node_type
bgp_node_type(afi_t afi
, safi_t safi
)
78 return BGP_IPV4M_NODE
;
80 case SAFI_LABELED_UNICAST
:
81 return BGP_IPV4L_NODE
;
84 return BGP_VPNV4_NODE
;
87 return BGP_FLOWSPECV4_NODE
;
100 return BGP_IPV6M_NODE
;
102 case SAFI_LABELED_UNICAST
:
103 return BGP_IPV6L_NODE
;
106 return BGP_VPNV6_NODE
;
109 return BGP_FLOWSPECV6_NODE
;
112 return BGP_IPV4_NODE
;
117 return BGP_EVPN_NODE
;
120 // We should never be here but to clarify the switch statement..
121 return BGP_IPV4_NODE
;
125 // Impossible to happen
126 return BGP_IPV4_NODE
;
129 /* Utility function to get address family from current node. */
130 afi_t
bgp_node_afi(struct vty
*vty
)
138 case BGP_FLOWSPECV6_NODE
:
151 /* Utility function to get subsequent address family from current
153 safi_t
bgp_node_safi(struct vty
*vty
)
159 safi
= SAFI_MPLS_VPN
;
163 safi
= SAFI_MULTICAST
;
170 safi
= SAFI_LABELED_UNICAST
;
172 case BGP_FLOWSPECV4_NODE
:
173 case BGP_FLOWSPECV6_NODE
:
174 safi
= SAFI_FLOWSPEC
;
184 * Converts an AFI in string form to afi_t
186 * @param afi string, one of
190 * @return the corresponding afi_t
192 afi_t
bgp_vty_afi_from_str(const char *afi_str
)
194 afi_t afi
= AFI_MAX
; /* unknown */
195 if (strmatch(afi_str
, "ipv4"))
197 else if (strmatch(afi_str
, "ipv6"))
199 else if (strmatch(afi_str
, "l2vpn"))
204 int argv_find_and_parse_afi(struct cmd_token
**argv
, int argc
, int *index
,
208 if (argv_find(argv
, argc
, "ipv4", index
)) {
212 } else if (argv_find(argv
, argc
, "ipv6", index
)) {
220 /* supports <unicast|multicast|vpn|labeled-unicast> */
221 safi_t
bgp_vty_safi_from_str(const char *safi_str
)
223 safi_t safi
= SAFI_MAX
; /* unknown */
224 if (strmatch(safi_str
, "multicast"))
225 safi
= SAFI_MULTICAST
;
226 else if (strmatch(safi_str
, "unicast"))
228 else if (strmatch(safi_str
, "vpn"))
229 safi
= SAFI_MPLS_VPN
;
230 else if (strmatch(safi_str
, "evpn"))
232 else if (strmatch(safi_str
, "labeled-unicast"))
233 safi
= SAFI_LABELED_UNICAST
;
234 else if (strmatch(safi_str
, "flowspec"))
235 safi
= SAFI_FLOWSPEC
;
239 int argv_find_and_parse_safi(struct cmd_token
**argv
, int argc
, int *index
,
243 if (argv_find(argv
, argc
, "unicast", index
)) {
246 *safi
= SAFI_UNICAST
;
247 } else if (argv_find(argv
, argc
, "multicast", index
)) {
250 *safi
= SAFI_MULTICAST
;
251 } else if (argv_find(argv
, argc
, "labeled-unicast", index
)) {
254 *safi
= SAFI_LABELED_UNICAST
;
255 } else if (argv_find(argv
, argc
, "vpn", index
)) {
258 *safi
= SAFI_MPLS_VPN
;
259 } else if (argv_find(argv
, argc
, "flowspec", index
)) {
262 *safi
= SAFI_FLOWSPEC
;
268 * bgp_vty_find_and_parse_afi_safi_bgp
270 * For a given 'show ...' command, correctly parse the afi/safi/bgp out from it
271 * This function *assumes* that the calling function pre-sets the afi/safi/bgp
272 * to appropriate values for the calling function. This is to allow the
273 * calling function to make decisions appropriate for the show command
274 * that is being parsed.
276 * The show commands are generally of the form:
277 * "show [ip] bgp [<view|vrf> VIEWVRFNAME] [<ipv4|ipv6>
278 * [<unicast|multicast|vpn|labeled-unicast>]] ..."
280 * Since we use argv_find if the show command in particular doesn't have:
282 * [<view|vrf> VIEWVRFNAME]
283 * [<ipv4|ipv6> [<unicast|multicast|vpn|labeled-unicast>]]
284 * The command parsing should still be ok.
286 * vty -> The vty for the command so we can output some useful data in
287 * the event of a parse error in the vrf.
288 * argv -> The command tokens
289 * argc -> How many command tokens we have
290 * idx -> The current place in the command, generally should be 0 for this
292 * afi -> The parsed afi if it was included in the show command, returned here
293 * safi -> The parsed safi if it was included in the show command, returned here
294 * bgp -> Pointer to the bgp data structure we need to fill in.
296 * The function returns the correct location in the parse tree for the
299 * Returns 0 for failure to parse correctly, else the idx position of where
300 * it found the last token.
302 int bgp_vty_find_and_parse_afi_safi_bgp(struct vty
*vty
,
303 struct cmd_token
**argv
, int argc
,
304 int *idx
, afi_t
*afi
, safi_t
*safi
,
305 struct bgp
**bgp
, bool use_json
)
307 char *vrf_name
= NULL
;
313 if (argv_find(argv
, argc
, "ip", idx
))
316 if (argv_find(argv
, argc
, "view", idx
))
317 vrf_name
= argv
[*idx
+ 1]->arg
;
318 else if (argv_find(argv
, argc
, "vrf", idx
)) {
319 vrf_name
= argv
[*idx
+ 1]->arg
;
320 if (strmatch(vrf_name
, VRF_DEFAULT_NAME
))
324 if (strmatch(vrf_name
, "all"))
327 *bgp
= bgp_lookup_by_name(vrf_name
);
330 vty_out(vty
, "{}\n");
332 vty_out(vty
, "View/Vrf %s is unknown\n",
339 *bgp
= bgp_get_default();
342 vty_out(vty
, "{}\n");
345 "Default BGP instance not found\n");
351 if (argv_find_and_parse_afi(argv
, argc
, idx
, afi
))
352 argv_find_and_parse_safi(argv
, argc
, idx
, safi
);
358 static int peer_address_self_check(struct bgp
*bgp
, union sockunion
*su
)
360 struct interface
*ifp
= NULL
;
362 if (su
->sa
.sa_family
== AF_INET
)
363 ifp
= if_lookup_by_ipv4_exact(&su
->sin
.sin_addr
, bgp
->vrf_id
);
364 else if (su
->sa
.sa_family
== AF_INET6
)
365 ifp
= if_lookup_by_ipv6_exact(&su
->sin6
.sin6_addr
,
366 su
->sin6
.sin6_scope_id
,
375 /* Utility function for looking up peer from VTY. */
376 /* This is used only for configuration, so disallow if attempted on
377 * a dynamic neighbor.
379 static struct peer
*peer_lookup_vty(struct vty
*vty
, const char *ip_str
)
381 struct bgp
*bgp
= VTY_GET_CONTEXT(bgp
);
390 ret
= str2sockunion(ip_str
, &su
);
392 peer
= peer_lookup_by_conf_if(bgp
, ip_str
);
394 if ((peer
= peer_lookup_by_hostname(bgp
, ip_str
))
397 "%% Malformed address or name: %s\n",
403 peer
= peer_lookup(bgp
, &su
);
406 "%% Specify remote-as or peer-group commands first\n");
409 if (peer_dynamic_neighbor(peer
)) {
411 "%% Operation not allowed on a dynamic neighbor\n");
418 /* Utility function for looking up peer or peer group. */
419 /* This is used only for configuration, so disallow if attempted on
420 * a dynamic neighbor.
422 struct peer
*peer_and_group_lookup_vty(struct vty
*vty
, const char *peer_str
)
424 struct bgp
*bgp
= VTY_GET_CONTEXT(bgp
);
427 struct peer
*peer
= NULL
;
428 struct peer_group
*group
= NULL
;
434 ret
= str2sockunion(peer_str
, &su
);
436 /* IP address, locate peer. */
437 peer
= peer_lookup(bgp
, &su
);
439 /* Not IP, could match either peer configured on interface or a
441 peer
= peer_lookup_by_conf_if(bgp
, peer_str
);
443 group
= peer_group_lookup(bgp
, peer_str
);
447 if (peer_dynamic_neighbor(peer
)) {
449 "%% Operation not allowed on a dynamic neighbor\n");
459 vty_out(vty
, "%% Specify remote-as or peer-group commands first\n");
464 int bgp_vty_return(struct vty
*vty
, int ret
)
466 const char *str
= NULL
;
469 case BGP_ERR_INVALID_VALUE
:
470 str
= "Invalid value";
472 case BGP_ERR_INVALID_FLAG
:
473 str
= "Invalid flag";
475 case BGP_ERR_PEER_GROUP_SHUTDOWN
:
476 str
= "Peer-group has been shutdown. Activate the peer-group first";
478 case BGP_ERR_PEER_FLAG_CONFLICT
:
479 str
= "Can't set override-capability and strict-capability-match at the same time";
481 case BGP_ERR_PEER_GROUP_NO_REMOTE_AS
:
482 str
= "Specify remote-as or peer-group remote AS first";
484 case BGP_ERR_PEER_GROUP_CANT_CHANGE
:
485 str
= "Cannot change the peer-group. Deconfigure first";
487 case BGP_ERR_PEER_GROUP_MISMATCH
:
488 str
= "Peer is not a member of this peer-group";
490 case BGP_ERR_PEER_FILTER_CONFLICT
:
491 str
= "Prefix/distribute list can not co-exist";
493 case BGP_ERR_NOT_INTERNAL_PEER
:
494 str
= "Invalid command. Not an internal neighbor";
496 case BGP_ERR_REMOVE_PRIVATE_AS
:
497 str
= "remove-private-AS cannot be configured for IBGP peers";
499 case BGP_ERR_LOCAL_AS_ALLOWED_ONLY_FOR_EBGP
:
500 str
= "Local-AS allowed only for EBGP peers";
502 case BGP_ERR_CANNOT_HAVE_LOCAL_AS_SAME_AS
:
503 str
= "Cannot have local-as same as BGP AS number";
505 case BGP_ERR_TCPSIG_FAILED
:
506 str
= "Error while applying TCP-Sig to session(s)";
508 case BGP_ERR_NO_EBGP_MULTIHOP_WITH_TTLHACK
:
509 str
= "ebgp-multihop and ttl-security cannot be configured together";
511 case BGP_ERR_NO_IBGP_WITH_TTLHACK
:
512 str
= "ttl-security only allowed for EBGP peers";
514 case BGP_ERR_AS_OVERRIDE
:
515 str
= "as-override cannot be configured for IBGP peers";
517 case BGP_ERR_INVALID_DYNAMIC_NEIGHBORS_LIMIT
:
518 str
= "Invalid limit for number of dynamic neighbors";
520 case BGP_ERR_DYNAMIC_NEIGHBORS_RANGE_EXISTS
:
521 str
= "Dynamic neighbor listen range already exists";
523 case BGP_ERR_INVALID_FOR_DYNAMIC_PEER
:
524 str
= "Operation not allowed on a dynamic neighbor";
526 case BGP_ERR_INVALID_FOR_DIRECT_PEER
:
527 str
= "Operation not allowed on a directly connected neighbor";
529 case BGP_ERR_PEER_SAFI_CONFLICT
:
530 str
= "Cannot activate peer for both 'ipv4 unicast' and 'ipv4 labeled-unicast'";
534 vty_out(vty
, "%% %s\n", str
);
535 return CMD_WARNING_CONFIG_FAILED
;
540 /* BGP clear sort. */
549 static void bgp_clear_vty_error(struct vty
*vty
, struct peer
*peer
, afi_t afi
,
550 safi_t safi
, int error
)
553 case BGP_ERR_AF_UNCONFIGURED
:
555 "%%BGP: Enable %s address family for the neighbor %s\n",
556 afi_safi_print(afi
, safi
), peer
->host
);
558 case BGP_ERR_SOFT_RECONFIG_UNCONFIGURED
:
560 "%%BGP: Inbound soft reconfig for %s not possible as it\n has neither refresh capability, nor inbound soft reconfig\n",
568 /* `clear ip bgp' functions. */
569 static int bgp_clear(struct vty
*vty
, struct bgp
*bgp
, afi_t afi
, safi_t safi
,
570 enum clear_sort sort
, enum bgp_clear_type stype
,
576 struct listnode
*node
, *nnode
;
578 /* Clear all neighbors. */
580 * Pass along pointer to next node to peer_clear() when walking all
581 * nodes on the BGP instance as that may get freed if it is a
584 if (sort
== clear_all
) {
585 for (ALL_LIST_ELEMENTS(bgp
->peer
, node
, nnode
, peer
)) {
586 if (!peer
->afc
[afi
][safi
])
589 if (stype
== BGP_CLEAR_SOFT_NONE
)
590 ret
= peer_clear(peer
, &nnode
);
592 ret
= peer_clear_soft(peer
, afi
, safi
, stype
);
595 bgp_clear_vty_error(vty
, peer
, afi
, safi
, ret
);
600 /* This is to apply read-only mode on this clear. */
601 if (stype
== BGP_CLEAR_SOFT_NONE
)
602 bgp
->update_delay_over
= 0;
605 vty_out(vty
, "%%BGP: No %s peer configured\n",
606 afi_safi_print(afi
, safi
));
611 /* Clear specified neighbor. */
612 if (sort
== clear_peer
) {
615 /* Make sockunion for lookup. */
616 ret
= str2sockunion(arg
, &su
);
618 peer
= peer_lookup_by_conf_if(bgp
, arg
);
620 peer
= peer_lookup_by_hostname(bgp
, arg
);
623 "Malformed address or name: %s\n",
629 peer
= peer_lookup(bgp
, &su
);
632 "%%BGP: Unknown neighbor - \"%s\"\n",
638 if (!peer
->afc
[afi
][safi
])
639 ret
= BGP_ERR_AF_UNCONFIGURED
;
640 else if (stype
== BGP_CLEAR_SOFT_NONE
)
641 ret
= peer_clear(peer
, NULL
);
643 ret
= peer_clear_soft(peer
, afi
, safi
, stype
);
646 bgp_clear_vty_error(vty
, peer
, afi
, safi
, ret
);
651 /* Clear all neighbors belonging to a specific peer-group. */
652 if (sort
== clear_group
) {
653 struct peer_group
*group
;
655 group
= peer_group_lookup(bgp
, arg
);
657 vty_out(vty
, "%%BGP: No such peer-group %s\n", arg
);
661 for (ALL_LIST_ELEMENTS(group
->peer
, node
, nnode
, peer
)) {
662 if (!peer
->afc
[afi
][safi
])
665 if (stype
== BGP_CLEAR_SOFT_NONE
)
666 ret
= peer_clear(peer
, NULL
);
668 ret
= peer_clear_soft(peer
, afi
, safi
, stype
);
671 bgp_clear_vty_error(vty
, peer
, afi
, safi
, ret
);
678 "%%BGP: No %s peer belonging to peer-group %s is configured\n",
679 afi_safi_print(afi
, safi
), arg
);
684 /* Clear all external (eBGP) neighbors. */
685 if (sort
== clear_external
) {
686 for (ALL_LIST_ELEMENTS(bgp
->peer
, node
, nnode
, peer
)) {
687 if (peer
->sort
== BGP_PEER_IBGP
)
690 if (!peer
->afc
[afi
][safi
])
693 if (stype
== BGP_CLEAR_SOFT_NONE
)
694 ret
= peer_clear(peer
, &nnode
);
696 ret
= peer_clear_soft(peer
, afi
, safi
, stype
);
699 bgp_clear_vty_error(vty
, peer
, afi
, safi
, ret
);
706 "%%BGP: No external %s peer is configured\n",
707 afi_safi_print(afi
, safi
));
712 /* Clear all neighbors belonging to a specific AS. */
713 if (sort
== clear_as
) {
714 as_t as
= strtoul(arg
, NULL
, 10);
716 for (ALL_LIST_ELEMENTS(bgp
->peer
, node
, nnode
, peer
)) {
720 if (!peer
->afc
[afi
][safi
])
721 ret
= BGP_ERR_AF_UNCONFIGURED
;
722 else if (stype
== BGP_CLEAR_SOFT_NONE
)
723 ret
= peer_clear(peer
, &nnode
);
725 ret
= peer_clear_soft(peer
, afi
, safi
, stype
);
728 bgp_clear_vty_error(vty
, peer
, afi
, safi
, ret
);
735 "%%BGP: No %s peer is configured with AS %s\n",
736 afi_safi_print(afi
, safi
), arg
);
744 static int bgp_clear_vty(struct vty
*vty
, const char *name
, afi_t afi
,
745 safi_t safi
, enum clear_sort sort
,
746 enum bgp_clear_type stype
, const char *arg
)
750 /* BGP structure lookup. */
752 bgp
= bgp_lookup_by_name(name
);
754 vty_out(vty
, "Can't find BGP instance %s\n", name
);
758 bgp
= bgp_get_default();
760 vty_out(vty
, "No BGP process is configured\n");
765 return bgp_clear(vty
, bgp
, afi
, safi
, sort
, stype
, arg
);
768 /* clear soft inbound */
769 static void bgp_clear_star_soft_in(struct vty
*vty
, const char *name
)
771 bgp_clear_vty(vty
, name
, AFI_IP
, SAFI_UNICAST
, clear_all
,
772 BGP_CLEAR_SOFT_IN
, NULL
);
773 bgp_clear_vty(vty
, name
, AFI_IP6
, SAFI_UNICAST
, clear_all
,
774 BGP_CLEAR_SOFT_IN
, NULL
);
777 /* clear soft outbound */
778 static void bgp_clear_star_soft_out(struct vty
*vty
, const char *name
)
780 bgp_clear_vty(vty
, name
, AFI_IP
, SAFI_UNICAST
, clear_all
,
781 BGP_CLEAR_SOFT_OUT
, NULL
);
782 bgp_clear_vty(vty
, name
, AFI_IP6
, SAFI_UNICAST
, clear_all
,
783 BGP_CLEAR_SOFT_OUT
, NULL
);
787 #ifndef VTYSH_EXTRACT_PL
788 #include "bgpd/bgp_vty_clippy.c"
791 /* BGP global configuration. */
792 #if (CONFDATE > 20190601)
793 CPP_NOTICE("bgpd: time to remove deprecated bgp multiple-instance")
794 CPP_NOTICE("This includes BGP_OPT_MULTIPLE_INSTANCE")
796 DEFUN_HIDDEN (bgp_multiple_instance_func
,
797 bgp_multiple_instance_cmd
,
798 "bgp multiple-instance",
800 "Enable bgp multiple instance\n")
802 bgp_option_set(BGP_OPT_MULTIPLE_INSTANCE
);
806 DEFUN_HIDDEN (no_bgp_multiple_instance
,
807 no_bgp_multiple_instance_cmd
,
808 "no bgp multiple-instance",
811 "BGP multiple instance\n")
815 vty_out(vty
, "This config option is deprecated, and is scheduled for removal.\n");
816 vty_out(vty
, "if you are using this please let the developers know\n");
817 zlog_info("Deprecated option: `bgp multiple-instance` being used");
818 ret
= bgp_option_unset(BGP_OPT_MULTIPLE_INSTANCE
);
820 vty_out(vty
, "%% There are more than two BGP instances\n");
821 return CMD_WARNING_CONFIG_FAILED
;
826 DEFUN_HIDDEN (bgp_local_mac
,
828 "bgp local-mac vni " CMD_VNI_RANGE
" mac WORD seq (0-4294967295)",
831 "VxLAN Network Identifier\n"
835 "mac-mobility sequence\n"
845 vni
= strtoul(argv
[3]->arg
, NULL
, 10);
846 if (!prefix_str2mac(argv
[5]->arg
, &mac
)) {
847 vty_out(vty
, "%% Malformed MAC address\n");
850 memset(&ip
, 0, sizeof(ip
));
851 seq
= strtoul(argv
[7]->arg
, NULL
, 10);
853 bgp
= bgp_get_default();
855 vty_out(vty
, "Default BGP instance is not there\n");
859 rv
= bgp_evpn_local_macip_add(bgp
, vni
, &mac
, &ip
, 0 /* flags */, seq
);
861 vty_out(vty
, "Internal error\n");
868 DEFUN_HIDDEN (no_bgp_local_mac
,
869 no_bgp_local_mac_cmd
,
870 "no bgp local-mac vni " CMD_VNI_RANGE
" mac WORD",
874 "VxLAN Network Identifier\n"
885 vni
= strtoul(argv
[4]->arg
, NULL
, 10);
886 if (!prefix_str2mac(argv
[6]->arg
, &mac
)) {
887 vty_out(vty
, "%% Malformed MAC address\n");
890 memset(&ip
, 0, sizeof(ip
));
892 bgp
= bgp_get_default();
894 vty_out(vty
, "Default BGP instance is not there\n");
898 rv
= bgp_evpn_local_macip_del(bgp
, vni
, &mac
, &ip
);
900 vty_out(vty
, "Internal error\n");
907 #if (CONFDATE > 20190601)
908 CPP_NOTICE("bgpd: time to remove deprecated cli bgp config-type cisco")
909 CPP_NOTICE("This includes BGP_OPT_CISCO_CONFIG")
911 DEFUN_HIDDEN (bgp_config_type
,
913 "bgp config-type <cisco|zebra>",
915 "Configuration type\n"
920 if (argv_find(argv
, argc
, "cisco", &idx
)) {
921 vty_out(vty
, "This config option is deprecated, and is scheduled for removal.\n");
922 vty_out(vty
, "if you are using this please let the developers know!\n");
923 zlog_info("Deprecated option: `bgp config-type cisco` being used");
924 bgp_option_set(BGP_OPT_CONFIG_CISCO
);
926 bgp_option_unset(BGP_OPT_CONFIG_CISCO
);
931 DEFUN_HIDDEN (no_bgp_config_type
,
932 no_bgp_config_type_cmd
,
933 "no bgp config-type [<cisco|zebra>]",
936 "Display configuration type\n"
940 bgp_option_unset(BGP_OPT_CONFIG_CISCO
);
945 DEFUN (no_synchronization
,
946 no_synchronization_cmd
,
947 "no synchronization",
949 "Perform IGP synchronization\n")
954 DEFUN (no_auto_summary
,
958 "Enable automatic network number summarization\n")
963 /* "router bgp" commands. */
964 DEFUN_NOSH (router_bgp
,
966 "router bgp [(1-4294967295) [<view|vrf> VIEWVRFNAME]]",
970 BGP_INSTANCE_HELP_STR
)
973 int idx_view_vrf
= 3;
979 const char *name
= NULL
;
980 enum bgp_instance_type inst_type
;
982 // "router bgp" without an ASN
984 // Pending: Make VRF option available for ASN less config
985 bgp
= bgp_get_default();
988 vty_out(vty
, "%% No BGP process is configured\n");
989 return CMD_WARNING_CONFIG_FAILED
;
992 if (listcount(bm
->bgp
) > 1) {
993 vty_out(vty
, "%% Please specify ASN and VRF\n");
994 return CMD_WARNING_CONFIG_FAILED
;
1000 as
= strtoul(argv
[idx_asn
]->arg
, NULL
, 10);
1002 inst_type
= BGP_INSTANCE_TYPE_DEFAULT
;
1004 name
= argv
[idx_vrf
]->arg
;
1006 if (!strcmp(argv
[idx_view_vrf
]->text
, "vrf")) {
1007 if (strmatch(name
, VRF_DEFAULT_NAME
))
1010 inst_type
= BGP_INSTANCE_TYPE_VRF
;
1011 } else if (!strcmp(argv
[idx_view_vrf
]->text
, "view"))
1012 inst_type
= BGP_INSTANCE_TYPE_VIEW
;
1015 if (inst_type
== BGP_INSTANCE_TYPE_DEFAULT
)
1016 is_new_bgp
= (bgp_lookup(as
, name
) == NULL
);
1018 ret
= bgp_get(&bgp
, &as
, name
, inst_type
);
1020 case BGP_ERR_MULTIPLE_INSTANCE_NOT_SET
:
1022 "Please specify 'bgp multiple-instance' first\n");
1023 return CMD_WARNING_CONFIG_FAILED
;
1024 case BGP_ERR_AS_MISMATCH
:
1025 vty_out(vty
, "BGP is already running; AS is %u\n", as
);
1026 return CMD_WARNING_CONFIG_FAILED
;
1027 case BGP_ERR_INSTANCE_MISMATCH
:
1029 "BGP instance name and AS number mismatch\n");
1031 "BGP instance is already running; AS is %u\n",
1033 return CMD_WARNING_CONFIG_FAILED
;
1037 * If we just instantiated the default instance, complete
1038 * any pending VRF-VPN leaking that was configured via
1039 * earlier "router bgp X vrf FOO" blocks.
1041 if (is_new_bgp
&& inst_type
== BGP_INSTANCE_TYPE_DEFAULT
)
1042 vpn_leak_postchange_all();
1044 /* Pending: handle when user tries to change a view to vrf n vv.
1048 /* unset the auto created flag as the user config is now present */
1049 UNSET_FLAG(bgp
->vrf_flags
, BGP_VRF_AUTO
);
1050 VTY_PUSH_CONTEXT(BGP_NODE
, bgp
);
1055 /* "no router bgp" commands. */
1056 DEFUN (no_router_bgp
,
1058 "no router bgp [(1-4294967295) [<view|vrf> VIEWVRFNAME]]",
1063 BGP_INSTANCE_HELP_STR
)
1069 const char *name
= NULL
;
1071 // "no router bgp" without an ASN
1073 // Pending: Make VRF option available for ASN less config
1074 bgp
= bgp_get_default();
1077 vty_out(vty
, "%% No BGP process is configured\n");
1078 return CMD_WARNING_CONFIG_FAILED
;
1081 if (listcount(bm
->bgp
) > 1) {
1082 vty_out(vty
, "%% Please specify ASN and VRF\n");
1083 return CMD_WARNING_CONFIG_FAILED
;
1087 vty_out(vty
, "%% Please unconfigure l3vni %u",
1089 return CMD_WARNING_CONFIG_FAILED
;
1092 as
= strtoul(argv
[idx_asn
]->arg
, NULL
, 10);
1095 name
= argv
[idx_vrf
]->arg
;
1097 /* Lookup bgp structure. */
1098 bgp
= bgp_lookup(as
, name
);
1100 vty_out(vty
, "%% Can't find BGP instance\n");
1101 return CMD_WARNING_CONFIG_FAILED
;
1105 vty_out(vty
, "%% Please unconfigure l3vni %u",
1107 return CMD_WARNING_CONFIG_FAILED
;
1117 /* BGP router-id. */
1119 DEFPY (bgp_router_id
,
1121 "bgp router-id A.B.C.D",
1123 "Override configured router identifier\n"
1124 "Manually configured router identifier\n")
1126 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1127 bgp_router_id_static_set(bgp
, router_id
);
1131 DEFPY (no_bgp_router_id
,
1132 no_bgp_router_id_cmd
,
1133 "no bgp router-id [A.B.C.D]",
1136 "Override configured router identifier\n"
1137 "Manually configured router identifier\n")
1139 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1141 if (router_id_str
) {
1142 if (!IPV4_ADDR_SAME(&bgp
->router_id_static
, &router_id
)) {
1143 vty_out(vty
, "%% BGP router-id doesn't match\n");
1144 return CMD_WARNING_CONFIG_FAILED
;
1148 router_id
.s_addr
= 0;
1149 bgp_router_id_static_set(bgp
, router_id
);
1155 /* BGP Cluster ID. */
1156 DEFUN (bgp_cluster_id
,
1158 "bgp cluster-id <A.B.C.D|(1-4294967295)>",
1160 "Configure Route-Reflector Cluster-id\n"
1161 "Route-Reflector Cluster-id in IP address format\n"
1162 "Route-Reflector Cluster-id as 32 bit quantity\n")
1164 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1167 struct in_addr cluster
;
1169 ret
= inet_aton(argv
[idx_ipv4
]->arg
, &cluster
);
1171 vty_out(vty
, "%% Malformed bgp cluster identifier\n");
1172 return CMD_WARNING_CONFIG_FAILED
;
1175 bgp_cluster_id_set(bgp
, &cluster
);
1176 bgp_clear_star_soft_out(vty
, bgp
->name
);
1181 DEFUN (no_bgp_cluster_id
,
1182 no_bgp_cluster_id_cmd
,
1183 "no bgp cluster-id [<A.B.C.D|(1-4294967295)>]",
1186 "Configure Route-Reflector Cluster-id\n"
1187 "Route-Reflector Cluster-id in IP address format\n"
1188 "Route-Reflector Cluster-id as 32 bit quantity\n")
1190 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1191 bgp_cluster_id_unset(bgp
);
1192 bgp_clear_star_soft_out(vty
, bgp
->name
);
1197 DEFUN (bgp_confederation_identifier
,
1198 bgp_confederation_identifier_cmd
,
1199 "bgp confederation identifier (1-4294967295)",
1200 "BGP specific commands\n"
1201 "AS confederation parameters\n"
1203 "Set routing domain confederation AS\n")
1205 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1209 as
= strtoul(argv
[idx_number
]->arg
, NULL
, 10);
1211 bgp_confederation_id_set(bgp
, as
);
1216 DEFUN (no_bgp_confederation_identifier
,
1217 no_bgp_confederation_identifier_cmd
,
1218 "no bgp confederation identifier [(1-4294967295)]",
1220 "BGP specific commands\n"
1221 "AS confederation parameters\n"
1223 "Set routing domain confederation AS\n")
1225 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1226 bgp_confederation_id_unset(bgp
);
1231 DEFUN (bgp_confederation_peers
,
1232 bgp_confederation_peers_cmd
,
1233 "bgp confederation peers (1-4294967295)...",
1234 "BGP specific commands\n"
1235 "AS confederation parameters\n"
1236 "Peer ASs in BGP confederation\n"
1239 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1244 for (i
= idx_asn
; i
< argc
; i
++) {
1245 as
= strtoul(argv
[i
]->arg
, NULL
, 10);
1247 if (bgp
->as
== as
) {
1249 "%% Local member-AS not allowed in confed peer list\n");
1253 bgp_confederation_peers_add(bgp
, as
);
1258 DEFUN (no_bgp_confederation_peers
,
1259 no_bgp_confederation_peers_cmd
,
1260 "no bgp confederation peers (1-4294967295)...",
1262 "BGP specific commands\n"
1263 "AS confederation parameters\n"
1264 "Peer ASs in BGP confederation\n"
1267 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1272 for (i
= idx_asn
; i
< argc
; i
++) {
1273 as
= strtoul(argv
[i
]->arg
, NULL
, 10);
1275 bgp_confederation_peers_remove(bgp
, as
);
1281 * Central routine for maximum-paths configuration.
1282 * @peer_type: BGP_PEER_EBGP or BGP_PEER_IBGP
1283 * @set: 1 for setting values, 0 for removing the max-paths config.
1285 static int bgp_maxpaths_config_vty(struct vty
*vty
, int peer_type
,
1286 const char *mpaths
, uint16_t options
,
1289 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1290 uint16_t maxpaths
= 0;
1295 afi
= bgp_node_afi(vty
);
1296 safi
= bgp_node_safi(vty
);
1299 maxpaths
= strtol(mpaths
, NULL
, 10);
1300 if (maxpaths
> multipath_num
) {
1302 "%% Maxpaths Specified: %d is > than multipath num specified on bgp command line %d",
1303 maxpaths
, multipath_num
);
1304 return CMD_WARNING_CONFIG_FAILED
;
1306 ret
= bgp_maximum_paths_set(bgp
, afi
, safi
, peer_type
, maxpaths
,
1309 ret
= bgp_maximum_paths_unset(bgp
, afi
, safi
, peer_type
);
1313 "%% Failed to %sset maximum-paths %s %u for afi %u, safi %u\n",
1314 (set
== 1) ? "" : "un",
1315 (peer_type
== BGP_PEER_EBGP
) ? "ebgp" : "ibgp",
1316 maxpaths
, afi
, safi
);
1317 return CMD_WARNING_CONFIG_FAILED
;
1320 bgp_recalculate_all_bestpaths(bgp
);
1325 DEFUN (bgp_maxmed_admin
,
1326 bgp_maxmed_admin_cmd
,
1327 "bgp max-med administrative ",
1329 "Advertise routes with max-med\n"
1330 "Administratively applied, for an indefinite period\n")
1332 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1334 bgp
->v_maxmed_admin
= 1;
1335 bgp
->maxmed_admin_value
= BGP_MAXMED_VALUE_DEFAULT
;
1337 bgp_maxmed_update(bgp
);
1342 DEFUN (bgp_maxmed_admin_medv
,
1343 bgp_maxmed_admin_medv_cmd
,
1344 "bgp max-med administrative (0-4294967295)",
1346 "Advertise routes with max-med\n"
1347 "Administratively applied, for an indefinite period\n"
1348 "Max MED value to be used\n")
1350 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1353 bgp
->v_maxmed_admin
= 1;
1354 bgp
->maxmed_admin_value
= strtoul(argv
[idx_number
]->arg
, NULL
, 10);
1356 bgp_maxmed_update(bgp
);
1361 DEFUN (no_bgp_maxmed_admin
,
1362 no_bgp_maxmed_admin_cmd
,
1363 "no bgp max-med administrative [(0-4294967295)]",
1366 "Advertise routes with max-med\n"
1367 "Administratively applied, for an indefinite period\n"
1368 "Max MED value to be used\n")
1370 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1371 bgp
->v_maxmed_admin
= BGP_MAXMED_ADMIN_UNCONFIGURED
;
1372 bgp
->maxmed_admin_value
= BGP_MAXMED_VALUE_DEFAULT
;
1373 bgp_maxmed_update(bgp
);
1378 DEFUN (bgp_maxmed_onstartup
,
1379 bgp_maxmed_onstartup_cmd
,
1380 "bgp max-med on-startup (5-86400) [(0-4294967295)]",
1382 "Advertise routes with max-med\n"
1383 "Effective on a startup\n"
1384 "Time (seconds) period for max-med\n"
1385 "Max MED value to be used\n")
1387 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1390 argv_find(argv
, argc
, "(5-86400)", &idx
);
1391 bgp
->v_maxmed_onstartup
= strtoul(argv
[idx
]->arg
, NULL
, 10);
1392 if (argv_find(argv
, argc
, "(0-4294967295)", &idx
))
1393 bgp
->maxmed_onstartup_value
= strtoul(argv
[idx
]->arg
, NULL
, 10);
1395 bgp
->maxmed_onstartup_value
= BGP_MAXMED_VALUE_DEFAULT
;
1397 bgp_maxmed_update(bgp
);
1402 DEFUN (no_bgp_maxmed_onstartup
,
1403 no_bgp_maxmed_onstartup_cmd
,
1404 "no bgp max-med on-startup [(5-86400) [(0-4294967295)]]",
1407 "Advertise routes with max-med\n"
1408 "Effective on a startup\n"
1409 "Time (seconds) period for max-med\n"
1410 "Max MED value to be used\n")
1412 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1414 /* Cancel max-med onstartup if its on */
1415 if (bgp
->t_maxmed_onstartup
) {
1416 THREAD_TIMER_OFF(bgp
->t_maxmed_onstartup
);
1417 bgp
->maxmed_onstartup_over
= 1;
1420 bgp
->v_maxmed_onstartup
= BGP_MAXMED_ONSTARTUP_UNCONFIGURED
;
1421 bgp
->maxmed_onstartup_value
= BGP_MAXMED_VALUE_DEFAULT
;
1423 bgp_maxmed_update(bgp
);
1428 static int bgp_update_delay_config_vty(struct vty
*vty
, const char *delay
,
1431 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1432 uint16_t update_delay
;
1433 uint16_t establish_wait
;
1435 update_delay
= strtoul(delay
, NULL
, 10);
1437 if (!wait
) /* update-delay <delay> */
1439 bgp
->v_update_delay
= update_delay
;
1440 bgp
->v_establish_wait
= bgp
->v_update_delay
;
1444 /* update-delay <delay> <establish-wait> */
1445 establish_wait
= atoi(wait
);
1446 if (update_delay
< establish_wait
) {
1448 "%%Failed: update-delay less than the establish-wait!\n");
1449 return CMD_WARNING_CONFIG_FAILED
;
1452 bgp
->v_update_delay
= update_delay
;
1453 bgp
->v_establish_wait
= establish_wait
;
1458 static int bgp_update_delay_deconfig_vty(struct vty
*vty
)
1460 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1462 bgp
->v_update_delay
= BGP_UPDATE_DELAY_DEF
;
1463 bgp
->v_establish_wait
= bgp
->v_update_delay
;
1468 void bgp_config_write_update_delay(struct vty
*vty
, struct bgp
*bgp
)
1470 if (bgp
->v_update_delay
!= BGP_UPDATE_DELAY_DEF
) {
1471 vty_out(vty
, " update-delay %d", bgp
->v_update_delay
);
1472 if (bgp
->v_update_delay
!= bgp
->v_establish_wait
)
1473 vty_out(vty
, " %d", bgp
->v_establish_wait
);
1479 /* Update-delay configuration */
1480 DEFUN (bgp_update_delay
,
1481 bgp_update_delay_cmd
,
1482 "update-delay (0-3600)",
1483 "Force initial delay for best-path and updates\n"
1487 return bgp_update_delay_config_vty(vty
, argv
[idx_number
]->arg
, NULL
);
1490 DEFUN (bgp_update_delay_establish_wait
,
1491 bgp_update_delay_establish_wait_cmd
,
1492 "update-delay (0-3600) (1-3600)",
1493 "Force initial delay for best-path and updates\n"
1498 int idx_number_2
= 2;
1499 return bgp_update_delay_config_vty(vty
, argv
[idx_number
]->arg
,
1500 argv
[idx_number_2
]->arg
);
1503 /* Update-delay deconfiguration */
1504 DEFUN (no_bgp_update_delay
,
1505 no_bgp_update_delay_cmd
,
1506 "no update-delay [(0-3600) [(1-3600)]]",
1508 "Force initial delay for best-path and updates\n"
1512 return bgp_update_delay_deconfig_vty(vty
);
1516 static int bgp_wpkt_quanta_config_vty(struct vty
*vty
, const char *num
,
1519 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1522 uint32_t quanta
= strtoul(num
, NULL
, 10);
1523 atomic_store_explicit(&bgp
->wpkt_quanta
, quanta
,
1524 memory_order_relaxed
);
1526 atomic_store_explicit(&bgp
->wpkt_quanta
, BGP_WRITE_PACKET_MAX
,
1527 memory_order_relaxed
);
1533 static int bgp_rpkt_quanta_config_vty(struct vty
*vty
, const char *num
,
1536 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1539 uint32_t quanta
= strtoul(num
, NULL
, 10);
1540 atomic_store_explicit(&bgp
->rpkt_quanta
, quanta
,
1541 memory_order_relaxed
);
1543 atomic_store_explicit(&bgp
->rpkt_quanta
, BGP_READ_PACKET_MAX
,
1544 memory_order_relaxed
);
1550 void bgp_config_write_wpkt_quanta(struct vty
*vty
, struct bgp
*bgp
)
1553 atomic_load_explicit(&bgp
->wpkt_quanta
, memory_order_relaxed
);
1554 if (quanta
!= BGP_WRITE_PACKET_MAX
)
1555 vty_out(vty
, " write-quanta %d\n", quanta
);
1558 void bgp_config_write_rpkt_quanta(struct vty
*vty
, struct bgp
*bgp
)
1561 atomic_load_explicit(&bgp
->rpkt_quanta
, memory_order_relaxed
);
1562 if (quanta
!= BGP_READ_PACKET_MAX
)
1563 vty_out(vty
, " read-quanta %d\n", quanta
);
1566 /* Packet quanta configuration */
1567 DEFUN (bgp_wpkt_quanta
,
1568 bgp_wpkt_quanta_cmd
,
1569 "write-quanta (1-10)",
1570 "How many packets to write to peer socket per run\n"
1571 "Number of packets\n")
1574 return bgp_wpkt_quanta_config_vty(vty
, argv
[idx_number
]->arg
, 1);
1577 DEFUN (no_bgp_wpkt_quanta
,
1578 no_bgp_wpkt_quanta_cmd
,
1579 "no write-quanta (1-10)",
1581 "How many packets to write to peer socket per I/O cycle\n"
1582 "Number of packets\n")
1585 return bgp_wpkt_quanta_config_vty(vty
, argv
[idx_number
]->arg
, 0);
1588 DEFUN (bgp_rpkt_quanta
,
1589 bgp_rpkt_quanta_cmd
,
1590 "read-quanta (1-10)",
1591 "How many packets to read from peer socket per I/O cycle\n"
1592 "Number of packets\n")
1595 return bgp_rpkt_quanta_config_vty(vty
, argv
[idx_number
]->arg
, 1);
1598 DEFUN (no_bgp_rpkt_quanta
,
1599 no_bgp_rpkt_quanta_cmd
,
1600 "no read-quanta (1-10)",
1602 "How many packets to read from peer socket per I/O cycle\n"
1603 "Number of packets\n")
1606 return bgp_rpkt_quanta_config_vty(vty
, argv
[idx_number
]->arg
, 0);
1609 void bgp_config_write_coalesce_time(struct vty
*vty
, struct bgp
*bgp
)
1611 if (!bgp
->heuristic_coalesce
)
1612 vty_out(vty
, " coalesce-time %u\n", bgp
->coalesce_time
);
1616 DEFUN (bgp_coalesce_time
,
1617 bgp_coalesce_time_cmd
,
1618 "coalesce-time (0-4294967295)",
1619 "Subgroup coalesce timer\n"
1620 "Subgroup coalesce timer value (in ms)\n")
1622 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1625 argv_find(argv
, argc
, "(0-4294967295)", &idx
);
1626 bgp
->heuristic_coalesce
= false;
1627 bgp
->coalesce_time
= strtoul(argv
[idx
]->arg
, NULL
, 10);
1631 DEFUN (no_bgp_coalesce_time
,
1632 no_bgp_coalesce_time_cmd
,
1633 "no coalesce-time (0-4294967295)",
1635 "Subgroup coalesce timer\n"
1636 "Subgroup coalesce timer value (in ms)\n")
1638 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1640 bgp
->heuristic_coalesce
= true;
1641 bgp
->coalesce_time
= BGP_DEFAULT_SUBGROUP_COALESCE_TIME
;
1645 /* Maximum-paths configuration */
1646 DEFUN (bgp_maxpaths
,
1648 "maximum-paths " CMD_RANGE_STR(1, MULTIPATH_NUM
),
1649 "Forward packets over multiple paths\n"
1650 "Number of paths\n")
1653 return bgp_maxpaths_config_vty(vty
, BGP_PEER_EBGP
,
1654 argv
[idx_number
]->arg
, 0, 1);
1657 ALIAS_HIDDEN(bgp_maxpaths
, bgp_maxpaths_hidden_cmd
,
1658 "maximum-paths " CMD_RANGE_STR(1, MULTIPATH_NUM
),
1659 "Forward packets over multiple paths\n"
1660 "Number of paths\n")
1662 DEFUN (bgp_maxpaths_ibgp
,
1663 bgp_maxpaths_ibgp_cmd
,
1664 "maximum-paths ibgp " CMD_RANGE_STR(1, MULTIPATH_NUM
),
1665 "Forward packets over multiple paths\n"
1667 "Number of paths\n")
1670 return bgp_maxpaths_config_vty(vty
, BGP_PEER_IBGP
,
1671 argv
[idx_number
]->arg
, 0, 1);
1674 ALIAS_HIDDEN(bgp_maxpaths_ibgp
, bgp_maxpaths_ibgp_hidden_cmd
,
1675 "maximum-paths ibgp " CMD_RANGE_STR(1, MULTIPATH_NUM
),
1676 "Forward packets over multiple paths\n"
1678 "Number of paths\n")
1680 DEFUN (bgp_maxpaths_ibgp_cluster
,
1681 bgp_maxpaths_ibgp_cluster_cmd
,
1682 "maximum-paths ibgp " CMD_RANGE_STR(1, MULTIPATH_NUM
) " equal-cluster-length",
1683 "Forward packets over multiple paths\n"
1686 "Match the cluster length\n")
1689 return bgp_maxpaths_config_vty(
1690 vty
, BGP_PEER_IBGP
, argv
[idx_number
]->arg
,
1691 BGP_FLAG_IBGP_MULTIPATH_SAME_CLUSTERLEN
, 1);
1694 ALIAS_HIDDEN(bgp_maxpaths_ibgp_cluster
, bgp_maxpaths_ibgp_cluster_hidden_cmd
,
1695 "maximum-paths ibgp " CMD_RANGE_STR(
1696 1, MULTIPATH_NUM
) " equal-cluster-length",
1697 "Forward packets over multiple paths\n"
1700 "Match the cluster length\n")
1702 DEFUN (no_bgp_maxpaths
,
1703 no_bgp_maxpaths_cmd
,
1704 "no maximum-paths [" CMD_RANGE_STR(1, MULTIPATH_NUM
) "]",
1706 "Forward packets over multiple paths\n"
1707 "Number of paths\n")
1709 return bgp_maxpaths_config_vty(vty
, BGP_PEER_EBGP
, NULL
, 0, 0);
1712 ALIAS_HIDDEN(no_bgp_maxpaths
, no_bgp_maxpaths_hidden_cmd
,
1713 "no maximum-paths [" CMD_RANGE_STR(1, MULTIPATH_NUM
) "]", NO_STR
1714 "Forward packets over multiple paths\n"
1715 "Number of paths\n")
1717 DEFUN (no_bgp_maxpaths_ibgp
,
1718 no_bgp_maxpaths_ibgp_cmd
,
1719 "no maximum-paths ibgp [" CMD_RANGE_STR(1, MULTIPATH_NUM
) " [equal-cluster-length]]",
1721 "Forward packets over multiple paths\n"
1724 "Match the cluster length\n")
1726 return bgp_maxpaths_config_vty(vty
, BGP_PEER_IBGP
, NULL
, 0, 0);
1729 ALIAS_HIDDEN(no_bgp_maxpaths_ibgp
, no_bgp_maxpaths_ibgp_hidden_cmd
,
1730 "no maximum-paths ibgp [" CMD_RANGE_STR(
1731 1, MULTIPATH_NUM
) " [equal-cluster-length]]",
1733 "Forward packets over multiple paths\n"
1736 "Match the cluster length\n")
1738 void bgp_config_write_maxpaths(struct vty
*vty
, struct bgp
*bgp
, afi_t afi
,
1741 if (bgp
->maxpaths
[afi
][safi
].maxpaths_ebgp
!= MULTIPATH_NUM
) {
1742 vty_out(vty
, " maximum-paths %d\n",
1743 bgp
->maxpaths
[afi
][safi
].maxpaths_ebgp
);
1746 if (bgp
->maxpaths
[afi
][safi
].maxpaths_ibgp
!= MULTIPATH_NUM
) {
1747 vty_out(vty
, " maximum-paths ibgp %d",
1748 bgp
->maxpaths
[afi
][safi
].maxpaths_ibgp
);
1749 if (CHECK_FLAG(bgp
->maxpaths
[afi
][safi
].ibgp_flags
,
1750 BGP_FLAG_IBGP_MULTIPATH_SAME_CLUSTERLEN
))
1751 vty_out(vty
, " equal-cluster-length");
1760 "timers bgp (0-65535) (0-65535)",
1761 "Adjust routing timers\n"
1763 "Keepalive interval\n"
1766 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1768 int idx_number_2
= 3;
1769 unsigned long keepalive
= 0;
1770 unsigned long holdtime
= 0;
1772 keepalive
= strtoul(argv
[idx_number
]->arg
, NULL
, 10);
1773 holdtime
= strtoul(argv
[idx_number_2
]->arg
, NULL
, 10);
1775 /* Holdtime value check. */
1776 if (holdtime
< 3 && holdtime
!= 0) {
1778 "%% hold time value must be either 0 or greater than 3\n");
1779 return CMD_WARNING_CONFIG_FAILED
;
1782 bgp_timers_set(bgp
, keepalive
, holdtime
);
1787 DEFUN (no_bgp_timers
,
1789 "no timers bgp [(0-65535) (0-65535)]",
1791 "Adjust routing timers\n"
1793 "Keepalive interval\n"
1796 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1797 bgp_timers_unset(bgp
);
1803 DEFUN (bgp_client_to_client_reflection
,
1804 bgp_client_to_client_reflection_cmd
,
1805 "bgp client-to-client reflection",
1806 "BGP specific commands\n"
1807 "Configure client to client route reflection\n"
1808 "reflection of routes allowed\n")
1810 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1811 bgp_flag_unset(bgp
, BGP_FLAG_NO_CLIENT_TO_CLIENT
);
1812 bgp_clear_star_soft_out(vty
, bgp
->name
);
1817 DEFUN (no_bgp_client_to_client_reflection
,
1818 no_bgp_client_to_client_reflection_cmd
,
1819 "no bgp client-to-client reflection",
1821 "BGP specific commands\n"
1822 "Configure client to client route reflection\n"
1823 "reflection of routes allowed\n")
1825 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1826 bgp_flag_set(bgp
, BGP_FLAG_NO_CLIENT_TO_CLIENT
);
1827 bgp_clear_star_soft_out(vty
, bgp
->name
);
1832 /* "bgp always-compare-med" configuration. */
1833 DEFUN (bgp_always_compare_med
,
1834 bgp_always_compare_med_cmd
,
1835 "bgp always-compare-med",
1836 "BGP specific commands\n"
1837 "Allow comparing MED from different neighbors\n")
1839 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1840 bgp_flag_set(bgp
, BGP_FLAG_ALWAYS_COMPARE_MED
);
1841 bgp_recalculate_all_bestpaths(bgp
);
1846 DEFUN (no_bgp_always_compare_med
,
1847 no_bgp_always_compare_med_cmd
,
1848 "no bgp always-compare-med",
1850 "BGP specific commands\n"
1851 "Allow comparing MED from different neighbors\n")
1853 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1854 bgp_flag_unset(bgp
, BGP_FLAG_ALWAYS_COMPARE_MED
);
1855 bgp_recalculate_all_bestpaths(bgp
);
1860 /* "bgp deterministic-med" configuration. */
1861 DEFUN (bgp_deterministic_med
,
1862 bgp_deterministic_med_cmd
,
1863 "bgp deterministic-med",
1864 "BGP specific commands\n"
1865 "Pick the best-MED path among paths advertised from the neighboring AS\n")
1867 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1869 if (!bgp_flag_check(bgp
, BGP_FLAG_DETERMINISTIC_MED
)) {
1870 bgp_flag_set(bgp
, BGP_FLAG_DETERMINISTIC_MED
);
1871 bgp_recalculate_all_bestpaths(bgp
);
1877 DEFUN (no_bgp_deterministic_med
,
1878 no_bgp_deterministic_med_cmd
,
1879 "no bgp deterministic-med",
1881 "BGP specific commands\n"
1882 "Pick the best-MED path among paths advertised from the neighboring AS\n")
1884 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1885 int bestpath_per_as_used
;
1889 struct listnode
*node
, *nnode
;
1891 if (bgp_flag_check(bgp
, BGP_FLAG_DETERMINISTIC_MED
)) {
1892 bestpath_per_as_used
= 0;
1894 for (ALL_LIST_ELEMENTS(bgp
->peer
, node
, nnode
, peer
)) {
1895 FOREACH_AFI_SAFI (afi
, safi
)
1896 if (bgp_addpath_dmed_required(
1897 peer
->addpath_type
[afi
][safi
])) {
1898 bestpath_per_as_used
= 1;
1902 if (bestpath_per_as_used
)
1906 if (bestpath_per_as_used
) {
1908 "bgp deterministic-med cannot be disabled while addpath-tx-bestpath-per-AS is in use\n");
1909 return CMD_WARNING_CONFIG_FAILED
;
1911 bgp_flag_unset(bgp
, BGP_FLAG_DETERMINISTIC_MED
);
1912 bgp_recalculate_all_bestpaths(bgp
);
1919 /* "bgp graceful-restart" configuration. */
1920 DEFUN (bgp_graceful_restart
,
1921 bgp_graceful_restart_cmd
,
1922 "bgp graceful-restart",
1923 "BGP specific commands\n"
1924 "Graceful restart capability parameters\n")
1926 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1927 bgp_flag_set(bgp
, BGP_FLAG_GRACEFUL_RESTART
);
1931 DEFUN (no_bgp_graceful_restart
,
1932 no_bgp_graceful_restart_cmd
,
1933 "no bgp graceful-restart",
1935 "BGP specific commands\n"
1936 "Graceful restart capability parameters\n")
1938 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1939 bgp_flag_unset(bgp
, BGP_FLAG_GRACEFUL_RESTART
);
1943 DEFUN (bgp_graceful_restart_stalepath_time
,
1944 bgp_graceful_restart_stalepath_time_cmd
,
1945 "bgp graceful-restart stalepath-time (1-3600)",
1946 "BGP specific commands\n"
1947 "Graceful restart capability parameters\n"
1948 "Set the max time to hold onto restarting peer's stale paths\n"
1949 "Delay value (seconds)\n")
1951 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1955 stalepath
= strtoul(argv
[idx_number
]->arg
, NULL
, 10);
1956 bgp
->stalepath_time
= stalepath
;
1960 DEFUN (bgp_graceful_restart_restart_time
,
1961 bgp_graceful_restart_restart_time_cmd
,
1962 "bgp graceful-restart restart-time (1-3600)",
1963 "BGP specific commands\n"
1964 "Graceful restart capability parameters\n"
1965 "Set the time to wait to delete stale routes before a BGP open message is received\n"
1966 "Delay value (seconds)\n")
1968 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1972 restart
= strtoul(argv
[idx_number
]->arg
, NULL
, 10);
1973 bgp
->restart_time
= restart
;
1977 DEFUN (no_bgp_graceful_restart_stalepath_time
,
1978 no_bgp_graceful_restart_stalepath_time_cmd
,
1979 "no bgp graceful-restart stalepath-time [(1-3600)]",
1981 "BGP specific commands\n"
1982 "Graceful restart capability parameters\n"
1983 "Set the max time to hold onto restarting peer's stale paths\n"
1984 "Delay value (seconds)\n")
1986 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1988 bgp
->stalepath_time
= BGP_DEFAULT_STALEPATH_TIME
;
1992 DEFUN (no_bgp_graceful_restart_restart_time
,
1993 no_bgp_graceful_restart_restart_time_cmd
,
1994 "no bgp graceful-restart restart-time [(1-3600)]",
1996 "BGP specific commands\n"
1997 "Graceful restart capability parameters\n"
1998 "Set the time to wait to delete stale routes before a BGP open message is received\n"
1999 "Delay value (seconds)\n")
2001 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2003 bgp
->restart_time
= BGP_DEFAULT_RESTART_TIME
;
2007 DEFUN (bgp_graceful_restart_preserve_fw
,
2008 bgp_graceful_restart_preserve_fw_cmd
,
2009 "bgp graceful-restart preserve-fw-state",
2010 "BGP specific commands\n"
2011 "Graceful restart capability parameters\n"
2012 "Sets F-bit indication that fib is preserved while doing Graceful Restart\n")
2014 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2015 bgp_flag_set(bgp
, BGP_FLAG_GR_PRESERVE_FWD
);
2019 DEFUN (no_bgp_graceful_restart_preserve_fw
,
2020 no_bgp_graceful_restart_preserve_fw_cmd
,
2021 "no bgp graceful-restart preserve-fw-state",
2023 "BGP specific commands\n"
2024 "Graceful restart capability parameters\n"
2025 "Unsets F-bit indication that fib is preserved while doing Graceful Restart\n")
2027 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2028 bgp_flag_unset(bgp
, BGP_FLAG_GR_PRESERVE_FWD
);
2032 static void bgp_redistribute_redo(struct bgp
*bgp
)
2036 struct list
*red_list
;
2037 struct listnode
*node
;
2038 struct bgp_redist
*red
;
2040 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++) {
2041 for (i
= 0; i
< ZEBRA_ROUTE_MAX
; i
++) {
2043 red_list
= bgp
->redist
[afi
][i
];
2047 for (ALL_LIST_ELEMENTS_RO(red_list
, node
, red
)) {
2048 bgp_redistribute_resend(bgp
, afi
, i
,
2055 /* "bgp graceful-shutdown" configuration */
2056 DEFUN (bgp_graceful_shutdown
,
2057 bgp_graceful_shutdown_cmd
,
2058 "bgp graceful-shutdown",
2060 "Graceful shutdown parameters\n")
2062 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2064 if (!bgp_flag_check(bgp
, BGP_FLAG_GRACEFUL_SHUTDOWN
)) {
2065 bgp_flag_set(bgp
, BGP_FLAG_GRACEFUL_SHUTDOWN
);
2066 bgp_static_redo_import_check(bgp
);
2067 bgp_redistribute_redo(bgp
);
2068 bgp_clear_star_soft_out(vty
, bgp
->name
);
2069 bgp_clear_star_soft_in(vty
, bgp
->name
);
2075 DEFUN (no_bgp_graceful_shutdown
,
2076 no_bgp_graceful_shutdown_cmd
,
2077 "no bgp graceful-shutdown",
2080 "Graceful shutdown parameters\n")
2082 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2084 if (bgp_flag_check(bgp
, BGP_FLAG_GRACEFUL_SHUTDOWN
)) {
2085 bgp_flag_unset(bgp
, BGP_FLAG_GRACEFUL_SHUTDOWN
);
2086 bgp_static_redo_import_check(bgp
);
2087 bgp_redistribute_redo(bgp
);
2088 bgp_clear_star_soft_out(vty
, bgp
->name
);
2089 bgp_clear_star_soft_in(vty
, bgp
->name
);
2095 /* "bgp fast-external-failover" configuration. */
2096 DEFUN (bgp_fast_external_failover
,
2097 bgp_fast_external_failover_cmd
,
2098 "bgp fast-external-failover",
2100 "Immediately reset session if a link to a directly connected external peer goes down\n")
2102 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2103 bgp_flag_unset(bgp
, BGP_FLAG_NO_FAST_EXT_FAILOVER
);
2107 DEFUN (no_bgp_fast_external_failover
,
2108 no_bgp_fast_external_failover_cmd
,
2109 "no bgp fast-external-failover",
2112 "Immediately reset session if a link to a directly connected external peer goes down\n")
2114 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2115 bgp_flag_set(bgp
, BGP_FLAG_NO_FAST_EXT_FAILOVER
);
2119 /* "bgp enforce-first-as" configuration. */
2120 #if CONFDATE > 20190517
2121 CPP_NOTICE("bgpd: remove deprecated '[no] bgp enforce-first-as' commands")
2124 DEFUN_HIDDEN (bgp_enforce_first_as
,
2125 bgp_enforce_first_as_cmd
,
2126 "[no] bgp enforce-first-as",
2129 "Enforce the first AS for EBGP routes\n")
2131 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2133 if (strmatch(argv
[0]->text
, "no"))
2134 bgp_flag_unset(bgp
, BGP_FLAG_ENFORCE_FIRST_AS
);
2136 bgp_flag_set(bgp
, BGP_FLAG_ENFORCE_FIRST_AS
);
2141 /* "bgp bestpath compare-routerid" configuration. */
2142 DEFUN (bgp_bestpath_compare_router_id
,
2143 bgp_bestpath_compare_router_id_cmd
,
2144 "bgp bestpath compare-routerid",
2145 "BGP specific commands\n"
2146 "Change the default bestpath selection\n"
2147 "Compare router-id for identical EBGP paths\n")
2149 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2150 bgp_flag_set(bgp
, BGP_FLAG_COMPARE_ROUTER_ID
);
2151 bgp_recalculate_all_bestpaths(bgp
);
2156 DEFUN (no_bgp_bestpath_compare_router_id
,
2157 no_bgp_bestpath_compare_router_id_cmd
,
2158 "no bgp bestpath compare-routerid",
2160 "BGP specific commands\n"
2161 "Change the default bestpath selection\n"
2162 "Compare router-id for identical EBGP paths\n")
2164 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2165 bgp_flag_unset(bgp
, BGP_FLAG_COMPARE_ROUTER_ID
);
2166 bgp_recalculate_all_bestpaths(bgp
);
2171 /* "bgp bestpath as-path ignore" configuration. */
2172 DEFUN (bgp_bestpath_aspath_ignore
,
2173 bgp_bestpath_aspath_ignore_cmd
,
2174 "bgp bestpath as-path ignore",
2175 "BGP specific commands\n"
2176 "Change the default bestpath selection\n"
2177 "AS-path attribute\n"
2178 "Ignore as-path length in selecting a route\n")
2180 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2181 bgp_flag_set(bgp
, BGP_FLAG_ASPATH_IGNORE
);
2182 bgp_recalculate_all_bestpaths(bgp
);
2187 DEFUN (no_bgp_bestpath_aspath_ignore
,
2188 no_bgp_bestpath_aspath_ignore_cmd
,
2189 "no bgp bestpath as-path ignore",
2191 "BGP specific commands\n"
2192 "Change the default bestpath selection\n"
2193 "AS-path attribute\n"
2194 "Ignore as-path length in selecting a route\n")
2196 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2197 bgp_flag_unset(bgp
, BGP_FLAG_ASPATH_IGNORE
);
2198 bgp_recalculate_all_bestpaths(bgp
);
2203 /* "bgp bestpath as-path confed" configuration. */
2204 DEFUN (bgp_bestpath_aspath_confed
,
2205 bgp_bestpath_aspath_confed_cmd
,
2206 "bgp bestpath as-path confed",
2207 "BGP specific commands\n"
2208 "Change the default bestpath selection\n"
2209 "AS-path attribute\n"
2210 "Compare path lengths including confederation sets & sequences in selecting a route\n")
2212 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2213 bgp_flag_set(bgp
, BGP_FLAG_ASPATH_CONFED
);
2214 bgp_recalculate_all_bestpaths(bgp
);
2219 DEFUN (no_bgp_bestpath_aspath_confed
,
2220 no_bgp_bestpath_aspath_confed_cmd
,
2221 "no bgp bestpath as-path confed",
2223 "BGP specific commands\n"
2224 "Change the default bestpath selection\n"
2225 "AS-path attribute\n"
2226 "Compare path lengths including confederation sets & sequences in selecting a route\n")
2228 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2229 bgp_flag_unset(bgp
, BGP_FLAG_ASPATH_CONFED
);
2230 bgp_recalculate_all_bestpaths(bgp
);
2235 /* "bgp bestpath as-path multipath-relax" configuration. */
2236 DEFUN (bgp_bestpath_aspath_multipath_relax
,
2237 bgp_bestpath_aspath_multipath_relax_cmd
,
2238 "bgp bestpath as-path multipath-relax [<as-set|no-as-set>]",
2239 "BGP specific commands\n"
2240 "Change the default bestpath selection\n"
2241 "AS-path attribute\n"
2242 "Allow load sharing across routes that have different AS paths (but same length)\n"
2243 "Generate an AS_SET\n"
2244 "Do not generate an AS_SET\n")
2246 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2248 bgp_flag_set(bgp
, BGP_FLAG_ASPATH_MULTIPATH_RELAX
);
2250 /* no-as-set is now the default behavior so we can silently
2252 if (argv_find(argv
, argc
, "as-set", &idx
))
2253 bgp_flag_set(bgp
, BGP_FLAG_MULTIPATH_RELAX_AS_SET
);
2255 bgp_flag_unset(bgp
, BGP_FLAG_MULTIPATH_RELAX_AS_SET
);
2257 bgp_recalculate_all_bestpaths(bgp
);
2262 DEFUN (no_bgp_bestpath_aspath_multipath_relax
,
2263 no_bgp_bestpath_aspath_multipath_relax_cmd
,
2264 "no bgp bestpath as-path multipath-relax [<as-set|no-as-set>]",
2266 "BGP specific commands\n"
2267 "Change the default bestpath selection\n"
2268 "AS-path attribute\n"
2269 "Allow load sharing across routes that have different AS paths (but same length)\n"
2270 "Generate an AS_SET\n"
2271 "Do not generate an AS_SET\n")
2273 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2274 bgp_flag_unset(bgp
, BGP_FLAG_ASPATH_MULTIPATH_RELAX
);
2275 bgp_flag_unset(bgp
, BGP_FLAG_MULTIPATH_RELAX_AS_SET
);
2276 bgp_recalculate_all_bestpaths(bgp
);
2281 /* "bgp log-neighbor-changes" configuration. */
2282 DEFUN (bgp_log_neighbor_changes
,
2283 bgp_log_neighbor_changes_cmd
,
2284 "bgp log-neighbor-changes",
2285 "BGP specific commands\n"
2286 "Log neighbor up/down and reset reason\n")
2288 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2289 bgp_flag_set(bgp
, BGP_FLAG_LOG_NEIGHBOR_CHANGES
);
2293 DEFUN (no_bgp_log_neighbor_changes
,
2294 no_bgp_log_neighbor_changes_cmd
,
2295 "no bgp log-neighbor-changes",
2297 "BGP specific commands\n"
2298 "Log neighbor up/down and reset reason\n")
2300 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2301 bgp_flag_unset(bgp
, BGP_FLAG_LOG_NEIGHBOR_CHANGES
);
2305 /* "bgp bestpath med" configuration. */
2306 DEFUN (bgp_bestpath_med
,
2307 bgp_bestpath_med_cmd
,
2308 "bgp bestpath med <confed [missing-as-worst]|missing-as-worst [confed]>",
2309 "BGP specific commands\n"
2310 "Change the default bestpath selection\n"
2312 "Compare MED among confederation paths\n"
2313 "Treat missing MED as the least preferred one\n"
2314 "Treat missing MED as the least preferred one\n"
2315 "Compare MED among confederation paths\n")
2317 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2320 if (argv_find(argv
, argc
, "confed", &idx
))
2321 bgp_flag_set(bgp
, BGP_FLAG_MED_CONFED
);
2323 if (argv_find(argv
, argc
, "missing-as-worst", &idx
))
2324 bgp_flag_set(bgp
, BGP_FLAG_MED_MISSING_AS_WORST
);
2326 bgp_recalculate_all_bestpaths(bgp
);
2331 DEFUN (no_bgp_bestpath_med
,
2332 no_bgp_bestpath_med_cmd
,
2333 "no bgp bestpath med <confed [missing-as-worst]|missing-as-worst [confed]>",
2335 "BGP specific commands\n"
2336 "Change the default bestpath selection\n"
2338 "Compare MED among confederation paths\n"
2339 "Treat missing MED as the least preferred one\n"
2340 "Treat missing MED as the least preferred one\n"
2341 "Compare MED among confederation paths\n")
2343 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2346 if (argv_find(argv
, argc
, "confed", &idx
))
2347 bgp_flag_unset(bgp
, BGP_FLAG_MED_CONFED
);
2349 if (argv_find(argv
, argc
, "missing-as-worst", &idx
))
2350 bgp_flag_unset(bgp
, BGP_FLAG_MED_MISSING_AS_WORST
);
2352 bgp_recalculate_all_bestpaths(bgp
);
2357 /* "no bgp default ipv4-unicast". */
2358 DEFUN (no_bgp_default_ipv4_unicast
,
2359 no_bgp_default_ipv4_unicast_cmd
,
2360 "no bgp default ipv4-unicast",
2362 "BGP specific commands\n"
2363 "Configure BGP defaults\n"
2364 "Activate ipv4-unicast for a peer by default\n")
2366 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2367 bgp_flag_set(bgp
, BGP_FLAG_NO_DEFAULT_IPV4
);
2371 DEFUN (bgp_default_ipv4_unicast
,
2372 bgp_default_ipv4_unicast_cmd
,
2373 "bgp default ipv4-unicast",
2374 "BGP specific commands\n"
2375 "Configure BGP defaults\n"
2376 "Activate ipv4-unicast for a peer by default\n")
2378 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2379 bgp_flag_unset(bgp
, BGP_FLAG_NO_DEFAULT_IPV4
);
2383 /* Display hostname in certain command outputs */
2384 DEFUN (bgp_default_show_hostname
,
2385 bgp_default_show_hostname_cmd
,
2386 "bgp default show-hostname",
2387 "BGP specific commands\n"
2388 "Configure BGP defaults\n"
2389 "Show hostname in certain command outputs\n")
2391 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2392 bgp_flag_set(bgp
, BGP_FLAG_SHOW_HOSTNAME
);
2396 DEFUN (no_bgp_default_show_hostname
,
2397 no_bgp_default_show_hostname_cmd
,
2398 "no bgp default show-hostname",
2400 "BGP specific commands\n"
2401 "Configure BGP defaults\n"
2402 "Show hostname in certain command outputs\n")
2404 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2405 bgp_flag_unset(bgp
, BGP_FLAG_SHOW_HOSTNAME
);
2409 /* "bgp network import-check" configuration. */
2410 DEFUN (bgp_network_import_check
,
2411 bgp_network_import_check_cmd
,
2412 "bgp network import-check",
2413 "BGP specific commands\n"
2414 "BGP network command\n"
2415 "Check BGP network route exists in IGP\n")
2417 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2418 if (!bgp_flag_check(bgp
, BGP_FLAG_IMPORT_CHECK
)) {
2419 bgp_flag_set(bgp
, BGP_FLAG_IMPORT_CHECK
);
2420 bgp_static_redo_import_check(bgp
);
2426 ALIAS_HIDDEN(bgp_network_import_check
, bgp_network_import_check_exact_cmd
,
2427 "bgp network import-check exact",
2428 "BGP specific commands\n"
2429 "BGP network command\n"
2430 "Check BGP network route exists in IGP\n"
2431 "Match route precisely\n")
2433 DEFUN (no_bgp_network_import_check
,
2434 no_bgp_network_import_check_cmd
,
2435 "no bgp network import-check",
2437 "BGP specific commands\n"
2438 "BGP network command\n"
2439 "Check BGP network route exists in IGP\n")
2441 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2442 if (bgp_flag_check(bgp
, BGP_FLAG_IMPORT_CHECK
)) {
2443 bgp_flag_unset(bgp
, BGP_FLAG_IMPORT_CHECK
);
2444 bgp_static_redo_import_check(bgp
);
2450 DEFUN (bgp_default_local_preference
,
2451 bgp_default_local_preference_cmd
,
2452 "bgp default local-preference (0-4294967295)",
2453 "BGP specific commands\n"
2454 "Configure BGP defaults\n"
2455 "local preference (higher=more preferred)\n"
2456 "Configure default local preference value\n")
2458 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2460 uint32_t local_pref
;
2462 local_pref
= strtoul(argv
[idx_number
]->arg
, NULL
, 10);
2464 bgp_default_local_preference_set(bgp
, local_pref
);
2465 bgp_clear_star_soft_in(vty
, bgp
->name
);
2470 DEFUN (no_bgp_default_local_preference
,
2471 no_bgp_default_local_preference_cmd
,
2472 "no bgp default local-preference [(0-4294967295)]",
2474 "BGP specific commands\n"
2475 "Configure BGP defaults\n"
2476 "local preference (higher=more preferred)\n"
2477 "Configure default local preference value\n")
2479 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2480 bgp_default_local_preference_unset(bgp
);
2481 bgp_clear_star_soft_in(vty
, bgp
->name
);
2487 DEFUN (bgp_default_subgroup_pkt_queue_max
,
2488 bgp_default_subgroup_pkt_queue_max_cmd
,
2489 "bgp default subgroup-pkt-queue-max (20-100)",
2490 "BGP specific commands\n"
2491 "Configure BGP defaults\n"
2492 "subgroup-pkt-queue-max\n"
2493 "Configure subgroup packet queue max\n")
2495 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2499 max_size
= strtoul(argv
[idx_number
]->arg
, NULL
, 10);
2501 bgp_default_subgroup_pkt_queue_max_set(bgp
, max_size
);
2506 DEFUN (no_bgp_default_subgroup_pkt_queue_max
,
2507 no_bgp_default_subgroup_pkt_queue_max_cmd
,
2508 "no bgp default subgroup-pkt-queue-max [(20-100)]",
2510 "BGP specific commands\n"
2511 "Configure BGP defaults\n"
2512 "subgroup-pkt-queue-max\n"
2513 "Configure subgroup packet queue max\n")
2515 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2516 bgp_default_subgroup_pkt_queue_max_unset(bgp
);
2521 DEFUN (bgp_rr_allow_outbound_policy
,
2522 bgp_rr_allow_outbound_policy_cmd
,
2523 "bgp route-reflector allow-outbound-policy",
2524 "BGP specific commands\n"
2525 "Allow modifications made by out route-map\n"
2526 "on ibgp neighbors\n")
2528 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2530 if (!bgp_flag_check(bgp
, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY
)) {
2531 bgp_flag_set(bgp
, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY
);
2532 update_group_announce_rrclients(bgp
);
2533 bgp_clear_star_soft_out(vty
, bgp
->name
);
2539 DEFUN (no_bgp_rr_allow_outbound_policy
,
2540 no_bgp_rr_allow_outbound_policy_cmd
,
2541 "no bgp route-reflector allow-outbound-policy",
2543 "BGP specific commands\n"
2544 "Allow modifications made by out route-map\n"
2545 "on ibgp neighbors\n")
2547 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2549 if (bgp_flag_check(bgp
, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY
)) {
2550 bgp_flag_unset(bgp
, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY
);
2551 update_group_announce_rrclients(bgp
);
2552 bgp_clear_star_soft_out(vty
, bgp
->name
);
2558 DEFUN (bgp_listen_limit
,
2559 bgp_listen_limit_cmd
,
2560 "bgp listen limit (1-5000)",
2561 "BGP specific commands\n"
2562 "Configure BGP defaults\n"
2563 "maximum number of BGP Dynamic Neighbors that can be created\n"
2564 "Configure Dynamic Neighbors listen limit value\n")
2566 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2570 listen_limit
= strtoul(argv
[idx_number
]->arg
, NULL
, 10);
2572 bgp_listen_limit_set(bgp
, listen_limit
);
2577 DEFUN (no_bgp_listen_limit
,
2578 no_bgp_listen_limit_cmd
,
2579 "no bgp listen limit [(1-5000)]",
2580 "BGP specific commands\n"
2581 "Configure BGP defaults\n"
2582 "unset maximum number of BGP Dynamic Neighbors that can be created\n"
2583 "Configure Dynamic Neighbors listen limit value to default\n"
2584 "Configure Dynamic Neighbors listen limit value\n")
2586 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2587 bgp_listen_limit_unset(bgp
);
2593 * Check if this listen range is already configured. Check for exact
2594 * match or overlap based on input.
2596 static struct peer_group
*listen_range_exists(struct bgp
*bgp
,
2597 struct prefix
*range
, int exact
)
2599 struct listnode
*node
, *nnode
;
2600 struct listnode
*node1
, *nnode1
;
2601 struct peer_group
*group
;
2606 afi
= family2afi(range
->family
);
2607 for (ALL_LIST_ELEMENTS(bgp
->group
, node
, nnode
, group
)) {
2608 for (ALL_LIST_ELEMENTS(group
->listen_range
[afi
], node1
, nnode1
,
2611 match
= prefix_same(range
, lr
);
2613 match
= (prefix_match(range
, lr
)
2614 || prefix_match(lr
, range
));
2623 DEFUN (bgp_listen_range
,
2624 bgp_listen_range_cmd
,
2625 "bgp listen range <A.B.C.D/M|X:X::X:X/M> peer-group WORD",
2626 "BGP specific commands\n"
2627 "Configure BGP dynamic neighbors listen range\n"
2628 "Configure BGP dynamic neighbors listen range\n"
2630 "Member of the peer-group\n"
2631 "Peer-group name\n")
2633 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2634 struct prefix range
;
2635 struct peer_group
*group
, *existing_group
;
2640 argv_find(argv
, argc
, "A.B.C.D/M", &idx
);
2641 argv_find(argv
, argc
, "X:X::X:X/M", &idx
);
2642 char *prefix
= argv
[idx
]->arg
;
2643 argv_find(argv
, argc
, "WORD", &idx
);
2644 char *peergroup
= argv
[idx
]->arg
;
2646 /* Convert IP prefix string to struct prefix. */
2647 ret
= str2prefix(prefix
, &range
);
2649 vty_out(vty
, "%% Malformed listen range\n");
2650 return CMD_WARNING_CONFIG_FAILED
;
2653 afi
= family2afi(range
.family
);
2655 if (afi
== AFI_IP6
&& IN6_IS_ADDR_LINKLOCAL(&range
.u
.prefix6
)) {
2657 "%% Malformed listen range (link-local address)\n");
2658 return CMD_WARNING_CONFIG_FAILED
;
2663 /* Check if same listen range is already configured. */
2664 existing_group
= listen_range_exists(bgp
, &range
, 1);
2665 if (existing_group
) {
2666 if (strcmp(existing_group
->name
, peergroup
) == 0)
2670 "%% Same listen range is attached to peer-group %s\n",
2671 existing_group
->name
);
2672 return CMD_WARNING_CONFIG_FAILED
;
2676 /* Check if an overlapping listen range exists. */
2677 if (listen_range_exists(bgp
, &range
, 0)) {
2679 "%% Listen range overlaps with existing listen range\n");
2680 return CMD_WARNING_CONFIG_FAILED
;
2683 group
= peer_group_lookup(bgp
, peergroup
);
2685 vty_out(vty
, "%% Configure the peer-group first\n");
2686 return CMD_WARNING_CONFIG_FAILED
;
2689 ret
= peer_group_listen_range_add(group
, &range
);
2690 return bgp_vty_return(vty
, ret
);
2693 DEFUN (no_bgp_listen_range
,
2694 no_bgp_listen_range_cmd
,
2695 "no bgp listen range <A.B.C.D/M|X:X::X:X/M> peer-group WORD",
2697 "BGP specific commands\n"
2698 "Unconfigure BGP dynamic neighbors listen range\n"
2699 "Unconfigure BGP dynamic neighbors listen range\n"
2701 "Member of the peer-group\n"
2702 "Peer-group name\n")
2704 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2705 struct prefix range
;
2706 struct peer_group
*group
;
2711 argv_find(argv
, argc
, "A.B.C.D/M", &idx
);
2712 argv_find(argv
, argc
, "X:X::X:X/M", &idx
);
2713 char *prefix
= argv
[idx
]->arg
;
2714 argv_find(argv
, argc
, "WORD", &idx
);
2715 char *peergroup
= argv
[idx
]->arg
;
2717 /* Convert IP prefix string to struct prefix. */
2718 ret
= str2prefix(prefix
, &range
);
2720 vty_out(vty
, "%% Malformed listen range\n");
2721 return CMD_WARNING_CONFIG_FAILED
;
2724 afi
= family2afi(range
.family
);
2726 if (afi
== AFI_IP6
&& IN6_IS_ADDR_LINKLOCAL(&range
.u
.prefix6
)) {
2728 "%% Malformed listen range (link-local address)\n");
2729 return CMD_WARNING_CONFIG_FAILED
;
2734 group
= peer_group_lookup(bgp
, peergroup
);
2736 vty_out(vty
, "%% Peer-group does not exist\n");
2737 return CMD_WARNING_CONFIG_FAILED
;
2740 ret
= peer_group_listen_range_del(group
, &range
);
2741 return bgp_vty_return(vty
, ret
);
2744 void bgp_config_write_listen(struct vty
*vty
, struct bgp
*bgp
)
2746 struct peer_group
*group
;
2747 struct listnode
*node
, *nnode
, *rnode
, *nrnode
;
2748 struct prefix
*range
;
2750 char buf
[PREFIX2STR_BUFFER
];
2752 if (bgp
->dynamic_neighbors_limit
!= BGP_DYNAMIC_NEIGHBORS_LIMIT_DEFAULT
)
2753 vty_out(vty
, " bgp listen limit %d\n",
2754 bgp
->dynamic_neighbors_limit
);
2756 for (ALL_LIST_ELEMENTS(bgp
->group
, node
, nnode
, group
)) {
2757 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++) {
2758 for (ALL_LIST_ELEMENTS(group
->listen_range
[afi
], rnode
,
2760 prefix2str(range
, buf
, sizeof(buf
));
2762 " bgp listen range %s peer-group %s\n",
2770 DEFUN (bgp_disable_connected_route_check
,
2771 bgp_disable_connected_route_check_cmd
,
2772 "bgp disable-ebgp-connected-route-check",
2773 "BGP specific commands\n"
2774 "Disable checking if nexthop is connected on ebgp sessions\n")
2776 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2777 bgp_flag_set(bgp
, BGP_FLAG_DISABLE_NH_CONNECTED_CHK
);
2778 bgp_clear_star_soft_in(vty
, bgp
->name
);
2783 DEFUN (no_bgp_disable_connected_route_check
,
2784 no_bgp_disable_connected_route_check_cmd
,
2785 "no bgp disable-ebgp-connected-route-check",
2787 "BGP specific commands\n"
2788 "Disable checking if nexthop is connected on ebgp sessions\n")
2790 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2791 bgp_flag_unset(bgp
, BGP_FLAG_DISABLE_NH_CONNECTED_CHK
);
2792 bgp_clear_star_soft_in(vty
, bgp
->name
);
2798 static int peer_remote_as_vty(struct vty
*vty
, const char *peer_str
,
2799 const char *as_str
, afi_t afi
, safi_t safi
)
2801 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2804 int as_type
= AS_SPECIFIED
;
2807 if (as_str
[0] == 'i') {
2809 as_type
= AS_INTERNAL
;
2810 } else if (as_str
[0] == 'e') {
2812 as_type
= AS_EXTERNAL
;
2814 /* Get AS number. */
2815 as
= strtoul(as_str
, NULL
, 10);
2818 /* If peer is peer group, call proper function. */
2819 ret
= str2sockunion(peer_str
, &su
);
2821 /* Check for peer by interface */
2822 ret
= peer_remote_as(bgp
, NULL
, peer_str
, &as
, as_type
, afi
,
2825 ret
= peer_group_remote_as(bgp
, peer_str
, &as
, as_type
);
2828 "%% Create the peer-group or interface first or specify \"interface\" keyword\n");
2829 vty_out(vty
, "%% if using an unnumbered interface neighbor\n");
2830 return CMD_WARNING_CONFIG_FAILED
;
2835 if (peer_address_self_check(bgp
, &su
)) {
2837 "%% Can not configure the local system as neighbor\n");
2838 return CMD_WARNING_CONFIG_FAILED
;
2840 ret
= peer_remote_as(bgp
, &su
, NULL
, &as
, as_type
, afi
, safi
);
2843 /* This peer belongs to peer group. */
2845 case BGP_ERR_PEER_GROUP_MEMBER
:
2847 "%% Peer-group AS %u. Cannot configure remote-as for member\n",
2849 return CMD_WARNING_CONFIG_FAILED
;
2850 case BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT
:
2852 "%% The AS# can not be changed from %u to %s, peer-group members must be all internal or all external\n",
2854 return CMD_WARNING_CONFIG_FAILED
;
2856 return bgp_vty_return(vty
, ret
);
2859 DEFUN (bgp_default_shutdown
,
2860 bgp_default_shutdown_cmd
,
2861 "[no] bgp default shutdown",
2864 "Configure BGP defaults\n"
2865 "Apply administrative shutdown to newly configured peers\n")
2867 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2868 bgp
->autoshutdown
= !strmatch(argv
[0]->text
, "no");
2872 DEFUN (neighbor_remote_as
,
2873 neighbor_remote_as_cmd
,
2874 "neighbor <A.B.C.D|X:X::X:X|WORD> remote-as <(1-4294967295)|internal|external>",
2877 "Specify a BGP neighbor\n"
2879 "Internal BGP peer\n"
2880 "External BGP peer\n")
2883 int idx_remote_as
= 3;
2884 return peer_remote_as_vty(vty
, argv
[idx_peer
]->arg
,
2885 argv
[idx_remote_as
]->arg
, AFI_IP
,
2889 static int peer_conf_interface_get(struct vty
*vty
, const char *conf_if
,
2890 afi_t afi
, safi_t safi
, int v6only
,
2891 const char *peer_group_name
,
2894 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2896 int as_type
= AS_UNSPECIFIED
;
2898 struct peer_group
*group
;
2902 group
= peer_group_lookup(bgp
, conf_if
);
2905 vty_out(vty
, "%% Name conflict with peer-group \n");
2906 return CMD_WARNING_CONFIG_FAILED
;
2910 if (as_str
[0] == 'i') {
2911 as_type
= AS_INTERNAL
;
2912 } else if (as_str
[0] == 'e') {
2913 as_type
= AS_EXTERNAL
;
2915 /* Get AS number. */
2916 as
= strtoul(as_str
, NULL
, 10);
2917 as_type
= AS_SPECIFIED
;
2921 peer
= peer_lookup_by_conf_if(bgp
, conf_if
);
2924 ret
= peer_remote_as(bgp
, NULL
, conf_if
, &as
, as_type
,
2927 if (bgp_flag_check(bgp
, BGP_FLAG_NO_DEFAULT_IPV4
)
2928 && afi
== AFI_IP
&& safi
== SAFI_UNICAST
)
2929 peer
= peer_create(NULL
, conf_if
, bgp
, bgp
->as
, as
,
2930 as_type
, 0, 0, NULL
);
2932 peer
= peer_create(NULL
, conf_if
, bgp
, bgp
->as
, as
,
2933 as_type
, afi
, safi
, NULL
);
2936 vty_out(vty
, "%% BGP failed to create peer\n");
2937 return CMD_WARNING_CONFIG_FAILED
;
2941 peer_flag_set(peer
, PEER_FLAG_IFPEER_V6ONLY
);
2943 /* Request zebra to initiate IPv6 RAs on this interface. We do
2945 * any unnumbered peer in order to not worry about run-time
2947 * (e.g., peering is initially IPv4, but the IPv4 /30 or /31
2949 * gets deleted later etc.)
2952 bgp_zebra_initiate_radv(bgp
, peer
);
2955 if ((v6only
&& !CHECK_FLAG(peer
->flags
, PEER_FLAG_IFPEER_V6ONLY
))
2956 || (!v6only
&& CHECK_FLAG(peer
->flags
, PEER_FLAG_IFPEER_V6ONLY
))) {
2958 peer_flag_set(peer
, PEER_FLAG_IFPEER_V6ONLY
);
2960 peer_flag_unset(peer
, PEER_FLAG_IFPEER_V6ONLY
);
2962 /* v6only flag changed. Reset bgp seesion */
2963 if (BGP_IS_VALID_STATE_FOR_NOTIF(peer
->status
)) {
2964 peer
->last_reset
= PEER_DOWN_V6ONLY_CHANGE
;
2965 bgp_notify_send(peer
, BGP_NOTIFY_CEASE
,
2966 BGP_NOTIFY_CEASE_CONFIG_CHANGE
);
2968 bgp_session_reset(peer
);
2971 if (!CHECK_FLAG(peer
->flags_invert
, PEER_FLAG_CAPABILITY_ENHE
)) {
2972 SET_FLAG(peer
->flags
, PEER_FLAG_CAPABILITY_ENHE
);
2973 SET_FLAG(peer
->flags_invert
, PEER_FLAG_CAPABILITY_ENHE
);
2974 UNSET_FLAG(peer
->flags_override
, PEER_FLAG_CAPABILITY_ENHE
);
2977 if (peer_group_name
) {
2978 group
= peer_group_lookup(bgp
, peer_group_name
);
2980 vty_out(vty
, "%% Configure the peer-group first\n");
2981 return CMD_WARNING_CONFIG_FAILED
;
2984 ret
= peer_group_bind(bgp
, &su
, peer
, group
, &as
);
2987 return bgp_vty_return(vty
, ret
);
2990 DEFUN (neighbor_interface_config
,
2991 neighbor_interface_config_cmd
,
2992 "neighbor WORD interface [peer-group WORD]",
2994 "Interface name or neighbor tag\n"
2995 "Enable BGP on interface\n"
2996 "Member of the peer-group\n"
2997 "Peer-group name\n")
3000 int idx_peer_group_word
= 4;
3002 if (argc
> idx_peer_group_word
)
3003 return peer_conf_interface_get(
3004 vty
, argv
[idx_word
]->arg
, AFI_IP
, SAFI_UNICAST
, 0,
3005 argv
[idx_peer_group_word
]->arg
, NULL
);
3007 return peer_conf_interface_get(vty
, argv
[idx_word
]->arg
, AFI_IP
,
3008 SAFI_UNICAST
, 0, NULL
, NULL
);
3011 DEFUN (neighbor_interface_config_v6only
,
3012 neighbor_interface_config_v6only_cmd
,
3013 "neighbor WORD interface v6only [peer-group WORD]",
3015 "Interface name or neighbor tag\n"
3016 "Enable BGP on interface\n"
3017 "Enable BGP with v6 link-local only\n"
3018 "Member of the peer-group\n"
3019 "Peer-group name\n")
3022 int idx_peer_group_word
= 5;
3024 if (argc
> idx_peer_group_word
)
3025 return peer_conf_interface_get(
3026 vty
, argv
[idx_word
]->arg
, AFI_IP
, SAFI_UNICAST
, 1,
3027 argv
[idx_peer_group_word
]->arg
, NULL
);
3029 return peer_conf_interface_get(vty
, argv
[idx_word
]->arg
, AFI_IP
,
3030 SAFI_UNICAST
, 1, NULL
, NULL
);
3034 DEFUN (neighbor_interface_config_remote_as
,
3035 neighbor_interface_config_remote_as_cmd
,
3036 "neighbor WORD interface remote-as <(1-4294967295)|internal|external>",
3038 "Interface name or neighbor tag\n"
3039 "Enable BGP on interface\n"
3040 "Specify a BGP neighbor\n"
3042 "Internal BGP peer\n"
3043 "External BGP peer\n")
3046 int idx_remote_as
= 4;
3047 return peer_conf_interface_get(vty
, argv
[idx_word
]->arg
, AFI_IP
,
3048 SAFI_UNICAST
, 0, NULL
,
3049 argv
[idx_remote_as
]->arg
);
3052 DEFUN (neighbor_interface_v6only_config_remote_as
,
3053 neighbor_interface_v6only_config_remote_as_cmd
,
3054 "neighbor WORD interface v6only remote-as <(1-4294967295)|internal|external>",
3056 "Interface name or neighbor tag\n"
3057 "Enable BGP with v6 link-local only\n"
3058 "Enable BGP on interface\n"
3059 "Specify a BGP neighbor\n"
3061 "Internal BGP peer\n"
3062 "External BGP peer\n")
3065 int idx_remote_as
= 5;
3066 return peer_conf_interface_get(vty
, argv
[idx_word
]->arg
, AFI_IP
,
3067 SAFI_UNICAST
, 1, NULL
,
3068 argv
[idx_remote_as
]->arg
);
3071 DEFUN (neighbor_peer_group
,
3072 neighbor_peer_group_cmd
,
3073 "neighbor WORD peer-group",
3075 "Interface name or neighbor tag\n"
3076 "Configure peer-group\n")
3078 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
3081 struct peer_group
*group
;
3083 peer
= peer_lookup_by_conf_if(bgp
, argv
[idx_word
]->arg
);
3085 vty_out(vty
, "%% Name conflict with interface: \n");
3086 return CMD_WARNING_CONFIG_FAILED
;
3089 group
= peer_group_get(bgp
, argv
[idx_word
]->arg
);
3091 vty_out(vty
, "%% BGP failed to find or create peer-group\n");
3092 return CMD_WARNING_CONFIG_FAILED
;
3100 "no neighbor <WORD|<A.B.C.D|X:X::X:X> [remote-as <(1-4294967295)|internal|external>]>",
3104 "Specify a BGP neighbor\n"
3106 "Internal BGP peer\n"
3107 "External BGP peer\n")
3109 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
3113 struct peer_group
*group
;
3117 ret
= str2sockunion(argv
[idx_peer
]->arg
, &su
);
3119 /* look up for neighbor by interface name config. */
3120 peer
= peer_lookup_by_conf_if(bgp
, argv
[idx_peer
]->arg
);
3122 /* Request zebra to terminate IPv6 RAs on this
3125 bgp_zebra_terminate_radv(peer
->bgp
, peer
);
3130 group
= peer_group_lookup(bgp
, argv
[idx_peer
]->arg
);
3132 peer_group_delete(group
);
3134 vty_out(vty
, "%% Create the peer-group first\n");
3135 return CMD_WARNING_CONFIG_FAILED
;
3138 peer
= peer_lookup(bgp
, &su
);
3140 if (peer_dynamic_neighbor(peer
)) {
3142 "%% Operation not allowed on a dynamic neighbor\n");
3143 return CMD_WARNING_CONFIG_FAILED
;
3146 other
= peer
->doppelganger
;
3148 if (other
&& other
->status
!= Deleted
)
3156 DEFUN (no_neighbor_interface_config
,
3157 no_neighbor_interface_config_cmd
,
3158 "no neighbor WORD interface [v6only] [peer-group WORD] [remote-as <(1-4294967295)|internal|external>]",
3162 "Configure BGP on interface\n"
3163 "Enable BGP with v6 link-local only\n"
3164 "Member of the peer-group\n"
3166 "Specify a BGP neighbor\n"
3168 "Internal BGP peer\n"
3169 "External BGP peer\n")
3171 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
3175 /* look up for neighbor by interface name config. */
3176 peer
= peer_lookup_by_conf_if(bgp
, argv
[idx_word
]->arg
);
3178 /* Request zebra to terminate IPv6 RAs on this interface. */
3180 bgp_zebra_terminate_radv(peer
->bgp
, peer
);
3183 vty_out(vty
, "%% Create the bgp interface first\n");
3184 return CMD_WARNING_CONFIG_FAILED
;
3189 DEFUN (no_neighbor_peer_group
,
3190 no_neighbor_peer_group_cmd
,
3191 "no neighbor WORD peer-group",
3195 "Configure peer-group\n")
3197 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
3199 struct peer_group
*group
;
3201 group
= peer_group_lookup(bgp
, argv
[idx_word
]->arg
);
3203 peer_group_delete(group
);
3205 vty_out(vty
, "%% Create the peer-group first\n");
3206 return CMD_WARNING_CONFIG_FAILED
;
3211 DEFUN (no_neighbor_interface_peer_group_remote_as
,
3212 no_neighbor_interface_peer_group_remote_as_cmd
,
3213 "no neighbor WORD remote-as <(1-4294967295)|internal|external>",
3216 "Interface name or neighbor tag\n"
3217 "Specify a BGP neighbor\n"
3219 "Internal BGP peer\n"
3220 "External BGP peer\n")
3222 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
3224 struct peer_group
*group
;
3227 /* look up for neighbor by interface name config. */
3228 peer
= peer_lookup_by_conf_if(bgp
, argv
[idx_word
]->arg
);
3230 peer_as_change(peer
, 0, AS_SPECIFIED
);
3234 group
= peer_group_lookup(bgp
, argv
[idx_word
]->arg
);
3236 peer_group_remote_as_delete(group
);
3238 vty_out(vty
, "%% Create the peer-group or interface first\n");
3239 return CMD_WARNING_CONFIG_FAILED
;
3244 DEFUN (neighbor_local_as
,
3245 neighbor_local_as_cmd
,
3246 "neighbor <A.B.C.D|X:X::X:X|WORD> local-as (1-4294967295)",
3249 "Specify a local-as number\n"
3250 "AS number used as local AS\n")
3258 peer
= peer_and_group_lookup_vty(vty
, argv
[idx_peer
]->arg
);
3260 return CMD_WARNING_CONFIG_FAILED
;
3262 as
= strtoul(argv
[idx_number
]->arg
, NULL
, 10);
3263 ret
= peer_local_as_set(peer
, as
, 0, 0);
3264 return bgp_vty_return(vty
, ret
);
3267 DEFUN (neighbor_local_as_no_prepend
,
3268 neighbor_local_as_no_prepend_cmd
,
3269 "neighbor <A.B.C.D|X:X::X:X|WORD> local-as (1-4294967295) no-prepend",
3272 "Specify a local-as number\n"
3273 "AS number used as local AS\n"
3274 "Do not prepend local-as to updates from ebgp peers\n")
3282 peer
= peer_and_group_lookup_vty(vty
, argv
[idx_peer
]->arg
);
3284 return CMD_WARNING_CONFIG_FAILED
;
3286 as
= strtoul(argv
[idx_number
]->arg
, NULL
, 10);
3287 ret
= peer_local_as_set(peer
, as
, 1, 0);
3288 return bgp_vty_return(vty
, ret
);
3291 DEFUN (neighbor_local_as_no_prepend_replace_as
,
3292 neighbor_local_as_no_prepend_replace_as_cmd
,
3293 "neighbor <A.B.C.D|X:X::X:X|WORD> local-as (1-4294967295) no-prepend replace-as",
3296 "Specify a local-as number\n"
3297 "AS number used as local AS\n"
3298 "Do not prepend local-as to updates from ebgp peers\n"
3299 "Do not prepend local-as to updates from ibgp peers\n")
3307 peer
= peer_and_group_lookup_vty(vty
, argv
[idx_peer
]->arg
);
3309 return CMD_WARNING_CONFIG_FAILED
;
3311 as
= strtoul(argv
[idx_number
]->arg
, NULL
, 10);
3312 ret
= peer_local_as_set(peer
, as
, 1, 1);
3313 return bgp_vty_return(vty
, ret
);
3316 DEFUN (no_neighbor_local_as
,
3317 no_neighbor_local_as_cmd
,
3318 "no neighbor <A.B.C.D|X:X::X:X|WORD> local-as [(1-4294967295) [no-prepend [replace-as]]]",
3322 "Specify a local-as number\n"
3323 "AS number used as local AS\n"
3324 "Do not prepend local-as to updates from ebgp peers\n"
3325 "Do not prepend local-as to updates from ibgp peers\n")
3331 peer
= peer_and_group_lookup_vty(vty
, argv
[idx_peer
]->arg
);
3333 return CMD_WARNING_CONFIG_FAILED
;
3335 ret
= peer_local_as_unset(peer
);
3336 return bgp_vty_return(vty
, ret
);
3340 DEFUN (neighbor_solo
,
3342 "neighbor <A.B.C.D|X:X::X:X|WORD> solo",
3345 "Solo peer - part of its own update group\n")
3351 peer
= peer_and_group_lookup_vty(vty
, argv
[idx_peer
]->arg
);
3353 return CMD_WARNING_CONFIG_FAILED
;
3355 ret
= update_group_adjust_soloness(peer
, 1);
3356 return bgp_vty_return(vty
, ret
);
3359 DEFUN (no_neighbor_solo
,
3360 no_neighbor_solo_cmd
,
3361 "no neighbor <A.B.C.D|X:X::X:X|WORD> solo",
3365 "Solo peer - part of its own update group\n")
3371 peer
= peer_and_group_lookup_vty(vty
, argv
[idx_peer
]->arg
);
3373 return CMD_WARNING_CONFIG_FAILED
;
3375 ret
= update_group_adjust_soloness(peer
, 0);
3376 return bgp_vty_return(vty
, ret
);
3379 DEFUN (neighbor_password
,
3380 neighbor_password_cmd
,
3381 "neighbor <A.B.C.D|X:X::X:X|WORD> password LINE",
3392 peer
= peer_and_group_lookup_vty(vty
, argv
[idx_peer
]->arg
);
3394 return CMD_WARNING_CONFIG_FAILED
;
3396 ret
= peer_password_set(peer
, argv
[idx_line
]->arg
);
3397 return bgp_vty_return(vty
, ret
);
3400 DEFUN (no_neighbor_password
,
3401 no_neighbor_password_cmd
,
3402 "no neighbor <A.B.C.D|X:X::X:X|WORD> password [LINE]",
3413 peer
= peer_and_group_lookup_vty(vty
, argv
[idx_peer
]->arg
);
3415 return CMD_WARNING_CONFIG_FAILED
;
3417 ret
= peer_password_unset(peer
);
3418 return bgp_vty_return(vty
, ret
);
3421 DEFUN (neighbor_activate
,
3422 neighbor_activate_cmd
,
3423 "neighbor <A.B.C.D|X:X::X:X|WORD> activate",
3426 "Enable the Address Family for this Neighbor\n")
3432 peer
= peer_and_group_lookup_vty(vty
, argv
[idx_peer
]->arg
);
3434 return CMD_WARNING_CONFIG_FAILED
;
3436 ret
= peer_activate(peer
, bgp_node_afi(vty
), bgp_node_safi(vty
));
3437 return bgp_vty_return(vty
, ret
);
3440 ALIAS_HIDDEN(neighbor_activate
, neighbor_activate_hidden_cmd
,
3441 "neighbor <A.B.C.D|X:X::X:X|WORD> activate",
3442 NEIGHBOR_STR NEIGHBOR_ADDR_STR2
3443 "Enable the Address Family for this Neighbor\n")
3445 DEFUN (no_neighbor_activate
,
3446 no_neighbor_activate_cmd
,
3447 "no neighbor <A.B.C.D|X:X::X:X|WORD> activate",
3451 "Enable the Address Family for this Neighbor\n")
3458 peer
= peer_and_group_lookup_vty(vty
, argv
[idx_peer
]->arg
);
3460 return CMD_WARNING_CONFIG_FAILED
;
3462 ret
= peer_deactivate(peer
, bgp_node_afi(vty
), bgp_node_safi(vty
));
3463 return bgp_vty_return(vty
, ret
);
3466 ALIAS_HIDDEN(no_neighbor_activate
, no_neighbor_activate_hidden_cmd
,
3467 "no neighbor <A.B.C.D|X:X::X:X|WORD> activate",
3468 NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2
3469 "Enable the Address Family for this Neighbor\n")
3471 DEFUN (neighbor_set_peer_group
,
3472 neighbor_set_peer_group_cmd
,
3473 "neighbor <A.B.C.D|X:X::X:X|WORD> peer-group WORD",
3476 "Member of the peer-group\n"
3477 "Peer-group name\n")
3479 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
3486 struct peer_group
*group
;
3488 ret
= str2sockunion(argv
[idx_peer
]->arg
, &su
);
3490 peer
= peer_lookup_by_conf_if(bgp
, argv
[idx_peer
]->arg
);
3492 vty_out(vty
, "%% Malformed address or name: %s\n",
3493 argv
[idx_peer
]->arg
);
3494 return CMD_WARNING_CONFIG_FAILED
;
3497 if (peer_address_self_check(bgp
, &su
)) {
3499 "%% Can not configure the local system as neighbor\n");
3500 return CMD_WARNING_CONFIG_FAILED
;
3503 /* Disallow for dynamic neighbor. */
3504 peer
= peer_lookup(bgp
, &su
);
3505 if (peer
&& peer_dynamic_neighbor(peer
)) {
3507 "%% Operation not allowed on a dynamic neighbor\n");
3508 return CMD_WARNING_CONFIG_FAILED
;
3512 group
= peer_group_lookup(bgp
, argv
[idx_word
]->arg
);
3514 vty_out(vty
, "%% Configure the peer-group first\n");
3515 return CMD_WARNING_CONFIG_FAILED
;
3518 ret
= peer_group_bind(bgp
, &su
, peer
, group
, &as
);
3520 if (ret
== BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT
) {
3522 "%% Peer with AS %u cannot be in this peer-group, members must be all internal or all external\n",
3524 return CMD_WARNING_CONFIG_FAILED
;
3527 return bgp_vty_return(vty
, ret
);
3530 ALIAS_HIDDEN(neighbor_set_peer_group
, neighbor_set_peer_group_hidden_cmd
,
3531 "neighbor <A.B.C.D|X:X::X:X|WORD> peer-group WORD",
3532 NEIGHBOR_STR NEIGHBOR_ADDR_STR2
3533 "Member of the peer-group\n"
3534 "Peer-group name\n")
3536 DEFUN (no_neighbor_set_peer_group
,
3537 no_neighbor_set_peer_group_cmd
,
3538 "no neighbor <A.B.C.D|X:X::X:X|WORD> peer-group WORD",
3542 "Member of the peer-group\n"
3543 "Peer-group name\n")
3545 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
3550 struct peer_group
*group
;
3552 peer
= peer_lookup_vty(vty
, argv
[idx_peer
]->arg
);
3554 return CMD_WARNING_CONFIG_FAILED
;
3556 group
= peer_group_lookup(bgp
, argv
[idx_word
]->arg
);
3558 vty_out(vty
, "%% Configure the peer-group first\n");
3559 return CMD_WARNING_CONFIG_FAILED
;
3562 ret
= peer_delete(peer
);
3564 return bgp_vty_return(vty
, ret
);
3567 ALIAS_HIDDEN(no_neighbor_set_peer_group
, no_neighbor_set_peer_group_hidden_cmd
,
3568 "no neighbor <A.B.C.D|X:X::X:X|WORD> peer-group WORD",
3569 NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2
3570 "Member of the peer-group\n"
3571 "Peer-group name\n")
3573 static int peer_flag_modify_vty(struct vty
*vty
, const char *ip_str
,
3574 uint32_t flag
, int set
)
3579 peer
= peer_and_group_lookup_vty(vty
, ip_str
);
3581 return CMD_WARNING_CONFIG_FAILED
;
3584 * If 'neighbor <interface>', then this is for directly connected peers,
3585 * we should not accept disable-connected-check.
3587 if (peer
->conf_if
&& (flag
== PEER_FLAG_DISABLE_CONNECTED_CHECK
)) {
3589 "%s is directly connected peer, cannot accept disable-"
3590 "connected-check\n",
3592 return CMD_WARNING_CONFIG_FAILED
;
3595 if (!set
&& flag
== PEER_FLAG_SHUTDOWN
)
3596 peer_tx_shutdown_message_unset(peer
);
3599 ret
= peer_flag_set(peer
, flag
);
3601 ret
= peer_flag_unset(peer
, flag
);
3603 return bgp_vty_return(vty
, ret
);
3606 static int peer_flag_set_vty(struct vty
*vty
, const char *ip_str
, uint32_t flag
)
3608 return peer_flag_modify_vty(vty
, ip_str
, flag
, 1);
3611 static int peer_flag_unset_vty(struct vty
*vty
, const char *ip_str
,
3614 return peer_flag_modify_vty(vty
, ip_str
, flag
, 0);
3617 /* neighbor passive. */
3618 DEFUN (neighbor_passive
,
3619 neighbor_passive_cmd
,
3620 "neighbor <A.B.C.D|X:X::X:X|WORD> passive",
3623 "Don't send open messages to this neighbor\n")
3626 return peer_flag_set_vty(vty
, argv
[idx_peer
]->arg
, PEER_FLAG_PASSIVE
);
3629 DEFUN (no_neighbor_passive
,
3630 no_neighbor_passive_cmd
,
3631 "no neighbor <A.B.C.D|X:X::X:X|WORD> passive",
3635 "Don't send open messages to this neighbor\n")
3638 return peer_flag_unset_vty(vty
, argv
[idx_peer
]->arg
, PEER_FLAG_PASSIVE
);
3641 /* neighbor shutdown. */
3642 DEFUN (neighbor_shutdown_msg
,
3643 neighbor_shutdown_msg_cmd
,
3644 "neighbor <A.B.C.D|X:X::X:X|WORD> shutdown message MSG...",
3647 "Administratively shut down this neighbor\n"
3648 "Add a shutdown message (draft-ietf-idr-shutdown-06)\n"
3649 "Shutdown message\n")
3655 peer_and_group_lookup_vty(vty
, argv
[idx_peer
]->arg
);
3659 return CMD_WARNING_CONFIG_FAILED
;
3660 message
= argv_concat(argv
, argc
, 4);
3661 peer_tx_shutdown_message_set(peer
, message
);
3662 XFREE(MTYPE_TMP
, message
);
3665 return peer_flag_set_vty(vty
, argv
[idx_peer
]->arg
, PEER_FLAG_SHUTDOWN
);
3668 ALIAS(neighbor_shutdown_msg
, neighbor_shutdown_cmd
,
3669 "neighbor <A.B.C.D|X:X::X:X|WORD> shutdown",
3670 NEIGHBOR_STR NEIGHBOR_ADDR_STR2
3671 "Administratively shut down this neighbor\n")
3673 DEFUN (no_neighbor_shutdown_msg
,
3674 no_neighbor_shutdown_msg_cmd
,
3675 "no neighbor <A.B.C.D|X:X::X:X|WORD> shutdown message MSG...",
3679 "Administratively shut down this neighbor\n"
3680 "Remove a shutdown message (draft-ietf-idr-shutdown-06)\n"
3681 "Shutdown message\n")
3685 return peer_flag_unset_vty(vty
, argv
[idx_peer
]->arg
,
3686 PEER_FLAG_SHUTDOWN
);
3689 ALIAS(no_neighbor_shutdown_msg
, no_neighbor_shutdown_cmd
,
3690 "no neighbor <A.B.C.D|X:X::X:X|WORD> shutdown",
3691 NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2
3692 "Administratively shut down this neighbor\n")
3694 /* neighbor capability dynamic. */
3695 DEFUN (neighbor_capability_dynamic
,
3696 neighbor_capability_dynamic_cmd
,
3697 "neighbor <A.B.C.D|X:X::X:X|WORD> capability dynamic",
3700 "Advertise capability to the peer\n"
3701 "Advertise dynamic capability to this neighbor\n")
3704 return peer_flag_set_vty(vty
, argv
[idx_peer
]->arg
,
3705 PEER_FLAG_DYNAMIC_CAPABILITY
);
3708 DEFUN (no_neighbor_capability_dynamic
,
3709 no_neighbor_capability_dynamic_cmd
,
3710 "no neighbor <A.B.C.D|X:X::X:X|WORD> capability dynamic",
3714 "Advertise capability to the peer\n"
3715 "Advertise dynamic capability to this neighbor\n")
3718 return peer_flag_unset_vty(vty
, argv
[idx_peer
]->arg
,
3719 PEER_FLAG_DYNAMIC_CAPABILITY
);
3722 /* neighbor dont-capability-negotiate */
3723 DEFUN (neighbor_dont_capability_negotiate
,
3724 neighbor_dont_capability_negotiate_cmd
,
3725 "neighbor <A.B.C.D|X:X::X:X|WORD> dont-capability-negotiate",
3728 "Do not perform capability negotiation\n")
3731 return peer_flag_set_vty(vty
, argv
[idx_peer
]->arg
,
3732 PEER_FLAG_DONT_CAPABILITY
);
3735 DEFUN (no_neighbor_dont_capability_negotiate
,
3736 no_neighbor_dont_capability_negotiate_cmd
,
3737 "no neighbor <A.B.C.D|X:X::X:X|WORD> dont-capability-negotiate",
3741 "Do not perform capability negotiation\n")
3744 return peer_flag_unset_vty(vty
, argv
[idx_peer
]->arg
,
3745 PEER_FLAG_DONT_CAPABILITY
);
3748 /* neighbor capability extended next hop encoding */
3749 DEFUN (neighbor_capability_enhe
,
3750 neighbor_capability_enhe_cmd
,
3751 "neighbor <A.B.C.D|X:X::X:X|WORD> capability extended-nexthop",
3754 "Advertise capability to the peer\n"
3755 "Advertise extended next-hop capability to the peer\n")
3758 return peer_flag_set_vty(vty
, argv
[idx_peer
]->arg
,
3759 PEER_FLAG_CAPABILITY_ENHE
);
3762 DEFUN (no_neighbor_capability_enhe
,
3763 no_neighbor_capability_enhe_cmd
,
3764 "no neighbor <A.B.C.D|X:X::X:X|WORD> capability extended-nexthop",
3768 "Advertise capability to the peer\n"
3769 "Advertise extended next-hop capability to the peer\n")
3772 return peer_flag_unset_vty(vty
, argv
[idx_peer
]->arg
,
3773 PEER_FLAG_CAPABILITY_ENHE
);
3776 static int peer_af_flag_modify_vty(struct vty
*vty
, const char *peer_str
,
3777 afi_t afi
, safi_t safi
, uint32_t flag
,
3783 peer
= peer_and_group_lookup_vty(vty
, peer_str
);
3785 return CMD_WARNING_CONFIG_FAILED
;
3788 ret
= peer_af_flag_set(peer
, afi
, safi
, flag
);
3790 ret
= peer_af_flag_unset(peer
, afi
, safi
, flag
);
3792 return bgp_vty_return(vty
, ret
);
3795 static int peer_af_flag_set_vty(struct vty
*vty
, const char *peer_str
,
3796 afi_t afi
, safi_t safi
, uint32_t flag
)
3798 return peer_af_flag_modify_vty(vty
, peer_str
, afi
, safi
, flag
, 1);
3801 static int peer_af_flag_unset_vty(struct vty
*vty
, const char *peer_str
,
3802 afi_t afi
, safi_t safi
, uint32_t flag
)
3804 return peer_af_flag_modify_vty(vty
, peer_str
, afi
, safi
, flag
, 0);
3807 /* neighbor capability orf prefix-list. */
3808 DEFUN (neighbor_capability_orf_prefix
,
3809 neighbor_capability_orf_prefix_cmd
,
3810 "neighbor <A.B.C.D|X:X::X:X|WORD> capability orf prefix-list <both|send|receive>",
3813 "Advertise capability to the peer\n"
3814 "Advertise ORF capability to the peer\n"
3815 "Advertise prefixlist ORF capability to this neighbor\n"
3816 "Capability to SEND and RECEIVE the ORF to/from this neighbor\n"
3817 "Capability to RECEIVE the ORF from this neighbor\n"
3818 "Capability to SEND the ORF to this neighbor\n")
3821 int idx_send_recv
= 5;
3824 if (strmatch(argv
[idx_send_recv
]->text
, "send"))
3825 flag
= PEER_FLAG_ORF_PREFIX_SM
;
3826 else if (strmatch(argv
[idx_send_recv
]->text
, "receive"))
3827 flag
= PEER_FLAG_ORF_PREFIX_RM
;
3828 else if (strmatch(argv
[idx_send_recv
]->text
, "both"))
3829 flag
= PEER_FLAG_ORF_PREFIX_SM
| PEER_FLAG_ORF_PREFIX_RM
;
3831 vty_out(vty
, "%% BGP invalid orf prefix-list option\n");
3832 return CMD_WARNING_CONFIG_FAILED
;
3835 return peer_af_flag_set_vty(vty
, argv
[idx_peer
]->arg
, bgp_node_afi(vty
),
3836 bgp_node_safi(vty
), flag
);
3840 neighbor_capability_orf_prefix
,
3841 neighbor_capability_orf_prefix_hidden_cmd
,
3842 "neighbor <A.B.C.D|X:X::X:X|WORD> capability orf prefix-list <both|send|receive>",
3843 NEIGHBOR_STR NEIGHBOR_ADDR_STR2
3844 "Advertise capability to the peer\n"
3845 "Advertise ORF capability to the peer\n"
3846 "Advertise prefixlist ORF capability to this neighbor\n"
3847 "Capability to SEND and RECEIVE the ORF to/from this neighbor\n"
3848 "Capability to RECEIVE the ORF from this neighbor\n"
3849 "Capability to SEND the ORF to this neighbor\n")
3851 DEFUN (no_neighbor_capability_orf_prefix
,
3852 no_neighbor_capability_orf_prefix_cmd
,
3853 "no neighbor <A.B.C.D|X:X::X:X|WORD> capability orf prefix-list <both|send|receive>",
3857 "Advertise capability to the peer\n"
3858 "Advertise ORF capability to the peer\n"
3859 "Advertise prefixlist ORF capability to this neighbor\n"
3860 "Capability to SEND and RECEIVE the ORF to/from this neighbor\n"
3861 "Capability to RECEIVE the ORF from this neighbor\n"
3862 "Capability to SEND the ORF to this neighbor\n")
3865 int idx_send_recv
= 6;
3868 if (strmatch(argv
[idx_send_recv
]->text
, "send"))
3869 flag
= PEER_FLAG_ORF_PREFIX_SM
;
3870 else if (strmatch(argv
[idx_send_recv
]->text
, "receive"))
3871 flag
= PEER_FLAG_ORF_PREFIX_RM
;
3872 else if (strmatch(argv
[idx_send_recv
]->text
, "both"))
3873 flag
= PEER_FLAG_ORF_PREFIX_SM
| PEER_FLAG_ORF_PREFIX_RM
;
3875 vty_out(vty
, "%% BGP invalid orf prefix-list option\n");
3876 return CMD_WARNING_CONFIG_FAILED
;
3879 return peer_af_flag_unset_vty(vty
, argv
[idx_peer
]->arg
,
3880 bgp_node_afi(vty
), bgp_node_safi(vty
),
3885 no_neighbor_capability_orf_prefix
,
3886 no_neighbor_capability_orf_prefix_hidden_cmd
,
3887 "no neighbor <A.B.C.D|X:X::X:X|WORD> capability orf prefix-list <both|send|receive>",
3888 NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2
3889 "Advertise capability to the peer\n"
3890 "Advertise ORF capability to the peer\n"
3891 "Advertise prefixlist ORF capability to this neighbor\n"
3892 "Capability to SEND and RECEIVE the ORF to/from this neighbor\n"
3893 "Capability to RECEIVE the ORF from this neighbor\n"
3894 "Capability to SEND the ORF to this neighbor\n")
3896 /* neighbor next-hop-self. */
3897 DEFUN (neighbor_nexthop_self
,
3898 neighbor_nexthop_self_cmd
,
3899 "neighbor <A.B.C.D|X:X::X:X|WORD> next-hop-self",
3902 "Disable the next hop calculation for this neighbor\n")
3905 return peer_af_flag_set_vty(vty
, argv
[idx_peer
]->arg
, bgp_node_afi(vty
),
3906 bgp_node_safi(vty
), PEER_FLAG_NEXTHOP_SELF
);
3909 ALIAS_HIDDEN(neighbor_nexthop_self
, neighbor_nexthop_self_hidden_cmd
,
3910 "neighbor <A.B.C.D|X:X::X:X|WORD> next-hop-self",
3911 NEIGHBOR_STR NEIGHBOR_ADDR_STR2
3912 "Disable the next hop calculation for this neighbor\n")
3914 /* neighbor next-hop-self. */
3915 DEFUN (neighbor_nexthop_self_force
,
3916 neighbor_nexthop_self_force_cmd
,
3917 "neighbor <A.B.C.D|X:X::X:X|WORD> next-hop-self force",
3920 "Disable the next hop calculation for this neighbor\n"
3921 "Set the next hop to self for reflected routes\n")
3924 return peer_af_flag_set_vty(vty
, argv
[idx_peer
]->arg
, bgp_node_afi(vty
),
3926 PEER_FLAG_FORCE_NEXTHOP_SELF
);
3929 ALIAS_HIDDEN(neighbor_nexthop_self_force
,
3930 neighbor_nexthop_self_force_hidden_cmd
,
3931 "neighbor <A.B.C.D|X:X::X:X|WORD> next-hop-self force",
3932 NEIGHBOR_STR NEIGHBOR_ADDR_STR2
3933 "Disable the next hop calculation for this neighbor\n"
3934 "Set the next hop to self for reflected routes\n")
3936 DEFUN (no_neighbor_nexthop_self
,
3937 no_neighbor_nexthop_self_cmd
,
3938 "no neighbor <A.B.C.D|X:X::X:X|WORD> next-hop-self",
3942 "Disable the next hop calculation for this neighbor\n")
3945 return peer_af_flag_unset_vty(vty
, argv
[idx_peer
]->arg
,
3946 bgp_node_afi(vty
), bgp_node_safi(vty
),
3947 PEER_FLAG_NEXTHOP_SELF
);
3950 ALIAS_HIDDEN(no_neighbor_nexthop_self
, no_neighbor_nexthop_self_hidden_cmd
,
3951 "no neighbor <A.B.C.D|X:X::X:X|WORD> next-hop-self",
3952 NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2
3953 "Disable the next hop calculation for this neighbor\n")
3955 DEFUN (no_neighbor_nexthop_self_force
,
3956 no_neighbor_nexthop_self_force_cmd
,
3957 "no neighbor <A.B.C.D|X:X::X:X|WORD> next-hop-self force",
3961 "Disable the next hop calculation for this neighbor\n"
3962 "Set the next hop to self for reflected routes\n")
3965 return peer_af_flag_unset_vty(vty
, argv
[idx_peer
]->arg
,
3966 bgp_node_afi(vty
), bgp_node_safi(vty
),
3967 PEER_FLAG_FORCE_NEXTHOP_SELF
);
3970 ALIAS_HIDDEN(no_neighbor_nexthop_self_force
,
3971 no_neighbor_nexthop_self_force_hidden_cmd
,
3972 "no neighbor <A.B.C.D|X:X::X:X|WORD> next-hop-self force",
3973 NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2
3974 "Disable the next hop calculation for this neighbor\n"
3975 "Set the next hop to self for reflected routes\n")
3977 /* neighbor as-override */
3978 DEFUN (neighbor_as_override
,
3979 neighbor_as_override_cmd
,
3980 "neighbor <A.B.C.D|X:X::X:X|WORD> as-override",
3983 "Override ASNs in outbound updates if aspath equals remote-as\n")
3986 return peer_af_flag_set_vty(vty
, argv
[idx_peer
]->arg
, bgp_node_afi(vty
),
3987 bgp_node_safi(vty
), PEER_FLAG_AS_OVERRIDE
);
3990 ALIAS_HIDDEN(neighbor_as_override
, neighbor_as_override_hidden_cmd
,
3991 "neighbor <A.B.C.D|X:X::X:X|WORD> as-override",
3992 NEIGHBOR_STR NEIGHBOR_ADDR_STR2
3993 "Override ASNs in outbound updates if aspath equals remote-as\n")
3995 DEFUN (no_neighbor_as_override
,
3996 no_neighbor_as_override_cmd
,
3997 "no neighbor <A.B.C.D|X:X::X:X|WORD> as-override",
4001 "Override ASNs in outbound updates if aspath equals remote-as\n")
4004 return peer_af_flag_unset_vty(vty
, argv
[idx_peer
]->arg
,
4005 bgp_node_afi(vty
), bgp_node_safi(vty
),
4006 PEER_FLAG_AS_OVERRIDE
);
4009 ALIAS_HIDDEN(no_neighbor_as_override
, no_neighbor_as_override_hidden_cmd
,
4010 "no neighbor <A.B.C.D|X:X::X:X|WORD> as-override",
4011 NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2
4012 "Override ASNs in outbound updates if aspath equals remote-as\n")
4014 /* neighbor remove-private-AS. */
4015 DEFUN (neighbor_remove_private_as
,
4016 neighbor_remove_private_as_cmd
,
4017 "neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS",
4020 "Remove private ASNs in outbound updates\n")
4023 return peer_af_flag_set_vty(vty
, argv
[idx_peer
]->arg
, bgp_node_afi(vty
),
4025 PEER_FLAG_REMOVE_PRIVATE_AS
);
4028 ALIAS_HIDDEN(neighbor_remove_private_as
, neighbor_remove_private_as_hidden_cmd
,
4029 "neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS",
4030 NEIGHBOR_STR NEIGHBOR_ADDR_STR2
4031 "Remove private ASNs in outbound updates\n")
4033 DEFUN (neighbor_remove_private_as_all
,
4034 neighbor_remove_private_as_all_cmd
,
4035 "neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS all",
4038 "Remove private ASNs in outbound updates\n"
4039 "Apply to all AS numbers\n")
4042 return peer_af_flag_set_vty(vty
, argv
[idx_peer
]->arg
, bgp_node_afi(vty
),
4044 PEER_FLAG_REMOVE_PRIVATE_AS_ALL
);
4047 ALIAS_HIDDEN(neighbor_remove_private_as_all
,
4048 neighbor_remove_private_as_all_hidden_cmd
,
4049 "neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS all",
4050 NEIGHBOR_STR NEIGHBOR_ADDR_STR2
4051 "Remove private ASNs in outbound updates\n"
4052 "Apply to all AS numbers")
4054 DEFUN (neighbor_remove_private_as_replace_as
,
4055 neighbor_remove_private_as_replace_as_cmd
,
4056 "neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS replace-AS",
4059 "Remove private ASNs in outbound updates\n"
4060 "Replace private ASNs with our ASN in outbound updates\n")
4063 return peer_af_flag_set_vty(vty
, argv
[idx_peer
]->arg
, bgp_node_afi(vty
),
4065 PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE
);
4068 ALIAS_HIDDEN(neighbor_remove_private_as_replace_as
,
4069 neighbor_remove_private_as_replace_as_hidden_cmd
,
4070 "neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS replace-AS",
4071 NEIGHBOR_STR NEIGHBOR_ADDR_STR2
4072 "Remove private ASNs in outbound updates\n"
4073 "Replace private ASNs with our ASN in outbound updates\n")
4075 DEFUN (neighbor_remove_private_as_all_replace_as
,
4076 neighbor_remove_private_as_all_replace_as_cmd
,
4077 "neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS all replace-AS",
4080 "Remove private ASNs in outbound updates\n"
4081 "Apply to all AS numbers\n"
4082 "Replace private ASNs with our ASN in outbound updates\n")
4085 return peer_af_flag_set_vty(vty
, argv
[idx_peer
]->arg
, bgp_node_afi(vty
),
4087 PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE
);
4091 neighbor_remove_private_as_all_replace_as
,
4092 neighbor_remove_private_as_all_replace_as_hidden_cmd
,
4093 "neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS all replace-AS",
4094 NEIGHBOR_STR NEIGHBOR_ADDR_STR2
4095 "Remove private ASNs in outbound updates\n"
4096 "Apply to all AS numbers\n"
4097 "Replace private ASNs with our ASN in outbound updates\n")
4099 DEFUN (no_neighbor_remove_private_as
,
4100 no_neighbor_remove_private_as_cmd
,
4101 "no neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS",
4105 "Remove private ASNs in outbound updates\n")
4108 return peer_af_flag_unset_vty(vty
, argv
[idx_peer
]->arg
,
4109 bgp_node_afi(vty
), bgp_node_safi(vty
),
4110 PEER_FLAG_REMOVE_PRIVATE_AS
);
4113 ALIAS_HIDDEN(no_neighbor_remove_private_as
,
4114 no_neighbor_remove_private_as_hidden_cmd
,
4115 "no neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS",
4116 NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2
4117 "Remove private ASNs in outbound updates\n")
4119 DEFUN (no_neighbor_remove_private_as_all
,
4120 no_neighbor_remove_private_as_all_cmd
,
4121 "no neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS all",
4125 "Remove private ASNs in outbound updates\n"
4126 "Apply to all AS numbers\n")
4129 return peer_af_flag_unset_vty(vty
, argv
[idx_peer
]->arg
,
4130 bgp_node_afi(vty
), bgp_node_safi(vty
),
4131 PEER_FLAG_REMOVE_PRIVATE_AS_ALL
);
4134 ALIAS_HIDDEN(no_neighbor_remove_private_as_all
,
4135 no_neighbor_remove_private_as_all_hidden_cmd
,
4136 "no neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS all",
4137 NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2
4138 "Remove private ASNs in outbound updates\n"
4139 "Apply to all AS numbers\n")
4141 DEFUN (no_neighbor_remove_private_as_replace_as
,
4142 no_neighbor_remove_private_as_replace_as_cmd
,
4143 "no neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS replace-AS",
4147 "Remove private ASNs in outbound updates\n"
4148 "Replace private ASNs with our ASN in outbound updates\n")
4151 return peer_af_flag_unset_vty(vty
, argv
[idx_peer
]->arg
,
4152 bgp_node_afi(vty
), bgp_node_safi(vty
),
4153 PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE
);
4156 ALIAS_HIDDEN(no_neighbor_remove_private_as_replace_as
,
4157 no_neighbor_remove_private_as_replace_as_hidden_cmd
,
4158 "no neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS replace-AS",
4159 NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2
4160 "Remove private ASNs in outbound updates\n"
4161 "Replace private ASNs with our ASN in outbound updates\n")
4163 DEFUN (no_neighbor_remove_private_as_all_replace_as
,
4164 no_neighbor_remove_private_as_all_replace_as_cmd
,
4165 "no neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS all replace-AS",
4169 "Remove private ASNs in outbound updates\n"
4170 "Apply to all AS numbers\n"
4171 "Replace private ASNs with our ASN in outbound updates\n")
4174 return peer_af_flag_unset_vty(vty
, argv
[idx_peer
]->arg
,
4175 bgp_node_afi(vty
), bgp_node_safi(vty
),
4176 PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE
);
4180 no_neighbor_remove_private_as_all_replace_as
,
4181 no_neighbor_remove_private_as_all_replace_as_hidden_cmd
,
4182 "no neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS all replace-AS",
4183 NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2
4184 "Remove private ASNs in outbound updates\n"
4185 "Apply to all AS numbers\n"
4186 "Replace private ASNs with our ASN in outbound updates\n")
4189 /* neighbor send-community. */
4190 DEFUN (neighbor_send_community
,
4191 neighbor_send_community_cmd
,
4192 "neighbor <A.B.C.D|X:X::X:X|WORD> send-community",
4195 "Send Community attribute to this neighbor\n")
4199 return peer_af_flag_set_vty(vty
, argv
[idx_peer
]->arg
, bgp_node_afi(vty
),
4201 PEER_FLAG_SEND_COMMUNITY
);
4204 ALIAS_HIDDEN(neighbor_send_community
, neighbor_send_community_hidden_cmd
,
4205 "neighbor <A.B.C.D|X:X::X:X|WORD> send-community",
4206 NEIGHBOR_STR NEIGHBOR_ADDR_STR2
4207 "Send Community attribute to this neighbor\n")
4209 DEFUN (no_neighbor_send_community
,
4210 no_neighbor_send_community_cmd
,
4211 "no neighbor <A.B.C.D|X:X::X:X|WORD> send-community",
4215 "Send Community attribute to this neighbor\n")
4219 return peer_af_flag_unset_vty(vty
, argv
[idx_peer
]->arg
,
4220 bgp_node_afi(vty
), bgp_node_safi(vty
),
4221 PEER_FLAG_SEND_COMMUNITY
);
4224 ALIAS_HIDDEN(no_neighbor_send_community
, no_neighbor_send_community_hidden_cmd
,
4225 "no neighbor <A.B.C.D|X:X::X:X|WORD> send-community",
4226 NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2
4227 "Send Community attribute to this neighbor\n")
4229 /* neighbor send-community extended. */
4230 DEFUN (neighbor_send_community_type
,
4231 neighbor_send_community_type_cmd
,
4232 "neighbor <A.B.C.D|X:X::X:X|WORD> send-community <both|all|extended|standard|large>",
4235 "Send Community attribute to this neighbor\n"
4236 "Send Standard and Extended Community attributes\n"
4237 "Send Standard, Large and Extended Community attributes\n"
4238 "Send Extended Community attributes\n"
4239 "Send Standard Community attributes\n"
4240 "Send Large Community attributes\n")
4244 const char *type
= argv
[argc
- 1]->text
;
4246 if (strmatch(type
, "standard")) {
4247 SET_FLAG(flag
, PEER_FLAG_SEND_COMMUNITY
);
4248 } else if (strmatch(type
, "extended")) {
4249 SET_FLAG(flag
, PEER_FLAG_SEND_EXT_COMMUNITY
);
4250 } else if (strmatch(type
, "large")) {
4251 SET_FLAG(flag
, PEER_FLAG_SEND_LARGE_COMMUNITY
);
4252 } else if (strmatch(type
, "both")) {
4253 SET_FLAG(flag
, PEER_FLAG_SEND_COMMUNITY
);
4254 SET_FLAG(flag
, PEER_FLAG_SEND_EXT_COMMUNITY
);
4255 } else { /* if (strmatch(type, "all")) */
4256 SET_FLAG(flag
, PEER_FLAG_SEND_COMMUNITY
);
4257 SET_FLAG(flag
, PEER_FLAG_SEND_EXT_COMMUNITY
);
4258 SET_FLAG(flag
, PEER_FLAG_SEND_LARGE_COMMUNITY
);
4261 return peer_af_flag_set_vty(vty
, argv
[idx_peer
]->arg
, bgp_node_afi(vty
),
4262 bgp_node_safi(vty
), flag
);
4266 neighbor_send_community_type
, neighbor_send_community_type_hidden_cmd
,
4267 "neighbor <A.B.C.D|X:X::X:X|WORD> send-community <both|all|extended|standard|large>",
4268 NEIGHBOR_STR NEIGHBOR_ADDR_STR2
4269 "Send Community attribute to this neighbor\n"
4270 "Send Standard and Extended Community attributes\n"
4271 "Send Standard, Large and Extended Community attributes\n"
4272 "Send Extended Community attributes\n"
4273 "Send Standard Community attributes\n"
4274 "Send Large Community attributes\n")
4276 DEFUN (no_neighbor_send_community_type
,
4277 no_neighbor_send_community_type_cmd
,
4278 "no neighbor <A.B.C.D|X:X::X:X|WORD> send-community <both|all|extended|standard|large>",
4282 "Send Community attribute to this neighbor\n"
4283 "Send Standard and Extended Community attributes\n"
4284 "Send Standard, Large and Extended Community attributes\n"
4285 "Send Extended Community attributes\n"
4286 "Send Standard Community attributes\n"
4287 "Send Large Community attributes\n")
4291 const char *type
= argv
[argc
- 1]->text
;
4293 if (strmatch(type
, "standard")) {
4294 SET_FLAG(flag
, PEER_FLAG_SEND_COMMUNITY
);
4295 } else if (strmatch(type
, "extended")) {
4296 SET_FLAG(flag
, PEER_FLAG_SEND_EXT_COMMUNITY
);
4297 } else if (strmatch(type
, "large")) {
4298 SET_FLAG(flag
, PEER_FLAG_SEND_LARGE_COMMUNITY
);
4299 } else if (strmatch(type
, "both")) {
4300 SET_FLAG(flag
, PEER_FLAG_SEND_COMMUNITY
);
4301 SET_FLAG(flag
, PEER_FLAG_SEND_EXT_COMMUNITY
);
4302 } else { /* if (strmatch(type, "all")) */
4303 SET_FLAG(flag
, PEER_FLAG_SEND_COMMUNITY
);
4304 SET_FLAG(flag
, PEER_FLAG_SEND_EXT_COMMUNITY
);
4305 SET_FLAG(flag
, PEER_FLAG_SEND_LARGE_COMMUNITY
);
4308 return peer_af_flag_unset_vty(vty
, argv
[idx_peer
]->arg
,
4309 bgp_node_afi(vty
), bgp_node_safi(vty
),
4314 no_neighbor_send_community_type
,
4315 no_neighbor_send_community_type_hidden_cmd
,
4316 "no neighbor <A.B.C.D|X:X::X:X|WORD> send-community <both|all|extended|standard|large>",
4317 NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2
4318 "Send Community attribute to this neighbor\n"
4319 "Send Standard and Extended Community attributes\n"
4320 "Send Standard, Large and Extended Community attributes\n"
4321 "Send Extended Community attributes\n"
4322 "Send Standard Community attributes\n"
4323 "Send Large Community attributes\n")
4325 /* neighbor soft-reconfig. */
4326 DEFUN (neighbor_soft_reconfiguration
,
4327 neighbor_soft_reconfiguration_cmd
,
4328 "neighbor <A.B.C.D|X:X::X:X|WORD> soft-reconfiguration inbound",
4331 "Per neighbor soft reconfiguration\n"
4332 "Allow inbound soft reconfiguration for this neighbor\n")
4335 return peer_af_flag_set_vty(vty
, argv
[idx_peer
]->arg
, bgp_node_afi(vty
),
4337 PEER_FLAG_SOFT_RECONFIG
);
4340 ALIAS_HIDDEN(neighbor_soft_reconfiguration
,
4341 neighbor_soft_reconfiguration_hidden_cmd
,
4342 "neighbor <A.B.C.D|X:X::X:X|WORD> soft-reconfiguration inbound",
4343 NEIGHBOR_STR NEIGHBOR_ADDR_STR2
4344 "Per neighbor soft reconfiguration\n"
4345 "Allow inbound soft reconfiguration for this neighbor\n")
4347 DEFUN (no_neighbor_soft_reconfiguration
,
4348 no_neighbor_soft_reconfiguration_cmd
,
4349 "no neighbor <A.B.C.D|X:X::X:X|WORD> soft-reconfiguration inbound",
4353 "Per neighbor soft reconfiguration\n"
4354 "Allow inbound soft reconfiguration for this neighbor\n")
4357 return peer_af_flag_unset_vty(vty
, argv
[idx_peer
]->arg
,
4358 bgp_node_afi(vty
), bgp_node_safi(vty
),
4359 PEER_FLAG_SOFT_RECONFIG
);
4362 ALIAS_HIDDEN(no_neighbor_soft_reconfiguration
,
4363 no_neighbor_soft_reconfiguration_hidden_cmd
,
4364 "no neighbor <A.B.C.D|X:X::X:X|WORD> soft-reconfiguration inbound",
4365 NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2
4366 "Per neighbor soft reconfiguration\n"
4367 "Allow inbound soft reconfiguration for this neighbor\n")
4369 DEFUN (neighbor_route_reflector_client
,
4370 neighbor_route_reflector_client_cmd
,
4371 "neighbor <A.B.C.D|X:X::X:X|WORD> route-reflector-client",
4374 "Configure a neighbor as Route Reflector client\n")
4380 peer
= peer_and_group_lookup_vty(vty
, argv
[idx_peer
]->arg
);
4382 return CMD_WARNING_CONFIG_FAILED
;
4384 return peer_af_flag_set_vty(vty
, argv
[idx_peer
]->arg
, bgp_node_afi(vty
),
4386 PEER_FLAG_REFLECTOR_CLIENT
);
4389 ALIAS_HIDDEN(neighbor_route_reflector_client
,
4390 neighbor_route_reflector_client_hidden_cmd
,
4391 "neighbor <A.B.C.D|X:X::X:X|WORD> route-reflector-client",
4392 NEIGHBOR_STR NEIGHBOR_ADDR_STR2
4393 "Configure a neighbor as Route Reflector client\n")
4395 DEFUN (no_neighbor_route_reflector_client
,
4396 no_neighbor_route_reflector_client_cmd
,
4397 "no neighbor <A.B.C.D|X:X::X:X|WORD> route-reflector-client",
4401 "Configure a neighbor as Route Reflector client\n")
4404 return peer_af_flag_unset_vty(vty
, argv
[idx_peer
]->arg
,
4405 bgp_node_afi(vty
), bgp_node_safi(vty
),
4406 PEER_FLAG_REFLECTOR_CLIENT
);
4409 ALIAS_HIDDEN(no_neighbor_route_reflector_client
,
4410 no_neighbor_route_reflector_client_hidden_cmd
,
4411 "no neighbor <A.B.C.D|X:X::X:X|WORD> route-reflector-client",
4412 NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2
4413 "Configure a neighbor as Route Reflector client\n")
4415 /* neighbor route-server-client. */
4416 DEFUN (neighbor_route_server_client
,
4417 neighbor_route_server_client_cmd
,
4418 "neighbor <A.B.C.D|X:X::X:X|WORD> route-server-client",
4421 "Configure a neighbor as Route Server client\n")
4426 peer
= peer_and_group_lookup_vty(vty
, argv
[idx_peer
]->arg
);
4428 return CMD_WARNING_CONFIG_FAILED
;
4429 return peer_af_flag_set_vty(vty
, argv
[idx_peer
]->arg
, bgp_node_afi(vty
),
4431 PEER_FLAG_RSERVER_CLIENT
);
4434 ALIAS_HIDDEN(neighbor_route_server_client
,
4435 neighbor_route_server_client_hidden_cmd
,
4436 "neighbor <A.B.C.D|X:X::X:X|WORD> route-server-client",
4437 NEIGHBOR_STR NEIGHBOR_ADDR_STR2
4438 "Configure a neighbor as Route Server client\n")
4440 DEFUN (no_neighbor_route_server_client
,
4441 no_neighbor_route_server_client_cmd
,
4442 "no neighbor <A.B.C.D|X:X::X:X|WORD> route-server-client",
4446 "Configure a neighbor as Route Server client\n")
4449 return peer_af_flag_unset_vty(vty
, argv
[idx_peer
]->arg
,
4450 bgp_node_afi(vty
), bgp_node_safi(vty
),
4451 PEER_FLAG_RSERVER_CLIENT
);
4454 ALIAS_HIDDEN(no_neighbor_route_server_client
,
4455 no_neighbor_route_server_client_hidden_cmd
,
4456 "no neighbor <A.B.C.D|X:X::X:X|WORD> route-server-client",
4457 NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2
4458 "Configure a neighbor as Route Server client\n")
4460 DEFUN (neighbor_nexthop_local_unchanged
,
4461 neighbor_nexthop_local_unchanged_cmd
,
4462 "neighbor <A.B.C.D|X:X::X:X|WORD> nexthop-local unchanged",
4465 "Configure treatment of outgoing link-local nexthop attribute\n"
4466 "Leave link-local nexthop unchanged for this peer\n")
4469 return peer_af_flag_set_vty(vty
, argv
[idx_peer
]->arg
, bgp_node_afi(vty
),
4471 PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED
);
4474 DEFUN (no_neighbor_nexthop_local_unchanged
,
4475 no_neighbor_nexthop_local_unchanged_cmd
,
4476 "no neighbor <A.B.C.D|X:X::X:X|WORD> nexthop-local unchanged",
4480 "Configure treatment of outgoing link-local-nexthop attribute\n"
4481 "Leave link-local nexthop unchanged for this peer\n")
4484 return peer_af_flag_unset_vty(vty
, argv
[idx_peer
]->arg
,
4485 bgp_node_afi(vty
), bgp_node_safi(vty
),
4486 PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED
);
4489 DEFUN (neighbor_attr_unchanged
,
4490 neighbor_attr_unchanged_cmd
,
4491 "neighbor <A.B.C.D|X:X::X:X|WORD> attribute-unchanged [{as-path|next-hop|med}]",
4494 "BGP attribute is propagated unchanged to this neighbor\n"
4495 "As-path attribute\n"
4496 "Nexthop attribute\n"
4500 char *peer_str
= argv
[1]->arg
;
4503 afi_t afi
= bgp_node_afi(vty
);
4504 safi_t safi
= bgp_node_safi(vty
);
4506 peer
= peer_and_group_lookup_vty(vty
, peer_str
);
4508 return CMD_WARNING_CONFIG_FAILED
;
4510 if (argv_find(argv
, argc
, "as-path", &idx
))
4511 SET_FLAG(flags
, PEER_FLAG_AS_PATH_UNCHANGED
);
4513 if (argv_find(argv
, argc
, "next-hop", &idx
))
4514 SET_FLAG(flags
, PEER_FLAG_NEXTHOP_UNCHANGED
);
4516 if (argv_find(argv
, argc
, "med", &idx
))
4517 SET_FLAG(flags
, PEER_FLAG_MED_UNCHANGED
);
4519 /* no flags means all of them! */
4521 SET_FLAG(flags
, PEER_FLAG_AS_PATH_UNCHANGED
);
4522 SET_FLAG(flags
, PEER_FLAG_NEXTHOP_UNCHANGED
);
4523 SET_FLAG(flags
, PEER_FLAG_MED_UNCHANGED
);
4525 if (!CHECK_FLAG(flags
, PEER_FLAG_AS_PATH_UNCHANGED
)
4526 && peer_af_flag_check(peer
, afi
, safi
,
4527 PEER_FLAG_AS_PATH_UNCHANGED
)) {
4528 peer_af_flag_unset_vty(vty
, peer_str
, afi
, safi
,
4529 PEER_FLAG_AS_PATH_UNCHANGED
);
4532 if (!CHECK_FLAG(flags
, PEER_FLAG_NEXTHOP_UNCHANGED
)
4533 && peer_af_flag_check(peer
, afi
, safi
,
4534 PEER_FLAG_NEXTHOP_UNCHANGED
)) {
4535 peer_af_flag_unset_vty(vty
, peer_str
, afi
, safi
,
4536 PEER_FLAG_NEXTHOP_UNCHANGED
);
4539 if (!CHECK_FLAG(flags
, PEER_FLAG_MED_UNCHANGED
)
4540 && peer_af_flag_check(peer
, afi
, safi
,
4541 PEER_FLAG_MED_UNCHANGED
)) {
4542 peer_af_flag_unset_vty(vty
, peer_str
, afi
, safi
,
4543 PEER_FLAG_MED_UNCHANGED
);
4547 return peer_af_flag_set_vty(vty
, peer_str
, afi
, safi
, flags
);
4551 neighbor_attr_unchanged
, neighbor_attr_unchanged_hidden_cmd
,
4552 "neighbor <A.B.C.D|X:X::X:X|WORD> attribute-unchanged [{as-path|next-hop|med}]",
4553 NEIGHBOR_STR NEIGHBOR_ADDR_STR2
4554 "BGP attribute is propagated unchanged to this neighbor\n"
4555 "As-path attribute\n"
4556 "Nexthop attribute\n"
4559 DEFUN (no_neighbor_attr_unchanged
,
4560 no_neighbor_attr_unchanged_cmd
,
4561 "no neighbor <A.B.C.D|X:X::X:X|WORD> attribute-unchanged [{as-path|next-hop|med}]",
4565 "BGP attribute is propagated unchanged to this neighbor\n"
4566 "As-path attribute\n"
4567 "Nexthop attribute\n"
4571 char *peer
= argv
[2]->arg
;
4574 if (argv_find(argv
, argc
, "as-path", &idx
))
4575 SET_FLAG(flags
, PEER_FLAG_AS_PATH_UNCHANGED
);
4577 if (argv_find(argv
, argc
, "next-hop", &idx
))
4578 SET_FLAG(flags
, PEER_FLAG_NEXTHOP_UNCHANGED
);
4580 if (argv_find(argv
, argc
, "med", &idx
))
4581 SET_FLAG(flags
, PEER_FLAG_MED_UNCHANGED
);
4583 if (!flags
) // no flags means all of them!
4585 SET_FLAG(flags
, PEER_FLAG_AS_PATH_UNCHANGED
);
4586 SET_FLAG(flags
, PEER_FLAG_NEXTHOP_UNCHANGED
);
4587 SET_FLAG(flags
, PEER_FLAG_MED_UNCHANGED
);
4590 return peer_af_flag_unset_vty(vty
, peer
, bgp_node_afi(vty
),
4591 bgp_node_safi(vty
), flags
);
4595 no_neighbor_attr_unchanged
, no_neighbor_attr_unchanged_hidden_cmd
,
4596 "no neighbor <A.B.C.D|X:X::X:X|WORD> attribute-unchanged [{as-path|next-hop|med}]",
4597 NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2
4598 "BGP attribute is propagated unchanged to this neighbor\n"
4599 "As-path attribute\n"
4600 "Nexthop attribute\n"
4603 /* EBGP multihop configuration. */
4604 static int peer_ebgp_multihop_set_vty(struct vty
*vty
, const char *ip_str
,
4605 const char *ttl_str
)
4610 peer
= peer_and_group_lookup_vty(vty
, ip_str
);
4612 return CMD_WARNING_CONFIG_FAILED
;
4615 return bgp_vty_return(vty
, BGP_ERR_INVALID_FOR_DIRECT_PEER
);
4620 ttl
= strtoul(ttl_str
, NULL
, 10);
4622 return bgp_vty_return(vty
, peer_ebgp_multihop_set(peer
, ttl
));
4625 static int peer_ebgp_multihop_unset_vty(struct vty
*vty
, const char *ip_str
)
4629 peer
= peer_and_group_lookup_vty(vty
, ip_str
);
4631 return CMD_WARNING_CONFIG_FAILED
;
4633 return bgp_vty_return(vty
, peer_ebgp_multihop_unset(peer
));
4636 /* neighbor ebgp-multihop. */
4637 DEFUN (neighbor_ebgp_multihop
,
4638 neighbor_ebgp_multihop_cmd
,
4639 "neighbor <A.B.C.D|X:X::X:X|WORD> ebgp-multihop",
4642 "Allow EBGP neighbors not on directly connected networks\n")
4645 return peer_ebgp_multihop_set_vty(vty
, argv
[idx_peer
]->arg
, NULL
);
4648 DEFUN (neighbor_ebgp_multihop_ttl
,
4649 neighbor_ebgp_multihop_ttl_cmd
,
4650 "neighbor <A.B.C.D|X:X::X:X|WORD> ebgp-multihop (1-255)",
4653 "Allow EBGP neighbors not on directly connected networks\n"
4654 "maximum hop count\n")
4658 return peer_ebgp_multihop_set_vty(vty
, argv
[idx_peer
]->arg
,
4659 argv
[idx_number
]->arg
);
4662 DEFUN (no_neighbor_ebgp_multihop
,
4663 no_neighbor_ebgp_multihop_cmd
,
4664 "no neighbor <A.B.C.D|X:X::X:X|WORD> ebgp-multihop [(1-255)]",
4668 "Allow EBGP neighbors not on directly connected networks\n"
4669 "maximum hop count\n")
4672 return peer_ebgp_multihop_unset_vty(vty
, argv
[idx_peer
]->arg
);
4676 /* disable-connected-check */
4677 DEFUN (neighbor_disable_connected_check
,
4678 neighbor_disable_connected_check_cmd
,
4679 "neighbor <A.B.C.D|X:X::X:X|WORD> <disable-connected-check|enforce-multihop>",
4682 "one-hop away EBGP peer using loopback address\n"
4683 "Enforce EBGP neighbors perform multihop\n")
4686 return peer_flag_set_vty(vty
, argv
[idx_peer
]->arg
,
4687 PEER_FLAG_DISABLE_CONNECTED_CHECK
);
4690 DEFUN (no_neighbor_disable_connected_check
,
4691 no_neighbor_disable_connected_check_cmd
,
4692 "no neighbor <A.B.C.D|X:X::X:X|WORD> <disable-connected-check|enforce-multihop>",
4696 "one-hop away EBGP peer using loopback address\n"
4697 "Enforce EBGP neighbors perform multihop\n")
4700 return peer_flag_unset_vty(vty
, argv
[idx_peer
]->arg
,
4701 PEER_FLAG_DISABLE_CONNECTED_CHECK
);
4705 /* enforce-first-as */
4706 DEFUN (neighbor_enforce_first_as
,
4707 neighbor_enforce_first_as_cmd
,
4708 "neighbor <A.B.C.D|X:X::X:X|WORD> enforce-first-as",
4711 "Enforce the first AS for EBGP routes\n")
4715 return peer_flag_set_vty(vty
, argv
[idx_peer
]->arg
,
4716 PEER_FLAG_ENFORCE_FIRST_AS
);
4719 DEFUN (no_neighbor_enforce_first_as
,
4720 no_neighbor_enforce_first_as_cmd
,
4721 "no neighbor <A.B.C.D|X:X::X:X|WORD> enforce-first-as",
4725 "Enforce the first AS for EBGP routes\n")
4729 return peer_flag_unset_vty(vty
, argv
[idx_peer
]->arg
,
4730 PEER_FLAG_ENFORCE_FIRST_AS
);
4734 DEFUN (neighbor_description
,
4735 neighbor_description_cmd
,
4736 "neighbor <A.B.C.D|X:X::X:X|WORD> description LINE...",
4739 "Neighbor specific description\n"
4740 "Up to 80 characters describing this neighbor\n")
4747 peer
= peer_and_group_lookup_vty(vty
, argv
[idx_peer
]->arg
);
4749 return CMD_WARNING_CONFIG_FAILED
;
4751 str
= argv_concat(argv
, argc
, idx_line
);
4753 peer_description_set(peer
, str
);
4755 XFREE(MTYPE_TMP
, str
);
4760 DEFUN (no_neighbor_description
,
4761 no_neighbor_description_cmd
,
4762 "no neighbor <A.B.C.D|X:X::X:X|WORD> description",
4766 "Neighbor specific description\n")
4771 peer
= peer_and_group_lookup_vty(vty
, argv
[idx_peer
]->arg
);
4773 return CMD_WARNING_CONFIG_FAILED
;
4775 peer_description_unset(peer
);
4780 ALIAS(no_neighbor_description
, no_neighbor_description_comment_cmd
,
4781 "no neighbor <A.B.C.D|X:X::X:X|WORD> description LINE...",
4782 NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2
4783 "Neighbor specific description\n"
4784 "Up to 80 characters describing this neighbor\n")
4786 /* Neighbor update-source. */
4787 static int peer_update_source_vty(struct vty
*vty
, const char *peer_str
,
4788 const char *source_str
)
4794 peer
= peer_and_group_lookup_vty(vty
, peer_str
);
4796 return CMD_WARNING_CONFIG_FAILED
;
4802 if (str2sockunion(source_str
, &su
) == 0)
4803 peer_update_source_addr_set(peer
, &su
);
4805 if (str2prefix(source_str
, &p
)) {
4807 "%% Invalid update-source, remove prefix length \n");
4808 return CMD_WARNING_CONFIG_FAILED
;
4810 peer_update_source_if_set(peer
, source_str
);
4813 peer_update_source_unset(peer
);
4818 #define BGP_UPDATE_SOURCE_HELP_STR \
4821 "Interface name (requires zebra to be running)\n"
4823 DEFUN (neighbor_update_source
,
4824 neighbor_update_source_cmd
,
4825 "neighbor <A.B.C.D|X:X::X:X|WORD> update-source <A.B.C.D|X:X::X:X|WORD>",
4828 "Source of routing updates\n"
4829 BGP_UPDATE_SOURCE_HELP_STR
)
4833 return peer_update_source_vty(vty
, argv
[idx_peer
]->arg
,
4834 argv
[idx_peer_2
]->arg
);
4837 DEFUN (no_neighbor_update_source
,
4838 no_neighbor_update_source_cmd
,
4839 "no neighbor <A.B.C.D|X:X::X:X|WORD> update-source [<A.B.C.D|X:X::X:X|WORD>]",
4843 "Source of routing updates\n"
4844 BGP_UPDATE_SOURCE_HELP_STR
)
4847 return peer_update_source_vty(vty
, argv
[idx_peer
]->arg
, NULL
);
4850 static int peer_default_originate_set_vty(struct vty
*vty
, const char *peer_str
,
4851 afi_t afi
, safi_t safi
,
4852 const char *rmap
, int set
)
4856 struct route_map
*route_map
;
4858 peer
= peer_and_group_lookup_vty(vty
, peer_str
);
4860 return CMD_WARNING_CONFIG_FAILED
;
4863 route_map
= route_map_lookup_warn_noexist(vty
, rmap
);
4864 ret
= peer_default_originate_set(peer
, afi
, safi
,
4867 ret
= peer_default_originate_unset(peer
, afi
, safi
);
4869 return bgp_vty_return(vty
, ret
);
4872 /* neighbor default-originate. */
4873 DEFUN (neighbor_default_originate
,
4874 neighbor_default_originate_cmd
,
4875 "neighbor <A.B.C.D|X:X::X:X|WORD> default-originate",
4878 "Originate default route to this neighbor\n")
4881 return peer_default_originate_set_vty(vty
, argv
[idx_peer
]->arg
,
4883 bgp_node_safi(vty
), NULL
, 1);
4886 ALIAS_HIDDEN(neighbor_default_originate
, neighbor_default_originate_hidden_cmd
,
4887 "neighbor <A.B.C.D|X:X::X:X|WORD> default-originate",
4888 NEIGHBOR_STR NEIGHBOR_ADDR_STR2
4889 "Originate default route to this neighbor\n")
4891 DEFUN (neighbor_default_originate_rmap
,
4892 neighbor_default_originate_rmap_cmd
,
4893 "neighbor <A.B.C.D|X:X::X:X|WORD> default-originate route-map WORD",
4896 "Originate default route to this neighbor\n"
4897 "Route-map to specify criteria to originate default\n"
4902 return peer_default_originate_set_vty(
4903 vty
, argv
[idx_peer
]->arg
, bgp_node_afi(vty
), bgp_node_safi(vty
),
4904 argv
[idx_word
]->arg
, 1);
4908 neighbor_default_originate_rmap
,
4909 neighbor_default_originate_rmap_hidden_cmd
,
4910 "neighbor <A.B.C.D|X:X::X:X|WORD> default-originate route-map WORD",
4911 NEIGHBOR_STR NEIGHBOR_ADDR_STR2
4912 "Originate default route to this neighbor\n"
4913 "Route-map to specify criteria to originate default\n"
4916 DEFUN (no_neighbor_default_originate
,
4917 no_neighbor_default_originate_cmd
,
4918 "no neighbor <A.B.C.D|X:X::X:X|WORD> default-originate [route-map WORD]",
4922 "Originate default route to this neighbor\n"
4923 "Route-map to specify criteria to originate default\n"
4927 return peer_default_originate_set_vty(vty
, argv
[idx_peer
]->arg
,
4929 bgp_node_safi(vty
), NULL
, 0);
4933 no_neighbor_default_originate
, no_neighbor_default_originate_hidden_cmd
,
4934 "no neighbor <A.B.C.D|X:X::X:X|WORD> default-originate [route-map WORD]",
4935 NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2
4936 "Originate default route to this neighbor\n"
4937 "Route-map to specify criteria to originate default\n"
4941 /* Set neighbor's BGP port. */
4942 static int peer_port_vty(struct vty
*vty
, const char *ip_str
, int afi
,
4943 const char *port_str
)
4949 peer
= peer_lookup_vty(vty
, ip_str
);
4951 return CMD_WARNING_CONFIG_FAILED
;
4954 sp
= getservbyname("bgp", "tcp");
4955 port
= (sp
== NULL
) ? BGP_PORT_DEFAULT
: ntohs(sp
->s_port
);
4957 port
= strtoul(port_str
, NULL
, 10);
4960 peer_port_set(peer
, port
);
4965 /* Set specified peer's BGP port. */
4966 DEFUN (neighbor_port
,
4968 "neighbor <A.B.C.D|X:X::X:X> port (0-65535)",
4971 "Neighbor's BGP port\n"
4972 "TCP port number\n")
4976 return peer_port_vty(vty
, argv
[idx_ip
]->arg
, AFI_IP
,
4977 argv
[idx_number
]->arg
);
4980 DEFUN (no_neighbor_port
,
4981 no_neighbor_port_cmd
,
4982 "no neighbor <A.B.C.D|X:X::X:X> port [(0-65535)]",
4986 "Neighbor's BGP port\n"
4987 "TCP port number\n")
4990 return peer_port_vty(vty
, argv
[idx_ip
]->arg
, AFI_IP
, NULL
);
4994 /* neighbor weight. */
4995 static int peer_weight_set_vty(struct vty
*vty
, const char *ip_str
, afi_t afi
,
4996 safi_t safi
, const char *weight_str
)
5000 unsigned long weight
;
5002 peer
= peer_and_group_lookup_vty(vty
, ip_str
);
5004 return CMD_WARNING_CONFIG_FAILED
;
5006 weight
= strtoul(weight_str
, NULL
, 10);
5008 ret
= peer_weight_set(peer
, afi
, safi
, weight
);
5009 return bgp_vty_return(vty
, ret
);
5012 static int peer_weight_unset_vty(struct vty
*vty
, const char *ip_str
, afi_t afi
,
5018 peer
= peer_and_group_lookup_vty(vty
, ip_str
);
5020 return CMD_WARNING_CONFIG_FAILED
;
5022 ret
= peer_weight_unset(peer
, afi
, safi
);
5023 return bgp_vty_return(vty
, ret
);
5026 DEFUN (neighbor_weight
,
5027 neighbor_weight_cmd
,
5028 "neighbor <A.B.C.D|X:X::X:X|WORD> weight (0-65535)",
5031 "Set default weight for routes from this neighbor\n"
5036 return peer_weight_set_vty(vty
, argv
[idx_peer
]->arg
, bgp_node_afi(vty
),
5037 bgp_node_safi(vty
), argv
[idx_number
]->arg
);
5040 ALIAS_HIDDEN(neighbor_weight
, neighbor_weight_hidden_cmd
,
5041 "neighbor <A.B.C.D|X:X::X:X|WORD> weight (0-65535)",
5042 NEIGHBOR_STR NEIGHBOR_ADDR_STR2
5043 "Set default weight for routes from this neighbor\n"
5046 DEFUN (no_neighbor_weight
,
5047 no_neighbor_weight_cmd
,
5048 "no neighbor <A.B.C.D|X:X::X:X|WORD> weight [(0-65535)]",
5052 "Set default weight for routes from this neighbor\n"
5056 return peer_weight_unset_vty(vty
, argv
[idx_peer
]->arg
,
5057 bgp_node_afi(vty
), bgp_node_safi(vty
));
5060 ALIAS_HIDDEN(no_neighbor_weight
, no_neighbor_weight_hidden_cmd
,
5061 "no neighbor <A.B.C.D|X:X::X:X|WORD> weight [(0-65535)]",
5062 NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2
5063 "Set default weight for routes from this neighbor\n"
5067 /* Override capability negotiation. */
5068 DEFUN (neighbor_override_capability
,
5069 neighbor_override_capability_cmd
,
5070 "neighbor <A.B.C.D|X:X::X:X|WORD> override-capability",
5073 "Override capability negotiation result\n")
5076 return peer_flag_set_vty(vty
, argv
[idx_peer
]->arg
,
5077 PEER_FLAG_OVERRIDE_CAPABILITY
);
5080 DEFUN (no_neighbor_override_capability
,
5081 no_neighbor_override_capability_cmd
,
5082 "no neighbor <A.B.C.D|X:X::X:X|WORD> override-capability",
5086 "Override capability negotiation result\n")
5089 return peer_flag_unset_vty(vty
, argv
[idx_peer
]->arg
,
5090 PEER_FLAG_OVERRIDE_CAPABILITY
);
5093 DEFUN (neighbor_strict_capability
,
5094 neighbor_strict_capability_cmd
,
5095 "neighbor <A.B.C.D|X:X::X:X|WORD> strict-capability-match",
5098 "Strict capability negotiation match\n")
5102 return peer_flag_set_vty(vty
, argv
[idx_peer
]->arg
,
5103 PEER_FLAG_STRICT_CAP_MATCH
);
5106 DEFUN (no_neighbor_strict_capability
,
5107 no_neighbor_strict_capability_cmd
,
5108 "no neighbor <A.B.C.D|X:X::X:X|WORD> strict-capability-match",
5112 "Strict capability negotiation match\n")
5116 return peer_flag_unset_vty(vty
, argv
[idx_peer
]->arg
,
5117 PEER_FLAG_STRICT_CAP_MATCH
);
5120 static int peer_timers_set_vty(struct vty
*vty
, const char *ip_str
,
5121 const char *keep_str
, const char *hold_str
)
5128 peer
= peer_and_group_lookup_vty(vty
, ip_str
);
5130 return CMD_WARNING_CONFIG_FAILED
;
5132 keepalive
= strtoul(keep_str
, NULL
, 10);
5133 holdtime
= strtoul(hold_str
, NULL
, 10);
5135 ret
= peer_timers_set(peer
, keepalive
, holdtime
);
5137 return bgp_vty_return(vty
, ret
);
5140 static int peer_timers_unset_vty(struct vty
*vty
, const char *ip_str
)
5145 peer
= peer_and_group_lookup_vty(vty
, ip_str
);
5147 return CMD_WARNING_CONFIG_FAILED
;
5149 ret
= peer_timers_unset(peer
);
5151 return bgp_vty_return(vty
, ret
);
5154 DEFUN (neighbor_timers
,
5155 neighbor_timers_cmd
,
5156 "neighbor <A.B.C.D|X:X::X:X|WORD> timers (0-65535) (0-65535)",
5159 "BGP per neighbor timers\n"
5160 "Keepalive interval\n"
5165 int idx_number_2
= 4;
5166 return peer_timers_set_vty(vty
, argv
[idx_peer
]->arg
,
5167 argv
[idx_number
]->arg
,
5168 argv
[idx_number_2
]->arg
);
5171 DEFUN (no_neighbor_timers
,
5172 no_neighbor_timers_cmd
,
5173 "no neighbor <A.B.C.D|X:X::X:X|WORD> timers [(0-65535) (0-65535)]",
5177 "BGP per neighbor timers\n"
5178 "Keepalive interval\n"
5182 return peer_timers_unset_vty(vty
, argv
[idx_peer
]->arg
);
5186 static int peer_timers_connect_set_vty(struct vty
*vty
, const char *ip_str
,
5187 const char *time_str
)
5193 peer
= peer_and_group_lookup_vty(vty
, ip_str
);
5195 return CMD_WARNING_CONFIG_FAILED
;
5197 connect
= strtoul(time_str
, NULL
, 10);
5199 ret
= peer_timers_connect_set(peer
, connect
);
5201 return bgp_vty_return(vty
, ret
);
5204 static int peer_timers_connect_unset_vty(struct vty
*vty
, const char *ip_str
)
5209 peer
= peer_and_group_lookup_vty(vty
, ip_str
);
5211 return CMD_WARNING_CONFIG_FAILED
;
5213 ret
= peer_timers_connect_unset(peer
);
5215 return bgp_vty_return(vty
, ret
);
5218 DEFUN (neighbor_timers_connect
,
5219 neighbor_timers_connect_cmd
,
5220 "neighbor <A.B.C.D|X:X::X:X|WORD> timers connect (1-65535)",
5223 "BGP per neighbor timers\n"
5224 "BGP connect timer\n"
5229 return peer_timers_connect_set_vty(vty
, argv
[idx_peer
]->arg
,
5230 argv
[idx_number
]->arg
);
5233 DEFUN (no_neighbor_timers_connect
,
5234 no_neighbor_timers_connect_cmd
,
5235 "no neighbor <A.B.C.D|X:X::X:X|WORD> timers connect [(1-65535)]",
5239 "BGP per neighbor timers\n"
5240 "BGP connect timer\n"
5244 return peer_timers_connect_unset_vty(vty
, argv
[idx_peer
]->arg
);
5248 static int peer_advertise_interval_vty(struct vty
*vty
, const char *ip_str
,
5249 const char *time_str
, int set
)
5253 uint32_t routeadv
= 0;
5255 peer
= peer_and_group_lookup_vty(vty
, ip_str
);
5257 return CMD_WARNING_CONFIG_FAILED
;
5260 routeadv
= strtoul(time_str
, NULL
, 10);
5263 ret
= peer_advertise_interval_set(peer
, routeadv
);
5265 ret
= peer_advertise_interval_unset(peer
);
5267 return bgp_vty_return(vty
, ret
);
5270 DEFUN (neighbor_advertise_interval
,
5271 neighbor_advertise_interval_cmd
,
5272 "neighbor <A.B.C.D|X:X::X:X|WORD> advertisement-interval (0-600)",
5275 "Minimum interval between sending BGP routing updates\n"
5276 "time in seconds\n")
5280 return peer_advertise_interval_vty(vty
, argv
[idx_peer
]->arg
,
5281 argv
[idx_number
]->arg
, 1);
5284 DEFUN (no_neighbor_advertise_interval
,
5285 no_neighbor_advertise_interval_cmd
,
5286 "no neighbor <A.B.C.D|X:X::X:X|WORD> advertisement-interval [(0-600)]",
5290 "Minimum interval between sending BGP routing updates\n"
5291 "time in seconds\n")
5294 return peer_advertise_interval_vty(vty
, argv
[idx_peer
]->arg
, NULL
, 0);
5298 /* Time to wait before processing route-map updates */
5299 DEFUN (bgp_set_route_map_delay_timer
,
5300 bgp_set_route_map_delay_timer_cmd
,
5301 "bgp route-map delay-timer (0-600)",
5303 "BGP route-map delay timer\n"
5304 "Time in secs to wait before processing route-map changes\n"
5305 "0 disables the timer, no route updates happen when route-maps change\n")
5308 uint32_t rmap_delay_timer
;
5310 if (argv
[idx_number
]->arg
) {
5311 rmap_delay_timer
= strtoul(argv
[idx_number
]->arg
, NULL
, 10);
5312 bm
->rmap_update_timer
= rmap_delay_timer
;
5314 /* if the dynamic update handling is being disabled, and a timer
5316 * running, stop the timer and act as if the timer has already
5319 if (!rmap_delay_timer
&& bm
->t_rmap_update
) {
5320 BGP_TIMER_OFF(bm
->t_rmap_update
);
5321 thread_execute(bm
->master
, bgp_route_map_update_timer
,
5326 vty_out(vty
, "%% BGP invalid route-map delay-timer\n");
5327 return CMD_WARNING_CONFIG_FAILED
;
5331 DEFUN (no_bgp_set_route_map_delay_timer
,
5332 no_bgp_set_route_map_delay_timer_cmd
,
5333 "no bgp route-map delay-timer [(0-600)]",
5336 "Default BGP route-map delay timer\n"
5337 "Reset to default time to wait for processing route-map changes\n"
5338 "0 disables the timer, no route updates happen when route-maps change\n")
5341 bm
->rmap_update_timer
= RMAP_DEFAULT_UPDATE_TIMER
;
5347 /* neighbor interface */
5348 static int peer_interface_vty(struct vty
*vty
, const char *ip_str
,
5353 peer
= peer_lookup_vty(vty
, ip_str
);
5354 if (!peer
|| peer
->conf_if
) {
5355 vty_out(vty
, "%% BGP invalid peer %s\n", ip_str
);
5356 return CMD_WARNING_CONFIG_FAILED
;
5360 peer_interface_set(peer
, str
);
5362 peer_interface_unset(peer
);
5367 DEFUN (neighbor_interface
,
5368 neighbor_interface_cmd
,
5369 "neighbor <A.B.C.D|X:X::X:X> interface WORD",
5377 return peer_interface_vty(vty
, argv
[idx_ip
]->arg
, argv
[idx_word
]->arg
);
5380 DEFUN (no_neighbor_interface
,
5381 no_neighbor_interface_cmd
,
5382 "no neighbor <A.B.C.D|X:X::X:X|WORD> interface WORD",
5390 return peer_interface_vty(vty
, argv
[idx_peer
]->arg
, NULL
);
5393 DEFUN (neighbor_distribute_list
,
5394 neighbor_distribute_list_cmd
,
5395 "neighbor <A.B.C.D|X:X::X:X|WORD> distribute-list <(1-199)|(1300-2699)|WORD> <in|out>",
5398 "Filter updates to/from this neighbor\n"
5399 "IP access-list number\n"
5400 "IP access-list number (expanded range)\n"
5401 "IP Access-list name\n"
5402 "Filter incoming updates\n"
5403 "Filter outgoing updates\n")
5410 const char *pstr
= argv
[idx_peer
]->arg
;
5411 const char *acl
= argv
[idx_acl
]->arg
;
5412 const char *inout
= argv
[argc
- 1]->text
;
5414 peer
= peer_and_group_lookup_vty(vty
, pstr
);
5416 return CMD_WARNING_CONFIG_FAILED
;
5418 /* Check filter direction. */
5419 direct
= strmatch(inout
, "in") ? FILTER_IN
: FILTER_OUT
;
5420 ret
= peer_distribute_set(peer
, bgp_node_afi(vty
), bgp_node_safi(vty
),
5423 return bgp_vty_return(vty
, ret
);
5427 neighbor_distribute_list
, neighbor_distribute_list_hidden_cmd
,
5428 "neighbor <A.B.C.D|X:X::X:X|WORD> distribute-list <(1-199)|(1300-2699)|WORD> <in|out>",
5429 NEIGHBOR_STR NEIGHBOR_ADDR_STR2
5430 "Filter updates to/from this neighbor\n"
5431 "IP access-list number\n"
5432 "IP access-list number (expanded range)\n"
5433 "IP Access-list name\n"
5434 "Filter incoming updates\n"
5435 "Filter outgoing updates\n")
5437 DEFUN (no_neighbor_distribute_list
,
5438 no_neighbor_distribute_list_cmd
,
5439 "no neighbor <A.B.C.D|X:X::X:X|WORD> distribute-list <(1-199)|(1300-2699)|WORD> <in|out>",
5443 "Filter updates to/from this neighbor\n"
5444 "IP access-list number\n"
5445 "IP access-list number (expanded range)\n"
5446 "IP Access-list name\n"
5447 "Filter incoming updates\n"
5448 "Filter outgoing updates\n")
5454 const char *pstr
= argv
[idx_peer
]->arg
;
5455 const char *inout
= argv
[argc
- 1]->text
;
5457 peer
= peer_and_group_lookup_vty(vty
, pstr
);
5459 return CMD_WARNING_CONFIG_FAILED
;
5461 /* Check filter direction. */
5462 direct
= strmatch(inout
, "in") ? FILTER_IN
: FILTER_OUT
;
5463 ret
= peer_distribute_unset(peer
, bgp_node_afi(vty
), bgp_node_safi(vty
),
5466 return bgp_vty_return(vty
, ret
);
5470 no_neighbor_distribute_list
, no_neighbor_distribute_list_hidden_cmd
,
5471 "no neighbor <A.B.C.D|X:X::X:X|WORD> distribute-list <(1-199)|(1300-2699)|WORD> <in|out>",
5472 NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2
5473 "Filter updates to/from this neighbor\n"
5474 "IP access-list number\n"
5475 "IP access-list number (expanded range)\n"
5476 "IP Access-list name\n"
5477 "Filter incoming updates\n"
5478 "Filter outgoing updates\n")
5480 /* Set prefix list to the peer. */
5481 static int peer_prefix_list_set_vty(struct vty
*vty
, const char *ip_str
,
5482 afi_t afi
, safi_t safi
,
5483 const char *name_str
,
5484 const char *direct_str
)
5487 int direct
= FILTER_IN
;
5490 peer
= peer_and_group_lookup_vty(vty
, ip_str
);
5492 return CMD_WARNING_CONFIG_FAILED
;
5494 /* Check filter direction. */
5495 if (strncmp(direct_str
, "i", 1) == 0)
5497 else if (strncmp(direct_str
, "o", 1) == 0)
5498 direct
= FILTER_OUT
;
5500 ret
= peer_prefix_list_set(peer
, afi
, safi
, direct
, name_str
);
5502 return bgp_vty_return(vty
, ret
);
5505 static int peer_prefix_list_unset_vty(struct vty
*vty
, const char *ip_str
,
5506 afi_t afi
, safi_t safi
,
5507 const char *direct_str
)
5511 int direct
= FILTER_IN
;
5513 peer
= peer_and_group_lookup_vty(vty
, ip_str
);
5515 return CMD_WARNING_CONFIG_FAILED
;
5517 /* Check filter direction. */
5518 if (strncmp(direct_str
, "i", 1) == 0)
5520 else if (strncmp(direct_str
, "o", 1) == 0)
5521 direct
= FILTER_OUT
;
5523 ret
= peer_prefix_list_unset(peer
, afi
, safi
, direct
);
5525 return bgp_vty_return(vty
, ret
);
5528 DEFUN (neighbor_prefix_list
,
5529 neighbor_prefix_list_cmd
,
5530 "neighbor <A.B.C.D|X:X::X:X|WORD> prefix-list WORD <in|out>",
5533 "Filter updates to/from this neighbor\n"
5534 "Name of a prefix list\n"
5535 "Filter incoming updates\n"
5536 "Filter outgoing updates\n")
5541 return peer_prefix_list_set_vty(
5542 vty
, argv
[idx_peer
]->arg
, bgp_node_afi(vty
), bgp_node_safi(vty
),
5543 argv
[idx_word
]->arg
, argv
[idx_in_out
]->arg
);
5546 ALIAS_HIDDEN(neighbor_prefix_list
, neighbor_prefix_list_hidden_cmd
,
5547 "neighbor <A.B.C.D|X:X::X:X|WORD> prefix-list WORD <in|out>",
5548 NEIGHBOR_STR NEIGHBOR_ADDR_STR2
5549 "Filter updates to/from this neighbor\n"
5550 "Name of a prefix list\n"
5551 "Filter incoming updates\n"
5552 "Filter outgoing updates\n")
5554 DEFUN (no_neighbor_prefix_list
,
5555 no_neighbor_prefix_list_cmd
,
5556 "no neighbor <A.B.C.D|X:X::X:X|WORD> prefix-list WORD <in|out>",
5560 "Filter updates to/from this neighbor\n"
5561 "Name of a prefix list\n"
5562 "Filter incoming updates\n"
5563 "Filter outgoing updates\n")
5567 return peer_prefix_list_unset_vty(vty
, argv
[idx_peer
]->arg
,
5568 bgp_node_afi(vty
), bgp_node_safi(vty
),
5569 argv
[idx_in_out
]->arg
);
5572 ALIAS_HIDDEN(no_neighbor_prefix_list
, no_neighbor_prefix_list_hidden_cmd
,
5573 "no neighbor <A.B.C.D|X:X::X:X|WORD> prefix-list WORD <in|out>",
5574 NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2
5575 "Filter updates to/from this neighbor\n"
5576 "Name of a prefix list\n"
5577 "Filter incoming updates\n"
5578 "Filter outgoing updates\n")
5580 static int peer_aslist_set_vty(struct vty
*vty
, const char *ip_str
, afi_t afi
,
5581 safi_t safi
, const char *name_str
,
5582 const char *direct_str
)
5586 int direct
= FILTER_IN
;
5588 peer
= peer_and_group_lookup_vty(vty
, ip_str
);
5590 return CMD_WARNING_CONFIG_FAILED
;
5592 /* Check filter direction. */
5593 if (strncmp(direct_str
, "i", 1) == 0)
5595 else if (strncmp(direct_str
, "o", 1) == 0)
5596 direct
= FILTER_OUT
;
5598 ret
= peer_aslist_set(peer
, afi
, safi
, direct
, name_str
);
5600 return bgp_vty_return(vty
, ret
);
5603 static int peer_aslist_unset_vty(struct vty
*vty
, const char *ip_str
, afi_t afi
,
5604 safi_t safi
, const char *direct_str
)
5608 int direct
= FILTER_IN
;
5610 peer
= peer_and_group_lookup_vty(vty
, ip_str
);
5612 return CMD_WARNING_CONFIG_FAILED
;
5614 /* Check filter direction. */
5615 if (strncmp(direct_str
, "i", 1) == 0)
5617 else if (strncmp(direct_str
, "o", 1) == 0)
5618 direct
= FILTER_OUT
;
5620 ret
= peer_aslist_unset(peer
, afi
, safi
, direct
);
5622 return bgp_vty_return(vty
, ret
);
5625 DEFUN (neighbor_filter_list
,
5626 neighbor_filter_list_cmd
,
5627 "neighbor <A.B.C.D|X:X::X:X|WORD> filter-list WORD <in|out>",
5630 "Establish BGP filters\n"
5631 "AS path access-list name\n"
5632 "Filter incoming routes\n"
5633 "Filter outgoing routes\n")
5638 return peer_aslist_set_vty(vty
, argv
[idx_peer
]->arg
, bgp_node_afi(vty
),
5639 bgp_node_safi(vty
), argv
[idx_word
]->arg
,
5640 argv
[idx_in_out
]->arg
);
5643 ALIAS_HIDDEN(neighbor_filter_list
, neighbor_filter_list_hidden_cmd
,
5644 "neighbor <A.B.C.D|X:X::X:X|WORD> filter-list WORD <in|out>",
5645 NEIGHBOR_STR NEIGHBOR_ADDR_STR2
5646 "Establish BGP filters\n"
5647 "AS path access-list name\n"
5648 "Filter incoming routes\n"
5649 "Filter outgoing routes\n")
5651 DEFUN (no_neighbor_filter_list
,
5652 no_neighbor_filter_list_cmd
,
5653 "no neighbor <A.B.C.D|X:X::X:X|WORD> filter-list WORD <in|out>",
5657 "Establish BGP filters\n"
5658 "AS path access-list name\n"
5659 "Filter incoming routes\n"
5660 "Filter outgoing routes\n")
5664 return peer_aslist_unset_vty(vty
, argv
[idx_peer
]->arg
,
5665 bgp_node_afi(vty
), bgp_node_safi(vty
),
5666 argv
[idx_in_out
]->arg
);
5669 ALIAS_HIDDEN(no_neighbor_filter_list
, no_neighbor_filter_list_hidden_cmd
,
5670 "no neighbor <A.B.C.D|X:X::X:X|WORD> filter-list WORD <in|out>",
5671 NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2
5672 "Establish BGP filters\n"
5673 "AS path access-list name\n"
5674 "Filter incoming routes\n"
5675 "Filter outgoing routes\n")
5677 /* Set route-map to the peer. */
5678 static int peer_route_map_set_vty(struct vty
*vty
, const char *ip_str
,
5679 afi_t afi
, safi_t safi
, const char *name_str
,
5680 const char *direct_str
)
5684 int direct
= RMAP_IN
;
5685 struct route_map
*route_map
;
5687 peer
= peer_and_group_lookup_vty(vty
, ip_str
);
5689 return CMD_WARNING_CONFIG_FAILED
;
5691 /* Check filter direction. */
5692 if (strncmp(direct_str
, "in", 2) == 0)
5694 else if (strncmp(direct_str
, "o", 1) == 0)
5697 route_map
= route_map_lookup_warn_noexist(vty
, name_str
);
5698 ret
= peer_route_map_set(peer
, afi
, safi
, direct
, name_str
, route_map
);
5700 return bgp_vty_return(vty
, ret
);
5703 static int peer_route_map_unset_vty(struct vty
*vty
, const char *ip_str
,
5704 afi_t afi
, safi_t safi
,
5705 const char *direct_str
)
5709 int direct
= RMAP_IN
;
5711 peer
= peer_and_group_lookup_vty(vty
, ip_str
);
5713 return CMD_WARNING_CONFIG_FAILED
;
5715 /* Check filter direction. */
5716 if (strncmp(direct_str
, "in", 2) == 0)
5718 else if (strncmp(direct_str
, "o", 1) == 0)
5721 ret
= peer_route_map_unset(peer
, afi
, safi
, direct
);
5723 return bgp_vty_return(vty
, ret
);
5726 DEFUN (neighbor_route_map
,
5727 neighbor_route_map_cmd
,
5728 "neighbor <A.B.C.D|X:X::X:X|WORD> route-map WORD <in|out>",
5731 "Apply route map to neighbor\n"
5732 "Name of route map\n"
5733 "Apply map to incoming routes\n"
5734 "Apply map to outbound routes\n")
5739 return peer_route_map_set_vty(
5740 vty
, argv
[idx_peer
]->arg
, bgp_node_afi(vty
), bgp_node_safi(vty
),
5741 argv
[idx_word
]->arg
, argv
[idx_in_out
]->arg
);
5744 ALIAS_HIDDEN(neighbor_route_map
, neighbor_route_map_hidden_cmd
,
5745 "neighbor <A.B.C.D|X:X::X:X|WORD> route-map WORD <in|out>",
5746 NEIGHBOR_STR NEIGHBOR_ADDR_STR2
5747 "Apply route map to neighbor\n"
5748 "Name of route map\n"
5749 "Apply map to incoming routes\n"
5750 "Apply map to outbound routes\n")
5752 DEFUN (no_neighbor_route_map
,
5753 no_neighbor_route_map_cmd
,
5754 "no neighbor <A.B.C.D|X:X::X:X|WORD> route-map WORD <in|out>",
5758 "Apply route map to neighbor\n"
5759 "Name of route map\n"
5760 "Apply map to incoming routes\n"
5761 "Apply map to outbound routes\n")
5765 return peer_route_map_unset_vty(vty
, argv
[idx_peer
]->arg
,
5766 bgp_node_afi(vty
), bgp_node_safi(vty
),
5767 argv
[idx_in_out
]->arg
);
5770 ALIAS_HIDDEN(no_neighbor_route_map
, no_neighbor_route_map_hidden_cmd
,
5771 "no neighbor <A.B.C.D|X:X::X:X|WORD> route-map WORD <in|out>",
5772 NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2
5773 "Apply route map to neighbor\n"
5774 "Name of route map\n"
5775 "Apply map to incoming routes\n"
5776 "Apply map to outbound routes\n")
5778 /* Set unsuppress-map to the peer. */
5779 static int peer_unsuppress_map_set_vty(struct vty
*vty
, const char *ip_str
,
5780 afi_t afi
, safi_t safi
,
5781 const char *name_str
)
5785 struct route_map
*route_map
;
5787 peer
= peer_and_group_lookup_vty(vty
, ip_str
);
5789 return CMD_WARNING_CONFIG_FAILED
;
5791 route_map
= route_map_lookup_warn_noexist(vty
, name_str
);
5792 ret
= peer_unsuppress_map_set(peer
, afi
, safi
, name_str
, route_map
);
5794 return bgp_vty_return(vty
, ret
);
5797 /* Unset route-map from the peer. */
5798 static int peer_unsuppress_map_unset_vty(struct vty
*vty
, const char *ip_str
,
5799 afi_t afi
, safi_t safi
)
5804 peer
= peer_and_group_lookup_vty(vty
, ip_str
);
5806 return CMD_WARNING_CONFIG_FAILED
;
5808 ret
= peer_unsuppress_map_unset(peer
, afi
, safi
);
5810 return bgp_vty_return(vty
, ret
);
5813 DEFUN (neighbor_unsuppress_map
,
5814 neighbor_unsuppress_map_cmd
,
5815 "neighbor <A.B.C.D|X:X::X:X|WORD> unsuppress-map WORD",
5818 "Route-map to selectively unsuppress suppressed routes\n"
5819 "Name of route map\n")
5823 return peer_unsuppress_map_set_vty(
5824 vty
, argv
[idx_peer
]->arg
, bgp_node_afi(vty
), bgp_node_safi(vty
),
5825 argv
[idx_word
]->arg
);
5828 ALIAS_HIDDEN(neighbor_unsuppress_map
, neighbor_unsuppress_map_hidden_cmd
,
5829 "neighbor <A.B.C.D|X:X::X:X|WORD> unsuppress-map WORD",
5830 NEIGHBOR_STR NEIGHBOR_ADDR_STR2
5831 "Route-map to selectively unsuppress suppressed routes\n"
5832 "Name of route map\n")
5834 DEFUN (no_neighbor_unsuppress_map
,
5835 no_neighbor_unsuppress_map_cmd
,
5836 "no neighbor <A.B.C.D|X:X::X:X|WORD> unsuppress-map WORD",
5840 "Route-map to selectively unsuppress suppressed routes\n"
5841 "Name of route map\n")
5844 return peer_unsuppress_map_unset_vty(vty
, argv
[idx_peer
]->arg
,
5846 bgp_node_safi(vty
));
5849 ALIAS_HIDDEN(no_neighbor_unsuppress_map
, no_neighbor_unsuppress_map_hidden_cmd
,
5850 "no neighbor <A.B.C.D|X:X::X:X|WORD> unsuppress-map WORD",
5851 NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2
5852 "Route-map to selectively unsuppress suppressed routes\n"
5853 "Name of route map\n")
5855 static int peer_maximum_prefix_set_vty(struct vty
*vty
, const char *ip_str
,
5856 afi_t afi
, safi_t safi
,
5857 const char *num_str
,
5858 const char *threshold_str
, int warning
,
5859 const char *restart_str
)
5867 peer
= peer_and_group_lookup_vty(vty
, ip_str
);
5869 return CMD_WARNING_CONFIG_FAILED
;
5871 max
= strtoul(num_str
, NULL
, 10);
5873 threshold
= atoi(threshold_str
);
5875 threshold
= MAXIMUM_PREFIX_THRESHOLD_DEFAULT
;
5878 restart
= atoi(restart_str
);
5882 ret
= peer_maximum_prefix_set(peer
, afi
, safi
, max
, threshold
, warning
,
5885 return bgp_vty_return(vty
, ret
);
5888 static int peer_maximum_prefix_unset_vty(struct vty
*vty
, const char *ip_str
,
5889 afi_t afi
, safi_t safi
)
5894 peer
= peer_and_group_lookup_vty(vty
, ip_str
);
5896 return CMD_WARNING_CONFIG_FAILED
;
5898 ret
= peer_maximum_prefix_unset(peer
, afi
, safi
);
5900 return bgp_vty_return(vty
, ret
);
5903 /* Maximum number of prefix configuration. prefix count is different
5904 for each peer configuration. So this configuration can be set for
5905 each peer configuration. */
5906 DEFUN (neighbor_maximum_prefix
,
5907 neighbor_maximum_prefix_cmd
,
5908 "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295)",
5911 "Maximum number of prefix accept from this peer\n"
5912 "maximum no. of prefix limit\n")
5916 return peer_maximum_prefix_set_vty(
5917 vty
, argv
[idx_peer
]->arg
, bgp_node_afi(vty
), bgp_node_safi(vty
),
5918 argv
[idx_number
]->arg
, NULL
, 0, NULL
);
5921 ALIAS_HIDDEN(neighbor_maximum_prefix
, neighbor_maximum_prefix_hidden_cmd
,
5922 "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295)",
5923 NEIGHBOR_STR NEIGHBOR_ADDR_STR2
5924 "Maximum number of prefix accept from this peer\n"
5925 "maximum no. of prefix limit\n")
5927 DEFUN (neighbor_maximum_prefix_threshold
,
5928 neighbor_maximum_prefix_threshold_cmd
,
5929 "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295) (1-100)",
5932 "Maximum number of prefix accept from this peer\n"
5933 "maximum no. of prefix limit\n"
5934 "Threshold value (%) at which to generate a warning msg\n")
5938 int idx_number_2
= 4;
5939 return peer_maximum_prefix_set_vty(
5940 vty
, argv
[idx_peer
]->arg
, bgp_node_afi(vty
), bgp_node_safi(vty
),
5941 argv
[idx_number
]->arg
, argv
[idx_number_2
]->arg
, 0, NULL
);
5945 neighbor_maximum_prefix_threshold
,
5946 neighbor_maximum_prefix_threshold_hidden_cmd
,
5947 "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295) (1-100)",
5948 NEIGHBOR_STR NEIGHBOR_ADDR_STR2
5949 "Maximum number of prefix accept from this peer\n"
5950 "maximum no. of prefix limit\n"
5951 "Threshold value (%) at which to generate a warning msg\n")
5953 DEFUN (neighbor_maximum_prefix_warning
,
5954 neighbor_maximum_prefix_warning_cmd
,
5955 "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295) warning-only",
5958 "Maximum number of prefix accept from this peer\n"
5959 "maximum no. of prefix limit\n"
5960 "Only give warning message when limit is exceeded\n")
5964 return peer_maximum_prefix_set_vty(
5965 vty
, argv
[idx_peer
]->arg
, bgp_node_afi(vty
), bgp_node_safi(vty
),
5966 argv
[idx_number
]->arg
, NULL
, 1, NULL
);
5970 neighbor_maximum_prefix_warning
,
5971 neighbor_maximum_prefix_warning_hidden_cmd
,
5972 "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295) warning-only",
5973 NEIGHBOR_STR NEIGHBOR_ADDR_STR2
5974 "Maximum number of prefix accept from this peer\n"
5975 "maximum no. of prefix limit\n"
5976 "Only give warning message when limit is exceeded\n")
5978 DEFUN (neighbor_maximum_prefix_threshold_warning
,
5979 neighbor_maximum_prefix_threshold_warning_cmd
,
5980 "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295) (1-100) warning-only",
5983 "Maximum number of prefix accept from this peer\n"
5984 "maximum no. of prefix limit\n"
5985 "Threshold value (%) at which to generate a warning msg\n"
5986 "Only give warning message when limit is exceeded\n")
5990 int idx_number_2
= 4;
5991 return peer_maximum_prefix_set_vty(
5992 vty
, argv
[idx_peer
]->arg
, bgp_node_afi(vty
), bgp_node_safi(vty
),
5993 argv
[idx_number
]->arg
, argv
[idx_number_2
]->arg
, 1, NULL
);
5997 neighbor_maximum_prefix_threshold_warning
,
5998 neighbor_maximum_prefix_threshold_warning_hidden_cmd
,
5999 "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295) (1-100) warning-only",
6000 NEIGHBOR_STR NEIGHBOR_ADDR_STR2
6001 "Maximum number of prefix accept from this peer\n"
6002 "maximum no. of prefix limit\n"
6003 "Threshold value (%) at which to generate a warning msg\n"
6004 "Only give warning message when limit is exceeded\n")
6006 DEFUN (neighbor_maximum_prefix_restart
,
6007 neighbor_maximum_prefix_restart_cmd
,
6008 "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295) restart (1-65535)",
6011 "Maximum number of prefix accept from this peer\n"
6012 "maximum no. of prefix limit\n"
6013 "Restart bgp connection after limit is exceeded\n"
6014 "Restart interval in minutes\n")
6018 int idx_number_2
= 5;
6019 return peer_maximum_prefix_set_vty(
6020 vty
, argv
[idx_peer
]->arg
, bgp_node_afi(vty
), bgp_node_safi(vty
),
6021 argv
[idx_number
]->arg
, NULL
, 0, argv
[idx_number_2
]->arg
);
6025 neighbor_maximum_prefix_restart
,
6026 neighbor_maximum_prefix_restart_hidden_cmd
,
6027 "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295) restart (1-65535)",
6028 NEIGHBOR_STR NEIGHBOR_ADDR_STR2
6029 "Maximum number of prefix accept from this peer\n"
6030 "maximum no. of prefix limit\n"
6031 "Restart bgp connection after limit is exceeded\n"
6032 "Restart interval in minutes\n")
6034 DEFUN (neighbor_maximum_prefix_threshold_restart
,
6035 neighbor_maximum_prefix_threshold_restart_cmd
,
6036 "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295) (1-100) restart (1-65535)",
6039 "Maximum number of prefixes to accept from this peer\n"
6040 "maximum no. of prefix limit\n"
6041 "Threshold value (%) at which to generate a warning msg\n"
6042 "Restart bgp connection after limit is exceeded\n"
6043 "Restart interval in minutes\n")
6047 int idx_number_2
= 4;
6048 int idx_number_3
= 6;
6049 return peer_maximum_prefix_set_vty(
6050 vty
, argv
[idx_peer
]->arg
, bgp_node_afi(vty
), bgp_node_safi(vty
),
6051 argv
[idx_number
]->arg
, argv
[idx_number_2
]->arg
, 0,
6052 argv
[idx_number_3
]->arg
);
6056 neighbor_maximum_prefix_threshold_restart
,
6057 neighbor_maximum_prefix_threshold_restart_hidden_cmd
,
6058 "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295) (1-100) restart (1-65535)",
6059 NEIGHBOR_STR NEIGHBOR_ADDR_STR2
6060 "Maximum number of prefixes to accept from this peer\n"
6061 "maximum no. of prefix limit\n"
6062 "Threshold value (%) at which to generate a warning msg\n"
6063 "Restart bgp connection after limit is exceeded\n"
6064 "Restart interval in minutes\n")
6066 DEFUN (no_neighbor_maximum_prefix
,
6067 no_neighbor_maximum_prefix_cmd
,
6068 "no neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix [(1-4294967295) [(1-100)] [restart (1-65535)] [warning-only]]",
6072 "Maximum number of prefixes to accept from this peer\n"
6073 "maximum no. of prefix limit\n"
6074 "Threshold value (%) at which to generate a warning msg\n"
6075 "Restart bgp connection after limit is exceeded\n"
6076 "Restart interval in minutes\n"
6077 "Only give warning message when limit is exceeded\n")
6080 return peer_maximum_prefix_unset_vty(vty
, argv
[idx_peer
]->arg
,
6082 bgp_node_safi(vty
));
6086 no_neighbor_maximum_prefix
, no_neighbor_maximum_prefix_hidden_cmd
,
6087 "no neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix [(1-4294967295) [(1-100)] [restart (1-65535)] [warning-only]]",
6088 NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2
6089 "Maximum number of prefixes to accept from this peer\n"
6090 "maximum no. of prefix limit\n"
6091 "Threshold value (%) at which to generate a warning msg\n"
6092 "Restart bgp connection after limit is exceeded\n"
6093 "Restart interval in minutes\n"
6094 "Only give warning message when limit is exceeded\n")
6097 /* "neighbor allowas-in" */
6098 DEFUN (neighbor_allowas_in
,
6099 neighbor_allowas_in_cmd
,
6100 "neighbor <A.B.C.D|X:X::X:X|WORD> allowas-in [<(1-10)|origin>]",
6103 "Accept as-path with my AS present in it\n"
6104 "Number of occurences of AS number\n"
6105 "Only accept my AS in the as-path if the route was originated in my AS\n")
6108 int idx_number_origin
= 3;
6114 peer
= peer_and_group_lookup_vty(vty
, argv
[idx_peer
]->arg
);
6116 return CMD_WARNING_CONFIG_FAILED
;
6118 if (argc
<= idx_number_origin
)
6121 if (argv
[idx_number_origin
]->type
== WORD_TKN
)
6124 allow_num
= atoi(argv
[idx_number_origin
]->arg
);
6127 ret
= peer_allowas_in_set(peer
, bgp_node_afi(vty
), bgp_node_safi(vty
),
6130 return bgp_vty_return(vty
, ret
);
6134 neighbor_allowas_in
, neighbor_allowas_in_hidden_cmd
,
6135 "neighbor <A.B.C.D|X:X::X:X|WORD> allowas-in [<(1-10)|origin>]",
6136 NEIGHBOR_STR NEIGHBOR_ADDR_STR2
6137 "Accept as-path with my AS present in it\n"
6138 "Number of occurences of AS number\n"
6139 "Only accept my AS in the as-path if the route was originated in my AS\n")
6141 DEFUN (no_neighbor_allowas_in
,
6142 no_neighbor_allowas_in_cmd
,
6143 "no neighbor <A.B.C.D|X:X::X:X|WORD> allowas-in [<(1-10)|origin>]",
6147 "allow local ASN appears in aspath attribute\n"
6148 "Number of occurences of AS number\n"
6149 "Only accept my AS in the as-path if the route was originated in my AS\n")
6155 peer
= peer_and_group_lookup_vty(vty
, argv
[idx_peer
]->arg
);
6157 return CMD_WARNING_CONFIG_FAILED
;
6159 ret
= peer_allowas_in_unset(peer
, bgp_node_afi(vty
),
6160 bgp_node_safi(vty
));
6162 return bgp_vty_return(vty
, ret
);
6166 no_neighbor_allowas_in
, no_neighbor_allowas_in_hidden_cmd
,
6167 "no neighbor <A.B.C.D|X:X::X:X|WORD> allowas-in [<(1-10)|origin>]",
6168 NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2
6169 "allow local ASN appears in aspath attribute\n"
6170 "Number of occurences of AS number\n"
6171 "Only accept my AS in the as-path if the route was originated in my AS\n")
6173 DEFUN (neighbor_ttl_security
,
6174 neighbor_ttl_security_cmd
,
6175 "neighbor <A.B.C.D|X:X::X:X|WORD> ttl-security hops (1-254)",
6178 "BGP ttl-security parameters\n"
6179 "Specify the maximum number of hops to the BGP peer\n"
6180 "Number of hops to BGP peer\n")
6187 peer
= peer_and_group_lookup_vty(vty
, argv
[idx_peer
]->arg
);
6189 return CMD_WARNING_CONFIG_FAILED
;
6191 gtsm_hops
= strtoul(argv
[idx_number
]->arg
, NULL
, 10);
6194 * If 'neighbor swpX', then this is for directly connected peers,
6195 * we should not accept a ttl-security hops value greater than 1.
6197 if (peer
->conf_if
&& (gtsm_hops
> 1)) {
6199 "%s is directly connected peer, hops cannot exceed 1\n",
6200 argv
[idx_peer
]->arg
);
6201 return CMD_WARNING_CONFIG_FAILED
;
6204 return bgp_vty_return(vty
, peer_ttl_security_hops_set(peer
, gtsm_hops
));
6207 DEFUN (no_neighbor_ttl_security
,
6208 no_neighbor_ttl_security_cmd
,
6209 "no neighbor <A.B.C.D|X:X::X:X|WORD> ttl-security hops (1-254)",
6213 "BGP ttl-security parameters\n"
6214 "Specify the maximum number of hops to the BGP peer\n"
6215 "Number of hops to BGP peer\n")
6220 peer
= peer_and_group_lookup_vty(vty
, argv
[idx_peer
]->arg
);
6222 return CMD_WARNING_CONFIG_FAILED
;
6224 return bgp_vty_return(vty
, peer_ttl_security_hops_unset(peer
));
6227 DEFUN (neighbor_addpath_tx_all_paths
,
6228 neighbor_addpath_tx_all_paths_cmd
,
6229 "neighbor <A.B.C.D|X:X::X:X|WORD> addpath-tx-all-paths",
6232 "Use addpath to advertise all paths to a neighbor\n")
6237 peer
= peer_and_group_lookup_vty(vty
, argv
[idx_peer
]->arg
);
6239 return CMD_WARNING_CONFIG_FAILED
;
6241 bgp_addpath_set_peer_type(peer
, bgp_node_afi(vty
), bgp_node_safi(vty
),
6246 ALIAS_HIDDEN(neighbor_addpath_tx_all_paths
,
6247 neighbor_addpath_tx_all_paths_hidden_cmd
,
6248 "neighbor <A.B.C.D|X:X::X:X|WORD> addpath-tx-all-paths",
6249 NEIGHBOR_STR NEIGHBOR_ADDR_STR2
6250 "Use addpath to advertise all paths to a neighbor\n")
6252 DEFUN (no_neighbor_addpath_tx_all_paths
,
6253 no_neighbor_addpath_tx_all_paths_cmd
,
6254 "no neighbor <A.B.C.D|X:X::X:X|WORD> addpath-tx-all-paths",
6258 "Use addpath to advertise all paths to a neighbor\n")
6263 peer
= peer_and_group_lookup_vty(vty
, argv
[idx_peer
]->arg
);
6265 return CMD_WARNING_CONFIG_FAILED
;
6267 if (peer
->addpath_type
[bgp_node_afi(vty
)][bgp_node_safi(vty
)]
6268 != BGP_ADDPATH_ALL
) {
6270 "%% Peer not currently configured to transmit all paths.");
6271 return CMD_WARNING_CONFIG_FAILED
;
6274 bgp_addpath_set_peer_type(peer
, bgp_node_afi(vty
), bgp_node_safi(vty
),
6280 ALIAS_HIDDEN(no_neighbor_addpath_tx_all_paths
,
6281 no_neighbor_addpath_tx_all_paths_hidden_cmd
,
6282 "no neighbor <A.B.C.D|X:X::X:X|WORD> addpath-tx-all-paths",
6283 NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2
6284 "Use addpath to advertise all paths to a neighbor\n")
6286 DEFUN (neighbor_addpath_tx_bestpath_per_as
,
6287 neighbor_addpath_tx_bestpath_per_as_cmd
,
6288 "neighbor <A.B.C.D|X:X::X:X|WORD> addpath-tx-bestpath-per-AS",
6291 "Use addpath to advertise the bestpath per each neighboring AS\n")
6296 peer
= peer_and_group_lookup_vty(vty
, argv
[idx_peer
]->arg
);
6298 return CMD_WARNING_CONFIG_FAILED
;
6300 bgp_addpath_set_peer_type(peer
, bgp_node_afi(vty
), bgp_node_safi(vty
),
6301 BGP_ADDPATH_BEST_PER_AS
);
6306 ALIAS_HIDDEN(neighbor_addpath_tx_bestpath_per_as
,
6307 neighbor_addpath_tx_bestpath_per_as_hidden_cmd
,
6308 "neighbor <A.B.C.D|X:X::X:X|WORD> addpath-tx-bestpath-per-AS",
6309 NEIGHBOR_STR NEIGHBOR_ADDR_STR2
6310 "Use addpath to advertise the bestpath per each neighboring AS\n")
6312 DEFUN (no_neighbor_addpath_tx_bestpath_per_as
,
6313 no_neighbor_addpath_tx_bestpath_per_as_cmd
,
6314 "no neighbor <A.B.C.D|X:X::X:X|WORD> addpath-tx-bestpath-per-AS",
6318 "Use addpath to advertise the bestpath per each neighboring AS\n")
6323 peer
= peer_and_group_lookup_vty(vty
, argv
[idx_peer
]->arg
);
6325 return CMD_WARNING_CONFIG_FAILED
;
6327 if (peer
->addpath_type
[bgp_node_afi(vty
)][bgp_node_safi(vty
)]
6328 != BGP_ADDPATH_BEST_PER_AS
) {
6330 "%% Peer not currently configured to transmit all best path per as.");
6331 return CMD_WARNING_CONFIG_FAILED
;
6334 bgp_addpath_set_peer_type(peer
, bgp_node_afi(vty
), bgp_node_safi(vty
),
6340 ALIAS_HIDDEN(no_neighbor_addpath_tx_bestpath_per_as
,
6341 no_neighbor_addpath_tx_bestpath_per_as_hidden_cmd
,
6342 "no neighbor <A.B.C.D|X:X::X:X|WORD> addpath-tx-bestpath-per-AS",
6343 NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2
6344 "Use addpath to advertise the bestpath per each neighboring AS\n")
6346 static int set_ecom_list(struct vty
*vty
, int argc
, struct cmd_token
**argv
,
6347 struct ecommunity
**list
)
6349 struct ecommunity
*ecom
= NULL
;
6350 struct ecommunity
*ecomadd
;
6352 for (; argc
; --argc
, ++argv
) {
6354 ecomadd
= ecommunity_str2com(argv
[0]->arg
,
6355 ECOMMUNITY_ROUTE_TARGET
, 0);
6357 vty_out(vty
, "Malformed community-list value\n");
6359 ecommunity_free(&ecom
);
6360 return CMD_WARNING_CONFIG_FAILED
;
6364 ecommunity_merge(ecom
, ecomadd
);
6365 ecommunity_free(&ecomadd
);
6372 ecommunity_free(&*list
);
6380 * v2vimport is true if we are handling a `import vrf ...` command
6382 static afi_t
vpn_policy_getafi(struct vty
*vty
, struct bgp
*bgp
, bool v2vimport
)
6386 switch (vty
->node
) {
6395 "%% context error: valid only in address-family <ipv4|ipv6> unicast block\n");
6400 if (CHECK_FLAG(bgp
->af_flags
[afi
][SAFI_UNICAST
],
6401 BGP_CONFIG_VRF_TO_VRF_IMPORT
)
6402 || CHECK_FLAG(bgp
->af_flags
[afi
][SAFI_UNICAST
],
6403 BGP_CONFIG_VRF_TO_VRF_EXPORT
)) {
6405 "%% error: Please unconfigure import vrf commands before using vpn commands\n");
6409 if (CHECK_FLAG(bgp
->af_flags
[afi
][SAFI_UNICAST
],
6410 BGP_CONFIG_VRF_TO_MPLSVPN_EXPORT
)
6411 || CHECK_FLAG(bgp
->af_flags
[afi
][SAFI_UNICAST
],
6412 BGP_CONFIG_MPLSVPN_TO_VRF_IMPORT
)) {
6414 "%% error: Please unconfigure vpn to vrf commands before using import vrf commands\n");
6421 DEFPY (af_rd_vpn_export
,
6422 af_rd_vpn_export_cmd
,
6423 "[no] rd vpn export ASN:NN_OR_IP-ADDRESS:NN$rd_str",
6425 "Specify route distinguisher\n"
6426 "Between current address-family and vpn\n"
6427 "For routes leaked from current address-family to vpn\n"
6428 "Route Distinguisher (<as-number>:<number> | <ip-address>:<number>)\n")
6430 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
6431 struct prefix_rd prd
;
6437 if (argv_find(argv
, argc
, "no", &idx
))
6441 ret
= str2prefix_rd(rd_str
, &prd
);
6443 vty_out(vty
, "%% Malformed rd\n");
6444 return CMD_WARNING_CONFIG_FAILED
;
6448 afi
= vpn_policy_getafi(vty
, bgp
, false);
6450 return CMD_WARNING_CONFIG_FAILED
;
6453 * pre-change: un-export vpn routes (vpn->vrf routes unaffected)
6455 vpn_leak_prechange(BGP_VPN_POLICY_DIR_TOVPN
, afi
,
6456 bgp_get_default(), bgp
);
6459 bgp
->vpn_policy
[afi
].tovpn_rd
= prd
;
6460 SET_FLAG(bgp
->vpn_policy
[afi
].flags
,
6461 BGP_VPN_POLICY_TOVPN_RD_SET
);
6463 UNSET_FLAG(bgp
->vpn_policy
[afi
].flags
,
6464 BGP_VPN_POLICY_TOVPN_RD_SET
);
6467 /* post-change: re-export vpn routes */
6468 vpn_leak_postchange(BGP_VPN_POLICY_DIR_TOVPN
, afi
,
6469 bgp_get_default(), bgp
);
6474 ALIAS (af_rd_vpn_export
,
6475 af_no_rd_vpn_export_cmd
,
6478 "Specify route distinguisher\n"
6479 "Between current address-family and vpn\n"
6480 "For routes leaked from current address-family to vpn\n")
6482 DEFPY (af_label_vpn_export
,
6483 af_label_vpn_export_cmd
,
6484 "[no] label vpn export <(0-1048575)$label_val|auto$label_auto>",
6486 "label value for VRF\n"
6487 "Between current address-family and vpn\n"
6488 "For routes leaked from current address-family to vpn\n"
6489 "Label Value <0-1048575>\n"
6490 "Automatically assign a label\n")
6492 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
6493 mpls_label_t label
= MPLS_LABEL_NONE
;
6498 if (argv_find(argv
, argc
, "no", &idx
))
6501 /* If "no ...", squash trailing parameter */
6507 label
= label_val
; /* parser should force unsigned */
6510 afi
= vpn_policy_getafi(vty
, bgp
, false);
6512 return CMD_WARNING_CONFIG_FAILED
;
6515 if (label_auto
&& CHECK_FLAG(bgp
->vpn_policy
[afi
].flags
,
6516 BGP_VPN_POLICY_TOVPN_LABEL_AUTO
))
6521 * pre-change: un-export vpn routes (vpn->vrf routes unaffected)
6523 vpn_leak_prechange(BGP_VPN_POLICY_DIR_TOVPN
, afi
,
6524 bgp_get_default(), bgp
);
6526 if (!label_auto
&& CHECK_FLAG(bgp
->vpn_policy
[afi
].flags
,
6527 BGP_VPN_POLICY_TOVPN_LABEL_AUTO
)) {
6529 if (bgp
->vpn_policy
[afi
].tovpn_label
!= MPLS_LABEL_NONE
) {
6532 * label has previously been automatically
6533 * assigned by labelpool: release it
6535 * NB if tovpn_label == MPLS_LABEL_NONE it
6536 * means the automatic assignment is in flight
6537 * and therefore the labelpool callback must
6538 * detect that the auto label is not needed.
6541 bgp_lp_release(LP_TYPE_VRF
,
6542 &bgp
->vpn_policy
[afi
],
6543 bgp
->vpn_policy
[afi
].tovpn_label
);
6545 UNSET_FLAG(bgp
->vpn_policy
[afi
].flags
,
6546 BGP_VPN_POLICY_TOVPN_LABEL_AUTO
);
6549 bgp
->vpn_policy
[afi
].tovpn_label
= label
;
6551 SET_FLAG(bgp
->vpn_policy
[afi
].flags
,
6552 BGP_VPN_POLICY_TOVPN_LABEL_AUTO
);
6553 bgp_lp_get(LP_TYPE_VRF
, &bgp
->vpn_policy
[afi
],
6554 vpn_leak_label_callback
);
6557 /* post-change: re-export vpn routes */
6558 vpn_leak_postchange(BGP_VPN_POLICY_DIR_TOVPN
, afi
,
6559 bgp_get_default(), bgp
);
6564 ALIAS (af_label_vpn_export
,
6565 af_no_label_vpn_export_cmd
,
6566 "no label vpn export",
6568 "label value for VRF\n"
6569 "Between current address-family and vpn\n"
6570 "For routes leaked from current address-family to vpn\n")
6572 DEFPY (af_nexthop_vpn_export
,
6573 af_nexthop_vpn_export_cmd
,
6574 "[no] nexthop vpn export <A.B.C.D|X:X::X:X>$nexthop_str",
6576 "Specify next hop to use for VRF advertised prefixes\n"
6577 "Between current address-family and vpn\n"
6578 "For routes leaked from current address-family to vpn\n"
6582 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
6588 if (argv_find(argv
, argc
, "no", &idx
))
6592 if (!sockunion2hostprefix(nexthop_str
, &p
))
6593 return CMD_WARNING_CONFIG_FAILED
;
6596 afi
= vpn_policy_getafi(vty
, bgp
, false);
6598 return CMD_WARNING_CONFIG_FAILED
;
6601 * pre-change: un-export vpn routes (vpn->vrf routes unaffected)
6603 vpn_leak_prechange(BGP_VPN_POLICY_DIR_TOVPN
, afi
,
6604 bgp_get_default(), bgp
);
6607 bgp
->vpn_policy
[afi
].tovpn_nexthop
= p
;
6608 SET_FLAG(bgp
->vpn_policy
[afi
].flags
,
6609 BGP_VPN_POLICY_TOVPN_NEXTHOP_SET
);
6611 UNSET_FLAG(bgp
->vpn_policy
[afi
].flags
,
6612 BGP_VPN_POLICY_TOVPN_NEXTHOP_SET
);
6615 /* post-change: re-export vpn routes */
6616 vpn_leak_postchange(BGP_VPN_POLICY_DIR_TOVPN
, afi
,
6617 bgp_get_default(), bgp
);
6622 ALIAS (af_nexthop_vpn_export
,
6623 af_no_nexthop_vpn_export_cmd
,
6624 "no nexthop vpn export",
6626 "Specify next hop to use for VRF advertised prefixes\n"
6627 "Between current address-family and vpn\n"
6628 "For routes leaked from current address-family to vpn\n")
6630 static int vpn_policy_getdirs(struct vty
*vty
, const char *dstr
, int *dodir
)
6632 if (!strcmp(dstr
, "import")) {
6633 dodir
[BGP_VPN_POLICY_DIR_FROMVPN
] = 1;
6634 } else if (!strcmp(dstr
, "export")) {
6635 dodir
[BGP_VPN_POLICY_DIR_TOVPN
] = 1;
6636 } else if (!strcmp(dstr
, "both")) {
6637 dodir
[BGP_VPN_POLICY_DIR_FROMVPN
] = 1;
6638 dodir
[BGP_VPN_POLICY_DIR_TOVPN
] = 1;
6640 vty_out(vty
, "%% direction parse error\n");
6641 return CMD_WARNING_CONFIG_FAILED
;
6646 DEFPY (af_rt_vpn_imexport
,
6647 af_rt_vpn_imexport_cmd
,
6648 "[no] <rt|route-target> vpn <import|export|both>$direction_str RTLIST...",
6650 "Specify route target list\n"
6651 "Specify route target list\n"
6652 "Between current address-family and vpn\n"
6653 "For routes leaked from vpn to current address-family: match any\n"
6654 "For routes leaked from current address-family to vpn: set\n"
6655 "both import: match any and export: set\n"
6656 "Space separated route target list (A.B.C.D:MN|EF:OPQR|GHJK:MN)\n")
6658 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
6660 struct ecommunity
*ecom
= NULL
;
6661 int dodir
[BGP_VPN_POLICY_DIR_MAX
] = {0};
6662 vpn_policy_direction_t dir
;
6667 if (argv_find(argv
, argc
, "no", &idx
))
6670 afi
= vpn_policy_getafi(vty
, bgp
, false);
6672 return CMD_WARNING_CONFIG_FAILED
;
6674 ret
= vpn_policy_getdirs(vty
, direction_str
, dodir
);
6675 if (ret
!= CMD_SUCCESS
)
6679 if (!argv_find(argv
, argc
, "RTLIST", &idx
)) {
6680 vty_out(vty
, "%% Missing RTLIST\n");
6681 return CMD_WARNING_CONFIG_FAILED
;
6683 ret
= set_ecom_list(vty
, argc
- idx
, argv
+ idx
, &ecom
);
6684 if (ret
!= CMD_SUCCESS
) {
6689 for (dir
= 0; dir
< BGP_VPN_POLICY_DIR_MAX
; ++dir
) {
6693 vpn_leak_prechange(dir
, afi
, bgp_get_default(), bgp
);
6696 if (bgp
->vpn_policy
[afi
].rtlist
[dir
])
6698 &bgp
->vpn_policy
[afi
].rtlist
[dir
]);
6699 bgp
->vpn_policy
[afi
].rtlist
[dir
] =
6700 ecommunity_dup(ecom
);
6702 if (bgp
->vpn_policy
[afi
].rtlist
[dir
])
6704 &bgp
->vpn_policy
[afi
].rtlist
[dir
]);
6705 bgp
->vpn_policy
[afi
].rtlist
[dir
] = NULL
;
6708 vpn_leak_postchange(dir
, afi
, bgp_get_default(), bgp
);
6712 ecommunity_free(&ecom
);
6717 ALIAS (af_rt_vpn_imexport
,
6718 af_no_rt_vpn_imexport_cmd
,
6719 "no <rt|route-target> vpn <import|export|both>$direction_str",
6721 "Specify route target list\n"
6722 "Specify route target list\n"
6723 "Between current address-family and vpn\n"
6724 "For routes leaked from vpn to current address-family\n"
6725 "For routes leaked from current address-family to vpn\n"
6726 "both import and export\n")
6728 DEFPY (af_route_map_vpn_imexport
,
6729 af_route_map_vpn_imexport_cmd
,
6730 /* future: "route-map <vpn|evpn|vrf NAME> <import|export> RMAP" */
6731 "[no] route-map vpn <import|export>$direction_str RMAP$rmap_str",
6733 "Specify route map\n"
6734 "Between current address-family and vpn\n"
6735 "For routes leaked from vpn to current address-family\n"
6736 "For routes leaked from current address-family to vpn\n"
6737 "name of route-map\n")
6739 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
6741 int dodir
[BGP_VPN_POLICY_DIR_MAX
] = {0};
6742 vpn_policy_direction_t dir
;
6747 if (argv_find(argv
, argc
, "no", &idx
))
6750 afi
= vpn_policy_getafi(vty
, bgp
, false);
6752 return CMD_WARNING_CONFIG_FAILED
;
6754 ret
= vpn_policy_getdirs(vty
, direction_str
, dodir
);
6755 if (ret
!= CMD_SUCCESS
)
6758 for (dir
= 0; dir
< BGP_VPN_POLICY_DIR_MAX
; ++dir
) {
6762 vpn_leak_prechange(dir
, afi
, bgp_get_default(), bgp
);
6765 if (bgp
->vpn_policy
[afi
].rmap_name
[dir
])
6766 XFREE(MTYPE_ROUTE_MAP_NAME
,
6767 bgp
->vpn_policy
[afi
].rmap_name
[dir
]);
6768 bgp
->vpn_policy
[afi
].rmap_name
[dir
] = XSTRDUP(
6769 MTYPE_ROUTE_MAP_NAME
, rmap_str
);
6770 bgp
->vpn_policy
[afi
].rmap
[dir
] =
6771 route_map_lookup_warn_noexist(vty
, rmap_str
);
6772 if (!bgp
->vpn_policy
[afi
].rmap
[dir
])
6775 if (bgp
->vpn_policy
[afi
].rmap_name
[dir
])
6776 XFREE(MTYPE_ROUTE_MAP_NAME
,
6777 bgp
->vpn_policy
[afi
].rmap_name
[dir
]);
6778 bgp
->vpn_policy
[afi
].rmap_name
[dir
] = NULL
;
6779 bgp
->vpn_policy
[afi
].rmap
[dir
] = NULL
;
6782 vpn_leak_postchange(dir
, afi
, bgp_get_default(), bgp
);
6788 ALIAS (af_route_map_vpn_imexport
,
6789 af_no_route_map_vpn_imexport_cmd
,
6790 "no route-map vpn <import|export>$direction_str",
6792 "Specify route map\n"
6793 "Between current address-family and vpn\n"
6794 "For routes leaked from vpn to current address-family\n"
6795 "For routes leaked from current address-family to vpn\n")
6797 DEFPY(af_import_vrf_route_map
, af_import_vrf_route_map_cmd
,
6798 "[no] import vrf route-map RMAP$rmap_str",
6800 "Import routes from another VRF\n"
6801 "Vrf routes being filtered\n"
6802 "Specify route map\n"
6803 "name of route-map\n")
6805 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
6806 vpn_policy_direction_t dir
= BGP_VPN_POLICY_DIR_FROMVPN
;
6810 struct bgp
*bgp_default
;
6812 if (argv_find(argv
, argc
, "no", &idx
))
6815 afi
= vpn_policy_getafi(vty
, bgp
, true);
6817 return CMD_WARNING_CONFIG_FAILED
;
6819 bgp_default
= bgp_get_default();
6824 /* Auto-create assuming the same AS */
6825 ret
= bgp_get(&bgp_default
, &as
, NULL
,
6826 BGP_INSTANCE_TYPE_DEFAULT
);
6830 "VRF default is not configured as a bgp instance\n");
6835 vpn_leak_prechange(dir
, afi
, bgp_get_default(), bgp
);
6838 if (bgp
->vpn_policy
[afi
].rmap_name
[dir
])
6839 XFREE(MTYPE_ROUTE_MAP_NAME
,
6840 bgp
->vpn_policy
[afi
].rmap_name
[dir
]);
6841 bgp
->vpn_policy
[afi
].rmap_name
[dir
] =
6842 XSTRDUP(MTYPE_ROUTE_MAP_NAME
, rmap_str
);
6843 bgp
->vpn_policy
[afi
].rmap
[dir
] =
6844 route_map_lookup_warn_noexist(vty
, rmap_str
);
6845 if (!bgp
->vpn_policy
[afi
].rmap
[dir
])
6848 if (bgp
->vpn_policy
[afi
].rmap_name
[dir
])
6849 XFREE(MTYPE_ROUTE_MAP_NAME
,
6850 bgp
->vpn_policy
[afi
].rmap_name
[dir
]);
6851 bgp
->vpn_policy
[afi
].rmap_name
[dir
] = NULL
;
6852 bgp
->vpn_policy
[afi
].rmap
[dir
] = NULL
;
6855 vpn_leak_postchange(dir
, afi
, bgp_get_default(), bgp
);
6860 ALIAS(af_import_vrf_route_map
, af_no_import_vrf_route_map_cmd
,
6861 "no import vrf route-map",
6863 "Import routes from another VRF\n"
6864 "Vrf routes being filtered\n"
6865 "Specify route map\n")
6867 DEFPY(bgp_imexport_vrf
, bgp_imexport_vrf_cmd
,
6868 "[no] import vrf VIEWVRFNAME$import_name",
6870 "Import routes from another VRF\n"
6871 "VRF to import from\n"
6872 "The name of the VRF\n")
6874 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
6875 struct listnode
*node
;
6876 struct bgp
*vrf_bgp
, *bgp_default
;
6879 bool remove
= false;
6882 enum bgp_instance_type bgp_type
= BGP_INSTANCE_TYPE_VRF
;
6886 if (import_name
== NULL
) {
6887 vty_out(vty
, "%% Missing import name\n");
6891 if (argv_find(argv
, argc
, "no", &idx
))
6894 afi
= vpn_policy_getafi(vty
, bgp
, true);
6896 return CMD_WARNING_CONFIG_FAILED
;
6898 safi
= bgp_node_safi(vty
);
6900 if (((BGP_INSTANCE_TYPE_DEFAULT
== bgp
->inst_type
)
6901 && (strcmp(import_name
, VRF_DEFAULT_NAME
) == 0))
6902 || (bgp
->name
&& (strcmp(import_name
, bgp
->name
) == 0))) {
6903 vty_out(vty
, "%% Cannot %s vrf %s into itself\n",
6904 remove
? "unimport" : "import", import_name
);
6908 bgp_default
= bgp_get_default();
6910 /* Auto-create assuming the same AS */
6911 ret
= bgp_get(&bgp_default
, &as
, NULL
,
6912 BGP_INSTANCE_TYPE_DEFAULT
);
6916 "VRF default is not configured as a bgp instance\n");
6921 vrf_bgp
= bgp_lookup_by_name(import_name
);
6923 if (strcmp(import_name
, VRF_DEFAULT_NAME
) == 0)
6924 vrf_bgp
= bgp_default
;
6926 /* Auto-create assuming the same AS */
6927 ret
= bgp_get(&vrf_bgp
, &as
, import_name
, bgp_type
);
6931 "VRF %s is not configured as a bgp instance\n",
6938 vrf_unimport_from_vrf(bgp
, vrf_bgp
, afi
, safi
);
6940 /* Already importing from "import_vrf"? */
6941 for (ALL_LIST_ELEMENTS_RO(bgp
->vpn_policy
[afi
].import_vrf
, node
,
6943 if (strcmp(vname
, import_name
) == 0)
6947 vrf_import_from_vrf(bgp
, vrf_bgp
, afi
, safi
);
6953 /* This command is valid only in a bgp vrf instance or the default instance */
6954 DEFPY (bgp_imexport_vpn
,
6955 bgp_imexport_vpn_cmd
,
6956 "[no] <import|export>$direction_str vpn",
6958 "Import routes to this address-family\n"
6959 "Export routes from this address-family\n"
6960 "to/from default instance VPN RIB\n")
6962 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
6969 vpn_policy_direction_t dir
;
6971 if (argv_find(argv
, argc
, "no", &idx
))
6974 if (BGP_INSTANCE_TYPE_VRF
!= bgp
->inst_type
&&
6975 BGP_INSTANCE_TYPE_DEFAULT
!= bgp
->inst_type
) {
6977 vty_out(vty
, "%% import|export vpn valid only for bgp vrf or default instance\n");
6978 return CMD_WARNING_CONFIG_FAILED
;
6981 afi
= bgp_node_afi(vty
);
6982 safi
= bgp_node_safi(vty
);
6983 if ((SAFI_UNICAST
!= safi
) || ((AFI_IP
!= afi
) && (AFI_IP6
!= afi
))) {
6984 vty_out(vty
, "%% import|export vpn valid only for unicast ipv4|ipv6\n");
6985 return CMD_WARNING_CONFIG_FAILED
;
6988 if (!strcmp(direction_str
, "import")) {
6989 flag
= BGP_CONFIG_MPLSVPN_TO_VRF_IMPORT
;
6990 dir
= BGP_VPN_POLICY_DIR_FROMVPN
;
6991 } else if (!strcmp(direction_str
, "export")) {
6992 flag
= BGP_CONFIG_VRF_TO_MPLSVPN_EXPORT
;
6993 dir
= BGP_VPN_POLICY_DIR_TOVPN
;
6995 vty_out(vty
, "%% unknown direction %s\n", direction_str
);
6996 return CMD_WARNING_CONFIG_FAILED
;
6999 previous_state
= CHECK_FLAG(bgp
->af_flags
[afi
][safi
], flag
);
7002 SET_FLAG(bgp
->af_flags
[afi
][safi
], flag
);
7003 if (!previous_state
) {
7004 /* trigger export current vrf */
7005 vpn_leak_postchange(dir
, afi
, bgp_get_default(), bgp
);
7008 if (previous_state
) {
7009 /* trigger un-export current vrf */
7010 vpn_leak_prechange(dir
, afi
, bgp_get_default(), bgp
);
7012 UNSET_FLAG(bgp
->af_flags
[afi
][safi
], flag
);
7018 DEFPY (af_routetarget_import
,
7019 af_routetarget_import_cmd
,
7020 "[no] <rt|route-target> redirect import RTLIST...",
7022 "Specify route target list\n"
7023 "Specify route target list\n"
7024 "Flow-spec redirect type route target\n"
7025 "Import routes to this address-family\n"
7026 "Space separated route target list (A.B.C.D:MN|EF:OPQR|GHJK:MN)\n")
7028 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
7030 struct ecommunity
*ecom
= NULL
;
7035 if (argv_find(argv
, argc
, "no", &idx
))
7038 afi
= vpn_policy_getafi(vty
, bgp
, false);
7040 return CMD_WARNING_CONFIG_FAILED
;
7043 if (!argv_find(argv
, argc
, "RTLIST", &idx
)) {
7044 vty_out(vty
, "%% Missing RTLIST\n");
7045 return CMD_WARNING_CONFIG_FAILED
;
7047 ret
= set_ecom_list(vty
, argc
- idx
, argv
+ idx
, &ecom
);
7048 if (ret
!= CMD_SUCCESS
)
7053 if (bgp
->vpn_policy
[afi
].import_redirect_rtlist
)
7054 ecommunity_free(&bgp
->vpn_policy
[afi
]
7055 .import_redirect_rtlist
);
7056 bgp
->vpn_policy
[afi
].import_redirect_rtlist
=
7057 ecommunity_dup(ecom
);
7059 if (bgp
->vpn_policy
[afi
].import_redirect_rtlist
)
7060 ecommunity_free(&bgp
->vpn_policy
[afi
]
7061 .import_redirect_rtlist
);
7062 bgp
->vpn_policy
[afi
].import_redirect_rtlist
= NULL
;
7066 ecommunity_free(&ecom
);
7071 DEFUN_NOSH (address_family_ipv4_safi
,
7072 address_family_ipv4_safi_cmd
,
7073 "address-family ipv4 [<unicast|multicast|vpn|labeled-unicast|flowspec>]",
7074 "Enter Address Family command mode\n"
7076 BGP_SAFI_WITH_LABEL_HELP_STR
)
7080 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
7081 safi_t safi
= bgp_vty_safi_from_str(argv
[2]->text
);
7082 if (bgp
->inst_type
!= BGP_INSTANCE_TYPE_DEFAULT
7083 && safi
!= SAFI_UNICAST
&& safi
!= SAFI_MULTICAST
7084 && safi
!= SAFI_EVPN
) {
7086 "Only Unicast/Multicast/EVPN SAFIs supported in non-core instances.\n");
7087 return CMD_WARNING_CONFIG_FAILED
;
7089 vty
->node
= bgp_node_type(AFI_IP
, safi
);
7091 vty
->node
= BGP_IPV4_NODE
;
7096 DEFUN_NOSH (address_family_ipv6_safi
,
7097 address_family_ipv6_safi_cmd
,
7098 "address-family ipv6 [<unicast|multicast|vpn|labeled-unicast|flowspec>]",
7099 "Enter Address Family command mode\n"
7101 BGP_SAFI_WITH_LABEL_HELP_STR
)
7104 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
7105 safi_t safi
= bgp_vty_safi_from_str(argv
[2]->text
);
7106 if (bgp
->inst_type
!= BGP_INSTANCE_TYPE_DEFAULT
7107 && safi
!= SAFI_UNICAST
&& safi
!= SAFI_MULTICAST
7108 && safi
!= SAFI_EVPN
) {
7110 "Only Unicast/Multicast/EVPN SAFIs supported in non-core instances.\n");
7111 return CMD_WARNING_CONFIG_FAILED
;
7113 vty
->node
= bgp_node_type(AFI_IP6
, safi
);
7115 vty
->node
= BGP_IPV6_NODE
;
7120 #ifdef KEEP_OLD_VPN_COMMANDS
7121 DEFUN_NOSH (address_family_vpnv4
,
7122 address_family_vpnv4_cmd
,
7123 "address-family vpnv4 [unicast]",
7124 "Enter Address Family command mode\n"
7126 "Address Family modifier\n")
7128 vty
->node
= BGP_VPNV4_NODE
;
7132 DEFUN_NOSH (address_family_vpnv6
,
7133 address_family_vpnv6_cmd
,
7134 "address-family vpnv6 [unicast]",
7135 "Enter Address Family command mode\n"
7137 "Address Family modifier\n")
7139 vty
->node
= BGP_VPNV6_NODE
;
7144 DEFUN_NOSH (address_family_evpn
,
7145 address_family_evpn_cmd
,
7146 "address-family l2vpn evpn",
7147 "Enter Address Family command mode\n"
7149 "Address Family modifier\n")
7151 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
7152 vty
->node
= BGP_EVPN_NODE
;
7156 DEFUN_NOSH (exit_address_family
,
7157 exit_address_family_cmd
,
7158 "exit-address-family",
7159 "Exit from Address Family configuration mode\n")
7161 if (vty
->node
== BGP_IPV4_NODE
|| vty
->node
== BGP_IPV4M_NODE
7162 || vty
->node
== BGP_IPV4L_NODE
|| vty
->node
== BGP_VPNV4_NODE
7163 || vty
->node
== BGP_IPV6_NODE
|| vty
->node
== BGP_IPV6M_NODE
7164 || vty
->node
== BGP_IPV6L_NODE
|| vty
->node
== BGP_VPNV6_NODE
7165 || vty
->node
== BGP_EVPN_NODE
7166 || vty
->node
== BGP_FLOWSPECV4_NODE
7167 || vty
->node
== BGP_FLOWSPECV6_NODE
)
7168 vty
->node
= BGP_NODE
;
7172 /* Recalculate bestpath and re-advertise a prefix */
7173 static int bgp_clear_prefix(struct vty
*vty
, const char *view_name
,
7174 const char *ip_str
, afi_t afi
, safi_t safi
,
7175 struct prefix_rd
*prd
)
7178 struct prefix match
;
7179 struct bgp_node
*rn
;
7180 struct bgp_node
*rm
;
7182 struct bgp_table
*table
;
7183 struct bgp_table
*rib
;
7185 /* BGP structure lookup. */
7187 bgp
= bgp_lookup_by_name(view_name
);
7189 vty_out(vty
, "%% Can't find BGP instance %s\n",
7194 bgp
= bgp_get_default();
7196 vty_out(vty
, "%% No BGP process is configured\n");
7201 /* Check IP address argument. */
7202 ret
= str2prefix(ip_str
, &match
);
7204 vty_out(vty
, "%% address is malformed\n");
7208 match
.family
= afi2family(afi
);
7209 rib
= bgp
->rib
[afi
][safi
];
7211 if (safi
== SAFI_MPLS_VPN
) {
7212 for (rn
= bgp_table_top(rib
); rn
; rn
= bgp_route_next(rn
)) {
7213 if (prd
&& memcmp(rn
->p
.u
.val
, prd
->val
, 8) != 0)
7216 table
= bgp_node_get_bgp_table_info(rn
);
7217 if (table
!= NULL
) {
7219 if ((rm
= bgp_node_match(table
, &match
))
7222 == match
.prefixlen
) {
7224 BGP_NODE_USER_CLEAR
);
7225 bgp_process(bgp
, rm
, afi
, safi
);
7227 bgp_unlock_node(rm
);
7232 if ((rn
= bgp_node_match(rib
, &match
)) != NULL
) {
7233 if (rn
->p
.prefixlen
== match
.prefixlen
) {
7234 SET_FLAG(rn
->flags
, BGP_NODE_USER_CLEAR
);
7235 bgp_process(bgp
, rn
, afi
, safi
);
7237 bgp_unlock_node(rn
);
7244 /* one clear bgp command to rule them all */
7245 DEFUN (clear_ip_bgp_all
,
7246 clear_ip_bgp_all_cmd
,
7247 "clear [ip] bgp [<view|vrf> VIEWVRFNAME] ["BGP_AFI_CMD_STR
" ["BGP_SAFI_WITH_LABEL_CMD_STR
"]] <*|A.B.C.D|X:X::X:X|WORD|(1-4294967295)|external|peer-group WORD> [<soft [<in|out>]|in [prefix-filter]|out>]",
7251 BGP_INSTANCE_HELP_STR
7253 BGP_SAFI_WITH_LABEL_HELP_STR
7255 "BGP neighbor address to clear\n"
7256 "BGP IPv6 neighbor to clear\n"
7257 "BGP neighbor on interface to clear\n"
7258 "Clear peers with the AS number\n"
7259 "Clear all external peers\n"
7260 "Clear all members of peer-group\n"
7261 "BGP peer-group name\n"
7266 "Push out prefix-list ORF and do inbound soft reconfig\n"
7271 afi_t afi
= AFI_IP6
;
7272 safi_t safi
= SAFI_UNICAST
;
7273 enum clear_sort clr_sort
= clear_peer
;
7274 enum bgp_clear_type clr_type
;
7275 char *clr_arg
= NULL
;
7279 /* clear [ip] bgp */
7280 if (argv_find(argv
, argc
, "ip", &idx
))
7283 /* [<vrf> VIEWVRFNAME] */
7284 if (argv_find(argv
, argc
, "vrf", &idx
)) {
7285 vrf
= argv
[idx
+ 1]->arg
;
7287 if (vrf
&& strmatch(vrf
, VRF_DEFAULT_NAME
))
7289 } else if (argv_find(argv
, argc
, "view", &idx
)) {
7290 /* [<view> VIEWVRFNAME] */
7291 vrf
= argv
[idx
+ 1]->arg
;
7294 /* ["BGP_AFI_CMD_STR" ["BGP_SAFI_CMD_STR"]] */
7295 if (argv_find_and_parse_afi(argv
, argc
, &idx
, &afi
))
7296 argv_find_and_parse_safi(argv
, argc
, &idx
, &safi
);
7298 /* <*|A.B.C.D|X:X::X:X|WORD|(1-4294967295)|external|peer-group WORD> */
7299 if (argv_find(argv
, argc
, "*", &idx
)) {
7300 clr_sort
= clear_all
;
7301 } else if (argv_find(argv
, argc
, "A.B.C.D", &idx
)) {
7302 clr_sort
= clear_peer
;
7303 clr_arg
= argv
[idx
]->arg
;
7304 } else if (argv_find(argv
, argc
, "X:X::X:X", &idx
)) {
7305 clr_sort
= clear_peer
;
7306 clr_arg
= argv
[idx
]->arg
;
7307 } else if (argv_find(argv
, argc
, "peer-group", &idx
)) {
7308 clr_sort
= clear_group
;
7310 clr_arg
= argv
[idx
]->arg
;
7311 } else if (argv_find(argv
, argc
, "WORD", &idx
)) {
7312 clr_sort
= clear_peer
;
7313 clr_arg
= argv
[idx
]->arg
;
7314 } else if (argv_find(argv
, argc
, "(1-4294967295)", &idx
)) {
7315 clr_sort
= clear_as
;
7316 clr_arg
= argv
[idx
]->arg
;
7317 } else if (argv_find(argv
, argc
, "external", &idx
)) {
7318 clr_sort
= clear_external
;
7321 /* [<soft [<in|out>]|in [prefix-filter]|out>] */
7322 if (argv_find(argv
, argc
, "soft", &idx
)) {
7323 if (argv_find(argv
, argc
, "in", &idx
)
7324 || argv_find(argv
, argc
, "out", &idx
))
7325 clr_type
= strmatch(argv
[idx
]->text
, "in")
7327 : BGP_CLEAR_SOFT_OUT
;
7329 clr_type
= BGP_CLEAR_SOFT_BOTH
;
7330 } else if (argv_find(argv
, argc
, "in", &idx
)) {
7331 clr_type
= argv_find(argv
, argc
, "prefix-filter", &idx
)
7332 ? BGP_CLEAR_SOFT_IN_ORF_PREFIX
7333 : BGP_CLEAR_SOFT_IN
;
7334 } else if (argv_find(argv
, argc
, "out", &idx
)) {
7335 clr_type
= BGP_CLEAR_SOFT_OUT
;
7337 clr_type
= BGP_CLEAR_SOFT_NONE
;
7339 return bgp_clear_vty(vty
, vrf
, afi
, safi
, clr_sort
, clr_type
, clr_arg
);
7342 DEFUN (clear_ip_bgp_prefix
,
7343 clear_ip_bgp_prefix_cmd
,
7344 "clear [ip] bgp [<view|vrf> VIEWVRFNAME] prefix A.B.C.D/M",
7348 BGP_INSTANCE_HELP_STR
7349 "Clear bestpath and re-advertise\n"
7353 char *prefix
= NULL
;
7357 /* [<view|vrf> VIEWVRFNAME] */
7358 if (argv_find(argv
, argc
, "vrf", &idx
)) {
7359 vrf
= argv
[idx
+ 1]->arg
;
7361 if (vrf
&& strmatch(vrf
, VRF_DEFAULT_NAME
))
7363 } else if (argv_find(argv
, argc
, "view", &idx
)) {
7364 /* [<view> VIEWVRFNAME] */
7365 vrf
= argv
[idx
+ 1]->arg
;
7369 prefix
= argv
[argc
- 1]->arg
;
7371 return bgp_clear_prefix(vty
, vrf
, prefix
, AFI_IP
, SAFI_UNICAST
, NULL
);
7374 DEFUN (clear_bgp_ipv6_safi_prefix
,
7375 clear_bgp_ipv6_safi_prefix_cmd
,
7376 "clear [ip] bgp ipv6 "BGP_SAFI_CMD_STR
" prefix X:X::X:X/M",
7382 "Clear bestpath and re-advertise\n"
7386 int idx_ipv6_prefix
= 0;
7387 safi_t safi
= SAFI_UNICAST
;
7388 char *prefix
= argv_find(argv
, argc
, "X:X::X:X/M", &idx_ipv6_prefix
) ?
7389 argv
[idx_ipv6_prefix
]->arg
: NULL
;
7391 argv_find_and_parse_safi(argv
, argc
, &idx_safi
, &safi
);
7392 return bgp_clear_prefix(
7393 vty
, NULL
, prefix
, AFI_IP6
,
7397 DEFUN (clear_bgp_instance_ipv6_safi_prefix
,
7398 clear_bgp_instance_ipv6_safi_prefix_cmd
,
7399 "clear [ip] bgp <view|vrf> VIEWVRFNAME ipv6 "BGP_SAFI_CMD_STR
" prefix X:X::X:X/M",
7403 BGP_INSTANCE_HELP_STR
7406 "Clear bestpath and re-advertise\n"
7410 int idx_vrfview
= 0;
7411 int idx_ipv6_prefix
= 0;
7412 safi_t safi
= SAFI_UNICAST
;
7413 char *prefix
= argv_find(argv
, argc
, "X:X::X:X/M", &idx_ipv6_prefix
) ?
7414 argv
[idx_ipv6_prefix
]->arg
: NULL
;
7415 char *vrfview
= NULL
;
7417 /* [<view|vrf> VIEWVRFNAME] */
7418 if (argv_find(argv
, argc
, "vrf", &idx_vrfview
)) {
7419 vrfview
= argv
[idx_vrfview
+ 1]->arg
;
7420 if (vrfview
&& strmatch(vrfview
, VRF_DEFAULT_NAME
))
7422 } else if (argv_find(argv
, argc
, "view", &idx_vrfview
)) {
7423 /* [<view> VIEWVRFNAME] */
7424 vrfview
= argv
[idx_vrfview
+ 1]->arg
;
7426 argv_find_and_parse_safi(argv
, argc
, &idx_safi
, &safi
);
7428 return bgp_clear_prefix(
7429 vty
, vrfview
, prefix
,
7430 AFI_IP6
, safi
, NULL
);
7433 DEFUN (show_bgp_views
,
7435 "show [ip] bgp views",
7439 "Show the defined BGP views\n")
7441 struct list
*inst
= bm
->bgp
;
7442 struct listnode
*node
;
7445 if (!bgp_option_check(BGP_OPT_MULTIPLE_INSTANCE
)) {
7446 vty_out(vty
, "BGP Multiple Instance is not enabled\n");
7450 vty_out(vty
, "Defined BGP views:\n");
7451 for (ALL_LIST_ELEMENTS_RO(inst
, node
, bgp
)) {
7453 if (bgp
->inst_type
== BGP_INSTANCE_TYPE_VRF
)
7455 vty_out(vty
, "\t%s (AS%u)\n", bgp
->name
? bgp
->name
: "(null)",
7462 DEFUN (show_bgp_vrfs
,
7464 "show [ip] bgp vrfs [json]",
7471 char buf
[ETHER_ADDR_STRLEN
];
7472 struct list
*inst
= bm
->bgp
;
7473 struct listnode
*node
;
7475 bool uj
= use_json(argc
, argv
);
7476 json_object
*json
= NULL
;
7477 json_object
*json_vrfs
= NULL
;
7480 if (!bgp_option_check(BGP_OPT_MULTIPLE_INSTANCE
)) {
7481 vty_out(vty
, "BGP Multiple Instance is not enabled\n");
7486 json
= json_object_new_object();
7487 json_vrfs
= json_object_new_object();
7490 for (ALL_LIST_ELEMENTS_RO(inst
, node
, bgp
)) {
7491 const char *name
, *type
;
7493 struct listnode
*node2
, *nnode2
;
7494 int peers_cfg
, peers_estb
;
7495 json_object
*json_vrf
= NULL
;
7498 if (bgp
->inst_type
== BGP_INSTANCE_TYPE_VIEW
)
7502 if (!uj
&& count
== 1)
7504 "%4s %-5s %-16s %9s %10s %-37s %-10s %-15s\n",
7505 "Type", "Id", "routerId", "#PeersVfg",
7506 "#PeersEstb", "Name", "L3-VNI", "Rmac");
7508 peers_cfg
= peers_estb
= 0;
7510 json_vrf
= json_object_new_object();
7513 for (ALL_LIST_ELEMENTS(bgp
->peer
, node2
, nnode2
, peer
)) {
7514 if (!CHECK_FLAG(peer
->flags
, PEER_FLAG_CONFIG_NODE
))
7517 if (peer
->status
== Established
)
7521 if (bgp
->inst_type
== BGP_INSTANCE_TYPE_DEFAULT
) {
7522 name
= VRF_DEFAULT_NAME
;
7531 int64_t vrf_id_ui
= (bgp
->vrf_id
== VRF_UNKNOWN
)
7533 : (int64_t)bgp
->vrf_id
;
7534 json_object_string_add(json_vrf
, "type", type
);
7535 json_object_int_add(json_vrf
, "vrfId", vrf_id_ui
);
7536 json_object_string_add(json_vrf
, "routerId",
7537 inet_ntoa(bgp
->router_id
));
7538 json_object_int_add(json_vrf
, "numConfiguredPeers",
7540 json_object_int_add(json_vrf
, "numEstablishedPeers",
7543 json_object_int_add(json_vrf
, "l3vni", bgp
->l3vni
);
7544 json_object_string_add(
7546 prefix_mac2str(&bgp
->rmac
, buf
, sizeof(buf
)));
7547 json_object_object_add(json_vrfs
, name
, json_vrf
);
7550 "%4s %-5d %-16s %9u %10u %-37s %-10u %-15s\n",
7552 bgp
->vrf_id
== VRF_UNKNOWN
? -1
7554 inet_ntoa(bgp
->router_id
), peers_cfg
,
7555 peers_estb
, name
, bgp
->l3vni
,
7556 prefix_mac2str(&bgp
->rmac
, buf
, sizeof(buf
)));
7560 json_object_object_add(json
, "vrfs", json_vrfs
);
7562 json_object_int_add(json
, "totalVrfs", count
);
7564 vty_out(vty
, "%s\n", json_object_to_json_string_ext(
7565 json
, JSON_C_TO_STRING_PRETTY
));
7566 json_object_free(json
);
7570 "\nTotal number of VRFs (including default): %d\n",
7578 static void show_tip_entry(struct hash_backet
*backet
, void *args
)
7580 struct vty
*vty
= (struct vty
*)args
;
7581 struct tip_addr
*tip
= (struct tip_addr
*)backet
->data
;
7583 vty_out(vty
, "addr: %s, count: %d\n", inet_ntoa(tip
->addr
),
7587 static void bgp_show_martian_nexthops(struct vty
*vty
, struct bgp
*bgp
)
7589 vty_out(vty
, "self nexthop database:\n");
7590 bgp_nexthop_show_address_hash(vty
, bgp
);
7592 vty_out(vty
, "Tunnel-ip database:\n");
7593 hash_iterate(bgp
->tip_hash
,
7594 (void (*)(struct hash_backet
*, void *))show_tip_entry
,
7598 DEFUN(show_bgp_martian_nexthop_db
, show_bgp_martian_nexthop_db_cmd
,
7599 "show bgp [<view|vrf> VIEWVRFNAME] martian next-hop",
7600 SHOW_STR BGP_STR BGP_INSTANCE_HELP_STR
7601 "martian next-hops\n"
7602 "martian next-hop database\n")
7604 struct bgp
*bgp
= NULL
;
7608 /* [<vrf> VIEWVRFNAME] */
7609 if (argv_find(argv
, argc
, "vrf", &idx
)) {
7610 name
= argv
[idx
+ 1]->arg
;
7611 if (name
&& strmatch(name
, VRF_DEFAULT_NAME
))
7613 } else if (argv_find(argv
, argc
, "view", &idx
))
7614 /* [<view> VIEWVRFNAME] */
7615 name
= argv
[idx
+ 1]->arg
;
7617 bgp
= bgp_lookup_by_name(name
);
7619 bgp
= bgp_get_default();
7622 vty_out(vty
, "%% No BGP process is configured\n");
7625 bgp_show_martian_nexthops(vty
, bgp
);
7630 DEFUN (show_bgp_memory
,
7631 show_bgp_memory_cmd
,
7632 "show [ip] bgp memory",
7636 "Global BGP memory statistics\n")
7638 char memstrbuf
[MTYPE_MEMSTR_LEN
];
7639 unsigned long count
;
7641 /* RIB related usage stats */
7642 count
= mtype_stats_alloc(MTYPE_BGP_NODE
);
7643 vty_out(vty
, "%ld RIB nodes, using %s of memory\n", count
,
7644 mtype_memstr(memstrbuf
, sizeof(memstrbuf
),
7645 count
* sizeof(struct bgp_node
)));
7647 count
= mtype_stats_alloc(MTYPE_BGP_ROUTE
);
7648 vty_out(vty
, "%ld BGP routes, using %s of memory\n", count
,
7649 mtype_memstr(memstrbuf
, sizeof(memstrbuf
),
7650 count
* sizeof(struct bgp_path_info
)));
7651 if ((count
= mtype_stats_alloc(MTYPE_BGP_ROUTE_EXTRA
)))
7652 vty_out(vty
, "%ld BGP route ancillaries, using %s of memory\n",
7655 memstrbuf
, sizeof(memstrbuf
),
7656 count
* sizeof(struct bgp_path_info_extra
)));
7658 if ((count
= mtype_stats_alloc(MTYPE_BGP_STATIC
)))
7659 vty_out(vty
, "%ld Static routes, using %s of memory\n", count
,
7660 mtype_memstr(memstrbuf
, sizeof(memstrbuf
),
7661 count
* sizeof(struct bgp_static
)));
7663 if ((count
= mtype_stats_alloc(MTYPE_BGP_PACKET
)))
7664 vty_out(vty
, "%ld Packets, using %s of memory\n", count
,
7665 mtype_memstr(memstrbuf
, sizeof(memstrbuf
),
7666 count
* sizeof(struct bpacket
)));
7669 if ((count
= mtype_stats_alloc(MTYPE_BGP_ADJ_IN
)))
7670 vty_out(vty
, "%ld Adj-In entries, using %s of memory\n", count
,
7671 mtype_memstr(memstrbuf
, sizeof(memstrbuf
),
7672 count
* sizeof(struct bgp_adj_in
)));
7673 if ((count
= mtype_stats_alloc(MTYPE_BGP_ADJ_OUT
)))
7674 vty_out(vty
, "%ld Adj-Out entries, using %s of memory\n", count
,
7675 mtype_memstr(memstrbuf
, sizeof(memstrbuf
),
7676 count
* sizeof(struct bgp_adj_out
)));
7678 if ((count
= mtype_stats_alloc(MTYPE_BGP_NEXTHOP_CACHE
)))
7679 vty_out(vty
, "%ld Nexthop cache entries, using %s of memory\n",
7681 mtype_memstr(memstrbuf
, sizeof(memstrbuf
),
7682 count
* sizeof(struct bgp_nexthop_cache
)));
7684 if ((count
= mtype_stats_alloc(MTYPE_BGP_DAMP_INFO
)))
7685 vty_out(vty
, "%ld Dampening entries, using %s of memory\n",
7687 mtype_memstr(memstrbuf
, sizeof(memstrbuf
),
7688 count
* sizeof(struct bgp_damp_info
)));
7691 count
= attr_count();
7692 vty_out(vty
, "%ld BGP attributes, using %s of memory\n", count
,
7693 mtype_memstr(memstrbuf
, sizeof(memstrbuf
),
7694 count
* sizeof(struct attr
)));
7696 if ((count
= attr_unknown_count()))
7697 vty_out(vty
, "%ld unknown attributes\n", count
);
7699 /* AS_PATH attributes */
7700 count
= aspath_count();
7701 vty_out(vty
, "%ld BGP AS-PATH entries, using %s of memory\n", count
,
7702 mtype_memstr(memstrbuf
, sizeof(memstrbuf
),
7703 count
* sizeof(struct aspath
)));
7705 count
= mtype_stats_alloc(MTYPE_AS_SEG
);
7706 vty_out(vty
, "%ld BGP AS-PATH segments, using %s of memory\n", count
,
7707 mtype_memstr(memstrbuf
, sizeof(memstrbuf
),
7708 count
* sizeof(struct assegment
)));
7710 /* Other attributes */
7711 if ((count
= community_count()))
7712 vty_out(vty
, "%ld BGP community entries, using %s of memory\n",
7713 count
, mtype_memstr(memstrbuf
, sizeof(memstrbuf
),
7714 count
* sizeof(struct community
)));
7715 if ((count
= mtype_stats_alloc(MTYPE_ECOMMUNITY
)))
7716 vty_out(vty
, "%ld BGP community entries, using %s of memory\n",
7717 count
, mtype_memstr(memstrbuf
, sizeof(memstrbuf
),
7718 count
* sizeof(struct ecommunity
)));
7719 if ((count
= mtype_stats_alloc(MTYPE_LCOMMUNITY
)))
7721 "%ld BGP large-community entries, using %s of memory\n",
7722 count
, mtype_memstr(memstrbuf
, sizeof(memstrbuf
),
7723 count
* sizeof(struct lcommunity
)));
7725 if ((count
= mtype_stats_alloc(MTYPE_CLUSTER
)))
7726 vty_out(vty
, "%ld Cluster lists, using %s of memory\n", count
,
7727 mtype_memstr(memstrbuf
, sizeof(memstrbuf
),
7728 count
* sizeof(struct cluster_list
)));
7730 /* Peer related usage */
7731 count
= mtype_stats_alloc(MTYPE_BGP_PEER
);
7732 vty_out(vty
, "%ld peers, using %s of memory\n", count
,
7733 mtype_memstr(memstrbuf
, sizeof(memstrbuf
),
7734 count
* sizeof(struct peer
)));
7736 if ((count
= mtype_stats_alloc(MTYPE_PEER_GROUP
)))
7737 vty_out(vty
, "%ld peer groups, using %s of memory\n", count
,
7738 mtype_memstr(memstrbuf
, sizeof(memstrbuf
),
7739 count
* sizeof(struct peer_group
)));
7742 if ((count
= mtype_stats_alloc(MTYPE_HASH
)))
7743 vty_out(vty
, "%ld hash tables, using %s of memory\n", count
,
7744 mtype_memstr(memstrbuf
, sizeof(memstrbuf
),
7745 count
* sizeof(struct hash
)));
7746 if ((count
= mtype_stats_alloc(MTYPE_HASH_BACKET
)))
7747 vty_out(vty
, "%ld hash buckets, using %s of memory\n", count
,
7748 mtype_memstr(memstrbuf
, sizeof(memstrbuf
),
7749 count
* sizeof(struct hash_backet
)));
7750 if ((count
= mtype_stats_alloc(MTYPE_BGP_REGEXP
)))
7751 vty_out(vty
, "%ld compiled regexes, using %s of memory\n",
7752 count
, mtype_memstr(memstrbuf
, sizeof(memstrbuf
),
7753 count
* sizeof(regex_t
)));
7757 static void bgp_show_bestpath_json(struct bgp
*bgp
, json_object
*json
)
7759 json_object
*bestpath
= json_object_new_object();
7761 if (bgp_flag_check(bgp
, BGP_FLAG_ASPATH_IGNORE
))
7762 json_object_string_add(bestpath
, "asPath", "ignore");
7764 if (bgp_flag_check(bgp
, BGP_FLAG_ASPATH_CONFED
))
7765 json_object_string_add(bestpath
, "asPath", "confed");
7767 if (bgp_flag_check(bgp
, BGP_FLAG_ASPATH_MULTIPATH_RELAX
)) {
7768 if (bgp_flag_check(bgp
, BGP_FLAG_MULTIPATH_RELAX_AS_SET
))
7769 json_object_string_add(bestpath
, "multiPathRelax",
7772 json_object_string_add(bestpath
, "multiPathRelax",
7775 json_object_string_add(bestpath
, "multiPathRelax", "false");
7777 if (bgp_flag_check(bgp
, BGP_FLAG_COMPARE_ROUTER_ID
))
7778 json_object_string_add(bestpath
, "compareRouterId", "true");
7779 if (bgp_flag_check(bgp
, BGP_FLAG_MED_CONFED
)
7780 || bgp_flag_check(bgp
, BGP_FLAG_MED_MISSING_AS_WORST
)) {
7781 if (bgp_flag_check(bgp
, BGP_FLAG_MED_CONFED
))
7782 json_object_string_add(bestpath
, "med", "confed");
7783 if (bgp_flag_check(bgp
, BGP_FLAG_MED_MISSING_AS_WORST
))
7784 json_object_string_add(bestpath
, "med",
7785 "missing-as-worst");
7787 json_object_string_add(bestpath
, "med", "true");
7790 json_object_object_add(json
, "bestPath", bestpath
);
7793 /* Show BGP peer's summary information. */
7794 static int bgp_show_summary(struct vty
*vty
, struct bgp
*bgp
, int afi
, int safi
,
7795 bool use_json
, json_object
*json
)
7798 struct listnode
*node
, *nnode
;
7799 unsigned int count
= 0, dn_count
= 0;
7800 char timebuf
[BGP_UPTIME_LEN
], dn_flag
[2];
7801 char neighbor_buf
[VTY_BUFSIZ
];
7802 int neighbor_col_default_width
= 16;
7804 int max_neighbor_width
= 0;
7806 json_object
*json_peer
= NULL
;
7807 json_object
*json_peers
= NULL
;
7808 struct peer_af
*paf
;
7810 /* labeled-unicast routes are installed in the unicast table so in order
7812 * display the correct PfxRcd value we must look at SAFI_UNICAST
7814 if (safi
== SAFI_LABELED_UNICAST
)
7815 pfx_rcd_safi
= SAFI_UNICAST
;
7817 pfx_rcd_safi
= safi
;
7821 json
= json_object_new_object();
7823 json_peers
= json_object_new_object();
7825 /* Loop over all neighbors that will be displayed to determine
7827 * characters are needed for the Neighbor column
7829 for (ALL_LIST_ELEMENTS(bgp
->peer
, node
, nnode
, peer
)) {
7830 if (!CHECK_FLAG(peer
->flags
, PEER_FLAG_CONFIG_NODE
))
7833 if (peer
->afc
[afi
][safi
]) {
7834 memset(dn_flag
, '\0', sizeof(dn_flag
));
7835 if (peer_dynamic_neighbor(peer
))
7839 && bgp_flag_check(bgp
,
7840 BGP_FLAG_SHOW_HOSTNAME
))
7841 sprintf(neighbor_buf
, "%s%s(%s) ",
7842 dn_flag
, peer
->hostname
,
7845 sprintf(neighbor_buf
, "%s%s ", dn_flag
,
7848 len
= strlen(neighbor_buf
);
7850 if (len
> max_neighbor_width
)
7851 max_neighbor_width
= len
;
7855 /* Originally we displayed the Neighbor column as 16
7856 * characters wide so make that the default
7858 if (max_neighbor_width
< neighbor_col_default_width
)
7859 max_neighbor_width
= neighbor_col_default_width
;
7862 for (ALL_LIST_ELEMENTS(bgp
->peer
, node
, nnode
, peer
)) {
7863 if (!CHECK_FLAG(peer
->flags
, PEER_FLAG_CONFIG_NODE
))
7866 if (!peer
->afc
[afi
][safi
])
7871 char memstrbuf
[MTYPE_MEMSTR_LEN
];
7874 vrf_id_ui
= (bgp
->vrf_id
== VRF_UNKNOWN
)
7876 : (int64_t)bgp
->vrf_id
;
7878 /* Usage summary and header */
7880 json_object_string_add(
7882 inet_ntoa(bgp
->router_id
));
7883 json_object_int_add(json
, "as", bgp
->as
);
7884 json_object_int_add(json
, "vrfId", vrf_id_ui
);
7885 json_object_string_add(
7888 == BGP_INSTANCE_TYPE_DEFAULT
)
7893 "BGP router identifier %s, local AS number %u vrf-id %d",
7894 inet_ntoa(bgp
->router_id
), bgp
->as
,
7895 bgp
->vrf_id
== VRF_UNKNOWN
7897 : (int)bgp
->vrf_id
);
7901 if (bgp_update_delay_configured(bgp
)) {
7903 json_object_int_add(
7904 json
, "updateDelayLimit",
7905 bgp
->v_update_delay
);
7907 if (bgp
->v_update_delay
7908 != bgp
->v_establish_wait
)
7909 json_object_int_add(
7911 "updateDelayEstablishWait",
7912 bgp
->v_establish_wait
);
7914 if (bgp_update_delay_active(bgp
)) {
7915 json_object_string_add(
7917 "updateDelayFirstNeighbor",
7918 bgp
->update_delay_begin_time
);
7919 json_object_boolean_true_add(
7921 "updateDelayInProgress");
7923 if (bgp
->update_delay_over
) {
7924 json_object_string_add(
7926 "updateDelayFirstNeighbor",
7927 bgp
->update_delay_begin_time
);
7928 json_object_string_add(
7930 "updateDelayBestpathResumed",
7931 bgp
->update_delay_end_time
);
7932 json_object_string_add(
7934 "updateDelayZebraUpdateResume",
7935 bgp
->update_delay_zebra_resume_time
);
7936 json_object_string_add(
7938 "updateDelayPeerUpdateResume",
7939 bgp
->update_delay_peers_resume_time
);
7944 "Read-only mode update-delay limit: %d seconds\n",
7945 bgp
->v_update_delay
);
7946 if (bgp
->v_update_delay
7947 != bgp
->v_establish_wait
)
7949 " Establish wait: %d seconds\n",
7950 bgp
->v_establish_wait
);
7952 if (bgp_update_delay_active(bgp
)) {
7954 " First neighbor established: %s\n",
7955 bgp
->update_delay_begin_time
);
7957 " Delay in progress\n");
7959 if (bgp
->update_delay_over
) {
7961 " First neighbor established: %s\n",
7962 bgp
->update_delay_begin_time
);
7964 " Best-paths resumed: %s\n",
7965 bgp
->update_delay_end_time
);
7967 " zebra update resumed: %s\n",
7968 bgp
->update_delay_zebra_resume_time
);
7970 " peers update resumed: %s\n",
7971 bgp
->update_delay_peers_resume_time
);
7978 if (bgp_maxmed_onstartup_configured(bgp
)
7979 && bgp
->maxmed_active
)
7980 json_object_boolean_true_add(
7981 json
, "maxMedOnStartup");
7982 if (bgp
->v_maxmed_admin
)
7983 json_object_boolean_true_add(
7984 json
, "maxMedAdministrative");
7986 json_object_int_add(
7987 json
, "tableVersion",
7988 bgp_table_version(bgp
->rib
[afi
][safi
]));
7990 ents
= bgp_table_count(bgp
->rib
[afi
][safi
]);
7991 json_object_int_add(json
, "ribCount", ents
);
7992 json_object_int_add(
7994 ents
* sizeof(struct bgp_node
));
7996 ents
= listcount(bgp
->peer
);
7997 json_object_int_add(json
, "peerCount", ents
);
7998 json_object_int_add(json
, "peerMemory",
7999 ents
* sizeof(struct peer
));
8001 if ((ents
= listcount(bgp
->group
))) {
8002 json_object_int_add(
8003 json
, "peerGroupCount", ents
);
8004 json_object_int_add(
8005 json
, "peerGroupMemory",
8006 ents
* sizeof(struct
8010 if (CHECK_FLAG(bgp
->af_flags
[afi
][safi
],
8011 BGP_CONFIG_DAMPENING
))
8012 json_object_boolean_true_add(
8013 json
, "dampeningEnabled");
8015 if (bgp_maxmed_onstartup_configured(bgp
)
8016 && bgp
->maxmed_active
)
8018 "Max-med on-startup active\n");
8019 if (bgp
->v_maxmed_admin
)
8021 "Max-med administrative active\n");
8023 vty_out(vty
, "BGP table version %" PRIu64
"\n",
8024 bgp_table_version(bgp
->rib
[afi
][safi
]));
8026 ents
= bgp_table_count(bgp
->rib
[afi
][safi
]);
8028 "RIB entries %ld, using %s of memory\n",
8030 mtype_memstr(memstrbuf
,
8032 ents
* sizeof(struct
8035 /* Peer related usage */
8036 ents
= listcount(bgp
->peer
);
8037 vty_out(vty
, "Peers %ld, using %s of memory\n",
8040 memstrbuf
, sizeof(memstrbuf
),
8041 ents
* sizeof(struct peer
)));
8043 if ((ents
= listcount(bgp
->group
)))
8045 "Peer groups %ld, using %s of memory\n",
8050 ents
* sizeof(struct
8053 if (CHECK_FLAG(bgp
->af_flags
[afi
][safi
],
8054 BGP_CONFIG_DAMPENING
))
8055 vty_out(vty
, "Dampening enabled.\n");
8058 /* Subtract 8 here because 'Neighbor' is
8060 vty_out(vty
, "Neighbor");
8061 vty_out(vty
, "%*s", max_neighbor_width
- 8,
8064 "V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd\n");
8071 json_peer
= json_object_new_object();
8073 if (peer_dynamic_neighbor(peer
)) {
8075 json_object_boolean_true_add(json_peer
,
8080 json_object_string_add(json_peer
, "hostname",
8083 if (peer
->domainname
)
8084 json_object_string_add(json_peer
, "domainname",
8087 json_object_int_add(json_peer
, "remoteAs", peer
->as
);
8088 json_object_int_add(json_peer
, "version", 4);
8089 json_object_int_add(json_peer
, "msgRcvd",
8090 PEER_TOTAL_RX(peer
));
8091 json_object_int_add(json_peer
, "msgSent",
8092 PEER_TOTAL_TX(peer
));
8094 json_object_int_add(json_peer
, "tableVersion",
8095 peer
->version
[afi
][safi
]);
8096 json_object_int_add(json_peer
, "outq",
8098 json_object_int_add(json_peer
, "inq", 0);
8099 peer_uptime(peer
->uptime
, timebuf
, BGP_UPTIME_LEN
,
8100 use_json
, json_peer
);
8103 * Adding "pfxRcd" field to match with the corresponding
8104 * CLI. "prefixReceivedCount" will be deprecated in
8107 json_object_int_add(json_peer
, "prefixReceivedCount",
8108 peer
->pcount
[afi
][pfx_rcd_safi
]);
8109 json_object_int_add(json_peer
, "pfxRcd",
8110 peer
->pcount
[afi
][pfx_rcd_safi
]);
8112 paf
= peer_af_find(peer
, afi
, pfx_rcd_safi
);
8113 if (paf
&& PAF_SUBGRP(paf
))
8114 json_object_int_add(json_peer
,
8116 (PAF_SUBGRP(paf
))->scount
);
8118 if (CHECK_FLAG(peer
->flags
, PEER_FLAG_SHUTDOWN
))
8119 json_object_string_add(json_peer
, "state",
8121 else if (peer
->afc_recv
[afi
][safi
])
8122 json_object_string_add(
8124 lookup_msg(bgp_status_msg
, peer
->status
,
8126 else if (CHECK_FLAG(peer
->sflags
,
8127 PEER_STATUS_PREFIX_OVERFLOW
))
8128 json_object_string_add(json_peer
, "state",
8131 json_object_string_add(
8133 lookup_msg(bgp_status_msg
, peer
->status
,
8137 json_object_string_add(json_peer
, "idType",
8139 else if (peer
->su
.sa
.sa_family
== AF_INET
)
8140 json_object_string_add(json_peer
, "idType",
8142 else if (peer
->su
.sa
.sa_family
== AF_INET6
)
8143 json_object_string_add(json_peer
, "idType",
8146 json_object_object_add(json_peers
, peer
->host
,
8149 memset(dn_flag
, '\0', sizeof(dn_flag
));
8150 if (peer_dynamic_neighbor(peer
)) {
8156 && bgp_flag_check(bgp
, BGP_FLAG_SHOW_HOSTNAME
))
8157 len
= vty_out(vty
, "%s%s(%s)", dn_flag
,
8158 peer
->hostname
, peer
->host
);
8160 len
= vty_out(vty
, "%s%s", dn_flag
, peer
->host
);
8162 /* pad the neighbor column with spaces */
8163 if (len
< max_neighbor_width
)
8164 vty_out(vty
, "%*s", max_neighbor_width
- len
,
8167 vty_out(vty
, "4 %10u %7u %7u %8" PRIu64
" %4d %4zd %8s",
8168 peer
->as
, PEER_TOTAL_RX(peer
),
8169 PEER_TOTAL_TX(peer
), peer
->version
[afi
][safi
],
8170 0, peer
->obuf
->count
,
8171 peer_uptime(peer
->uptime
, timebuf
,
8172 BGP_UPTIME_LEN
, 0, NULL
));
8174 if (peer
->status
== Established
)
8175 if (peer
->afc_recv
[afi
][safi
])
8176 vty_out(vty
, " %12ld",
8180 vty_out(vty
, " NoNeg");
8182 if (CHECK_FLAG(peer
->flags
, PEER_FLAG_SHUTDOWN
))
8183 vty_out(vty
, " Idle (Admin)");
8184 else if (CHECK_FLAG(
8186 PEER_STATUS_PREFIX_OVERFLOW
))
8187 vty_out(vty
, " Idle (PfxCt)");
8189 vty_out(vty
, " %12s",
8190 lookup_msg(bgp_status_msg
,
8191 peer
->status
, NULL
));
8198 json_object_object_add(json
, "peers", json_peers
);
8200 json_object_int_add(json
, "totalPeers", count
);
8201 json_object_int_add(json
, "dynamicPeers", dn_count
);
8203 bgp_show_bestpath_json(bgp
, json
);
8205 vty_out(vty
, "%s\n", json_object_to_json_string_ext(
8206 json
, JSON_C_TO_STRING_PRETTY
));
8207 json_object_free(json
);
8210 vty_out(vty
, "\nTotal number of neighbors %d\n", count
);
8212 vty_out(vty
, "No %s neighbor is configured\n",
8213 afi_safi_print(afi
, safi
));
8217 vty_out(vty
, "* - dynamic neighbor\n");
8218 vty_out(vty
, "%d dynamic neighbor(s), limit %d\n",
8219 dn_count
, bgp
->dynamic_neighbors_limit
);
8226 static void bgp_show_summary_afi_safi(struct vty
*vty
, struct bgp
*bgp
, int afi
,
8227 int safi
, bool use_json
,
8231 int afi_wildcard
= (afi
== AFI_MAX
);
8232 int safi_wildcard
= (safi
== SAFI_MAX
);
8233 int is_wildcard
= (afi_wildcard
|| safi_wildcard
);
8234 bool nbr_output
= false;
8236 if (use_json
&& is_wildcard
)
8237 vty_out(vty
, "{\n");
8239 afi
= 1; /* AFI_IP */
8240 while (afi
< AFI_MAX
) {
8242 safi
= 1; /* SAFI_UNICAST */
8243 while (safi
< SAFI_MAX
) {
8244 if (bgp_afi_safi_peer_exists(bgp
, afi
, safi
)) {
8248 * So limit output to those afi/safi
8250 * actualy have something interesting in
8254 json
= json_object_new_object();
8257 vty_out(vty
, ",\n");
8261 vty_out(vty
, "\"%s\":",
8265 vty_out(vty
, "\n%s Summary:\n",
8270 bgp_show_summary(vty
, bgp
, afi
, safi
, use_json
,
8282 if (use_json
&& is_wildcard
)
8283 vty_out(vty
, "}\n");
8284 else if (!nbr_output
) {
8286 vty_out(vty
, "{}\n");
8288 vty_out(vty
, "%% No BGP neighbors found\n");
8292 static void bgp_show_all_instances_summary_vty(struct vty
*vty
, afi_t afi
,
8293 safi_t safi
, bool use_json
)
8295 struct listnode
*node
, *nnode
;
8297 json_object
*json
= NULL
;
8299 bool nbr_output
= false;
8302 vty_out(vty
, "{\n");
8304 for (ALL_LIST_ELEMENTS(bm
->bgp
, node
, nnode
, bgp
)) {
8307 json
= json_object_new_object();
8310 vty_out(vty
, ",\n");
8314 vty_out(vty
, "\"%s\":",
8315 (bgp
->inst_type
== BGP_INSTANCE_TYPE_DEFAULT
)
8319 vty_out(vty
, "\nInstance %s:\n",
8320 (bgp
->inst_type
== BGP_INSTANCE_TYPE_DEFAULT
)
8324 bgp_show_summary_afi_safi(vty
, bgp
, afi
, safi
, use_json
, json
);
8328 vty_out(vty
, "}\n");
8329 else if (!nbr_output
)
8330 vty_out(vty
, "%% BGP instance not found\n");
8333 int bgp_show_summary_vty(struct vty
*vty
, const char *name
, afi_t afi
,
8334 safi_t safi
, bool use_json
)
8339 if (strmatch(name
, "all")) {
8340 bgp_show_all_instances_summary_vty(vty
, afi
, safi
,
8344 bgp
= bgp_lookup_by_name(name
);
8348 vty_out(vty
, "{}\n");
8351 "%% BGP instance not found\n");
8355 bgp_show_summary_afi_safi(vty
, bgp
, afi
, safi
, use_json
,
8361 bgp
= bgp_get_default();
8364 bgp_show_summary_afi_safi(vty
, bgp
, afi
, safi
, use_json
, NULL
);
8367 vty_out(vty
, "{}\n");
8369 vty_out(vty
, "%% BGP instance not found\n");
8376 /* `show [ip] bgp summary' commands. */
8377 DEFUN (show_ip_bgp_summary
,
8378 show_ip_bgp_summary_cmd
,
8379 "show [ip] bgp [<view|vrf> VIEWVRFNAME] ["BGP_AFI_CMD_STR
" ["BGP_SAFI_WITH_LABEL_CMD_STR
"]] summary [json]",
8383 BGP_INSTANCE_HELP_STR
8385 BGP_SAFI_WITH_LABEL_HELP_STR
8386 "Summary of BGP neighbor status\n"
8390 afi_t afi
= AFI_MAX
;
8391 safi_t safi
= SAFI_MAX
;
8396 if (argv_find(argv
, argc
, "ip", &idx
))
8398 /* [<vrf> VIEWVRFNAME] */
8399 if (argv_find(argv
, argc
, "vrf", &idx
)) {
8400 vrf
= argv
[idx
+ 1]->arg
;
8401 if (vrf
&& strmatch(vrf
, VRF_DEFAULT_NAME
))
8403 } else if (argv_find(argv
, argc
, "view", &idx
))
8404 /* [<view> VIEWVRFNAME] */
8405 vrf
= argv
[idx
+ 1]->arg
;
8406 /* ["BGP_AFI_CMD_STR" ["BGP_SAFI_CMD_STR"]] */
8407 if (argv_find_and_parse_afi(argv
, argc
, &idx
, &afi
)) {
8408 argv_find_and_parse_safi(argv
, argc
, &idx
, &safi
);
8411 bool uj
= use_json(argc
, argv
);
8413 return bgp_show_summary_vty(vty
, vrf
, afi
, safi
, uj
);
8416 const char *afi_safi_print(afi_t afi
, safi_t safi
)
8418 if (afi
== AFI_IP
&& safi
== SAFI_UNICAST
)
8419 return "IPv4 Unicast";
8420 else if (afi
== AFI_IP
&& safi
== SAFI_MULTICAST
)
8421 return "IPv4 Multicast";
8422 else if (afi
== AFI_IP
&& safi
== SAFI_LABELED_UNICAST
)
8423 return "IPv4 Labeled Unicast";
8424 else if (afi
== AFI_IP
&& safi
== SAFI_MPLS_VPN
)
8426 else if (afi
== AFI_IP
&& safi
== SAFI_ENCAP
)
8427 return "IPv4 Encap";
8428 else if (afi
== AFI_IP
&& safi
== SAFI_FLOWSPEC
)
8429 return "IPv4 Flowspec";
8430 else if (afi
== AFI_IP6
&& safi
== SAFI_UNICAST
)
8431 return "IPv6 Unicast";
8432 else if (afi
== AFI_IP6
&& safi
== SAFI_MULTICAST
)
8433 return "IPv6 Multicast";
8434 else if (afi
== AFI_IP6
&& safi
== SAFI_LABELED_UNICAST
)
8435 return "IPv6 Labeled Unicast";
8436 else if (afi
== AFI_IP6
&& safi
== SAFI_MPLS_VPN
)
8438 else if (afi
== AFI_IP6
&& safi
== SAFI_ENCAP
)
8439 return "IPv6 Encap";
8440 else if (afi
== AFI_IP6
&& safi
== SAFI_FLOWSPEC
)
8441 return "IPv6 Flowspec";
8442 else if (afi
== AFI_L2VPN
&& safi
== SAFI_EVPN
)
8443 return "L2VPN EVPN";
8449 * Please note that we have intentionally camelCased
8450 * the return strings here. So if you want
8451 * to use this function, please ensure you
8452 * are doing this within json output
8454 const char *afi_safi_json(afi_t afi
, safi_t safi
)
8456 if (afi
== AFI_IP
&& safi
== SAFI_UNICAST
)
8457 return "ipv4Unicast";
8458 else if (afi
== AFI_IP
&& safi
== SAFI_MULTICAST
)
8459 return "ipv4Multicast";
8460 else if (afi
== AFI_IP
&& safi
== SAFI_LABELED_UNICAST
)
8461 return "ipv4LabeledUnicast";
8462 else if (afi
== AFI_IP
&& safi
== SAFI_MPLS_VPN
)
8464 else if (afi
== AFI_IP
&& safi
== SAFI_ENCAP
)
8466 else if (afi
== AFI_IP
&& safi
== SAFI_FLOWSPEC
)
8467 return "ipv4Flowspec";
8468 else if (afi
== AFI_IP6
&& safi
== SAFI_UNICAST
)
8469 return "ipv6Unicast";
8470 else if (afi
== AFI_IP6
&& safi
== SAFI_MULTICAST
)
8471 return "ipv6Multicast";
8472 else if (afi
== AFI_IP6
&& safi
== SAFI_LABELED_UNICAST
)
8473 return "ipv6LabeledUnicast";
8474 else if (afi
== AFI_IP6
&& safi
== SAFI_MPLS_VPN
)
8476 else if (afi
== AFI_IP6
&& safi
== SAFI_ENCAP
)
8478 else if (afi
== AFI_IP6
&& safi
== SAFI_FLOWSPEC
)
8479 return "ipv6Flowspec";
8480 else if (afi
== AFI_L2VPN
&& safi
== SAFI_EVPN
)
8486 /* Show BGP peer's information. */
8487 enum show_type
{ show_all
, show_peer
};
8489 static void bgp_show_peer_afi_orf_cap(struct vty
*vty
, struct peer
*p
,
8490 afi_t afi
, safi_t safi
,
8491 uint16_t adv_smcap
, uint16_t adv_rmcap
,
8492 uint16_t rcv_smcap
, uint16_t rcv_rmcap
,
8493 bool use_json
, json_object
*json_pref
)
8496 if (CHECK_FLAG(p
->af_cap
[afi
][safi
], adv_smcap
)
8497 || CHECK_FLAG(p
->af_cap
[afi
][safi
], rcv_smcap
)) {
8499 if (CHECK_FLAG(p
->af_cap
[afi
][safi
], adv_smcap
)
8500 && CHECK_FLAG(p
->af_cap
[afi
][safi
], rcv_smcap
))
8501 json_object_string_add(json_pref
, "sendMode",
8502 "advertisedAndReceived");
8503 else if (CHECK_FLAG(p
->af_cap
[afi
][safi
], adv_smcap
))
8504 json_object_string_add(json_pref
, "sendMode",
8506 else if (CHECK_FLAG(p
->af_cap
[afi
][safi
], rcv_smcap
))
8507 json_object_string_add(json_pref
, "sendMode",
8510 vty_out(vty
, " Send-mode: ");
8511 if (CHECK_FLAG(p
->af_cap
[afi
][safi
], adv_smcap
))
8512 vty_out(vty
, "advertised");
8513 if (CHECK_FLAG(p
->af_cap
[afi
][safi
], rcv_smcap
))
8514 vty_out(vty
, "%sreceived",
8515 CHECK_FLAG(p
->af_cap
[afi
][safi
],
8524 if (CHECK_FLAG(p
->af_cap
[afi
][safi
], adv_rmcap
)
8525 || CHECK_FLAG(p
->af_cap
[afi
][safi
], rcv_rmcap
)) {
8527 if (CHECK_FLAG(p
->af_cap
[afi
][safi
], adv_rmcap
)
8528 && CHECK_FLAG(p
->af_cap
[afi
][safi
], rcv_rmcap
))
8529 json_object_string_add(json_pref
, "recvMode",
8530 "advertisedAndReceived");
8531 else if (CHECK_FLAG(p
->af_cap
[afi
][safi
], adv_rmcap
))
8532 json_object_string_add(json_pref
, "recvMode",
8534 else if (CHECK_FLAG(p
->af_cap
[afi
][safi
], rcv_rmcap
))
8535 json_object_string_add(json_pref
, "recvMode",
8538 vty_out(vty
, " Receive-mode: ");
8539 if (CHECK_FLAG(p
->af_cap
[afi
][safi
], adv_rmcap
))
8540 vty_out(vty
, "advertised");
8541 if (CHECK_FLAG(p
->af_cap
[afi
][safi
], rcv_rmcap
))
8542 vty_out(vty
, "%sreceived",
8543 CHECK_FLAG(p
->af_cap
[afi
][safi
],
8552 static void bgp_show_peer_afi(struct vty
*vty
, struct peer
*p
, afi_t afi
,
8553 safi_t safi
, bool use_json
,
8554 json_object
*json_neigh
)
8556 struct bgp_filter
*filter
;
8557 struct peer_af
*paf
;
8558 char orf_pfx_name
[BUFSIZ
];
8560 json_object
*json_af
= NULL
;
8561 json_object
*json_prefA
= NULL
;
8562 json_object
*json_prefB
= NULL
;
8563 json_object
*json_addr
= NULL
;
8566 json_addr
= json_object_new_object();
8567 json_af
= json_object_new_object();
8568 filter
= &p
->filter
[afi
][safi
];
8570 if (peer_group_active(p
))
8571 json_object_string_add(json_addr
, "peerGroupMember",
8574 paf
= peer_af_find(p
, afi
, safi
);
8575 if (paf
&& PAF_SUBGRP(paf
)) {
8576 json_object_int_add(json_addr
, "updateGroupId",
8577 PAF_UPDGRP(paf
)->id
);
8578 json_object_int_add(json_addr
, "subGroupId",
8579 PAF_SUBGRP(paf
)->id
);
8580 json_object_int_add(json_addr
, "packetQueueLength",
8581 bpacket_queue_virtual_length(paf
));
8584 if (CHECK_FLAG(p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_ADV
)
8585 || CHECK_FLAG(p
->af_cap
[afi
][safi
],
8586 PEER_CAP_ORF_PREFIX_SM_RCV
)
8587 || CHECK_FLAG(p
->af_cap
[afi
][safi
],
8588 PEER_CAP_ORF_PREFIX_RM_ADV
)
8589 || CHECK_FLAG(p
->af_cap
[afi
][safi
],
8590 PEER_CAP_ORF_PREFIX_RM_RCV
)) {
8591 json_object_int_add(json_af
, "orfType",
8593 json_prefA
= json_object_new_object();
8594 bgp_show_peer_afi_orf_cap(vty
, p
, afi
, safi
,
8595 PEER_CAP_ORF_PREFIX_SM_ADV
,
8596 PEER_CAP_ORF_PREFIX_RM_ADV
,
8597 PEER_CAP_ORF_PREFIX_SM_RCV
,
8598 PEER_CAP_ORF_PREFIX_RM_RCV
,
8599 use_json
, json_prefA
);
8600 json_object_object_add(json_af
, "orfPrefixList",
8604 if (CHECK_FLAG(p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_ADV
)
8605 || CHECK_FLAG(p
->af_cap
[afi
][safi
],
8606 PEER_CAP_ORF_PREFIX_SM_OLD_RCV
)
8607 || CHECK_FLAG(p
->af_cap
[afi
][safi
],
8608 PEER_CAP_ORF_PREFIX_RM_ADV
)
8609 || CHECK_FLAG(p
->af_cap
[afi
][safi
],
8610 PEER_CAP_ORF_PREFIX_RM_OLD_RCV
)) {
8611 json_object_int_add(json_af
, "orfOldType",
8612 ORF_TYPE_PREFIX_OLD
);
8613 json_prefB
= json_object_new_object();
8614 bgp_show_peer_afi_orf_cap(
8615 vty
, p
, afi
, safi
, PEER_CAP_ORF_PREFIX_SM_ADV
,
8616 PEER_CAP_ORF_PREFIX_RM_ADV
,
8617 PEER_CAP_ORF_PREFIX_SM_OLD_RCV
,
8618 PEER_CAP_ORF_PREFIX_RM_OLD_RCV
, use_json
,
8620 json_object_object_add(json_af
, "orfOldPrefixList",
8624 if (CHECK_FLAG(p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_ADV
)
8625 || CHECK_FLAG(p
->af_cap
[afi
][safi
],
8626 PEER_CAP_ORF_PREFIX_SM_RCV
)
8627 || CHECK_FLAG(p
->af_cap
[afi
][safi
],
8628 PEER_CAP_ORF_PREFIX_SM_OLD_RCV
)
8629 || CHECK_FLAG(p
->af_cap
[afi
][safi
],
8630 PEER_CAP_ORF_PREFIX_RM_ADV
)
8631 || CHECK_FLAG(p
->af_cap
[afi
][safi
],
8632 PEER_CAP_ORF_PREFIX_RM_RCV
)
8633 || CHECK_FLAG(p
->af_cap
[afi
][safi
],
8634 PEER_CAP_ORF_PREFIX_RM_OLD_RCV
))
8635 json_object_object_add(json_addr
, "afDependentCap",
8638 json_object_free(json_af
);
8640 sprintf(orf_pfx_name
, "%s.%d.%d", p
->host
, afi
, safi
);
8641 orf_pfx_count
= prefix_bgp_show_prefix_list(
8642 NULL
, afi
, orf_pfx_name
, use_json
);
8644 if (CHECK_FLAG(p
->af_sflags
[afi
][safi
],
8645 PEER_STATUS_ORF_PREFIX_SEND
)
8647 if (CHECK_FLAG(p
->af_sflags
[afi
][safi
],
8648 PEER_STATUS_ORF_PREFIX_SEND
))
8649 json_object_boolean_true_add(json_neigh
,
8652 json_object_int_add(json_addr
, "orfRecvCounter",
8655 if (CHECK_FLAG(p
->af_sflags
[afi
][safi
],
8656 PEER_STATUS_ORF_WAIT_REFRESH
))
8657 json_object_string_add(
8658 json_addr
, "orfFirstUpdate",
8659 "deferredUntilORFOrRouteRefreshRecvd");
8661 if (CHECK_FLAG(p
->af_flags
[afi
][safi
],
8662 PEER_FLAG_REFLECTOR_CLIENT
))
8663 json_object_boolean_true_add(json_addr
,
8664 "routeReflectorClient");
8665 if (CHECK_FLAG(p
->af_flags
[afi
][safi
],
8666 PEER_FLAG_RSERVER_CLIENT
))
8667 json_object_boolean_true_add(json_addr
,
8668 "routeServerClient");
8669 if (CHECK_FLAG(p
->af_flags
[afi
][safi
], PEER_FLAG_SOFT_RECONFIG
))
8670 json_object_boolean_true_add(json_addr
,
8671 "inboundSoftConfigPermit");
8673 if (CHECK_FLAG(p
->af_flags
[afi
][safi
],
8674 PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE
))
8675 json_object_boolean_true_add(
8677 "privateAsNumsAllReplacedInUpdatesToNbr");
8678 else if (CHECK_FLAG(p
->af_flags
[afi
][safi
],
8679 PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE
))
8680 json_object_boolean_true_add(
8682 "privateAsNumsReplacedInUpdatesToNbr");
8683 else if (CHECK_FLAG(p
->af_flags
[afi
][safi
],
8684 PEER_FLAG_REMOVE_PRIVATE_AS_ALL
))
8685 json_object_boolean_true_add(
8687 "privateAsNumsAllRemovedInUpdatesToNbr");
8688 else if (CHECK_FLAG(p
->af_flags
[afi
][safi
],
8689 PEER_FLAG_REMOVE_PRIVATE_AS
))
8690 json_object_boolean_true_add(
8692 "privateAsNumsRemovedInUpdatesToNbr");
8694 if (p
->addpath_type
[afi
][safi
] != BGP_ADDPATH_NONE
)
8695 json_object_boolean_true_add(
8697 bgp_addpath_names(p
->addpath_type
[afi
][safi
])
8700 if (CHECK_FLAG(p
->af_flags
[afi
][safi
], PEER_FLAG_AS_OVERRIDE
))
8701 json_object_string_add(json_addr
,
8702 "overrideASNsInOutboundUpdates",
8703 "ifAspathEqualRemoteAs");
8705 if (CHECK_FLAG(p
->af_flags
[afi
][safi
], PEER_FLAG_NEXTHOP_SELF
)
8706 || CHECK_FLAG(p
->af_flags
[afi
][safi
],
8707 PEER_FLAG_FORCE_NEXTHOP_SELF
))
8708 json_object_boolean_true_add(json_addr
,
8709 "routerAlwaysNextHop");
8710 if (CHECK_FLAG(p
->af_flags
[afi
][safi
],
8711 PEER_FLAG_AS_PATH_UNCHANGED
))
8712 json_object_boolean_true_add(
8713 json_addr
, "unchangedAsPathPropogatedToNbr");
8714 if (CHECK_FLAG(p
->af_flags
[afi
][safi
],
8715 PEER_FLAG_NEXTHOP_UNCHANGED
))
8716 json_object_boolean_true_add(
8717 json_addr
, "unchangedNextHopPropogatedToNbr");
8718 if (CHECK_FLAG(p
->af_flags
[afi
][safi
], PEER_FLAG_MED_UNCHANGED
))
8719 json_object_boolean_true_add(
8720 json_addr
, "unchangedMedPropogatedToNbr");
8721 if (CHECK_FLAG(p
->af_flags
[afi
][safi
], PEER_FLAG_SEND_COMMUNITY
)
8722 || CHECK_FLAG(p
->af_flags
[afi
][safi
],
8723 PEER_FLAG_SEND_EXT_COMMUNITY
)) {
8724 if (CHECK_FLAG(p
->af_flags
[afi
][safi
],
8725 PEER_FLAG_SEND_COMMUNITY
)
8726 && CHECK_FLAG(p
->af_flags
[afi
][safi
],
8727 PEER_FLAG_SEND_EXT_COMMUNITY
))
8728 json_object_string_add(json_addr
,
8729 "commAttriSentToNbr",
8730 "extendedAndStandard");
8731 else if (CHECK_FLAG(p
->af_flags
[afi
][safi
],
8732 PEER_FLAG_SEND_EXT_COMMUNITY
))
8733 json_object_string_add(json_addr
,
8734 "commAttriSentToNbr",
8737 json_object_string_add(json_addr
,
8738 "commAttriSentToNbr",
8741 if (CHECK_FLAG(p
->af_flags
[afi
][safi
],
8742 PEER_FLAG_DEFAULT_ORIGINATE
)) {
8743 if (p
->default_rmap
[afi
][safi
].name
)
8744 json_object_string_add(
8745 json_addr
, "defaultRouteMap",
8746 p
->default_rmap
[afi
][safi
].name
);
8748 if (paf
&& PAF_SUBGRP(paf
)
8749 && CHECK_FLAG(PAF_SUBGRP(paf
)->sflags
,
8750 SUBGRP_STATUS_DEFAULT_ORIGINATE
))
8751 json_object_boolean_true_add(json_addr
,
8754 json_object_boolean_true_add(json_addr
,
8758 if (afi
== AFI_L2VPN
&& safi
== SAFI_EVPN
) {
8759 if (is_evpn_enabled())
8760 json_object_boolean_true_add(
8761 json_addr
, "advertiseAllVnis");
8764 if (filter
->plist
[FILTER_IN
].name
8765 || filter
->dlist
[FILTER_IN
].name
8766 || filter
->aslist
[FILTER_IN
].name
8767 || filter
->map
[RMAP_IN
].name
)
8768 json_object_boolean_true_add(json_addr
,
8769 "inboundPathPolicyConfig");
8770 if (filter
->plist
[FILTER_OUT
].name
8771 || filter
->dlist
[FILTER_OUT
].name
8772 || filter
->aslist
[FILTER_OUT
].name
8773 || filter
->map
[RMAP_OUT
].name
|| filter
->usmap
.name
)
8774 json_object_boolean_true_add(
8775 json_addr
, "outboundPathPolicyConfig");
8778 if (filter
->plist
[FILTER_IN
].name
)
8779 json_object_string_add(json_addr
,
8780 "incomingUpdatePrefixFilterList",
8781 filter
->plist
[FILTER_IN
].name
);
8782 if (filter
->plist
[FILTER_OUT
].name
)
8783 json_object_string_add(json_addr
,
8784 "outgoingUpdatePrefixFilterList",
8785 filter
->plist
[FILTER_OUT
].name
);
8787 /* distribute-list */
8788 if (filter
->dlist
[FILTER_IN
].name
)
8789 json_object_string_add(
8790 json_addr
, "incomingUpdateNetworkFilterList",
8791 filter
->dlist
[FILTER_IN
].name
);
8792 if (filter
->dlist
[FILTER_OUT
].name
)
8793 json_object_string_add(
8794 json_addr
, "outgoingUpdateNetworkFilterList",
8795 filter
->dlist
[FILTER_OUT
].name
);
8798 if (filter
->aslist
[FILTER_IN
].name
)
8799 json_object_string_add(json_addr
,
8800 "incomingUpdateAsPathFilterList",
8801 filter
->aslist
[FILTER_IN
].name
);
8802 if (filter
->aslist
[FILTER_OUT
].name
)
8803 json_object_string_add(json_addr
,
8804 "outgoingUpdateAsPathFilterList",
8805 filter
->aslist
[FILTER_OUT
].name
);
8808 if (filter
->map
[RMAP_IN
].name
)
8809 json_object_string_add(
8810 json_addr
, "routeMapForIncomingAdvertisements",
8811 filter
->map
[RMAP_IN
].name
);
8812 if (filter
->map
[RMAP_OUT
].name
)
8813 json_object_string_add(
8814 json_addr
, "routeMapForOutgoingAdvertisements",
8815 filter
->map
[RMAP_OUT
].name
);
8817 /* unsuppress-map */
8818 if (filter
->usmap
.name
)
8819 json_object_string_add(json_addr
,
8820 "selectiveUnsuppressRouteMap",
8821 filter
->usmap
.name
);
8823 /* Receive prefix count */
8824 json_object_int_add(json_addr
, "acceptedPrefixCounter",
8825 p
->pcount
[afi
][safi
]);
8826 if (paf
&& PAF_SUBGRP(paf
))
8827 json_object_int_add(json_addr
, "sentPrefixCounter",
8828 (PAF_SUBGRP(paf
))->scount
);
8830 /* Maximum prefix */
8831 if (CHECK_FLAG(p
->af_flags
[afi
][safi
], PEER_FLAG_MAX_PREFIX
)) {
8832 json_object_int_add(json_addr
, "prefixAllowedMax",
8833 p
->pmax
[afi
][safi
]);
8834 if (CHECK_FLAG(p
->af_flags
[afi
][safi
],
8835 PEER_FLAG_MAX_PREFIX_WARNING
))
8836 json_object_boolean_true_add(
8837 json_addr
, "prefixAllowedMaxWarning");
8838 json_object_int_add(json_addr
,
8839 "prefixAllowedWarningThresh",
8840 p
->pmax_threshold
[afi
][safi
]);
8841 if (p
->pmax_restart
[afi
][safi
])
8842 json_object_int_add(
8844 "prefixAllowedRestartIntervalMsecs",
8845 p
->pmax_restart
[afi
][safi
] * 60000);
8847 json_object_object_add(json_neigh
, afi_safi_print(afi
, safi
),
8851 filter
= &p
->filter
[afi
][safi
];
8853 vty_out(vty
, " For address family: %s\n",
8854 afi_safi_print(afi
, safi
));
8856 if (peer_group_active(p
))
8857 vty_out(vty
, " %s peer-group member\n",
8860 paf
= peer_af_find(p
, afi
, safi
);
8861 if (paf
&& PAF_SUBGRP(paf
)) {
8862 vty_out(vty
, " Update group %" PRIu64
8863 ", subgroup %" PRIu64
"\n",
8864 PAF_UPDGRP(paf
)->id
, PAF_SUBGRP(paf
)->id
);
8865 vty_out(vty
, " Packet Queue length %d\n",
8866 bpacket_queue_virtual_length(paf
));
8868 vty_out(vty
, " Not part of any update group\n");
8870 if (CHECK_FLAG(p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_ADV
)
8871 || CHECK_FLAG(p
->af_cap
[afi
][safi
],
8872 PEER_CAP_ORF_PREFIX_SM_RCV
)
8873 || CHECK_FLAG(p
->af_cap
[afi
][safi
],
8874 PEER_CAP_ORF_PREFIX_SM_OLD_RCV
)
8875 || CHECK_FLAG(p
->af_cap
[afi
][safi
],
8876 PEER_CAP_ORF_PREFIX_RM_ADV
)
8877 || CHECK_FLAG(p
->af_cap
[afi
][safi
],
8878 PEER_CAP_ORF_PREFIX_RM_RCV
)
8879 || CHECK_FLAG(p
->af_cap
[afi
][safi
],
8880 PEER_CAP_ORF_PREFIX_RM_OLD_RCV
))
8881 vty_out(vty
, " AF-dependant capabilities:\n");
8883 if (CHECK_FLAG(p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_ADV
)
8884 || CHECK_FLAG(p
->af_cap
[afi
][safi
],
8885 PEER_CAP_ORF_PREFIX_SM_RCV
)
8886 || CHECK_FLAG(p
->af_cap
[afi
][safi
],
8887 PEER_CAP_ORF_PREFIX_RM_ADV
)
8888 || CHECK_FLAG(p
->af_cap
[afi
][safi
],
8889 PEER_CAP_ORF_PREFIX_RM_RCV
)) {
8891 " Outbound Route Filter (ORF) type (%d) Prefix-list:\n",
8893 bgp_show_peer_afi_orf_cap(
8894 vty
, p
, afi
, safi
, PEER_CAP_ORF_PREFIX_SM_ADV
,
8895 PEER_CAP_ORF_PREFIX_RM_ADV
,
8896 PEER_CAP_ORF_PREFIX_SM_RCV
,
8897 PEER_CAP_ORF_PREFIX_RM_RCV
, use_json
, NULL
);
8899 if (CHECK_FLAG(p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_ADV
)
8900 || CHECK_FLAG(p
->af_cap
[afi
][safi
],
8901 PEER_CAP_ORF_PREFIX_SM_OLD_RCV
)
8902 || CHECK_FLAG(p
->af_cap
[afi
][safi
],
8903 PEER_CAP_ORF_PREFIX_RM_ADV
)
8904 || CHECK_FLAG(p
->af_cap
[afi
][safi
],
8905 PEER_CAP_ORF_PREFIX_RM_OLD_RCV
)) {
8907 " Outbound Route Filter (ORF) type (%d) Prefix-list:\n",
8908 ORF_TYPE_PREFIX_OLD
);
8909 bgp_show_peer_afi_orf_cap(
8910 vty
, p
, afi
, safi
, PEER_CAP_ORF_PREFIX_SM_ADV
,
8911 PEER_CAP_ORF_PREFIX_RM_ADV
,
8912 PEER_CAP_ORF_PREFIX_SM_OLD_RCV
,
8913 PEER_CAP_ORF_PREFIX_RM_OLD_RCV
, use_json
, NULL
);
8916 sprintf(orf_pfx_name
, "%s.%d.%d", p
->host
, afi
, safi
);
8917 orf_pfx_count
= prefix_bgp_show_prefix_list(
8918 NULL
, afi
, orf_pfx_name
, use_json
);
8920 if (CHECK_FLAG(p
->af_sflags
[afi
][safi
],
8921 PEER_STATUS_ORF_PREFIX_SEND
)
8923 vty_out(vty
, " Outbound Route Filter (ORF):");
8924 if (CHECK_FLAG(p
->af_sflags
[afi
][safi
],
8925 PEER_STATUS_ORF_PREFIX_SEND
))
8926 vty_out(vty
, " sent;");
8928 vty_out(vty
, " received (%d entries)",
8932 if (CHECK_FLAG(p
->af_sflags
[afi
][safi
],
8933 PEER_STATUS_ORF_WAIT_REFRESH
))
8935 " First update is deferred until ORF or ROUTE-REFRESH is received\n");
8937 if (CHECK_FLAG(p
->af_flags
[afi
][safi
],
8938 PEER_FLAG_REFLECTOR_CLIENT
))
8939 vty_out(vty
, " Route-Reflector Client\n");
8940 if (CHECK_FLAG(p
->af_flags
[afi
][safi
],
8941 PEER_FLAG_RSERVER_CLIENT
))
8942 vty_out(vty
, " Route-Server Client\n");
8943 if (CHECK_FLAG(p
->af_flags
[afi
][safi
], PEER_FLAG_SOFT_RECONFIG
))
8945 " Inbound soft reconfiguration allowed\n");
8947 if (CHECK_FLAG(p
->af_flags
[afi
][safi
],
8948 PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE
))
8950 " Private AS numbers (all) replaced in updates to this neighbor\n");
8951 else if (CHECK_FLAG(p
->af_flags
[afi
][safi
],
8952 PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE
))
8954 " Private AS numbers replaced in updates to this neighbor\n");
8955 else if (CHECK_FLAG(p
->af_flags
[afi
][safi
],
8956 PEER_FLAG_REMOVE_PRIVATE_AS_ALL
))
8958 " Private AS numbers (all) removed in updates to this neighbor\n");
8959 else if (CHECK_FLAG(p
->af_flags
[afi
][safi
],
8960 PEER_FLAG_REMOVE_PRIVATE_AS
))
8962 " Private AS numbers removed in updates to this neighbor\n");
8964 if (p
->addpath_type
[afi
][safi
] != BGP_ADDPATH_NONE
)
8965 vty_out(vty
, " %s\n",
8966 bgp_addpath_names(p
->addpath_type
[afi
][safi
])
8967 ->human_description
);
8969 if (CHECK_FLAG(p
->af_flags
[afi
][safi
], PEER_FLAG_AS_OVERRIDE
))
8971 " Override ASNs in outbound updates if aspath equals remote-as\n");
8973 if (CHECK_FLAG(p
->af_flags
[afi
][safi
], PEER_FLAG_NEXTHOP_SELF
)
8974 || CHECK_FLAG(p
->af_flags
[afi
][safi
],
8975 PEER_FLAG_FORCE_NEXTHOP_SELF
))
8976 vty_out(vty
, " NEXT_HOP is always this router\n");
8977 if (CHECK_FLAG(p
->af_flags
[afi
][safi
],
8978 PEER_FLAG_AS_PATH_UNCHANGED
))
8980 " AS_PATH is propagated unchanged to this neighbor\n");
8981 if (CHECK_FLAG(p
->af_flags
[afi
][safi
],
8982 PEER_FLAG_NEXTHOP_UNCHANGED
))
8984 " NEXT_HOP is propagated unchanged to this neighbor\n");
8985 if (CHECK_FLAG(p
->af_flags
[afi
][safi
], PEER_FLAG_MED_UNCHANGED
))
8987 " MED is propagated unchanged to this neighbor\n");
8988 if (CHECK_FLAG(p
->af_flags
[afi
][safi
], PEER_FLAG_SEND_COMMUNITY
)
8989 || CHECK_FLAG(p
->af_flags
[afi
][safi
],
8990 PEER_FLAG_SEND_EXT_COMMUNITY
)
8991 || CHECK_FLAG(p
->af_flags
[afi
][safi
],
8992 PEER_FLAG_SEND_LARGE_COMMUNITY
)) {
8994 " Community attribute sent to this neighbor");
8995 if (CHECK_FLAG(p
->af_flags
[afi
][safi
],
8996 PEER_FLAG_SEND_COMMUNITY
)
8997 && CHECK_FLAG(p
->af_flags
[afi
][safi
],
8998 PEER_FLAG_SEND_EXT_COMMUNITY
)
8999 && CHECK_FLAG(p
->af_flags
[afi
][safi
],
9000 PEER_FLAG_SEND_LARGE_COMMUNITY
))
9001 vty_out(vty
, "(all)\n");
9002 else if (CHECK_FLAG(p
->af_flags
[afi
][safi
],
9003 PEER_FLAG_SEND_LARGE_COMMUNITY
))
9004 vty_out(vty
, "(large)\n");
9005 else if (CHECK_FLAG(p
->af_flags
[afi
][safi
],
9006 PEER_FLAG_SEND_EXT_COMMUNITY
))
9007 vty_out(vty
, "(extended)\n");
9009 vty_out(vty
, "(standard)\n");
9011 if (CHECK_FLAG(p
->af_flags
[afi
][safi
],
9012 PEER_FLAG_DEFAULT_ORIGINATE
)) {
9013 vty_out(vty
, " Default information originate,");
9015 if (p
->default_rmap
[afi
][safi
].name
)
9016 vty_out(vty
, " default route-map %s%s,",
9017 p
->default_rmap
[afi
][safi
].map
? "*"
9019 p
->default_rmap
[afi
][safi
].name
);
9020 if (paf
&& PAF_SUBGRP(paf
)
9021 && CHECK_FLAG(PAF_SUBGRP(paf
)->sflags
,
9022 SUBGRP_STATUS_DEFAULT_ORIGINATE
))
9023 vty_out(vty
, " default sent\n");
9025 vty_out(vty
, " default not sent\n");
9028 /* advertise-vni-all */
9029 if (afi
== AFI_L2VPN
&& safi
== SAFI_EVPN
) {
9030 if (is_evpn_enabled())
9031 vty_out(vty
, " advertise-all-vni\n");
9034 if (filter
->plist
[FILTER_IN
].name
9035 || filter
->dlist
[FILTER_IN
].name
9036 || filter
->aslist
[FILTER_IN
].name
9037 || filter
->map
[RMAP_IN
].name
)
9038 vty_out(vty
, " Inbound path policy configured\n");
9039 if (filter
->plist
[FILTER_OUT
].name
9040 || filter
->dlist
[FILTER_OUT
].name
9041 || filter
->aslist
[FILTER_OUT
].name
9042 || filter
->map
[RMAP_OUT
].name
|| filter
->usmap
.name
)
9043 vty_out(vty
, " Outbound path policy configured\n");
9046 if (filter
->plist
[FILTER_IN
].name
)
9048 " Incoming update prefix filter list is %s%s\n",
9049 filter
->plist
[FILTER_IN
].plist
? "*" : "",
9050 filter
->plist
[FILTER_IN
].name
);
9051 if (filter
->plist
[FILTER_OUT
].name
)
9053 " Outgoing update prefix filter list is %s%s\n",
9054 filter
->plist
[FILTER_OUT
].plist
? "*" : "",
9055 filter
->plist
[FILTER_OUT
].name
);
9057 /* distribute-list */
9058 if (filter
->dlist
[FILTER_IN
].name
)
9060 " Incoming update network filter list is %s%s\n",
9061 filter
->dlist
[FILTER_IN
].alist
? "*" : "",
9062 filter
->dlist
[FILTER_IN
].name
);
9063 if (filter
->dlist
[FILTER_OUT
].name
)
9065 " Outgoing update network filter list is %s%s\n",
9066 filter
->dlist
[FILTER_OUT
].alist
? "*" : "",
9067 filter
->dlist
[FILTER_OUT
].name
);
9070 if (filter
->aslist
[FILTER_IN
].name
)
9072 " Incoming update AS path filter list is %s%s\n",
9073 filter
->aslist
[FILTER_IN
].aslist
? "*" : "",
9074 filter
->aslist
[FILTER_IN
].name
);
9075 if (filter
->aslist
[FILTER_OUT
].name
)
9077 " Outgoing update AS path filter list is %s%s\n",
9078 filter
->aslist
[FILTER_OUT
].aslist
? "*" : "",
9079 filter
->aslist
[FILTER_OUT
].name
);
9082 if (filter
->map
[RMAP_IN
].name
)
9084 " Route map for incoming advertisements is %s%s\n",
9085 filter
->map
[RMAP_IN
].map
? "*" : "",
9086 filter
->map
[RMAP_IN
].name
);
9087 if (filter
->map
[RMAP_OUT
].name
)
9089 " Route map for outgoing advertisements is %s%s\n",
9090 filter
->map
[RMAP_OUT
].map
? "*" : "",
9091 filter
->map
[RMAP_OUT
].name
);
9093 /* unsuppress-map */
9094 if (filter
->usmap
.name
)
9096 " Route map for selective unsuppress is %s%s\n",
9097 filter
->usmap
.map
? "*" : "",
9098 filter
->usmap
.name
);
9100 /* Receive prefix count */
9101 vty_out(vty
, " %ld accepted prefixes\n", p
->pcount
[afi
][safi
]);
9103 /* Maximum prefix */
9104 if (CHECK_FLAG(p
->af_flags
[afi
][safi
], PEER_FLAG_MAX_PREFIX
)) {
9105 vty_out(vty
, " Maximum prefixes allowed %ld%s\n",
9107 CHECK_FLAG(p
->af_flags
[afi
][safi
],
9108 PEER_FLAG_MAX_PREFIX_WARNING
)
9111 vty_out(vty
, " Threshold for warning message %d%%",
9112 p
->pmax_threshold
[afi
][safi
]);
9113 if (p
->pmax_restart
[afi
][safi
])
9114 vty_out(vty
, ", restart interval %d min",
9115 p
->pmax_restart
[afi
][safi
]);
9123 static void bgp_show_peer(struct vty
*vty
, struct peer
*p
, bool use_json
,
9127 char buf1
[PREFIX2STR_BUFFER
], buf
[SU_ADDRSTRLEN
];
9128 char timebuf
[BGP_UPTIME_LEN
];
9130 const char *subcode_str
;
9131 const char *code_str
;
9136 json_object
*json_neigh
= NULL
;
9142 json_neigh
= json_object_new_object();
9144 memset(dn_flag
, '\0', sizeof(dn_flag
));
9145 if (!p
->conf_if
&& peer_dynamic_neighbor(p
))
9149 if (p
->conf_if
) /* Configured interface name. */
9150 vty_out(vty
, "BGP neighbor on %s: %s, ", p
->conf_if
,
9151 BGP_PEER_SU_UNSPEC(p
)
9153 : sockunion2str(&p
->su
, buf
,
9155 else /* Configured IP address. */
9156 vty_out(vty
, "BGP neighbor is %s%s, ", dn_flag
,
9161 if (p
->conf_if
&& BGP_PEER_SU_UNSPEC(p
))
9162 json_object_string_add(json_neigh
, "bgpNeighborAddr",
9164 else if (p
->conf_if
&& !BGP_PEER_SU_UNSPEC(p
))
9165 json_object_string_add(
9166 json_neigh
, "bgpNeighborAddr",
9167 sockunion2str(&p
->su
, buf
, SU_ADDRSTRLEN
));
9169 json_object_int_add(json_neigh
, "remoteAs", p
->as
);
9171 if (p
->change_local_as
)
9172 json_object_int_add(json_neigh
, "localAs",
9173 p
->change_local_as
);
9175 json_object_int_add(json_neigh
, "localAs", p
->local_as
);
9177 if (CHECK_FLAG(p
->flags
, PEER_FLAG_LOCAL_AS_NO_PREPEND
))
9178 json_object_boolean_true_add(json_neigh
,
9179 "localAsNoPrepend");
9181 if (CHECK_FLAG(p
->flags
, PEER_FLAG_LOCAL_AS_REPLACE_AS
))
9182 json_object_boolean_true_add(json_neigh
,
9183 "localAsReplaceAs");
9185 if ((p
->as_type
== AS_SPECIFIED
) || (p
->as_type
== AS_EXTERNAL
)
9186 || (p
->as_type
== AS_INTERNAL
))
9187 vty_out(vty
, "remote AS %u, ", p
->as
);
9189 vty_out(vty
, "remote AS Unspecified, ");
9190 vty_out(vty
, "local AS %u%s%s, ",
9191 p
->change_local_as
? p
->change_local_as
: p
->local_as
,
9192 CHECK_FLAG(p
->flags
, PEER_FLAG_LOCAL_AS_NO_PREPEND
)
9195 CHECK_FLAG(p
->flags
, PEER_FLAG_LOCAL_AS_REPLACE_AS
)
9199 /* peer type internal, external, confed-internal or confed-external */
9200 if (p
->as
== p
->local_as
) {
9202 if (CHECK_FLAG(bgp
->config
, BGP_CONFIG_CONFEDERATION
))
9203 json_object_boolean_true_add(
9204 json_neigh
, "nbrConfedInternalLink");
9206 json_object_boolean_true_add(json_neigh
,
9209 if (CHECK_FLAG(bgp
->config
, BGP_CONFIG_CONFEDERATION
))
9210 vty_out(vty
, "confed-internal link\n");
9212 vty_out(vty
, "internal link\n");
9216 if (CHECK_FLAG(bgp
->config
, BGP_CONFIG_CONFEDERATION
))
9217 json_object_boolean_true_add(
9218 json_neigh
, "nbrConfedExternalLink");
9220 json_object_boolean_true_add(json_neigh
,
9223 if (bgp_confederation_peers_check(bgp
, p
->as
))
9224 vty_out(vty
, "confed-external link\n");
9226 vty_out(vty
, "external link\n");
9233 json_object_string_add(json_neigh
, "nbrDesc", p
->desc
);
9235 vty_out(vty
, " Description: %s\n", p
->desc
);
9241 json_object_string_add(json_neigh
, "hostname",
9245 json_object_string_add(json_neigh
, "domainname",
9248 if (p
->domainname
&& (p
->domainname
[0] != '\0'))
9249 vty_out(vty
, "Hostname: %s.%s\n", p
->hostname
,
9252 vty_out(vty
, "Hostname: %s\n", p
->hostname
);
9259 json_object_string_add(json_neigh
, "peerGroup",
9263 struct prefix prefix
, *range
= NULL
;
9265 sockunion2hostprefix(&(p
->su
), &prefix
);
9266 range
= peer_group_lookup_dynamic_neighbor_range(
9270 prefix2str(range
, buf1
, sizeof(buf1
));
9271 json_object_string_add(
9273 "peerSubnetRangeGroup", buf1
);
9278 " Member of peer-group %s for session parameters\n",
9282 struct prefix prefix
, *range
= NULL
;
9284 sockunion2hostprefix(&(p
->su
), &prefix
);
9285 range
= peer_group_lookup_dynamic_neighbor_range(
9289 prefix2str(range
, buf1
, sizeof(buf1
));
9291 " Belongs to the subnet range group: %s\n",
9299 /* Administrative shutdown. */
9300 if (CHECK_FLAG(p
->flags
, PEER_FLAG_SHUTDOWN
))
9301 json_object_boolean_true_add(json_neigh
,
9305 json_object_int_add(json_neigh
, "bgpVersion", 4);
9306 json_object_string_add(
9307 json_neigh
, "remoteRouterId",
9308 inet_ntop(AF_INET
, &p
->remote_id
, buf1
, sizeof(buf1
)));
9309 json_object_string_add(
9310 json_neigh
, "localRouterId",
9311 inet_ntop(AF_INET
, &bgp
->router_id
, buf1
,
9315 if (CHECK_FLAG(bgp
->config
, BGP_CONFIG_CONFEDERATION
)
9316 && bgp_confederation_peers_check(bgp
, p
->as
))
9317 json_object_boolean_true_add(json_neigh
,
9321 json_object_string_add(
9322 json_neigh
, "bgpState",
9323 lookup_msg(bgp_status_msg
, p
->status
, NULL
));
9325 if (p
->status
== Established
) {
9328 uptime
= bgp_clock();
9329 uptime
-= p
->uptime
;
9330 epoch_tbuf
= time(NULL
) - uptime
;
9332 #if CONFDATE > 20200101
9334 "bgpTimerUp should be deprecated and can be removed now");
9337 * bgpTimerUp was miliseconds that was accurate
9338 * up to 1 day, then the value returned
9339 * became garbage. So in order to provide
9340 * some level of backwards compatability,
9341 * we still provde the data, but now
9342 * we are returning the correct value
9343 * and also adding a new bgpTimerUpMsec
9344 * which will allow us to deprecate
9347 json_object_int_add(json_neigh
, "bgpTimerUp",
9349 json_object_int_add(json_neigh
, "bgpTimerUpMsec",
9351 json_object_string_add(json_neigh
, "bgpTimerUpString",
9352 peer_uptime(p
->uptime
, timebuf
,
9355 json_object_int_add(json_neigh
,
9356 "bgpTimerUpEstablishedEpoch",
9360 else if (p
->status
== Active
) {
9361 if (CHECK_FLAG(p
->flags
, PEER_FLAG_PASSIVE
))
9362 json_object_string_add(json_neigh
, "bgpStateIs",
9364 else if (CHECK_FLAG(p
->sflags
, PEER_STATUS_NSF_WAIT
))
9365 json_object_string_add(json_neigh
, "bgpStateIs",
9373 uptime
= bgp_clock();
9374 uptime
-= p
->readtime
;
9375 tm
= gmtime(&uptime
);
9376 json_object_int_add(json_neigh
, "bgpTimerLastRead",
9377 (tm
->tm_sec
* 1000) + (tm
->tm_min
* 60000)
9378 + (tm
->tm_hour
* 3600000));
9380 uptime
= bgp_clock();
9381 uptime
-= p
->last_write
;
9382 tm
= gmtime(&uptime
);
9383 json_object_int_add(json_neigh
, "bgpTimerLastWrite",
9384 (tm
->tm_sec
* 1000) + (tm
->tm_min
* 60000)
9385 + (tm
->tm_hour
* 3600000));
9387 uptime
= bgp_clock();
9388 uptime
-= p
->update_time
;
9389 tm
= gmtime(&uptime
);
9390 json_object_int_add(json_neigh
, "bgpInUpdateElapsedTimeMsecs",
9391 (tm
->tm_sec
* 1000) + (tm
->tm_min
* 60000)
9392 + (tm
->tm_hour
* 3600000));
9394 /* Configured timer values. */
9395 json_object_int_add(json_neigh
, "bgpTimerHoldTimeMsecs",
9396 p
->v_holdtime
* 1000);
9397 json_object_int_add(json_neigh
,
9398 "bgpTimerKeepAliveIntervalMsecs",
9399 p
->v_keepalive
* 1000);
9400 if (CHECK_FLAG(p
->flags
, PEER_FLAG_TIMER
)) {
9401 json_object_int_add(json_neigh
,
9402 "bgpTimerConfiguredHoldTimeMsecs",
9403 p
->holdtime
* 1000);
9404 json_object_int_add(
9406 "bgpTimerConfiguredKeepAliveIntervalMsecs",
9407 p
->keepalive
* 1000);
9408 } else if ((bgp
->default_holdtime
!= BGP_DEFAULT_HOLDTIME
)
9409 || (bgp
->default_keepalive
9410 != BGP_DEFAULT_KEEPALIVE
)) {
9411 json_object_int_add(json_neigh
,
9412 "bgpTimerConfiguredHoldTimeMsecs",
9413 bgp
->default_holdtime
);
9414 json_object_int_add(
9416 "bgpTimerConfiguredKeepAliveIntervalMsecs",
9417 bgp
->default_keepalive
);
9420 /* Administrative shutdown. */
9421 if (CHECK_FLAG(p
->flags
, PEER_FLAG_SHUTDOWN
))
9422 vty_out(vty
, " Administratively shut down\n");
9425 vty_out(vty
, " BGP version 4");
9426 vty_out(vty
, ", remote router ID %s",
9427 inet_ntop(AF_INET
, &p
->remote_id
, buf1
, sizeof(buf1
)));
9428 vty_out(vty
, ", local router ID %s\n",
9429 inet_ntop(AF_INET
, &bgp
->router_id
, buf1
,
9433 if (CHECK_FLAG(bgp
->config
, BGP_CONFIG_CONFEDERATION
)
9434 && bgp_confederation_peers_check(bgp
, p
->as
))
9436 " Neighbor under common administration\n");
9439 vty_out(vty
, " BGP state = %s",
9440 lookup_msg(bgp_status_msg
, p
->status
, NULL
));
9442 if (p
->status
== Established
)
9443 vty_out(vty
, ", up for %8s",
9444 peer_uptime(p
->uptime
, timebuf
, BGP_UPTIME_LEN
,
9447 else if (p
->status
== Active
) {
9448 if (CHECK_FLAG(p
->flags
, PEER_FLAG_PASSIVE
))
9449 vty_out(vty
, " (passive)");
9450 else if (CHECK_FLAG(p
->sflags
, PEER_STATUS_NSF_WAIT
))
9451 vty_out(vty
, " (NSF passive)");
9456 vty_out(vty
, " Last read %s",
9457 peer_uptime(p
->readtime
, timebuf
, BGP_UPTIME_LEN
, 0,
9459 vty_out(vty
, ", Last write %s\n",
9460 peer_uptime(p
->last_write
, timebuf
, BGP_UPTIME_LEN
, 0,
9463 /* Configured timer values. */
9465 " Hold time is %d, keepalive interval is %d seconds\n",
9466 p
->v_holdtime
, p
->v_keepalive
);
9467 if (CHECK_FLAG(p
->flags
, PEER_FLAG_TIMER
)) {
9468 vty_out(vty
, " Configured hold time is %d",
9470 vty_out(vty
, ", keepalive interval is %d seconds\n",
9472 } else if ((bgp
->default_holdtime
!= BGP_DEFAULT_HOLDTIME
)
9473 || (bgp
->default_keepalive
9474 != BGP_DEFAULT_KEEPALIVE
)) {
9475 vty_out(vty
, " Configured hold time is %d",
9476 bgp
->default_holdtime
);
9477 vty_out(vty
, ", keepalive interval is %d seconds\n",
9478 bgp
->default_keepalive
);
9482 if (p
->status
== Established
) {
9483 if (p
->cap
|| p
->afc_adv
[AFI_IP
][SAFI_UNICAST
]
9484 || p
->afc_recv
[AFI_IP
][SAFI_UNICAST
]
9485 || p
->afc_adv
[AFI_IP
][SAFI_MULTICAST
]
9486 || p
->afc_recv
[AFI_IP
][SAFI_MULTICAST
]
9487 || p
->afc_adv
[AFI_IP6
][SAFI_UNICAST
]
9488 || p
->afc_recv
[AFI_IP6
][SAFI_UNICAST
]
9489 || p
->afc_adv
[AFI_IP6
][SAFI_MULTICAST
]
9490 || p
->afc_recv
[AFI_IP6
][SAFI_MULTICAST
]
9491 || p
->afc_adv
[AFI_IP6
][SAFI_MPLS_VPN
]
9492 || p
->afc_recv
[AFI_IP6
][SAFI_MPLS_VPN
]
9493 || p
->afc_adv
[AFI_IP6
][SAFI_ENCAP
]
9494 || p
->afc_recv
[AFI_IP6
][SAFI_ENCAP
]
9495 || p
->afc_adv
[AFI_IP6
][SAFI_FLOWSPEC
]
9496 || p
->afc_recv
[AFI_IP6
][SAFI_FLOWSPEC
]
9497 || p
->afc_adv
[AFI_IP
][SAFI_ENCAP
]
9498 || p
->afc_recv
[AFI_IP
][SAFI_ENCAP
]
9499 || p
->afc_adv
[AFI_IP
][SAFI_FLOWSPEC
]
9500 || p
->afc_recv
[AFI_IP
][SAFI_FLOWSPEC
]
9501 || p
->afc_adv
[AFI_IP
][SAFI_MPLS_VPN
]
9502 || p
->afc_recv
[AFI_IP
][SAFI_MPLS_VPN
]) {
9504 json_object
*json_cap
= NULL
;
9506 json_cap
= json_object_new_object();
9509 if (CHECK_FLAG(p
->cap
, PEER_CAP_AS4_RCV
)
9510 || CHECK_FLAG(p
->cap
, PEER_CAP_AS4_ADV
)) {
9511 if (CHECK_FLAG(p
->cap
, PEER_CAP_AS4_ADV
)
9512 && CHECK_FLAG(p
->cap
,
9514 json_object_string_add(
9515 json_cap
, "4byteAs",
9516 "advertisedAndReceived");
9517 else if (CHECK_FLAG(p
->cap
,
9519 json_object_string_add(
9520 json_cap
, "4byteAs",
9522 else if (CHECK_FLAG(p
->cap
,
9524 json_object_string_add(
9525 json_cap
, "4byteAs",
9530 if (CHECK_FLAG(p
->cap
, PEER_CAP_ADDPATH_RCV
)
9531 || CHECK_FLAG(p
->cap
,
9532 PEER_CAP_ADDPATH_ADV
)) {
9533 json_object
*json_add
= NULL
;
9534 const char *print_store
;
9536 json_add
= json_object_new_object();
9538 FOREACH_AFI_SAFI (afi
, safi
) {
9539 json_object
*json_sub
= NULL
;
9541 json_object_new_object();
9542 print_store
= afi_safi_print(
9548 PEER_CAP_ADDPATH_AF_TX_ADV
)
9552 PEER_CAP_ADDPATH_AF_TX_RCV
)) {
9557 PEER_CAP_ADDPATH_AF_TX_ADV
)
9562 PEER_CAP_ADDPATH_AF_TX_RCV
))
9563 json_object_boolean_true_add(
9565 "txAdvertisedAndReceived");
9571 PEER_CAP_ADDPATH_AF_TX_ADV
))
9572 json_object_boolean_true_add(
9580 PEER_CAP_ADDPATH_AF_TX_RCV
))
9581 json_object_boolean_true_add(
9589 PEER_CAP_ADDPATH_AF_RX_ADV
)
9593 PEER_CAP_ADDPATH_AF_RX_RCV
)) {
9598 PEER_CAP_ADDPATH_AF_RX_ADV
)
9603 PEER_CAP_ADDPATH_AF_RX_RCV
))
9604 json_object_boolean_true_add(
9606 "rxAdvertisedAndReceived");
9612 PEER_CAP_ADDPATH_AF_RX_ADV
))
9613 json_object_boolean_true_add(
9621 PEER_CAP_ADDPATH_AF_RX_RCV
))
9622 json_object_boolean_true_add(
9630 PEER_CAP_ADDPATH_AF_TX_ADV
)
9634 PEER_CAP_ADDPATH_AF_TX_RCV
)
9638 PEER_CAP_ADDPATH_AF_RX_ADV
)
9642 PEER_CAP_ADDPATH_AF_RX_RCV
))
9643 json_object_object_add(
9652 json_object_object_add(
9653 json_cap
, "addPath", json_add
);
9657 if (CHECK_FLAG(p
->cap
, PEER_CAP_DYNAMIC_RCV
)
9658 || CHECK_FLAG(p
->cap
,
9659 PEER_CAP_DYNAMIC_ADV
)) {
9660 if (CHECK_FLAG(p
->cap
,
9661 PEER_CAP_DYNAMIC_ADV
)
9662 && CHECK_FLAG(p
->cap
,
9663 PEER_CAP_DYNAMIC_RCV
))
9664 json_object_string_add(
9665 json_cap
, "dynamic",
9666 "advertisedAndReceived");
9667 else if (CHECK_FLAG(
9669 PEER_CAP_DYNAMIC_ADV
))
9670 json_object_string_add(
9671 json_cap
, "dynamic",
9673 else if (CHECK_FLAG(
9675 PEER_CAP_DYNAMIC_RCV
))
9676 json_object_string_add(
9677 json_cap
, "dynamic",
9681 /* Extended nexthop */
9682 if (CHECK_FLAG(p
->cap
, PEER_CAP_ENHE_RCV
)
9683 || CHECK_FLAG(p
->cap
, PEER_CAP_ENHE_ADV
)) {
9684 json_object
*json_nxt
= NULL
;
9685 const char *print_store
;
9688 if (CHECK_FLAG(p
->cap
,
9690 && CHECK_FLAG(p
->cap
,
9692 json_object_string_add(
9695 "advertisedAndReceived");
9696 else if (CHECK_FLAG(p
->cap
,
9698 json_object_string_add(
9702 else if (CHECK_FLAG(p
->cap
,
9704 json_object_string_add(
9709 if (CHECK_FLAG(p
->cap
,
9710 PEER_CAP_ENHE_RCV
)) {
9712 json_object_new_object();
9714 for (safi
= SAFI_UNICAST
;
9715 safi
< SAFI_MAX
; safi
++) {
9720 PEER_CAP_ENHE_AF_RCV
)) {
9721 print_store
= afi_safi_print(
9724 json_object_string_add(
9727 "recieved"); /* misspelled for compatibility */
9730 json_object_object_add(
9732 "extendedNexthopFamililesByPeer",
9738 if (CHECK_FLAG(p
->cap
, PEER_CAP_REFRESH_ADV
)
9739 || CHECK_FLAG(p
->cap
,
9740 PEER_CAP_REFRESH_NEW_RCV
)
9741 || CHECK_FLAG(p
->cap
,
9742 PEER_CAP_REFRESH_OLD_RCV
)) {
9743 if (CHECK_FLAG(p
->cap
,
9744 PEER_CAP_REFRESH_ADV
)
9747 PEER_CAP_REFRESH_NEW_RCV
)
9750 PEER_CAP_REFRESH_OLD_RCV
))) {
9753 PEER_CAP_REFRESH_OLD_RCV
)
9756 PEER_CAP_REFRESH_NEW_RCV
))
9757 json_object_string_add(
9760 "advertisedAndReceivedOldNew");
9764 PEER_CAP_REFRESH_OLD_RCV
))
9765 json_object_string_add(
9768 "advertisedAndReceivedOld");
9770 json_object_string_add(
9773 "advertisedAndReceivedNew");
9778 PEER_CAP_REFRESH_ADV
))
9779 json_object_string_add(
9786 PEER_CAP_REFRESH_NEW_RCV
)
9789 PEER_CAP_REFRESH_OLD_RCV
))
9790 json_object_string_add(
9796 /* Multiprotocol Extensions */
9797 json_object
*json_multi
= NULL
;
9798 json_multi
= json_object_new_object();
9800 FOREACH_AFI_SAFI (afi
, safi
) {
9801 if (p
->afc_adv
[afi
][safi
]
9802 || p
->afc_recv
[afi
][safi
]) {
9803 json_object
*json_exten
= NULL
;
9805 json_object_new_object();
9807 if (p
->afc_adv
[afi
][safi
]
9808 && p
->afc_recv
[afi
][safi
])
9809 json_object_boolean_true_add(
9811 "advertisedAndReceived");
9812 else if (p
->afc_adv
[afi
][safi
])
9813 json_object_boolean_true_add(
9816 else if (p
->afc_recv
[afi
][safi
])
9817 json_object_boolean_true_add(
9821 json_object_object_add(
9828 json_object_object_add(
9829 json_cap
, "multiprotocolExtensions",
9832 /* Hostname capabilities */
9833 json_object
*json_hname
= NULL
;
9835 json_hname
= json_object_new_object();
9837 if (CHECK_FLAG(p
->cap
, PEER_CAP_HOSTNAME_ADV
)) {
9838 json_object_string_add(
9839 json_hname
, "advHostName",
9840 bgp
->peer_self
->hostname
9844 json_object_string_add(
9845 json_hname
, "advDomainName",
9846 bgp
->peer_self
->domainname
9853 if (CHECK_FLAG(p
->cap
, PEER_CAP_HOSTNAME_RCV
)) {
9854 json_object_string_add(
9855 json_hname
, "rcvHostName",
9856 p
->hostname
? p
->hostname
9858 json_object_string_add(
9859 json_hname
, "rcvDomainName",
9860 p
->domainname
? p
->domainname
9864 json_object_object_add(json_cap
, "hostName",
9867 /* Gracefull Restart */
9868 if (CHECK_FLAG(p
->cap
, PEER_CAP_RESTART_RCV
)
9869 || CHECK_FLAG(p
->cap
,
9870 PEER_CAP_RESTART_ADV
)) {
9871 if (CHECK_FLAG(p
->cap
,
9872 PEER_CAP_RESTART_ADV
)
9873 && CHECK_FLAG(p
->cap
,
9874 PEER_CAP_RESTART_RCV
))
9875 json_object_string_add(
9878 "advertisedAndReceived");
9879 else if (CHECK_FLAG(
9881 PEER_CAP_RESTART_ADV
))
9882 json_object_string_add(
9884 "gracefulRestartCapability",
9886 else if (CHECK_FLAG(
9888 PEER_CAP_RESTART_RCV
))
9889 json_object_string_add(
9891 "gracefulRestartCapability",
9894 if (CHECK_FLAG(p
->cap
,
9895 PEER_CAP_RESTART_RCV
)) {
9896 int restart_af_count
= 0;
9897 json_object
*json_restart
=
9900 json_object_new_object();
9902 json_object_int_add(
9904 "gracefulRestartRemoteTimerMsecs",
9905 p
->v_gr_restart
* 1000);
9907 FOREACH_AFI_SAFI (afi
, safi
) {
9912 PEER_CAP_RESTART_AF_RCV
)) {
9917 json_object_new_object();
9923 PEER_CAP_RESTART_AF_PRESERVE_RCV
))
9924 json_object_boolean_true_add(
9928 json_object_object_add(
9936 if (!restart_af_count
) {
9937 json_object_string_add(
9939 "addressFamiliesByPeer",
9944 json_object_object_add(
9946 "addressFamiliesByPeer",
9950 json_object_object_add(json_neigh
,
9951 "neighborCapabilities",
9954 vty_out(vty
, " Neighbor capabilities:\n");
9957 if (CHECK_FLAG(p
->cap
, PEER_CAP_AS4_RCV
)
9958 || CHECK_FLAG(p
->cap
, PEER_CAP_AS4_ADV
)) {
9959 vty_out(vty
, " 4 Byte AS:");
9960 if (CHECK_FLAG(p
->cap
,
9962 vty_out(vty
, " advertised");
9963 if (CHECK_FLAG(p
->cap
,
9965 vty_out(vty
, " %sreceived",
9975 if (CHECK_FLAG(p
->cap
, PEER_CAP_ADDPATH_RCV
)
9976 || CHECK_FLAG(p
->cap
,
9977 PEER_CAP_ADDPATH_ADV
)) {
9978 vty_out(vty
, " AddPath:\n");
9980 FOREACH_AFI_SAFI (afi
, safi
) {
9984 PEER_CAP_ADDPATH_AF_TX_ADV
)
9988 PEER_CAP_ADDPATH_AF_TX_RCV
)) {
9999 PEER_CAP_ADDPATH_AF_TX_ADV
))
10010 PEER_CAP_ADDPATH_AF_TX_RCV
))
10017 PEER_CAP_ADDPATH_AF_TX_ADV
)
10021 vty_out(vty
, "\n");
10027 PEER_CAP_ADDPATH_AF_RX_ADV
)
10031 PEER_CAP_ADDPATH_AF_RX_RCV
)) {
10042 PEER_CAP_ADDPATH_AF_RX_ADV
))
10053 PEER_CAP_ADDPATH_AF_RX_RCV
))
10060 PEER_CAP_ADDPATH_AF_RX_ADV
)
10064 vty_out(vty
, "\n");
10070 if (CHECK_FLAG(p
->cap
, PEER_CAP_DYNAMIC_RCV
)
10071 || CHECK_FLAG(p
->cap
,
10072 PEER_CAP_DYNAMIC_ADV
)) {
10073 vty_out(vty
, " Dynamic:");
10074 if (CHECK_FLAG(p
->cap
,
10075 PEER_CAP_DYNAMIC_ADV
))
10076 vty_out(vty
, " advertised");
10077 if (CHECK_FLAG(p
->cap
,
10078 PEER_CAP_DYNAMIC_RCV
))
10079 vty_out(vty
, " %sreceived",
10082 PEER_CAP_DYNAMIC_ADV
)
10085 vty_out(vty
, "\n");
10088 /* Extended nexthop */
10089 if (CHECK_FLAG(p
->cap
, PEER_CAP_ENHE_RCV
)
10090 || CHECK_FLAG(p
->cap
, PEER_CAP_ENHE_ADV
)) {
10091 vty_out(vty
, " Extended nexthop:");
10092 if (CHECK_FLAG(p
->cap
,
10093 PEER_CAP_ENHE_ADV
))
10094 vty_out(vty
, " advertised");
10095 if (CHECK_FLAG(p
->cap
,
10096 PEER_CAP_ENHE_RCV
))
10097 vty_out(vty
, " %sreceived",
10103 vty_out(vty
, "\n");
10105 if (CHECK_FLAG(p
->cap
,
10106 PEER_CAP_ENHE_RCV
)) {
10108 " Address families by peer:\n ");
10109 for (safi
= SAFI_UNICAST
;
10110 safi
< SAFI_MAX
; safi
++)
10115 PEER_CAP_ENHE_AF_RCV
))
10124 /* Route Refresh */
10125 if (CHECK_FLAG(p
->cap
, PEER_CAP_REFRESH_ADV
)
10126 || CHECK_FLAG(p
->cap
,
10127 PEER_CAP_REFRESH_NEW_RCV
)
10128 || CHECK_FLAG(p
->cap
,
10129 PEER_CAP_REFRESH_OLD_RCV
)) {
10130 vty_out(vty
, " Route refresh:");
10131 if (CHECK_FLAG(p
->cap
,
10132 PEER_CAP_REFRESH_ADV
))
10133 vty_out(vty
, " advertised");
10134 if (CHECK_FLAG(p
->cap
,
10135 PEER_CAP_REFRESH_NEW_RCV
)
10138 PEER_CAP_REFRESH_OLD_RCV
))
10139 vty_out(vty
, " %sreceived(%s)",
10142 PEER_CAP_REFRESH_ADV
)
10147 PEER_CAP_REFRESH_OLD_RCV
)
10150 PEER_CAP_REFRESH_NEW_RCV
))
10154 PEER_CAP_REFRESH_OLD_RCV
)
10158 vty_out(vty
, "\n");
10161 /* Multiprotocol Extensions */
10162 FOREACH_AFI_SAFI (afi
, safi
)
10163 if (p
->afc_adv
[afi
][safi
]
10164 || p
->afc_recv
[afi
][safi
]) {
10166 " Address Family %s:",
10167 afi_safi_print(afi
,
10169 if (p
->afc_adv
[afi
][safi
])
10172 if (p
->afc_recv
[afi
][safi
])
10179 vty_out(vty
, "\n");
10182 /* Hostname capability */
10183 vty_out(vty
, " Hostname Capability:");
10185 if (CHECK_FLAG(p
->cap
, PEER_CAP_HOSTNAME_ADV
)) {
10187 " advertised (name: %s,domain name: %s)",
10188 bgp
->peer_self
->hostname
10192 bgp
->peer_self
->domainname
10197 vty_out(vty
, " not advertised");
10200 if (CHECK_FLAG(p
->cap
, PEER_CAP_HOSTNAME_RCV
)) {
10202 " received (name: %s,domain name: %s)",
10203 p
->hostname
? p
->hostname
10205 p
->domainname
? p
->domainname
10208 vty_out(vty
, " not received");
10211 vty_out(vty
, "\n");
10213 /* Gracefull Restart */
10214 if (CHECK_FLAG(p
->cap
, PEER_CAP_RESTART_RCV
)
10215 || CHECK_FLAG(p
->cap
,
10216 PEER_CAP_RESTART_ADV
)) {
10218 " Graceful Restart Capabilty:");
10219 if (CHECK_FLAG(p
->cap
,
10220 PEER_CAP_RESTART_ADV
))
10221 vty_out(vty
, " advertised");
10222 if (CHECK_FLAG(p
->cap
,
10223 PEER_CAP_RESTART_RCV
))
10224 vty_out(vty
, " %sreceived",
10227 PEER_CAP_RESTART_ADV
)
10230 vty_out(vty
, "\n");
10232 if (CHECK_FLAG(p
->cap
,
10233 PEER_CAP_RESTART_RCV
)) {
10234 int restart_af_count
= 0;
10237 " Remote Restart timer is %d seconds\n",
10240 " Address families by peer:\n ");
10242 FOREACH_AFI_SAFI (afi
, safi
)
10247 PEER_CAP_RESTART_AF_RCV
)) {
10260 PEER_CAP_RESTART_AF_PRESERVE_RCV
)
10262 : "not preserved");
10263 restart_af_count
++;
10265 if (!restart_af_count
)
10266 vty_out(vty
, "none");
10267 vty_out(vty
, "\n");
10274 /* graceful restart information */
10275 if (CHECK_FLAG(p
->cap
, PEER_CAP_RESTART_RCV
) || p
->t_gr_restart
10276 || p
->t_gr_stale
) {
10277 json_object
*json_grace
= NULL
;
10278 json_object
*json_grace_send
= NULL
;
10279 json_object
*json_grace_recv
= NULL
;
10280 int eor_send_af_count
= 0;
10281 int eor_receive_af_count
= 0;
10284 json_grace
= json_object_new_object();
10285 json_grace_send
= json_object_new_object();
10286 json_grace_recv
= json_object_new_object();
10288 if (p
->status
== Established
) {
10289 FOREACH_AFI_SAFI (afi
, safi
) {
10290 if (CHECK_FLAG(p
->af_sflags
[afi
][safi
],
10291 PEER_STATUS_EOR_SEND
)) {
10292 json_object_boolean_true_add(
10294 afi_safi_print(afi
,
10296 eor_send_af_count
++;
10299 FOREACH_AFI_SAFI (afi
, safi
) {
10301 p
->af_sflags
[afi
][safi
],
10302 PEER_STATUS_EOR_RECEIVED
)) {
10303 json_object_boolean_true_add(
10305 afi_safi_print(afi
,
10307 eor_receive_af_count
++;
10312 json_object_object_add(json_grace
, "endOfRibSend",
10314 json_object_object_add(json_grace
, "endOfRibRecv",
10317 if (p
->t_gr_restart
)
10318 json_object_int_add(json_grace
,
10319 "gracefulRestartTimerMsecs",
10320 thread_timer_remain_second(
10325 json_object_int_add(
10327 "gracefulStalepathTimerMsecs",
10328 thread_timer_remain_second(
10332 json_object_object_add(
10333 json_neigh
, "gracefulRestartInfo", json_grace
);
10335 vty_out(vty
, " Graceful restart information:\n");
10336 if (p
->status
== Established
) {
10337 vty_out(vty
, " End-of-RIB send: ");
10338 FOREACH_AFI_SAFI (afi
, safi
) {
10339 if (CHECK_FLAG(p
->af_sflags
[afi
][safi
],
10340 PEER_STATUS_EOR_SEND
)) {
10341 vty_out(vty
, "%s%s",
10342 eor_send_af_count
? ", "
10344 afi_safi_print(afi
,
10346 eor_send_af_count
++;
10349 vty_out(vty
, "\n");
10350 vty_out(vty
, " End-of-RIB received: ");
10351 FOREACH_AFI_SAFI (afi
, safi
) {
10353 p
->af_sflags
[afi
][safi
],
10354 PEER_STATUS_EOR_RECEIVED
)) {
10355 vty_out(vty
, "%s%s",
10356 eor_receive_af_count
10359 afi_safi_print(afi
,
10361 eor_receive_af_count
++;
10364 vty_out(vty
, "\n");
10367 if (p
->t_gr_restart
)
10369 " The remaining time of restart timer is %ld\n",
10370 thread_timer_remain_second(
10375 " The remaining time of stalepath timer is %ld\n",
10376 thread_timer_remain_second(
10381 json_object
*json_stat
= NULL
;
10382 json_stat
= json_object_new_object();
10383 /* Packet counts. */
10384 json_object_int_add(json_stat
, "depthInq", 0);
10385 json_object_int_add(json_stat
, "depthOutq",
10386 (unsigned long)p
->obuf
->count
);
10387 json_object_int_add(json_stat
, "opensSent",
10388 atomic_load_explicit(&p
->open_out
,
10389 memory_order_relaxed
));
10390 json_object_int_add(json_stat
, "opensRecv",
10391 atomic_load_explicit(&p
->open_in
,
10392 memory_order_relaxed
));
10393 json_object_int_add(json_stat
, "notificationsSent",
10394 atomic_load_explicit(&p
->notify_out
,
10395 memory_order_relaxed
));
10396 json_object_int_add(json_stat
, "notificationsRecv",
10397 atomic_load_explicit(&p
->notify_in
,
10398 memory_order_relaxed
));
10399 json_object_int_add(json_stat
, "updatesSent",
10400 atomic_load_explicit(&p
->update_out
,
10401 memory_order_relaxed
));
10402 json_object_int_add(json_stat
, "updatesRecv",
10403 atomic_load_explicit(&p
->update_in
,
10404 memory_order_relaxed
));
10405 json_object_int_add(json_stat
, "keepalivesSent",
10406 atomic_load_explicit(&p
->keepalive_out
,
10407 memory_order_relaxed
));
10408 json_object_int_add(json_stat
, "keepalivesRecv",
10409 atomic_load_explicit(&p
->keepalive_in
,
10410 memory_order_relaxed
));
10411 json_object_int_add(json_stat
, "routeRefreshSent",
10412 atomic_load_explicit(&p
->refresh_out
,
10413 memory_order_relaxed
));
10414 json_object_int_add(json_stat
, "routeRefreshRecv",
10415 atomic_load_explicit(&p
->refresh_in
,
10416 memory_order_relaxed
));
10417 json_object_int_add(json_stat
, "capabilitySent",
10418 atomic_load_explicit(&p
->dynamic_cap_out
,
10419 memory_order_relaxed
));
10420 json_object_int_add(json_stat
, "capabilityRecv",
10421 atomic_load_explicit(&p
->dynamic_cap_in
,
10422 memory_order_relaxed
));
10423 json_object_int_add(json_stat
, "totalSent", PEER_TOTAL_TX(p
));
10424 json_object_int_add(json_stat
, "totalRecv", PEER_TOTAL_RX(p
));
10425 json_object_object_add(json_neigh
, "messageStats", json_stat
);
10427 /* Packet counts. */
10428 vty_out(vty
, " Message statistics:\n");
10429 vty_out(vty
, " Inq depth is 0\n");
10430 vty_out(vty
, " Outq depth is %lu\n",
10431 (unsigned long)p
->obuf
->count
);
10432 vty_out(vty
, " Sent Rcvd\n");
10433 vty_out(vty
, " Opens: %10d %10d\n",
10434 atomic_load_explicit(&p
->open_out
,
10435 memory_order_relaxed
),
10436 atomic_load_explicit(&p
->open_in
,
10437 memory_order_relaxed
));
10438 vty_out(vty
, " Notifications: %10d %10d\n",
10439 atomic_load_explicit(&p
->notify_out
,
10440 memory_order_relaxed
),
10441 atomic_load_explicit(&p
->notify_in
,
10442 memory_order_relaxed
));
10443 vty_out(vty
, " Updates: %10d %10d\n",
10444 atomic_load_explicit(&p
->update_out
,
10445 memory_order_relaxed
),
10446 atomic_load_explicit(&p
->update_in
,
10447 memory_order_relaxed
));
10448 vty_out(vty
, " Keepalives: %10d %10d\n",
10449 atomic_load_explicit(&p
->keepalive_out
,
10450 memory_order_relaxed
),
10451 atomic_load_explicit(&p
->keepalive_in
,
10452 memory_order_relaxed
));
10453 vty_out(vty
, " Route Refresh: %10d %10d\n",
10454 atomic_load_explicit(&p
->refresh_out
,
10455 memory_order_relaxed
),
10456 atomic_load_explicit(&p
->refresh_in
,
10457 memory_order_relaxed
));
10458 vty_out(vty
, " Capability: %10d %10d\n",
10459 atomic_load_explicit(&p
->dynamic_cap_out
,
10460 memory_order_relaxed
),
10461 atomic_load_explicit(&p
->dynamic_cap_in
,
10462 memory_order_relaxed
));
10463 vty_out(vty
, " Total: %10d %10d\n", PEER_TOTAL_TX(p
),
10468 /* advertisement-interval */
10469 json_object_int_add(json_neigh
,
10470 "minBtwnAdvertisementRunsTimerMsecs",
10471 p
->v_routeadv
* 1000);
10473 /* Update-source. */
10474 if (p
->update_if
|| p
->update_source
) {
10476 json_object_string_add(json_neigh
,
10479 else if (p
->update_source
)
10480 json_object_string_add(
10481 json_neigh
, "updateSource",
10482 sockunion2str(p
->update_source
, buf1
,
10486 /* advertisement-interval */
10488 " Minimum time between advertisement runs is %d seconds\n",
10491 /* Update-source. */
10492 if (p
->update_if
|| p
->update_source
) {
10493 vty_out(vty
, " Update source is ");
10495 vty_out(vty
, "%s", p
->update_if
);
10496 else if (p
->update_source
)
10498 sockunion2str(p
->update_source
, buf1
,
10500 vty_out(vty
, "\n");
10503 vty_out(vty
, "\n");
10506 /* Address Family Information */
10507 json_object
*json_hold
= NULL
;
10510 json_hold
= json_object_new_object();
10512 FOREACH_AFI_SAFI (afi
, safi
)
10513 if (p
->afc
[afi
][safi
])
10514 bgp_show_peer_afi(vty
, p
, afi
, safi
, use_json
,
10518 json_object_object_add(json_neigh
, "addressFamilyInfo",
10520 json_object_int_add(json_neigh
, "connectionsEstablished",
10522 json_object_int_add(json_neigh
, "connectionsDropped",
10525 vty_out(vty
, " Connections established %d; dropped %d\n",
10526 p
->established
, p
->dropped
);
10528 if (!p
->last_reset
) {
10530 json_object_string_add(json_neigh
, "lastReset",
10533 vty_out(vty
, " Last reset never\n");
10539 uptime
= bgp_clock();
10540 uptime
-= p
->resettime
;
10541 tm
= gmtime(&uptime
);
10542 json_object_int_add(json_neigh
, "lastResetTimerMsecs",
10543 (tm
->tm_sec
* 1000)
10544 + (tm
->tm_min
* 60000)
10545 + (tm
->tm_hour
* 3600000));
10546 json_object_string_add(
10547 json_neigh
, "lastResetDueTo",
10548 peer_down_str
[(int)p
->last_reset
]);
10549 if (p
->last_reset
== PEER_DOWN_NOTIFY_SEND
10550 || p
->last_reset
== PEER_DOWN_NOTIFY_RECEIVED
) {
10551 char errorcodesubcode_hexstr
[5];
10552 char errorcodesubcode_str
[256];
10554 code_str
= bgp_notify_code_str(p
->notify
.code
);
10555 subcode_str
= bgp_notify_subcode_str(
10556 p
->notify
.code
, p
->notify
.subcode
);
10558 sprintf(errorcodesubcode_hexstr
, "%02X%02X",
10559 p
->notify
.code
, p
->notify
.subcode
);
10560 json_object_string_add(json_neigh
,
10561 "lastErrorCodeSubcode",
10562 errorcodesubcode_hexstr
);
10563 snprintf(errorcodesubcode_str
, 255, "%s%s",
10564 code_str
, subcode_str
);
10565 json_object_string_add(json_neigh
,
10566 "lastNotificationReason",
10567 errorcodesubcode_str
);
10568 if (p
->last_reset
== PEER_DOWN_NOTIFY_RECEIVED
10569 && p
->notify
.code
== BGP_NOTIFY_CEASE
10570 && (p
->notify
.subcode
10571 == BGP_NOTIFY_CEASE_ADMIN_SHUTDOWN
10572 || p
->notify
.subcode
10573 == BGP_NOTIFY_CEASE_ADMIN_RESET
)
10574 && p
->notify
.length
) {
10576 const char *msg_str
;
10578 msg_str
= bgp_notify_admin_message(
10579 msgbuf
, sizeof(msgbuf
),
10580 (uint8_t *)p
->notify
.data
,
10583 json_object_string_add(
10585 "lastShutdownDescription",
10590 vty_out(vty
, " Last reset %s, ",
10591 peer_uptime(p
->resettime
, timebuf
,
10592 BGP_UPTIME_LEN
, 0, NULL
));
10594 if (p
->last_reset
== PEER_DOWN_NOTIFY_SEND
10595 || p
->last_reset
== PEER_DOWN_NOTIFY_RECEIVED
) {
10596 code_str
= bgp_notify_code_str(p
->notify
.code
);
10597 subcode_str
= bgp_notify_subcode_str(
10598 p
->notify
.code
, p
->notify
.subcode
);
10599 vty_out(vty
, "due to NOTIFICATION %s (%s%s)\n",
10600 p
->last_reset
== PEER_DOWN_NOTIFY_SEND
10603 code_str
, subcode_str
);
10604 if (p
->last_reset
== PEER_DOWN_NOTIFY_RECEIVED
10605 && p
->notify
.code
== BGP_NOTIFY_CEASE
10606 && (p
->notify
.subcode
10607 == BGP_NOTIFY_CEASE_ADMIN_SHUTDOWN
10608 || p
->notify
.subcode
10609 == BGP_NOTIFY_CEASE_ADMIN_RESET
)
10610 && p
->notify
.length
) {
10612 const char *msg_str
;
10614 msg_str
= bgp_notify_admin_message(
10615 msgbuf
, sizeof(msgbuf
),
10616 (uint8_t *)p
->notify
.data
,
10620 " Message: \"%s\"\n",
10624 vty_out(vty
, "due to %s\n",
10625 peer_down_str
[(int)p
->last_reset
]);
10628 if (p
->last_reset_cause_size
) {
10629 msg
= p
->last_reset_cause
;
10631 " Message received that caused BGP to send a NOTIFICATION:\n ");
10632 for (i
= 1; i
<= p
->last_reset_cause_size
;
10634 vty_out(vty
, "%02X", *msg
++);
10636 if (i
!= p
->last_reset_cause_size
) {
10638 vty_out(vty
, "\n ");
10639 } else if (i
% 4 == 0) {
10644 vty_out(vty
, "\n");
10649 if (CHECK_FLAG(p
->sflags
, PEER_STATUS_PREFIX_OVERFLOW
)) {
10651 json_object_boolean_true_add(json_neigh
,
10652 "prefixesConfigExceedMax");
10655 " Peer had exceeded the max. no. of prefixes configured.\n");
10657 if (p
->t_pmax_restart
) {
10659 json_object_boolean_true_add(
10660 json_neigh
, "reducePrefixNumFrom");
10661 json_object_int_add(json_neigh
,
10662 "restartInTimerMsec",
10663 thread_timer_remain_second(
10668 " Reduce the no. of prefix from %s, will restart in %ld seconds\n",
10669 p
->host
, thread_timer_remain_second(
10670 p
->t_pmax_restart
));
10673 json_object_boolean_true_add(
10675 "reducePrefixNumAndClearIpBgp");
10678 " Reduce the no. of prefix and clear ip bgp %s to restore peering\n",
10683 /* EBGP Multihop and GTSM */
10684 if (p
->sort
!= BGP_PEER_IBGP
) {
10686 if (p
->gtsm_hops
> 0)
10687 json_object_int_add(json_neigh
,
10688 "externalBgpNbrMaxHopsAway",
10690 else if (p
->ttl
> 1)
10691 json_object_int_add(json_neigh
,
10692 "externalBgpNbrMaxHopsAway",
10695 if (p
->gtsm_hops
> 0)
10697 " External BGP neighbor may be up to %d hops away.\n",
10699 else if (p
->ttl
> 1)
10701 " External BGP neighbor may be up to %d hops away.\n",
10705 if (p
->gtsm_hops
> 0) {
10707 json_object_int_add(json_neigh
,
10708 "internalBgpNbrMaxHopsAway",
10712 " Internal BGP neighbor may be up to %d hops away.\n",
10717 /* Local address. */
10720 json_object_string_add(json_neigh
, "hostLocal",
10721 sockunion2str(p
->su_local
, buf1
,
10723 json_object_int_add(json_neigh
, "portLocal",
10724 ntohs(p
->su_local
->sin
.sin_port
));
10726 vty_out(vty
, "Local host: %s, Local port: %d\n",
10727 sockunion2str(p
->su_local
, buf1
, SU_ADDRSTRLEN
),
10728 ntohs(p
->su_local
->sin
.sin_port
));
10731 /* Remote address. */
10732 if (p
->su_remote
) {
10734 json_object_string_add(json_neigh
, "hostForeign",
10735 sockunion2str(p
->su_remote
, buf1
,
10737 json_object_int_add(json_neigh
, "portForeign",
10738 ntohs(p
->su_remote
->sin
.sin_port
));
10740 vty_out(vty
, "Foreign host: %s, Foreign port: %d\n",
10741 sockunion2str(p
->su_remote
, buf1
,
10743 ntohs(p
->su_remote
->sin
.sin_port
));
10746 /* Nexthop display. */
10749 json_object_string_add(json_neigh
, "nexthop",
10751 &p
->nexthop
.v4
, buf1
,
10753 json_object_string_add(json_neigh
, "nexthopGlobal",
10754 inet_ntop(AF_INET6
,
10755 &p
->nexthop
.v6_global
,
10756 buf1
, sizeof(buf1
)));
10757 json_object_string_add(json_neigh
, "nexthopLocal",
10758 inet_ntop(AF_INET6
,
10759 &p
->nexthop
.v6_local
,
10760 buf1
, sizeof(buf1
)));
10761 if (p
->shared_network
)
10762 json_object_string_add(json_neigh
,
10766 json_object_string_add(json_neigh
,
10768 "nonSharedNetwork");
10770 vty_out(vty
, "Nexthop: %s\n",
10771 inet_ntop(AF_INET
, &p
->nexthop
.v4
, buf1
,
10773 vty_out(vty
, "Nexthop global: %s\n",
10774 inet_ntop(AF_INET6
, &p
->nexthop
.v6_global
, buf1
,
10776 vty_out(vty
, "Nexthop local: %s\n",
10777 inet_ntop(AF_INET6
, &p
->nexthop
.v6_local
, buf1
,
10779 vty_out(vty
, "BGP connection: %s\n",
10780 p
->shared_network
? "shared network"
10781 : "non shared network");
10785 /* Timer information. */
10787 json_object_int_add(json_neigh
, "connectRetryTimer",
10789 if (p
->status
== Established
&& p
->rtt
)
10790 json_object_int_add(json_neigh
, "estimatedRttInMsecs",
10793 json_object_int_add(
10794 json_neigh
, "nextStartTimerDueInMsecs",
10795 thread_timer_remain_second(p
->t_start
) * 1000);
10797 json_object_int_add(
10798 json_neigh
, "nextConnectTimerDueInMsecs",
10799 thread_timer_remain_second(p
->t_connect
)
10801 if (p
->t_routeadv
) {
10802 json_object_int_add(json_neigh
, "mraiInterval",
10804 json_object_int_add(
10805 json_neigh
, "mraiTimerExpireInMsecs",
10806 thread_timer_remain_second(p
->t_routeadv
)
10810 json_object_int_add(json_neigh
, "authenticationEnabled",
10814 json_object_string_add(json_neigh
, "readThread", "on");
10816 json_object_string_add(json_neigh
, "readThread", "off");
10818 if (CHECK_FLAG(p
->thread_flags
, PEER_THREAD_WRITES_ON
))
10819 json_object_string_add(json_neigh
, "writeThread", "on");
10821 json_object_string_add(json_neigh
, "writeThread",
10824 vty_out(vty
, "BGP Connect Retry Timer in Seconds: %d\n",
10826 if (p
->status
== Established
&& p
->rtt
)
10827 vty_out(vty
, "Estimated round trip time: %d ms\n",
10830 vty_out(vty
, "Next start timer due in %ld seconds\n",
10831 thread_timer_remain_second(p
->t_start
));
10833 vty_out(vty
, "Next connect timer due in %ld seconds\n",
10834 thread_timer_remain_second(p
->t_connect
));
10837 "MRAI (interval %u) timer expires in %ld seconds\n",
10839 thread_timer_remain_second(p
->t_routeadv
));
10841 vty_out(vty
, "Peer Authentication Enabled\n");
10843 vty_out(vty
, "Read thread: %s Write thread: %s\n",
10844 p
->t_read
? "on" : "off",
10845 CHECK_FLAG(p
->thread_flags
, PEER_THREAD_WRITES_ON
)
10850 if (p
->notify
.code
== BGP_NOTIFY_OPEN_ERR
10851 && p
->notify
.subcode
== BGP_NOTIFY_OPEN_UNSUP_CAPBL
)
10852 bgp_capability_vty_out(vty
, p
, use_json
, json_neigh
);
10855 vty_out(vty
, "\n");
10857 /* BFD information. */
10858 bgp_bfd_show_info(vty
, p
, use_json
, json_neigh
);
10861 if (p
->conf_if
) /* Configured interface name. */
10862 json_object_object_add(json
, p
->conf_if
, json_neigh
);
10863 else /* Configured IP address. */
10864 json_object_object_add(json
, p
->host
, json_neigh
);
10868 static int bgp_show_neighbor(struct vty
*vty
, struct bgp
*bgp
,
10869 enum show_type type
, union sockunion
*su
,
10870 const char *conf_if
, bool use_json
,
10873 struct listnode
*node
, *nnode
;
10876 bool nbr_output
= false;
10878 for (ALL_LIST_ELEMENTS(bgp
->peer
, node
, nnode
, peer
)) {
10879 if (!CHECK_FLAG(peer
->flags
, PEER_FLAG_CONFIG_NODE
))
10884 bgp_show_peer(vty
, peer
, use_json
, json
);
10890 && !strcmp(peer
->conf_if
, conf_if
))
10892 && !strcmp(peer
->hostname
, conf_if
))) {
10894 bgp_show_peer(vty
, peer
, use_json
,
10898 if (sockunion_same(&peer
->su
, su
)) {
10900 bgp_show_peer(vty
, peer
, use_json
,
10908 if (type
== show_peer
&& !find
) {
10910 json_object_boolean_true_add(json
, "bgpNoSuchNeighbor");
10912 vty_out(vty
, "%% No such neighbor in this view/vrf\n");
10915 if (type
!= show_peer
&& !nbr_output
&& !use_json
)
10916 vty_out(vty
, "%% No BGP neighbors found\n");
10919 vty_out(vty
, "%s\n", json_object_to_json_string_ext(
10920 json
, JSON_C_TO_STRING_PRETTY
));
10922 vty_out(vty
, "\n");
10925 return CMD_SUCCESS
;
10928 static void bgp_show_all_instances_neighbors_vty(struct vty
*vty
,
10929 enum show_type type
,
10930 const char *ip_str
,
10933 struct listnode
*node
, *nnode
;
10935 union sockunion su
;
10936 json_object
*json
= NULL
;
10937 int ret
, is_first
= 1;
10938 bool nbr_output
= false;
10941 vty_out(vty
, "{\n");
10943 for (ALL_LIST_ELEMENTS(bm
->bgp
, node
, nnode
, bgp
)) {
10946 if (!(json
= json_object_new_object())) {
10948 EC_BGP_JSON_MEM_ERROR
,
10949 "Unable to allocate memory for JSON object");
10951 "{\"error\": {\"message:\": \"Unable to allocate memory for JSON object\"}}}\n");
10955 json_object_int_add(json
, "vrfId",
10956 (bgp
->vrf_id
== VRF_UNKNOWN
)
10958 : (int64_t)bgp
->vrf_id
);
10959 json_object_string_add(
10961 (bgp
->inst_type
== BGP_INSTANCE_TYPE_DEFAULT
)
10966 vty_out(vty
, ",\n");
10970 vty_out(vty
, "\"%s\":",
10971 (bgp
->inst_type
== BGP_INSTANCE_TYPE_DEFAULT
)
10975 vty_out(vty
, "\nInstance %s:\n",
10976 (bgp
->inst_type
== BGP_INSTANCE_TYPE_DEFAULT
)
10981 if (type
== show_peer
) {
10982 ret
= str2sockunion(ip_str
, &su
);
10984 bgp_show_neighbor(vty
, bgp
, type
, NULL
, ip_str
,
10987 bgp_show_neighbor(vty
, bgp
, type
, &su
, NULL
,
10990 bgp_show_neighbor(vty
, bgp
, show_all
, NULL
, NULL
,
10996 vty_out(vty
, "}\n");
10997 json_object_free(json
);
10999 else if (!nbr_output
)
11000 vty_out(vty
, "%% BGP instance not found\n");
11003 static int bgp_show_neighbor_vty(struct vty
*vty
, const char *name
,
11004 enum show_type type
, const char *ip_str
,
11009 union sockunion su
;
11010 json_object
*json
= NULL
;
11013 if (strmatch(name
, "all")) {
11014 bgp_show_all_instances_neighbors_vty(vty
, type
, ip_str
,
11016 return CMD_SUCCESS
;
11018 bgp
= bgp_lookup_by_name(name
);
11021 json
= json_object_new_object();
11022 vty_out(vty
, "%s\n",
11023 json_object_to_json_string_ext(
11025 JSON_C_TO_STRING_PRETTY
));
11026 json_object_free(json
);
11029 "%% BGP instance not found\n");
11031 return CMD_WARNING
;
11035 bgp
= bgp_get_default();
11039 json
= json_object_new_object();
11041 ret
= str2sockunion(ip_str
, &su
);
11043 bgp_show_neighbor(vty
, bgp
, type
, NULL
, ip_str
,
11046 bgp_show_neighbor(vty
, bgp
, type
, &su
, NULL
,
11049 bgp_show_neighbor(vty
, bgp
, type
, NULL
, NULL
, use_json
,
11052 json_object_free(json
);
11055 vty_out(vty
, "{}\n");
11057 vty_out(vty
, "%% BGP instance not found\n");
11060 return CMD_SUCCESS
;
11063 /* "show [ip] bgp neighbors" commands. */
11064 DEFUN (show_ip_bgp_neighbors
,
11065 show_ip_bgp_neighbors_cmd
,
11066 "show [ip] bgp [<view|vrf> VIEWVRFNAME] [<ipv4|ipv6>] neighbors [<A.B.C.D|X:X::X:X|WORD>] [json]",
11070 BGP_INSTANCE_HELP_STR
11073 "Detailed information on TCP and BGP neighbor connections\n"
11074 "Neighbor to display information about\n"
11075 "Neighbor to display information about\n"
11076 "Neighbor on BGP configured interface\n"
11080 char *sh_arg
= NULL
;
11081 enum show_type sh_type
;
11083 bool uj
= use_json(argc
, argv
);
11087 /* [<vrf> VIEWVRFNAME] */
11088 if (argv_find(argv
, argc
, "vrf", &idx
)) {
11089 vrf
= argv
[idx
+ 1]->arg
;
11090 if (vrf
&& strmatch(vrf
, VRF_DEFAULT_NAME
))
11092 } else if (argv_find(argv
, argc
, "view", &idx
))
11093 /* [<view> VIEWVRFNAME] */
11094 vrf
= argv
[idx
+ 1]->arg
;
11097 if (argv_find(argv
, argc
, "A.B.C.D", &idx
)
11098 || argv_find(argv
, argc
, "X:X::X:X", &idx
)
11099 || argv_find(argv
, argc
, "WORD", &idx
)) {
11100 sh_type
= show_peer
;
11101 sh_arg
= argv
[idx
]->arg
;
11103 sh_type
= show_all
;
11105 return bgp_show_neighbor_vty(vty
, vrf
, sh_type
, sh_arg
, uj
);
11108 /* Show BGP's AS paths internal data. There are both `show [ip] bgp
11109 paths' and `show ip mbgp paths'. Those functions results are the
11111 DEFUN (show_ip_bgp_paths
,
11112 show_ip_bgp_paths_cmd
,
11113 "show [ip] bgp ["BGP_SAFI_CMD_STR
"] paths",
11118 "Path information\n")
11120 vty_out(vty
, "Address Refcnt Path\n");
11121 aspath_print_all_vty(vty
);
11122 return CMD_SUCCESS
;
11127 static void community_show_all_iterator(struct hash_backet
*backet
,
11130 struct community
*com
;
11132 com
= (struct community
*)backet
->data
;
11133 vty_out(vty
, "[%p] (%ld) %s\n", (void *)com
, com
->refcnt
,
11134 community_str(com
, false));
11137 /* Show BGP's community internal data. */
11138 DEFUN (show_ip_bgp_community_info
,
11139 show_ip_bgp_community_info_cmd
,
11140 "show [ip] bgp community-info",
11144 "List all bgp community information\n")
11146 vty_out(vty
, "Address Refcnt Community\n");
11148 hash_iterate(community_hash(),
11149 (void (*)(struct hash_backet
*,
11150 void *))community_show_all_iterator
,
11153 return CMD_SUCCESS
;
11156 static void lcommunity_show_all_iterator(struct hash_backet
*backet
,
11159 struct lcommunity
*lcom
;
11161 lcom
= (struct lcommunity
*)backet
->data
;
11162 vty_out(vty
, "[%p] (%ld) %s\n", (void *)lcom
, lcom
->refcnt
,
11163 lcommunity_str(lcom
, false));
11166 /* Show BGP's community internal data. */
11167 DEFUN (show_ip_bgp_lcommunity_info
,
11168 show_ip_bgp_lcommunity_info_cmd
,
11169 "show ip bgp large-community-info",
11173 "List all bgp large-community information\n")
11175 vty_out(vty
, "Address Refcnt Large-community\n");
11177 hash_iterate(lcommunity_hash(),
11178 (void (*)(struct hash_backet
*,
11179 void *))lcommunity_show_all_iterator
,
11182 return CMD_SUCCESS
;
11186 DEFUN (show_ip_bgp_attr_info
,
11187 show_ip_bgp_attr_info_cmd
,
11188 "show [ip] bgp attribute-info",
11192 "List all bgp attribute information\n")
11194 attr_show_all(vty
);
11195 return CMD_SUCCESS
;
11198 static int bgp_show_route_leak_vty(struct vty
*vty
, const char *name
, afi_t afi
,
11199 safi_t safi
, bool use_json
)
11202 struct listnode
*node
;
11204 char buf1
[INET6_ADDRSTRLEN
];
11206 vpn_policy_direction_t dir
;
11209 json_object
*json
= NULL
;
11210 json_object
*json_import_vrfs
= NULL
;
11211 json_object
*json_export_vrfs
= NULL
;
11213 json
= json_object_new_object();
11215 bgp
= name
? bgp_lookup_by_name(name
) : bgp_get_default();
11218 vty_out(vty
, "%s\n",
11219 json_object_to_json_string_ext(
11221 JSON_C_TO_STRING_PRETTY
));
11222 json_object_free(json
);
11224 return CMD_WARNING
;
11227 /* Provide context for the block */
11228 json_object_string_add(json
, "vrf", name
? name
: "default");
11229 json_object_string_add(json
, "afiSafi",
11230 afi_safi_print(afi
, safi
));
11232 if (!CHECK_FLAG(bgp
->af_flags
[afi
][safi
],
11233 BGP_CONFIG_VRF_TO_VRF_IMPORT
)) {
11234 json_object_string_add(json
, "importFromVrfs", "none");
11235 json_object_string_add(json
, "importRts", "none");
11237 json_import_vrfs
= json_object_new_array();
11239 for (ALL_LIST_ELEMENTS_RO(
11240 bgp
->vpn_policy
[afi
].import_vrf
,
11242 json_object_array_add(json_import_vrfs
,
11243 json_object_new_string(vname
));
11245 dir
= BGP_VPN_POLICY_DIR_FROMVPN
;
11246 ecom_str
= ecommunity_ecom2str(
11247 bgp
->vpn_policy
[afi
].rtlist
[dir
],
11248 ECOMMUNITY_FORMAT_ROUTE_MAP
, 0);
11249 json_object_object_add(json
, "importFromVrfs",
11251 json_object_string_add(json
, "importRts", ecom_str
);
11253 XFREE(MTYPE_ECOMMUNITY_STR
, ecom_str
);
11256 if (!CHECK_FLAG(bgp
->af_flags
[afi
][safi
],
11257 BGP_CONFIG_VRF_TO_VRF_EXPORT
)) {
11258 json_object_string_add(json
, "exportToVrfs", "none");
11259 json_object_string_add(json
, "routeDistinguisher",
11261 json_object_string_add(json
, "exportRts", "none");
11263 json_export_vrfs
= json_object_new_array();
11265 for (ALL_LIST_ELEMENTS_RO(
11266 bgp
->vpn_policy
[afi
].export_vrf
,
11268 json_object_array_add(json_export_vrfs
,
11269 json_object_new_string(vname
));
11270 json_object_object_add(json
, "exportToVrfs",
11272 json_object_string_add(json
, "routeDistinguisher",
11273 prefix_rd2str(&bgp
->vpn_policy
[afi
].tovpn_rd
,
11274 buf1
, RD_ADDRSTRLEN
));
11276 dir
= BGP_VPN_POLICY_DIR_TOVPN
;
11277 ecom_str
= ecommunity_ecom2str(
11278 bgp
->vpn_policy
[afi
].rtlist
[dir
],
11279 ECOMMUNITY_FORMAT_ROUTE_MAP
, 0);
11280 json_object_string_add(json
, "exportRts", ecom_str
);
11282 XFREE(MTYPE_ECOMMUNITY_STR
, ecom_str
);
11285 vty_out(vty
, "%s\n",
11286 json_object_to_json_string_ext(json
,
11287 JSON_C_TO_STRING_PRETTY
));
11288 json_object_free(json
);
11291 bgp
= name
? bgp_lookup_by_name(name
) : bgp_get_default();
11294 vty_out(vty
, "%% No such BGP instance exist\n");
11295 return CMD_WARNING
;
11298 if (!CHECK_FLAG(bgp
->af_flags
[afi
][safi
],
11299 BGP_CONFIG_VRF_TO_VRF_IMPORT
))
11301 "This VRF is not importing %s routes from any other VRF\n",
11302 afi_safi_print(afi
, safi
));
11305 "This VRF is importing %s routes from the following VRFs:\n",
11306 afi_safi_print(afi
, safi
));
11308 for (ALL_LIST_ELEMENTS_RO(
11309 bgp
->vpn_policy
[afi
].import_vrf
,
11311 vty_out(vty
, " %s\n", vname
);
11313 dir
= BGP_VPN_POLICY_DIR_FROMVPN
;
11314 ecom_str
= ecommunity_ecom2str(
11315 bgp
->vpn_policy
[afi
].rtlist
[dir
],
11316 ECOMMUNITY_FORMAT_ROUTE_MAP
, 0);
11317 vty_out(vty
, "Import RT(s): %s\n", ecom_str
);
11319 XFREE(MTYPE_ECOMMUNITY_STR
, ecom_str
);
11322 if (!CHECK_FLAG(bgp
->af_flags
[afi
][safi
],
11323 BGP_CONFIG_VRF_TO_VRF_EXPORT
))
11325 "This VRF is not exporting %s routes to any other VRF\n",
11326 afi_safi_print(afi
, safi
));
11329 "This VRF is exporting %s routes to the following VRFs:\n",
11330 afi_safi_print(afi
, safi
));
11332 for (ALL_LIST_ELEMENTS_RO(
11333 bgp
->vpn_policy
[afi
].export_vrf
,
11335 vty_out(vty
, " %s\n", vname
);
11337 vty_out(vty
, "RD: %s\n",
11338 prefix_rd2str(&bgp
->vpn_policy
[afi
].tovpn_rd
,
11339 buf1
, RD_ADDRSTRLEN
));
11341 dir
= BGP_VPN_POLICY_DIR_TOVPN
;
11342 ecom_str
= ecommunity_ecom2str(
11343 bgp
->vpn_policy
[afi
].rtlist
[dir
],
11344 ECOMMUNITY_FORMAT_ROUTE_MAP
, 0);
11345 vty_out(vty
, "Export RT: %s\n", ecom_str
);
11346 XFREE(MTYPE_ECOMMUNITY_STR
, ecom_str
);
11350 return CMD_SUCCESS
;
11353 /* "show [ip] bgp route-leak" command. */
11354 DEFUN (show_ip_bgp_route_leak
,
11355 show_ip_bgp_route_leak_cmd
,
11356 "show [ip] bgp [<view|vrf> VIEWVRFNAME] ["BGP_AFI_CMD_STR
" ["BGP_SAFI_CMD_STR
"]] route-leak [json]",
11360 BGP_INSTANCE_HELP_STR
11363 "Route leaking information\n"
11367 afi_t afi
= AFI_MAX
;
11368 safi_t safi
= SAFI_MAX
;
11370 bool uj
= use_json(argc
, argv
);
11373 /* show [ip] bgp */
11374 if (argv_find(argv
, argc
, "ip", &idx
)) {
11376 safi
= SAFI_UNICAST
;
11378 /* [vrf VIEWVRFNAME] */
11379 if (argv_find(argv
, argc
, "view", &idx
)) {
11381 "%% This command is not applicable to BGP views\n");
11382 return CMD_WARNING
;
11385 if (argv_find(argv
, argc
, "vrf", &idx
)) {
11386 vrf
= argv
[idx
+ 1]->arg
;
11387 if (vrf
&& strmatch(vrf
, VRF_DEFAULT_NAME
))
11390 /* ["BGP_AFI_CMD_STR" ["BGP_SAFI_CMD_STR"]] */
11391 if (argv_find_and_parse_afi(argv
, argc
, &idx
, &afi
)) {
11392 argv_find_and_parse_safi(argv
, argc
, &idx
, &safi
);
11395 if (!((afi
== AFI_IP
|| afi
== AFI_IP6
) && safi
== SAFI_UNICAST
)) {
11397 "%% This command is applicable only for unicast ipv4|ipv6\n");
11398 return CMD_WARNING
;
11401 return bgp_show_route_leak_vty(vty
, vrf
, afi
, safi
, uj
);
11404 static void bgp_show_all_instances_updgrps_vty(struct vty
*vty
, afi_t afi
,
11407 struct listnode
*node
, *nnode
;
11410 for (ALL_LIST_ELEMENTS(bm
->bgp
, node
, nnode
, bgp
)) {
11411 vty_out(vty
, "\nInstance %s:\n",
11412 (bgp
->inst_type
== BGP_INSTANCE_TYPE_DEFAULT
)
11415 update_group_show(bgp
, afi
, safi
, vty
, 0);
11419 static int bgp_show_update_groups(struct vty
*vty
, const char *name
, int afi
,
11420 int safi
, uint64_t subgrp_id
)
11425 if (strmatch(name
, "all")) {
11426 bgp_show_all_instances_updgrps_vty(vty
, afi
, safi
);
11427 return CMD_SUCCESS
;
11429 bgp
= bgp_lookup_by_name(name
);
11432 bgp
= bgp_get_default();
11436 update_group_show(bgp
, afi
, safi
, vty
, subgrp_id
);
11437 return CMD_SUCCESS
;
11440 DEFUN (show_ip_bgp_updgrps
,
11441 show_ip_bgp_updgrps_cmd
,
11442 "show [ip] bgp [<view|vrf> VIEWVRFNAME] ["BGP_AFI_CMD_STR
" ["BGP_SAFI_WITH_LABEL_CMD_STR
"]] update-groups [SUBGROUP-ID]",
11446 BGP_INSTANCE_HELP_STR
11448 BGP_SAFI_WITH_LABEL_HELP_STR
11449 "Detailed info about dynamic update groups\n"
11450 "Specific subgroup to display detailed info for\n")
11453 afi_t afi
= AFI_IP6
;
11454 safi_t safi
= SAFI_UNICAST
;
11455 uint64_t subgrp_id
= 0;
11459 /* show [ip] bgp */
11460 if (argv_find(argv
, argc
, "ip", &idx
))
11462 /* [<vrf> VIEWVRFNAME] */
11463 if (argv_find(argv
, argc
, "vrf", &idx
)) {
11464 vrf
= argv
[idx
+ 1]->arg
;
11465 if (vrf
&& strmatch(vrf
, VRF_DEFAULT_NAME
))
11467 } else if (argv_find(argv
, argc
, "view", &idx
))
11468 /* [<view> VIEWVRFNAME] */
11469 vrf
= argv
[idx
+ 1]->arg
;
11470 /* ["BGP_AFI_CMD_STR" ["BGP_SAFI_CMD_STR"]] */
11471 if (argv_find_and_parse_afi(argv
, argc
, &idx
, &afi
)) {
11472 argv_find_and_parse_safi(argv
, argc
, &idx
, &safi
);
11475 /* get subgroup id, if provided */
11477 if (argv
[idx
]->type
== VARIABLE_TKN
)
11478 subgrp_id
= strtoull(argv
[idx
]->arg
, NULL
, 10);
11480 return (bgp_show_update_groups(vty
, vrf
, afi
, safi
, subgrp_id
));
11483 DEFUN (show_bgp_instance_all_ipv6_updgrps
,
11484 show_bgp_instance_all_ipv6_updgrps_cmd
,
11485 "show [ip] bgp <view|vrf> all update-groups",
11489 BGP_INSTANCE_ALL_HELP_STR
11490 "Detailed info about dynamic update groups\n")
11492 bgp_show_all_instances_updgrps_vty(vty
, AFI_IP6
, SAFI_UNICAST
);
11493 return CMD_SUCCESS
;
11496 DEFUN (show_bgp_l2vpn_evpn_updgrps
,
11497 show_bgp_l2vpn_evpn_updgrps_cmd
,
11498 "show [ip] bgp l2vpn evpn update-groups",
11502 "l2vpn address family\n"
11503 "evpn sub-address family\n"
11504 "Detailed info about dynamic update groups\n")
11507 uint64_t subgrp_id
= 0;
11509 bgp_show_update_groups(vty
, vrf
, AFI_L2VPN
, SAFI_EVPN
, subgrp_id
);
11510 return CMD_SUCCESS
;
11513 DEFUN (show_bgp_updgrps_stats
,
11514 show_bgp_updgrps_stats_cmd
,
11515 "show [ip] bgp update-groups statistics",
11519 "Detailed info about dynamic update groups\n"
11524 bgp
= bgp_get_default();
11526 update_group_show_stats(bgp
, vty
);
11528 return CMD_SUCCESS
;
11531 DEFUN (show_bgp_instance_updgrps_stats
,
11532 show_bgp_instance_updgrps_stats_cmd
,
11533 "show [ip] bgp <view|vrf> VIEWVRFNAME update-groups statistics",
11537 BGP_INSTANCE_HELP_STR
11538 "Detailed info about dynamic update groups\n"
11544 bgp
= bgp_lookup_by_name(argv
[idx_word
]->arg
);
11546 update_group_show_stats(bgp
, vty
);
11548 return CMD_SUCCESS
;
11551 static void show_bgp_updgrps_adj_info_aux(struct vty
*vty
, const char *name
,
11552 afi_t afi
, safi_t safi
,
11553 const char *what
, uint64_t subgrp_id
)
11558 bgp
= bgp_lookup_by_name(name
);
11560 bgp
= bgp_get_default();
11563 if (!strcmp(what
, "advertise-queue"))
11564 update_group_show_adj_queue(bgp
, afi
, safi
, vty
,
11566 else if (!strcmp(what
, "advertised-routes"))
11567 update_group_show_advertised(bgp
, afi
, safi
, vty
,
11569 else if (!strcmp(what
, "packet-queue"))
11570 update_group_show_packet_queue(bgp
, afi
, safi
, vty
,
11575 DEFPY(show_ip_bgp_instance_updgrps_adj_s
,
11576 show_ip_bgp_instance_updgrps_adj_s_cmd
,
11577 "show [ip]$ip bgp [<view|vrf> VIEWVRFNAME$vrf] [<ipv4|ipv6>$afi <unicast|multicast|vpn>$safi] update-groups [SUBGROUP-ID]$sgid <advertise-queue|advertised-routes|packet-queue>$rtq",
11578 SHOW_STR IP_STR BGP_STR BGP_INSTANCE_HELP_STR BGP_AFI_HELP_STR
11580 "Detailed info about dynamic update groups\n"
11581 "Specific subgroup to display info for\n"
11582 "Advertisement queue\n"
11583 "Announced routes\n"
11586 uint64_t subgrp_id
= 0;
11590 subgrp_id
= strtoull(sgid
, NULL
, 10);
11595 afiz
= bgp_vty_afi_from_str(afi
);
11599 afiz
= bgp_vty_afi_from_str(afi
);
11600 if (afiz
!= AFI_IP
)
11602 "%% Cannot specify both 'ip' and 'ipv6'\n");
11603 return CMD_WARNING
;
11606 safiz
= safi
? bgp_vty_safi_from_str(safi
) : SAFI_UNICAST
;
11608 show_bgp_updgrps_adj_info_aux(vty
, vrf
, afiz
, safiz
, rtq
, subgrp_id
);
11609 return CMD_SUCCESS
;
11612 static int bgp_show_one_peer_group(struct vty
*vty
, struct peer_group
*group
)
11614 struct listnode
*node
, *nnode
;
11615 struct prefix
*range
;
11618 char buf
[PREFIX2STR_BUFFER
];
11621 const char *peer_status
;
11622 const char *af_str
;
11627 conf
= group
->conf
;
11629 if (conf
->as_type
== AS_SPECIFIED
|| conf
->as_type
== AS_EXTERNAL
) {
11630 vty_out(vty
, "\nBGP peer-group %s, remote AS %d\n", group
->name
,
11632 } else if (conf
->as_type
== AS_INTERNAL
) {
11633 vty_out(vty
, "\nBGP peer-group %s, remote AS %d\n", group
->name
,
11636 vty_out(vty
, "\nBGP peer-group %s\n", group
->name
);
11639 if ((group
->bgp
->as
== conf
->as
) || (conf
->as_type
== AS_INTERNAL
))
11640 vty_out(vty
, " Peer-group type is internal\n");
11642 vty_out(vty
, " Peer-group type is external\n");
11644 /* Display AFs configured. */
11645 vty_out(vty
, " Configured address-families:");
11646 FOREACH_AFI_SAFI (afi
, safi
) {
11647 if (conf
->afc
[afi
][safi
]) {
11649 vty_out(vty
, " %s;", afi_safi_print(afi
, safi
));
11653 vty_out(vty
, " none\n");
11655 vty_out(vty
, "\n");
11657 /* Display listen ranges (for dynamic neighbors), if any */
11658 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++) {
11661 else if (afi
== AFI_IP6
)
11665 lr_count
= listcount(group
->listen_range
[afi
]);
11667 vty_out(vty
, " %d %s listen range(s)\n", lr_count
,
11671 for (ALL_LIST_ELEMENTS(group
->listen_range
[afi
], node
,
11673 prefix2str(range
, buf
, sizeof(buf
));
11674 vty_out(vty
, " %s\n", buf
);
11679 /* Display group members and their status */
11680 if (listcount(group
->peer
)) {
11681 vty_out(vty
, " Peer-group members:\n");
11682 for (ALL_LIST_ELEMENTS(group
->peer
, node
, nnode
, peer
)) {
11683 if (CHECK_FLAG(peer
->flags
, PEER_FLAG_SHUTDOWN
))
11684 peer_status
= "Idle (Admin)";
11685 else if (CHECK_FLAG(peer
->sflags
,
11686 PEER_STATUS_PREFIX_OVERFLOW
))
11687 peer_status
= "Idle (PfxCt)";
11689 peer_status
= lookup_msg(bgp_status_msg
,
11690 peer
->status
, NULL
);
11692 dynamic
= peer_dynamic_neighbor(peer
);
11693 vty_out(vty
, " %s %s %s \n", peer
->host
,
11694 dynamic
? "(dynamic)" : "", peer_status
);
11698 return CMD_SUCCESS
;
11701 static int bgp_show_peer_group_vty(struct vty
*vty
, const char *name
,
11702 const char *group_name
)
11705 struct listnode
*node
, *nnode
;
11706 struct peer_group
*group
;
11707 bool found
= false;
11709 bgp
= name
? bgp_lookup_by_name(name
) : bgp_get_default();
11712 vty_out(vty
, "%% BGP instance not found\n");
11713 return CMD_WARNING
;
11716 for (ALL_LIST_ELEMENTS(bgp
->group
, node
, nnode
, group
)) {
11718 if (strmatch(group
->name
, group_name
)) {
11719 bgp_show_one_peer_group(vty
, group
);
11724 bgp_show_one_peer_group(vty
, group
);
11728 if (group_name
&& !found
)
11729 vty_out(vty
, "%% No such peer-group\n");
11731 return CMD_SUCCESS
;
11734 DEFUN (show_ip_bgp_peer_groups
,
11735 show_ip_bgp_peer_groups_cmd
,
11736 "show [ip] bgp [<view|vrf> VIEWVRFNAME] peer-group [PGNAME]",
11740 BGP_INSTANCE_HELP_STR
11741 "Detailed information on BGP peer groups\n"
11742 "Peer group name\n")
11747 vrf
= argv_find(argv
, argc
, "VIEWVRFNAME", &idx
) ? argv
[idx
]->arg
11749 pg
= argv_find(argv
, argc
, "PGNAME", &idx
) ? argv
[idx
]->arg
: NULL
;
11751 return bgp_show_peer_group_vty(vty
, vrf
, pg
);
11755 /* Redistribute VTY commands. */
11757 DEFUN (bgp_redistribute_ipv4
,
11758 bgp_redistribute_ipv4_cmd
,
11759 "redistribute " FRR_IP_REDIST_STR_BGPD
,
11760 "Redistribute information from another routing protocol\n"
11761 FRR_IP_REDIST_HELP_STR_BGPD
)
11763 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
11764 int idx_protocol
= 1;
11767 type
= proto_redistnum(AFI_IP
, argv
[idx_protocol
]->text
);
11769 vty_out(vty
, "%% Invalid route type\n");
11770 return CMD_WARNING_CONFIG_FAILED
;
11773 bgp_redist_add(bgp
, AFI_IP
, type
, 0);
11774 return bgp_redistribute_set(bgp
, AFI_IP
, type
, 0, false);
11778 bgp_redistribute_ipv4
, bgp_redistribute_ipv4_hidden_cmd
,
11779 "redistribute " FRR_IP_REDIST_STR_BGPD
,
11780 "Redistribute information from another routing protocol\n" FRR_IP_REDIST_HELP_STR_BGPD
)
11782 DEFUN (bgp_redistribute_ipv4_rmap
,
11783 bgp_redistribute_ipv4_rmap_cmd
,
11784 "redistribute " FRR_IP_REDIST_STR_BGPD
" route-map WORD",
11785 "Redistribute information from another routing protocol\n"
11786 FRR_IP_REDIST_HELP_STR_BGPD
11787 "Route map reference\n"
11788 "Pointer to route-map entries\n")
11790 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
11791 int idx_protocol
= 1;
11794 struct bgp_redist
*red
;
11796 struct route_map
*route_map
= route_map_lookup_warn_noexist(
11797 vty
, argv
[idx_word
]->arg
);
11799 type
= proto_redistnum(AFI_IP
, argv
[idx_protocol
]->text
);
11801 vty_out(vty
, "%% Invalid route type\n");
11802 return CMD_WARNING_CONFIG_FAILED
;
11805 red
= bgp_redist_add(bgp
, AFI_IP
, type
, 0);
11807 bgp_redistribute_rmap_set(red
, argv
[idx_word
]->arg
, route_map
);
11808 return bgp_redistribute_set(bgp
, AFI_IP
, type
, 0, changed
);
11812 bgp_redistribute_ipv4_rmap
, bgp_redistribute_ipv4_rmap_hidden_cmd
,
11813 "redistribute " FRR_IP_REDIST_STR_BGPD
" route-map WORD",
11814 "Redistribute information from another routing protocol\n" FRR_IP_REDIST_HELP_STR_BGPD
11815 "Route map reference\n"
11816 "Pointer to route-map entries\n")
11818 DEFUN (bgp_redistribute_ipv4_metric
,
11819 bgp_redistribute_ipv4_metric_cmd
,
11820 "redistribute " FRR_IP_REDIST_STR_BGPD
" metric (0-4294967295)",
11821 "Redistribute information from another routing protocol\n"
11822 FRR_IP_REDIST_HELP_STR_BGPD
11823 "Metric for redistributed routes\n"
11824 "Default metric\n")
11826 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
11827 int idx_protocol
= 1;
11828 int idx_number
= 3;
11831 struct bgp_redist
*red
;
11834 type
= proto_redistnum(AFI_IP
, argv
[idx_protocol
]->text
);
11836 vty_out(vty
, "%% Invalid route type\n");
11837 return CMD_WARNING_CONFIG_FAILED
;
11839 metric
= strtoul(argv
[idx_number
]->arg
, NULL
, 10);
11841 red
= bgp_redist_add(bgp
, AFI_IP
, type
, 0);
11842 changed
= bgp_redistribute_metric_set(bgp
, red
, AFI_IP
, type
, metric
);
11843 return bgp_redistribute_set(bgp
, AFI_IP
, type
, 0, changed
);
11847 bgp_redistribute_ipv4_metric
, bgp_redistribute_ipv4_metric_hidden_cmd
,
11848 "redistribute " FRR_IP_REDIST_STR_BGPD
" metric (0-4294967295)",
11849 "Redistribute information from another routing protocol\n" FRR_IP_REDIST_HELP_STR_BGPD
11850 "Metric for redistributed routes\n"
11851 "Default metric\n")
11853 DEFUN (bgp_redistribute_ipv4_rmap_metric
,
11854 bgp_redistribute_ipv4_rmap_metric_cmd
,
11855 "redistribute " FRR_IP_REDIST_STR_BGPD
" route-map WORD metric (0-4294967295)",
11856 "Redistribute information from another routing protocol\n"
11857 FRR_IP_REDIST_HELP_STR_BGPD
11858 "Route map reference\n"
11859 "Pointer to route-map entries\n"
11860 "Metric for redistributed routes\n"
11861 "Default metric\n")
11863 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
11864 int idx_protocol
= 1;
11866 int idx_number
= 5;
11869 struct bgp_redist
*red
;
11871 struct route_map
*route_map
=
11872 route_map_lookup_warn_noexist(vty
, argv
[idx_word
]->arg
);
11874 type
= proto_redistnum(AFI_IP
, argv
[idx_protocol
]->text
);
11876 vty_out(vty
, "%% Invalid route type\n");
11877 return CMD_WARNING_CONFIG_FAILED
;
11879 metric
= strtoul(argv
[idx_number
]->arg
, NULL
, 10);
11881 red
= bgp_redist_add(bgp
, AFI_IP
, type
, 0);
11883 bgp_redistribute_rmap_set(red
, argv
[idx_word
]->arg
, route_map
);
11884 changed
|= bgp_redistribute_metric_set(bgp
, red
, AFI_IP
, type
, metric
);
11885 return bgp_redistribute_set(bgp
, AFI_IP
, type
, 0, changed
);
11889 bgp_redistribute_ipv4_rmap_metric
,
11890 bgp_redistribute_ipv4_rmap_metric_hidden_cmd
,
11891 "redistribute " FRR_IP_REDIST_STR_BGPD
11892 " route-map WORD metric (0-4294967295)",
11893 "Redistribute information from another routing protocol\n" FRR_IP_REDIST_HELP_STR_BGPD
11894 "Route map reference\n"
11895 "Pointer to route-map entries\n"
11896 "Metric for redistributed routes\n"
11897 "Default metric\n")
11899 DEFUN (bgp_redistribute_ipv4_metric_rmap
,
11900 bgp_redistribute_ipv4_metric_rmap_cmd
,
11901 "redistribute " FRR_IP_REDIST_STR_BGPD
" metric (0-4294967295) route-map WORD",
11902 "Redistribute information from another routing protocol\n"
11903 FRR_IP_REDIST_HELP_STR_BGPD
11904 "Metric for redistributed routes\n"
11906 "Route map reference\n"
11907 "Pointer to route-map entries\n")
11909 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
11910 int idx_protocol
= 1;
11911 int idx_number
= 3;
11915 struct bgp_redist
*red
;
11917 struct route_map
*route_map
=
11918 route_map_lookup_warn_noexist(vty
, argv
[idx_word
]->arg
);
11920 type
= proto_redistnum(AFI_IP
, argv
[idx_protocol
]->text
);
11922 vty_out(vty
, "%% Invalid route type\n");
11923 return CMD_WARNING_CONFIG_FAILED
;
11925 metric
= strtoul(argv
[idx_number
]->arg
, NULL
, 10);
11927 red
= bgp_redist_add(bgp
, AFI_IP
, type
, 0);
11928 changed
= bgp_redistribute_metric_set(bgp
, red
, AFI_IP
, type
, metric
);
11930 bgp_redistribute_rmap_set(red
, argv
[idx_word
]->arg
, route_map
);
11931 return bgp_redistribute_set(bgp
, AFI_IP
, type
, 0, changed
);
11935 bgp_redistribute_ipv4_metric_rmap
,
11936 bgp_redistribute_ipv4_metric_rmap_hidden_cmd
,
11937 "redistribute " FRR_IP_REDIST_STR_BGPD
11938 " metric (0-4294967295) route-map WORD",
11939 "Redistribute information from another routing protocol\n" FRR_IP_REDIST_HELP_STR_BGPD
11940 "Metric for redistributed routes\n"
11942 "Route map reference\n"
11943 "Pointer to route-map entries\n")
11945 DEFUN (bgp_redistribute_ipv4_ospf
,
11946 bgp_redistribute_ipv4_ospf_cmd
,
11947 "redistribute <ospf|table> (1-65535)",
11948 "Redistribute information from another routing protocol\n"
11949 "Open Shortest Path First (OSPFv2)\n"
11950 "Non-main Kernel Routing Table\n"
11951 "Instance ID/Table ID\n")
11953 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
11954 int idx_ospf_table
= 1;
11955 int idx_number
= 2;
11956 unsigned short instance
;
11957 unsigned short protocol
;
11959 instance
= strtoul(argv
[idx_number
]->arg
, NULL
, 10);
11961 if (strncmp(argv
[idx_ospf_table
]->arg
, "o", 1) == 0)
11962 protocol
= ZEBRA_ROUTE_OSPF
;
11964 protocol
= ZEBRA_ROUTE_TABLE
;
11966 bgp_redist_add(bgp
, AFI_IP
, protocol
, instance
);
11967 return bgp_redistribute_set(bgp
, AFI_IP
, protocol
, instance
, false);
11970 ALIAS_HIDDEN(bgp_redistribute_ipv4_ospf
, bgp_redistribute_ipv4_ospf_hidden_cmd
,
11971 "redistribute <ospf|table> (1-65535)",
11972 "Redistribute information from another routing protocol\n"
11973 "Open Shortest Path First (OSPFv2)\n"
11974 "Non-main Kernel Routing Table\n"
11975 "Instance ID/Table ID\n")
11977 DEFUN (bgp_redistribute_ipv4_ospf_rmap
,
11978 bgp_redistribute_ipv4_ospf_rmap_cmd
,
11979 "redistribute <ospf|table> (1-65535) route-map WORD",
11980 "Redistribute information from another routing protocol\n"
11981 "Open Shortest Path First (OSPFv2)\n"
11982 "Non-main Kernel Routing Table\n"
11983 "Instance ID/Table ID\n"
11984 "Route map reference\n"
11985 "Pointer to route-map entries\n")
11987 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
11988 int idx_ospf_table
= 1;
11989 int idx_number
= 2;
11991 struct bgp_redist
*red
;
11992 unsigned short instance
;
11995 struct route_map
*route_map
=
11996 route_map_lookup_warn_noexist(vty
, argv
[idx_word
]->arg
);
11998 if (strncmp(argv
[idx_ospf_table
]->arg
, "o", 1) == 0)
11999 protocol
= ZEBRA_ROUTE_OSPF
;
12001 protocol
= ZEBRA_ROUTE_TABLE
;
12003 instance
= strtoul(argv
[idx_number
]->arg
, NULL
, 10);
12004 red
= bgp_redist_add(bgp
, AFI_IP
, protocol
, instance
);
12006 bgp_redistribute_rmap_set(red
, argv
[idx_word
]->arg
, route_map
);
12007 return bgp_redistribute_set(bgp
, AFI_IP
, protocol
, instance
, changed
);
12010 ALIAS_HIDDEN(bgp_redistribute_ipv4_ospf_rmap
,
12011 bgp_redistribute_ipv4_ospf_rmap_hidden_cmd
,
12012 "redistribute <ospf|table> (1-65535) route-map WORD",
12013 "Redistribute information from another routing protocol\n"
12014 "Open Shortest Path First (OSPFv2)\n"
12015 "Non-main Kernel Routing Table\n"
12016 "Instance ID/Table ID\n"
12017 "Route map reference\n"
12018 "Pointer to route-map entries\n")
12020 DEFUN (bgp_redistribute_ipv4_ospf_metric
,
12021 bgp_redistribute_ipv4_ospf_metric_cmd
,
12022 "redistribute <ospf|table> (1-65535) metric (0-4294967295)",
12023 "Redistribute information from another routing protocol\n"
12024 "Open Shortest Path First (OSPFv2)\n"
12025 "Non-main Kernel Routing Table\n"
12026 "Instance ID/Table ID\n"
12027 "Metric for redistributed routes\n"
12028 "Default metric\n")
12030 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
12031 int idx_ospf_table
= 1;
12032 int idx_number
= 2;
12033 int idx_number_2
= 4;
12035 struct bgp_redist
*red
;
12036 unsigned short instance
;
12040 if (strncmp(argv
[idx_ospf_table
]->arg
, "o", 1) == 0)
12041 protocol
= ZEBRA_ROUTE_OSPF
;
12043 protocol
= ZEBRA_ROUTE_TABLE
;
12045 instance
= strtoul(argv
[idx_number
]->arg
, NULL
, 10);
12046 metric
= strtoul(argv
[idx_number_2
]->arg
, NULL
, 10);
12048 red
= bgp_redist_add(bgp
, AFI_IP
, protocol
, instance
);
12049 changed
= bgp_redistribute_metric_set(bgp
, red
, AFI_IP
, protocol
,
12051 return bgp_redistribute_set(bgp
, AFI_IP
, protocol
, instance
, changed
);
12054 ALIAS_HIDDEN(bgp_redistribute_ipv4_ospf_metric
,
12055 bgp_redistribute_ipv4_ospf_metric_hidden_cmd
,
12056 "redistribute <ospf|table> (1-65535) metric (0-4294967295)",
12057 "Redistribute information from another routing protocol\n"
12058 "Open Shortest Path First (OSPFv2)\n"
12059 "Non-main Kernel Routing Table\n"
12060 "Instance ID/Table ID\n"
12061 "Metric for redistributed routes\n"
12062 "Default metric\n")
12064 DEFUN (bgp_redistribute_ipv4_ospf_rmap_metric
,
12065 bgp_redistribute_ipv4_ospf_rmap_metric_cmd
,
12066 "redistribute <ospf|table> (1-65535) route-map WORD metric (0-4294967295)",
12067 "Redistribute information from another routing protocol\n"
12068 "Open Shortest Path First (OSPFv2)\n"
12069 "Non-main Kernel Routing Table\n"
12070 "Instance ID/Table ID\n"
12071 "Route map reference\n"
12072 "Pointer to route-map entries\n"
12073 "Metric for redistributed routes\n"
12074 "Default metric\n")
12076 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
12077 int idx_ospf_table
= 1;
12078 int idx_number
= 2;
12080 int idx_number_2
= 6;
12082 struct bgp_redist
*red
;
12083 unsigned short instance
;
12086 struct route_map
*route_map
=
12087 route_map_lookup_warn_noexist(vty
, argv
[idx_word
]->arg
);
12089 if (strncmp(argv
[idx_ospf_table
]->arg
, "o", 1) == 0)
12090 protocol
= ZEBRA_ROUTE_OSPF
;
12092 protocol
= ZEBRA_ROUTE_TABLE
;
12094 instance
= strtoul(argv
[idx_number
]->arg
, NULL
, 10);
12095 metric
= strtoul(argv
[idx_number_2
]->arg
, NULL
, 10);
12097 red
= bgp_redist_add(bgp
, AFI_IP
, protocol
, instance
);
12099 bgp_redistribute_rmap_set(red
, argv
[idx_word
]->arg
, route_map
);
12100 changed
|= bgp_redistribute_metric_set(bgp
, red
, AFI_IP
, protocol
,
12102 return bgp_redistribute_set(bgp
, AFI_IP
, protocol
, instance
, changed
);
12106 bgp_redistribute_ipv4_ospf_rmap_metric
,
12107 bgp_redistribute_ipv4_ospf_rmap_metric_hidden_cmd
,
12108 "redistribute <ospf|table> (1-65535) route-map WORD metric (0-4294967295)",
12109 "Redistribute information from another routing protocol\n"
12110 "Open Shortest Path First (OSPFv2)\n"
12111 "Non-main Kernel Routing Table\n"
12112 "Instance ID/Table ID\n"
12113 "Route map reference\n"
12114 "Pointer to route-map entries\n"
12115 "Metric for redistributed routes\n"
12116 "Default metric\n")
12118 DEFUN (bgp_redistribute_ipv4_ospf_metric_rmap
,
12119 bgp_redistribute_ipv4_ospf_metric_rmap_cmd
,
12120 "redistribute <ospf|table> (1-65535) metric (0-4294967295) route-map WORD",
12121 "Redistribute information from another routing protocol\n"
12122 "Open Shortest Path First (OSPFv2)\n"
12123 "Non-main Kernel Routing Table\n"
12124 "Instance ID/Table ID\n"
12125 "Metric for redistributed routes\n"
12127 "Route map reference\n"
12128 "Pointer to route-map entries\n")
12130 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
12131 int idx_ospf_table
= 1;
12132 int idx_number
= 2;
12133 int idx_number_2
= 4;
12136 struct bgp_redist
*red
;
12137 unsigned short instance
;
12140 struct route_map
*route_map
=
12141 route_map_lookup_warn_noexist(vty
, argv
[idx_word
]->arg
);
12143 if (strncmp(argv
[idx_ospf_table
]->arg
, "o", 1) == 0)
12144 protocol
= ZEBRA_ROUTE_OSPF
;
12146 protocol
= ZEBRA_ROUTE_TABLE
;
12148 instance
= strtoul(argv
[idx_number
]->arg
, NULL
, 10);
12149 metric
= strtoul(argv
[idx_number_2
]->arg
, NULL
, 10);
12151 red
= bgp_redist_add(bgp
, AFI_IP
, protocol
, instance
);
12152 changed
= bgp_redistribute_metric_set(bgp
, red
, AFI_IP
, protocol
,
12155 bgp_redistribute_rmap_set(red
, argv
[idx_word
]->arg
, route_map
);
12156 return bgp_redistribute_set(bgp
, AFI_IP
, protocol
, instance
, changed
);
12160 bgp_redistribute_ipv4_ospf_metric_rmap
,
12161 bgp_redistribute_ipv4_ospf_metric_rmap_hidden_cmd
,
12162 "redistribute <ospf|table> (1-65535) metric (0-4294967295) route-map WORD",
12163 "Redistribute information from another routing protocol\n"
12164 "Open Shortest Path First (OSPFv2)\n"
12165 "Non-main Kernel Routing Table\n"
12166 "Instance ID/Table ID\n"
12167 "Metric for redistributed routes\n"
12169 "Route map reference\n"
12170 "Pointer to route-map entries\n")
12172 DEFUN (no_bgp_redistribute_ipv4_ospf
,
12173 no_bgp_redistribute_ipv4_ospf_cmd
,
12174 "no redistribute <ospf|table> (1-65535) [metric (0-4294967295)] [route-map WORD]",
12176 "Redistribute information from another routing protocol\n"
12177 "Open Shortest Path First (OSPFv2)\n"
12178 "Non-main Kernel Routing Table\n"
12179 "Instance ID/Table ID\n"
12180 "Metric for redistributed routes\n"
12182 "Route map reference\n"
12183 "Pointer to route-map entries\n")
12185 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
12186 int idx_ospf_table
= 2;
12187 int idx_number
= 3;
12188 unsigned short instance
;
12191 if (strncmp(argv
[idx_ospf_table
]->arg
, "o", 1) == 0)
12192 protocol
= ZEBRA_ROUTE_OSPF
;
12194 protocol
= ZEBRA_ROUTE_TABLE
;
12196 instance
= strtoul(argv
[idx_number
]->arg
, NULL
, 10);
12197 return bgp_redistribute_unset(bgp
, AFI_IP
, protocol
, instance
);
12201 no_bgp_redistribute_ipv4_ospf
, no_bgp_redistribute_ipv4_ospf_hidden_cmd
,
12202 "no redistribute <ospf|table> (1-65535) [metric (0-4294967295)] [route-map WORD]",
12204 "Redistribute information from another routing protocol\n"
12205 "Open Shortest Path First (OSPFv2)\n"
12206 "Non-main Kernel Routing Table\n"
12207 "Instance ID/Table ID\n"
12208 "Metric for redistributed routes\n"
12210 "Route map reference\n"
12211 "Pointer to route-map entries\n")
12213 DEFUN (no_bgp_redistribute_ipv4
,
12214 no_bgp_redistribute_ipv4_cmd
,
12215 "no redistribute " FRR_IP_REDIST_STR_BGPD
" [metric (0-4294967295)] [route-map WORD]",
12217 "Redistribute information from another routing protocol\n"
12218 FRR_IP_REDIST_HELP_STR_BGPD
12219 "Metric for redistributed routes\n"
12221 "Route map reference\n"
12222 "Pointer to route-map entries\n")
12224 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
12225 int idx_protocol
= 2;
12228 type
= proto_redistnum(AFI_IP
, argv
[idx_protocol
]->text
);
12230 vty_out(vty
, "%% Invalid route type\n");
12231 return CMD_WARNING_CONFIG_FAILED
;
12233 return bgp_redistribute_unset(bgp
, AFI_IP
, type
, 0);
12237 no_bgp_redistribute_ipv4
, no_bgp_redistribute_ipv4_hidden_cmd
,
12238 "no redistribute " FRR_IP_REDIST_STR_BGPD
12239 " [metric (0-4294967295)] [route-map WORD]",
12241 "Redistribute information from another routing protocol\n" FRR_IP_REDIST_HELP_STR_BGPD
12242 "Metric for redistributed routes\n"
12244 "Route map reference\n"
12245 "Pointer to route-map entries\n")
12247 DEFUN (bgp_redistribute_ipv6
,
12248 bgp_redistribute_ipv6_cmd
,
12249 "redistribute " FRR_IP6_REDIST_STR_BGPD
,
12250 "Redistribute information from another routing protocol\n"
12251 FRR_IP6_REDIST_HELP_STR_BGPD
)
12253 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
12254 int idx_protocol
= 1;
12257 type
= proto_redistnum(AFI_IP6
, argv
[idx_protocol
]->text
);
12259 vty_out(vty
, "%% Invalid route type\n");
12260 return CMD_WARNING_CONFIG_FAILED
;
12263 bgp_redist_add(bgp
, AFI_IP6
, type
, 0);
12264 return bgp_redistribute_set(bgp
, AFI_IP6
, type
, 0, false);
12267 DEFUN (bgp_redistribute_ipv6_rmap
,
12268 bgp_redistribute_ipv6_rmap_cmd
,
12269 "redistribute " FRR_IP6_REDIST_STR_BGPD
" route-map WORD",
12270 "Redistribute information from another routing protocol\n"
12271 FRR_IP6_REDIST_HELP_STR_BGPD
12272 "Route map reference\n"
12273 "Pointer to route-map entries\n")
12275 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
12276 int idx_protocol
= 1;
12279 struct bgp_redist
*red
;
12281 struct route_map
*route_map
=
12282 route_map_lookup_warn_noexist(vty
, argv
[idx_word
]->arg
);
12284 type
= proto_redistnum(AFI_IP6
, argv
[idx_protocol
]->text
);
12286 vty_out(vty
, "%% Invalid route type\n");
12287 return CMD_WARNING_CONFIG_FAILED
;
12290 red
= bgp_redist_add(bgp
, AFI_IP6
, type
, 0);
12292 bgp_redistribute_rmap_set(red
, argv
[idx_word
]->arg
, route_map
);
12293 return bgp_redistribute_set(bgp
, AFI_IP6
, type
, 0, changed
);
12296 DEFUN (bgp_redistribute_ipv6_metric
,
12297 bgp_redistribute_ipv6_metric_cmd
,
12298 "redistribute " FRR_IP6_REDIST_STR_BGPD
" metric (0-4294967295)",
12299 "Redistribute information from another routing protocol\n"
12300 FRR_IP6_REDIST_HELP_STR_BGPD
12301 "Metric for redistributed routes\n"
12302 "Default metric\n")
12304 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
12305 int idx_protocol
= 1;
12306 int idx_number
= 3;
12309 struct bgp_redist
*red
;
12312 type
= proto_redistnum(AFI_IP6
, argv
[idx_protocol
]->text
);
12314 vty_out(vty
, "%% Invalid route type\n");
12315 return CMD_WARNING_CONFIG_FAILED
;
12317 metric
= strtoul(argv
[idx_number
]->arg
, NULL
, 10);
12319 red
= bgp_redist_add(bgp
, AFI_IP6
, type
, 0);
12320 changed
= bgp_redistribute_metric_set(bgp
, red
, AFI_IP6
, type
, metric
);
12321 return bgp_redistribute_set(bgp
, AFI_IP6
, type
, 0, changed
);
12324 DEFUN (bgp_redistribute_ipv6_rmap_metric
,
12325 bgp_redistribute_ipv6_rmap_metric_cmd
,
12326 "redistribute " FRR_IP6_REDIST_STR_BGPD
" route-map WORD metric (0-4294967295)",
12327 "Redistribute information from another routing protocol\n"
12328 FRR_IP6_REDIST_HELP_STR_BGPD
12329 "Route map reference\n"
12330 "Pointer to route-map entries\n"
12331 "Metric for redistributed routes\n"
12332 "Default metric\n")
12334 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
12335 int idx_protocol
= 1;
12337 int idx_number
= 5;
12340 struct bgp_redist
*red
;
12342 struct route_map
*route_map
=
12343 route_map_lookup_warn_noexist(vty
, argv
[idx_word
]->arg
);
12345 type
= proto_redistnum(AFI_IP6
, argv
[idx_protocol
]->text
);
12347 vty_out(vty
, "%% Invalid route type\n");
12348 return CMD_WARNING_CONFIG_FAILED
;
12350 metric
= strtoul(argv
[idx_number
]->arg
, NULL
, 10);
12352 red
= bgp_redist_add(bgp
, AFI_IP6
, type
, 0);
12354 bgp_redistribute_rmap_set(red
, argv
[idx_word
]->arg
, route_map
);
12355 changed
|= bgp_redistribute_metric_set(bgp
, red
, AFI_IP6
, type
,
12357 return bgp_redistribute_set(bgp
, AFI_IP6
, type
, 0, changed
);
12360 DEFUN (bgp_redistribute_ipv6_metric_rmap
,
12361 bgp_redistribute_ipv6_metric_rmap_cmd
,
12362 "redistribute " FRR_IP6_REDIST_STR_BGPD
" metric (0-4294967295) route-map WORD",
12363 "Redistribute information from another routing protocol\n"
12364 FRR_IP6_REDIST_HELP_STR_BGPD
12365 "Metric for redistributed routes\n"
12367 "Route map reference\n"
12368 "Pointer to route-map entries\n")
12370 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
12371 int idx_protocol
= 1;
12372 int idx_number
= 3;
12376 struct bgp_redist
*red
;
12378 struct route_map
*route_map
=
12379 route_map_lookup_warn_noexist(vty
, argv
[idx_word
]->arg
);
12381 type
= proto_redistnum(AFI_IP6
, argv
[idx_protocol
]->text
);
12383 vty_out(vty
, "%% Invalid route type\n");
12384 return CMD_WARNING_CONFIG_FAILED
;
12386 metric
= strtoul(argv
[idx_number
]->arg
, NULL
, 10);
12388 red
= bgp_redist_add(bgp
, AFI_IP6
, type
, 0);
12389 changed
= bgp_redistribute_metric_set(bgp
, red
, AFI_IP6
, SAFI_UNICAST
,
12392 bgp_redistribute_rmap_set(red
, argv
[idx_word
]->arg
, route_map
);
12393 return bgp_redistribute_set(bgp
, AFI_IP6
, type
, 0, changed
);
12396 DEFUN (no_bgp_redistribute_ipv6
,
12397 no_bgp_redistribute_ipv6_cmd
,
12398 "no redistribute " FRR_IP6_REDIST_STR_BGPD
" [metric (0-4294967295)] [route-map WORD]",
12400 "Redistribute information from another routing protocol\n"
12401 FRR_IP6_REDIST_HELP_STR_BGPD
12402 "Metric for redistributed routes\n"
12404 "Route map reference\n"
12405 "Pointer to route-map entries\n")
12407 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
12408 int idx_protocol
= 2;
12411 type
= proto_redistnum(AFI_IP6
, argv
[idx_protocol
]->text
);
12413 vty_out(vty
, "%% Invalid route type\n");
12414 return CMD_WARNING_CONFIG_FAILED
;
12417 return bgp_redistribute_unset(bgp
, AFI_IP6
, type
, 0);
12420 void bgp_config_write_redistribute(struct vty
*vty
, struct bgp
*bgp
, afi_t afi
,
12425 /* Unicast redistribution only. */
12426 if (safi
!= SAFI_UNICAST
)
12429 for (i
= 0; i
< ZEBRA_ROUTE_MAX
; i
++) {
12430 /* Redistribute BGP does not make sense. */
12431 if (i
!= ZEBRA_ROUTE_BGP
) {
12432 struct list
*red_list
;
12433 struct listnode
*node
;
12434 struct bgp_redist
*red
;
12436 red_list
= bgp
->redist
[afi
][i
];
12440 for (ALL_LIST_ELEMENTS_RO(red_list
, node
, red
)) {
12441 /* "redistribute" configuration. */
12442 vty_out(vty
, " redistribute %s",
12443 zebra_route_string(i
));
12445 vty_out(vty
, " %d", red
->instance
);
12446 if (red
->redist_metric_flag
)
12447 vty_out(vty
, " metric %u",
12448 red
->redist_metric
);
12449 if (red
->rmap
.name
)
12450 vty_out(vty
, " route-map %s",
12452 vty_out(vty
, "\n");
12458 /* This is part of the address-family block (unicast only) */
12459 void bgp_vpn_policy_config_write_afi(struct vty
*vty
, struct bgp
*bgp
,
12464 if (bgp
->vpn_policy
[afi
].rmap_name
[BGP_VPN_POLICY_DIR_FROMVPN
]) {
12465 if (listcount(bgp
->vpn_policy
[afi
].import_vrf
))
12466 vty_out(vty
, "%*simport vrf route-map %s\n", indent
, "",
12467 bgp
->vpn_policy
[afi
]
12468 .rmap_name
[BGP_VPN_POLICY_DIR_FROMVPN
]);
12470 vty_out(vty
, "%*sroute-map vpn import %s\n", indent
, "",
12471 bgp
->vpn_policy
[afi
]
12472 .rmap_name
[BGP_VPN_POLICY_DIR_FROMVPN
]);
12474 if (CHECK_FLAG(bgp
->af_flags
[afi
][SAFI_UNICAST
],
12475 BGP_CONFIG_VRF_TO_VRF_IMPORT
)
12476 || CHECK_FLAG(bgp
->af_flags
[afi
][SAFI_UNICAST
],
12477 BGP_CONFIG_VRF_TO_VRF_EXPORT
))
12480 if (CHECK_FLAG(bgp
->vpn_policy
[afi
].flags
,
12481 BGP_VPN_POLICY_TOVPN_LABEL_AUTO
)) {
12483 vty_out(vty
, "%*slabel vpn export %s\n", indent
, "", "auto");
12486 if (bgp
->vpn_policy
[afi
].tovpn_label
!= MPLS_LABEL_NONE
) {
12487 vty_out(vty
, "%*slabel vpn export %u\n", indent
, "",
12488 bgp
->vpn_policy
[afi
].tovpn_label
);
12491 if (CHECK_FLAG(bgp
->vpn_policy
[afi
].flags
,
12492 BGP_VPN_POLICY_TOVPN_RD_SET
)) {
12493 char buf
[RD_ADDRSTRLEN
];
12494 vty_out(vty
, "%*srd vpn export %s\n", indent
, "",
12495 prefix_rd2str(&bgp
->vpn_policy
[afi
].tovpn_rd
, buf
,
12498 if (CHECK_FLAG(bgp
->vpn_policy
[afi
].flags
,
12499 BGP_VPN_POLICY_TOVPN_NEXTHOP_SET
)) {
12501 char buf
[PREFIX_STRLEN
];
12502 if (inet_ntop(bgp
->vpn_policy
[afi
].tovpn_nexthop
.family
,
12503 &bgp
->vpn_policy
[afi
].tovpn_nexthop
.u
.prefix
, buf
,
12506 vty_out(vty
, "%*snexthop vpn export %s\n",
12510 if (bgp
->vpn_policy
[afi
].rtlist
[BGP_VPN_POLICY_DIR_FROMVPN
]
12511 && bgp
->vpn_policy
[afi
].rtlist
[BGP_VPN_POLICY_DIR_TOVPN
]
12513 bgp
->vpn_policy
[afi
].rtlist
[BGP_VPN_POLICY_DIR_FROMVPN
],
12514 bgp
->vpn_policy
[afi
].rtlist
[BGP_VPN_POLICY_DIR_TOVPN
])) {
12516 char *b
= ecommunity_ecom2str(
12517 bgp
->vpn_policy
[afi
].rtlist
[BGP_VPN_POLICY_DIR_TOVPN
],
12518 ECOMMUNITY_FORMAT_ROUTE_MAP
, ECOMMUNITY_ROUTE_TARGET
);
12519 vty_out(vty
, "%*srt vpn both %s\n", indent
, "", b
);
12520 XFREE(MTYPE_ECOMMUNITY_STR
, b
);
12522 if (bgp
->vpn_policy
[afi
].rtlist
[BGP_VPN_POLICY_DIR_FROMVPN
]) {
12523 char *b
= ecommunity_ecom2str(
12524 bgp
->vpn_policy
[afi
]
12525 .rtlist
[BGP_VPN_POLICY_DIR_FROMVPN
],
12526 ECOMMUNITY_FORMAT_ROUTE_MAP
,
12527 ECOMMUNITY_ROUTE_TARGET
);
12528 vty_out(vty
, "%*srt vpn import %s\n", indent
, "", b
);
12529 XFREE(MTYPE_ECOMMUNITY_STR
, b
);
12531 if (bgp
->vpn_policy
[afi
].rtlist
[BGP_VPN_POLICY_DIR_TOVPN
]) {
12532 char *b
= ecommunity_ecom2str(
12533 bgp
->vpn_policy
[afi
]
12534 .rtlist
[BGP_VPN_POLICY_DIR_TOVPN
],
12535 ECOMMUNITY_FORMAT_ROUTE_MAP
,
12536 ECOMMUNITY_ROUTE_TARGET
);
12537 vty_out(vty
, "%*srt vpn export %s\n", indent
, "", b
);
12538 XFREE(MTYPE_ECOMMUNITY_STR
, b
);
12542 if (bgp
->vpn_policy
[afi
].rmap_name
[BGP_VPN_POLICY_DIR_TOVPN
])
12543 vty_out(vty
, "%*sroute-map vpn export %s\n", indent
, "",
12544 bgp
->vpn_policy
[afi
]
12545 .rmap_name
[BGP_VPN_POLICY_DIR_TOVPN
]);
12547 if (bgp
->vpn_policy
[afi
].import_redirect_rtlist
) {
12548 char *b
= ecommunity_ecom2str(
12549 bgp
->vpn_policy
[afi
]
12550 .import_redirect_rtlist
,
12551 ECOMMUNITY_FORMAT_ROUTE_MAP
,
12552 ECOMMUNITY_ROUTE_TARGET
);
12554 vty_out(vty
, "%*srt redirect import %s\n", indent
, "", b
);
12555 XFREE(MTYPE_ECOMMUNITY_STR
, b
);
12560 /* BGP node structure. */
12561 static struct cmd_node bgp_node
= {
12562 BGP_NODE
, "%s(config-router)# ", 1,
12565 static struct cmd_node bgp_ipv4_unicast_node
= {
12566 BGP_IPV4_NODE
, "%s(config-router-af)# ", 1,
12569 static struct cmd_node bgp_ipv4_multicast_node
= {
12570 BGP_IPV4M_NODE
, "%s(config-router-af)# ", 1,
12573 static struct cmd_node bgp_ipv4_labeled_unicast_node
= {
12574 BGP_IPV4L_NODE
, "%s(config-router-af)# ", 1,
12577 static struct cmd_node bgp_ipv6_unicast_node
= {
12578 BGP_IPV6_NODE
, "%s(config-router-af)# ", 1,
12581 static struct cmd_node bgp_ipv6_multicast_node
= {
12582 BGP_IPV6M_NODE
, "%s(config-router-af)# ", 1,
12585 static struct cmd_node bgp_ipv6_labeled_unicast_node
= {
12586 BGP_IPV6L_NODE
, "%s(config-router-af)# ", 1,
12589 static struct cmd_node bgp_vpnv4_node
= {BGP_VPNV4_NODE
,
12590 "%s(config-router-af)# ", 1};
12592 static struct cmd_node bgp_vpnv6_node
= {BGP_VPNV6_NODE
,
12593 "%s(config-router-af-vpnv6)# ", 1};
12595 static struct cmd_node bgp_evpn_node
= {BGP_EVPN_NODE
,
12596 "%s(config-router-evpn)# ", 1};
12598 static struct cmd_node bgp_evpn_vni_node
= {BGP_EVPN_VNI_NODE
,
12599 "%s(config-router-af-vni)# ", 1};
12601 static struct cmd_node bgp_flowspecv4_node
= {BGP_FLOWSPECV4_NODE
,
12602 "%s(config-router-af)# ", 1};
12604 static struct cmd_node bgp_flowspecv6_node
= {BGP_FLOWSPECV6_NODE
,
12605 "%s(config-router-af-vpnv6)# ", 1};
12607 static void community_list_vty(void);
12609 static void bgp_ac_neighbor(vector comps
, struct cmd_token
*token
)
12613 struct listnode
*lnbgp
, *lnpeer
;
12615 for (ALL_LIST_ELEMENTS_RO(bm
->bgp
, lnbgp
, bgp
)) {
12616 for (ALL_LIST_ELEMENTS_RO(bgp
->peer
, lnpeer
, peer
)) {
12617 /* only provide suggestions on the appropriate input
12619 * they'll otherwise show up multiple times */
12620 enum cmd_token_type match_type
;
12621 char *name
= peer
->host
;
12623 if (peer
->conf_if
) {
12624 match_type
= VARIABLE_TKN
;
12625 name
= peer
->conf_if
;
12626 } else if (strchr(peer
->host
, ':'))
12627 match_type
= IPV6_TKN
;
12629 match_type
= IPV4_TKN
;
12631 if (token
->type
!= match_type
)
12634 vector_set(comps
, XSTRDUP(MTYPE_COMPLETION
, name
));
12639 static const struct cmd_variable_handler bgp_var_neighbor
[] = {
12640 {.varname
= "neighbor", .completions
= bgp_ac_neighbor
},
12641 {.varname
= "neighbors", .completions
= bgp_ac_neighbor
},
12642 {.varname
= "peer", .completions
= bgp_ac_neighbor
},
12643 {.completions
= NULL
}};
12645 static void bgp_ac_peergroup(vector comps
, struct cmd_token
*token
)
12648 struct peer_group
*group
;
12649 struct listnode
*lnbgp
, *lnpeer
;
12651 for (ALL_LIST_ELEMENTS_RO(bm
->bgp
, lnbgp
, bgp
)) {
12652 for (ALL_LIST_ELEMENTS_RO(bgp
->group
, lnpeer
, group
))
12653 vector_set(comps
, XSTRDUP(MTYPE_COMPLETION
,
12658 static const struct cmd_variable_handler bgp_var_peergroup
[] = {
12659 {.tokenname
= "PGNAME", .completions
= bgp_ac_peergroup
},
12660 {.completions
= NULL
} };
12662 void bgp_vty_init(void)
12664 cmd_variable_handler_register(bgp_var_neighbor
);
12665 cmd_variable_handler_register(bgp_var_peergroup
);
12667 /* Install bgp top node. */
12668 install_node(&bgp_node
, bgp_config_write
);
12669 install_node(&bgp_ipv4_unicast_node
, NULL
);
12670 install_node(&bgp_ipv4_multicast_node
, NULL
);
12671 install_node(&bgp_ipv4_labeled_unicast_node
, NULL
);
12672 install_node(&bgp_ipv6_unicast_node
, NULL
);
12673 install_node(&bgp_ipv6_multicast_node
, NULL
);
12674 install_node(&bgp_ipv6_labeled_unicast_node
, NULL
);
12675 install_node(&bgp_vpnv4_node
, NULL
);
12676 install_node(&bgp_vpnv6_node
, NULL
);
12677 install_node(&bgp_evpn_node
, NULL
);
12678 install_node(&bgp_evpn_vni_node
, NULL
);
12679 install_node(&bgp_flowspecv4_node
, NULL
);
12680 install_node(&bgp_flowspecv6_node
, NULL
);
12682 /* Install default VTY commands to new nodes. */
12683 install_default(BGP_NODE
);
12684 install_default(BGP_IPV4_NODE
);
12685 install_default(BGP_IPV4M_NODE
);
12686 install_default(BGP_IPV4L_NODE
);
12687 install_default(BGP_IPV6_NODE
);
12688 install_default(BGP_IPV6M_NODE
);
12689 install_default(BGP_IPV6L_NODE
);
12690 install_default(BGP_VPNV4_NODE
);
12691 install_default(BGP_VPNV6_NODE
);
12692 install_default(BGP_FLOWSPECV4_NODE
);
12693 install_default(BGP_FLOWSPECV6_NODE
);
12694 install_default(BGP_EVPN_NODE
);
12695 install_default(BGP_EVPN_VNI_NODE
);
12697 /* "bgp multiple-instance" commands. */
12698 install_element(CONFIG_NODE
, &bgp_multiple_instance_cmd
);
12699 install_element(CONFIG_NODE
, &no_bgp_multiple_instance_cmd
);
12701 /* "bgp config-type" commands. */
12702 install_element(CONFIG_NODE
, &bgp_config_type_cmd
);
12703 install_element(CONFIG_NODE
, &no_bgp_config_type_cmd
);
12705 /* "bgp local-mac" hidden commands. */
12706 install_element(CONFIG_NODE
, &bgp_local_mac_cmd
);
12707 install_element(CONFIG_NODE
, &no_bgp_local_mac_cmd
);
12709 /* bgp route-map delay-timer commands. */
12710 install_element(CONFIG_NODE
, &bgp_set_route_map_delay_timer_cmd
);
12711 install_element(CONFIG_NODE
, &no_bgp_set_route_map_delay_timer_cmd
);
12713 /* Dummy commands (Currently not supported) */
12714 install_element(BGP_NODE
, &no_synchronization_cmd
);
12715 install_element(BGP_NODE
, &no_auto_summary_cmd
);
12717 /* "router bgp" commands. */
12718 install_element(CONFIG_NODE
, &router_bgp_cmd
);
12720 /* "no router bgp" commands. */
12721 install_element(CONFIG_NODE
, &no_router_bgp_cmd
);
12723 /* "bgp router-id" commands. */
12724 install_element(BGP_NODE
, &bgp_router_id_cmd
);
12725 install_element(BGP_NODE
, &no_bgp_router_id_cmd
);
12727 /* "bgp cluster-id" commands. */
12728 install_element(BGP_NODE
, &bgp_cluster_id_cmd
);
12729 install_element(BGP_NODE
, &no_bgp_cluster_id_cmd
);
12731 /* "bgp confederation" commands. */
12732 install_element(BGP_NODE
, &bgp_confederation_identifier_cmd
);
12733 install_element(BGP_NODE
, &no_bgp_confederation_identifier_cmd
);
12735 /* "bgp confederation peers" commands. */
12736 install_element(BGP_NODE
, &bgp_confederation_peers_cmd
);
12737 install_element(BGP_NODE
, &no_bgp_confederation_peers_cmd
);
12739 /* bgp max-med command */
12740 install_element(BGP_NODE
, &bgp_maxmed_admin_cmd
);
12741 install_element(BGP_NODE
, &no_bgp_maxmed_admin_cmd
);
12742 install_element(BGP_NODE
, &bgp_maxmed_admin_medv_cmd
);
12743 install_element(BGP_NODE
, &bgp_maxmed_onstartup_cmd
);
12744 install_element(BGP_NODE
, &no_bgp_maxmed_onstartup_cmd
);
12746 /* bgp disable-ebgp-connected-nh-check */
12747 install_element(BGP_NODE
, &bgp_disable_connected_route_check_cmd
);
12748 install_element(BGP_NODE
, &no_bgp_disable_connected_route_check_cmd
);
12750 /* bgp update-delay command */
12751 install_element(BGP_NODE
, &bgp_update_delay_cmd
);
12752 install_element(BGP_NODE
, &no_bgp_update_delay_cmd
);
12753 install_element(BGP_NODE
, &bgp_update_delay_establish_wait_cmd
);
12755 install_element(BGP_NODE
, &bgp_wpkt_quanta_cmd
);
12756 install_element(BGP_NODE
, &no_bgp_wpkt_quanta_cmd
);
12757 install_element(BGP_NODE
, &bgp_rpkt_quanta_cmd
);
12758 install_element(BGP_NODE
, &no_bgp_rpkt_quanta_cmd
);
12760 install_element(BGP_NODE
, &bgp_coalesce_time_cmd
);
12761 install_element(BGP_NODE
, &no_bgp_coalesce_time_cmd
);
12763 /* "maximum-paths" commands. */
12764 install_element(BGP_NODE
, &bgp_maxpaths_hidden_cmd
);
12765 install_element(BGP_NODE
, &no_bgp_maxpaths_hidden_cmd
);
12766 install_element(BGP_IPV4_NODE
, &bgp_maxpaths_cmd
);
12767 install_element(BGP_IPV4_NODE
, &no_bgp_maxpaths_cmd
);
12768 install_element(BGP_IPV6_NODE
, &bgp_maxpaths_cmd
);
12769 install_element(BGP_IPV6_NODE
, &no_bgp_maxpaths_cmd
);
12770 install_element(BGP_NODE
, &bgp_maxpaths_ibgp_hidden_cmd
);
12771 install_element(BGP_NODE
, &bgp_maxpaths_ibgp_cluster_hidden_cmd
);
12772 install_element(BGP_NODE
, &no_bgp_maxpaths_ibgp_hidden_cmd
);
12773 install_element(BGP_IPV4_NODE
, &bgp_maxpaths_ibgp_cmd
);
12774 install_element(BGP_IPV4_NODE
, &bgp_maxpaths_ibgp_cluster_cmd
);
12775 install_element(BGP_IPV4_NODE
, &no_bgp_maxpaths_ibgp_cmd
);
12776 install_element(BGP_IPV6_NODE
, &bgp_maxpaths_ibgp_cmd
);
12777 install_element(BGP_IPV6_NODE
, &bgp_maxpaths_ibgp_cluster_cmd
);
12778 install_element(BGP_IPV6_NODE
, &no_bgp_maxpaths_ibgp_cmd
);
12780 install_element(BGP_IPV6L_NODE
, &bgp_maxpaths_cmd
);
12781 install_element(BGP_IPV6L_NODE
, &no_bgp_maxpaths_cmd
);
12782 install_element(BGP_IPV6L_NODE
, &bgp_maxpaths_ibgp_cmd
);
12783 install_element(BGP_IPV6L_NODE
, &bgp_maxpaths_ibgp_cluster_cmd
);
12784 install_element(BGP_IPV6L_NODE
, &no_bgp_maxpaths_ibgp_cmd
);
12786 /* "timers bgp" commands. */
12787 install_element(BGP_NODE
, &bgp_timers_cmd
);
12788 install_element(BGP_NODE
, &no_bgp_timers_cmd
);
12790 /* route-map delay-timer commands - per instance for backwards compat.
12792 install_element(BGP_NODE
, &bgp_set_route_map_delay_timer_cmd
);
12793 install_element(BGP_NODE
, &no_bgp_set_route_map_delay_timer_cmd
);
12795 /* "bgp client-to-client reflection" commands */
12796 install_element(BGP_NODE
, &no_bgp_client_to_client_reflection_cmd
);
12797 install_element(BGP_NODE
, &bgp_client_to_client_reflection_cmd
);
12799 /* "bgp always-compare-med" commands */
12800 install_element(BGP_NODE
, &bgp_always_compare_med_cmd
);
12801 install_element(BGP_NODE
, &no_bgp_always_compare_med_cmd
);
12803 /* "bgp deterministic-med" commands */
12804 install_element(BGP_NODE
, &bgp_deterministic_med_cmd
);
12805 install_element(BGP_NODE
, &no_bgp_deterministic_med_cmd
);
12807 /* "bgp graceful-restart" commands */
12808 install_element(BGP_NODE
, &bgp_graceful_restart_cmd
);
12809 install_element(BGP_NODE
, &no_bgp_graceful_restart_cmd
);
12810 install_element(BGP_NODE
, &bgp_graceful_restart_stalepath_time_cmd
);
12811 install_element(BGP_NODE
, &no_bgp_graceful_restart_stalepath_time_cmd
);
12812 install_element(BGP_NODE
, &bgp_graceful_restart_restart_time_cmd
);
12813 install_element(BGP_NODE
, &no_bgp_graceful_restart_restart_time_cmd
);
12815 install_element(BGP_NODE
, &bgp_graceful_restart_preserve_fw_cmd
);
12816 install_element(BGP_NODE
, &no_bgp_graceful_restart_preserve_fw_cmd
);
12818 /* "bgp graceful-shutdown" commands */
12819 install_element(BGP_NODE
, &bgp_graceful_shutdown_cmd
);
12820 install_element(BGP_NODE
, &no_bgp_graceful_shutdown_cmd
);
12822 /* "bgp fast-external-failover" commands */
12823 install_element(BGP_NODE
, &bgp_fast_external_failover_cmd
);
12824 install_element(BGP_NODE
, &no_bgp_fast_external_failover_cmd
);
12826 /* "bgp enforce-first-as" commands */
12827 install_element(BGP_NODE
, &bgp_enforce_first_as_cmd
);
12829 /* "bgp bestpath compare-routerid" commands */
12830 install_element(BGP_NODE
, &bgp_bestpath_compare_router_id_cmd
);
12831 install_element(BGP_NODE
, &no_bgp_bestpath_compare_router_id_cmd
);
12833 /* "bgp bestpath as-path ignore" commands */
12834 install_element(BGP_NODE
, &bgp_bestpath_aspath_ignore_cmd
);
12835 install_element(BGP_NODE
, &no_bgp_bestpath_aspath_ignore_cmd
);
12837 /* "bgp bestpath as-path confed" commands */
12838 install_element(BGP_NODE
, &bgp_bestpath_aspath_confed_cmd
);
12839 install_element(BGP_NODE
, &no_bgp_bestpath_aspath_confed_cmd
);
12841 /* "bgp bestpath as-path multipath-relax" commands */
12842 install_element(BGP_NODE
, &bgp_bestpath_aspath_multipath_relax_cmd
);
12843 install_element(BGP_NODE
, &no_bgp_bestpath_aspath_multipath_relax_cmd
);
12845 /* "bgp log-neighbor-changes" commands */
12846 install_element(BGP_NODE
, &bgp_log_neighbor_changes_cmd
);
12847 install_element(BGP_NODE
, &no_bgp_log_neighbor_changes_cmd
);
12849 /* "bgp bestpath med" commands */
12850 install_element(BGP_NODE
, &bgp_bestpath_med_cmd
);
12851 install_element(BGP_NODE
, &no_bgp_bestpath_med_cmd
);
12853 /* "no bgp default ipv4-unicast" commands. */
12854 install_element(BGP_NODE
, &no_bgp_default_ipv4_unicast_cmd
);
12855 install_element(BGP_NODE
, &bgp_default_ipv4_unicast_cmd
);
12857 /* "bgp network import-check" commands. */
12858 install_element(BGP_NODE
, &bgp_network_import_check_cmd
);
12859 install_element(BGP_NODE
, &bgp_network_import_check_exact_cmd
);
12860 install_element(BGP_NODE
, &no_bgp_network_import_check_cmd
);
12862 /* "bgp default local-preference" commands. */
12863 install_element(BGP_NODE
, &bgp_default_local_preference_cmd
);
12864 install_element(BGP_NODE
, &no_bgp_default_local_preference_cmd
);
12866 /* bgp default show-hostname */
12867 install_element(BGP_NODE
, &bgp_default_show_hostname_cmd
);
12868 install_element(BGP_NODE
, &no_bgp_default_show_hostname_cmd
);
12870 /* "bgp default subgroup-pkt-queue-max" commands. */
12871 install_element(BGP_NODE
, &bgp_default_subgroup_pkt_queue_max_cmd
);
12872 install_element(BGP_NODE
, &no_bgp_default_subgroup_pkt_queue_max_cmd
);
12874 /* bgp ibgp-allow-policy-mods command */
12875 install_element(BGP_NODE
, &bgp_rr_allow_outbound_policy_cmd
);
12876 install_element(BGP_NODE
, &no_bgp_rr_allow_outbound_policy_cmd
);
12878 /* "bgp listen limit" commands. */
12879 install_element(BGP_NODE
, &bgp_listen_limit_cmd
);
12880 install_element(BGP_NODE
, &no_bgp_listen_limit_cmd
);
12882 /* "bgp listen range" commands. */
12883 install_element(BGP_NODE
, &bgp_listen_range_cmd
);
12884 install_element(BGP_NODE
, &no_bgp_listen_range_cmd
);
12886 /* "bgp default shutdown" command */
12887 install_element(BGP_NODE
, &bgp_default_shutdown_cmd
);
12889 /* "neighbor remote-as" commands. */
12890 install_element(BGP_NODE
, &neighbor_remote_as_cmd
);
12891 install_element(BGP_NODE
, &neighbor_interface_config_cmd
);
12892 install_element(BGP_NODE
, &neighbor_interface_config_v6only_cmd
);
12893 install_element(BGP_NODE
, &neighbor_interface_config_remote_as_cmd
);
12894 install_element(BGP_NODE
,
12895 &neighbor_interface_v6only_config_remote_as_cmd
);
12896 install_element(BGP_NODE
, &no_neighbor_cmd
);
12897 install_element(BGP_NODE
, &no_neighbor_interface_config_cmd
);
12899 /* "neighbor peer-group" commands. */
12900 install_element(BGP_NODE
, &neighbor_peer_group_cmd
);
12901 install_element(BGP_NODE
, &no_neighbor_peer_group_cmd
);
12902 install_element(BGP_NODE
,
12903 &no_neighbor_interface_peer_group_remote_as_cmd
);
12905 /* "neighbor local-as" commands. */
12906 install_element(BGP_NODE
, &neighbor_local_as_cmd
);
12907 install_element(BGP_NODE
, &neighbor_local_as_no_prepend_cmd
);
12908 install_element(BGP_NODE
, &neighbor_local_as_no_prepend_replace_as_cmd
);
12909 install_element(BGP_NODE
, &no_neighbor_local_as_cmd
);
12911 /* "neighbor solo" commands. */
12912 install_element(BGP_NODE
, &neighbor_solo_cmd
);
12913 install_element(BGP_NODE
, &no_neighbor_solo_cmd
);
12915 /* "neighbor password" commands. */
12916 install_element(BGP_NODE
, &neighbor_password_cmd
);
12917 install_element(BGP_NODE
, &no_neighbor_password_cmd
);
12919 /* "neighbor activate" commands. */
12920 install_element(BGP_NODE
, &neighbor_activate_hidden_cmd
);
12921 install_element(BGP_IPV4_NODE
, &neighbor_activate_cmd
);
12922 install_element(BGP_IPV4M_NODE
, &neighbor_activate_cmd
);
12923 install_element(BGP_IPV4L_NODE
, &neighbor_activate_cmd
);
12924 install_element(BGP_IPV6_NODE
, &neighbor_activate_cmd
);
12925 install_element(BGP_IPV6M_NODE
, &neighbor_activate_cmd
);
12926 install_element(BGP_IPV6L_NODE
, &neighbor_activate_cmd
);
12927 install_element(BGP_VPNV4_NODE
, &neighbor_activate_cmd
);
12928 install_element(BGP_VPNV6_NODE
, &neighbor_activate_cmd
);
12929 install_element(BGP_FLOWSPECV4_NODE
, &neighbor_activate_cmd
);
12930 install_element(BGP_FLOWSPECV6_NODE
, &neighbor_activate_cmd
);
12931 install_element(BGP_EVPN_NODE
, &neighbor_activate_cmd
);
12933 /* "no neighbor activate" commands. */
12934 install_element(BGP_NODE
, &no_neighbor_activate_hidden_cmd
);
12935 install_element(BGP_IPV4_NODE
, &no_neighbor_activate_cmd
);
12936 install_element(BGP_IPV4M_NODE
, &no_neighbor_activate_cmd
);
12937 install_element(BGP_IPV4L_NODE
, &no_neighbor_activate_cmd
);
12938 install_element(BGP_IPV6_NODE
, &no_neighbor_activate_cmd
);
12939 install_element(BGP_IPV6M_NODE
, &no_neighbor_activate_cmd
);
12940 install_element(BGP_IPV6L_NODE
, &no_neighbor_activate_cmd
);
12941 install_element(BGP_VPNV4_NODE
, &no_neighbor_activate_cmd
);
12942 install_element(BGP_VPNV6_NODE
, &no_neighbor_activate_cmd
);
12943 install_element(BGP_FLOWSPECV4_NODE
, &no_neighbor_activate_cmd
);
12944 install_element(BGP_FLOWSPECV6_NODE
, &no_neighbor_activate_cmd
);
12945 install_element(BGP_EVPN_NODE
, &no_neighbor_activate_cmd
);
12947 /* "neighbor peer-group" set commands. */
12948 install_element(BGP_NODE
, &neighbor_set_peer_group_cmd
);
12949 install_element(BGP_IPV4_NODE
, &neighbor_set_peer_group_hidden_cmd
);
12950 install_element(BGP_IPV4M_NODE
, &neighbor_set_peer_group_hidden_cmd
);
12951 install_element(BGP_IPV6_NODE
, &neighbor_set_peer_group_hidden_cmd
);
12952 install_element(BGP_IPV6M_NODE
, &neighbor_set_peer_group_hidden_cmd
);
12953 install_element(BGP_IPV6L_NODE
, &neighbor_set_peer_group_hidden_cmd
);
12954 install_element(BGP_VPNV4_NODE
, &neighbor_set_peer_group_hidden_cmd
);
12955 install_element(BGP_VPNV6_NODE
, &neighbor_set_peer_group_hidden_cmd
);
12956 install_element(BGP_FLOWSPECV4_NODE
,
12957 &neighbor_set_peer_group_hidden_cmd
);
12958 install_element(BGP_FLOWSPECV6_NODE
,
12959 &neighbor_set_peer_group_hidden_cmd
);
12961 /* "no neighbor peer-group unset" commands. */
12962 install_element(BGP_NODE
, &no_neighbor_set_peer_group_cmd
);
12963 install_element(BGP_IPV4_NODE
, &no_neighbor_set_peer_group_hidden_cmd
);
12964 install_element(BGP_IPV4M_NODE
, &no_neighbor_set_peer_group_hidden_cmd
);
12965 install_element(BGP_IPV6_NODE
, &no_neighbor_set_peer_group_hidden_cmd
);
12966 install_element(BGP_IPV6M_NODE
, &no_neighbor_set_peer_group_hidden_cmd
);
12967 install_element(BGP_IPV6L_NODE
, &no_neighbor_set_peer_group_hidden_cmd
);
12968 install_element(BGP_VPNV4_NODE
, &no_neighbor_set_peer_group_hidden_cmd
);
12969 install_element(BGP_VPNV6_NODE
, &no_neighbor_set_peer_group_hidden_cmd
);
12970 install_element(BGP_FLOWSPECV4_NODE
,
12971 &no_neighbor_set_peer_group_hidden_cmd
);
12972 install_element(BGP_FLOWSPECV6_NODE
,
12973 &no_neighbor_set_peer_group_hidden_cmd
);
12975 /* "neighbor softreconfiguration inbound" commands.*/
12976 install_element(BGP_NODE
, &neighbor_soft_reconfiguration_hidden_cmd
);
12977 install_element(BGP_NODE
, &no_neighbor_soft_reconfiguration_hidden_cmd
);
12978 install_element(BGP_IPV4_NODE
, &neighbor_soft_reconfiguration_cmd
);
12979 install_element(BGP_IPV4_NODE
, &no_neighbor_soft_reconfiguration_cmd
);
12980 install_element(BGP_IPV4L_NODE
, &neighbor_soft_reconfiguration_cmd
);
12981 install_element(BGP_IPV4L_NODE
, &no_neighbor_soft_reconfiguration_cmd
);
12982 install_element(BGP_IPV4M_NODE
, &neighbor_soft_reconfiguration_cmd
);
12983 install_element(BGP_IPV4M_NODE
, &no_neighbor_soft_reconfiguration_cmd
);
12984 install_element(BGP_IPV6_NODE
, &neighbor_soft_reconfiguration_cmd
);
12985 install_element(BGP_IPV6_NODE
, &no_neighbor_soft_reconfiguration_cmd
);
12986 install_element(BGP_IPV6M_NODE
, &neighbor_soft_reconfiguration_cmd
);
12987 install_element(BGP_IPV6M_NODE
, &no_neighbor_soft_reconfiguration_cmd
);
12988 install_element(BGP_IPV6L_NODE
, &neighbor_soft_reconfiguration_cmd
);
12989 install_element(BGP_IPV6L_NODE
, &no_neighbor_soft_reconfiguration_cmd
);
12990 install_element(BGP_VPNV4_NODE
, &neighbor_soft_reconfiguration_cmd
);
12991 install_element(BGP_VPNV4_NODE
, &no_neighbor_soft_reconfiguration_cmd
);
12992 install_element(BGP_VPNV6_NODE
, &neighbor_soft_reconfiguration_cmd
);
12993 install_element(BGP_VPNV6_NODE
, &no_neighbor_soft_reconfiguration_cmd
);
12994 install_element(BGP_FLOWSPECV4_NODE
,
12995 &neighbor_soft_reconfiguration_cmd
);
12996 install_element(BGP_FLOWSPECV4_NODE
,
12997 &no_neighbor_soft_reconfiguration_cmd
);
12998 install_element(BGP_FLOWSPECV6_NODE
,
12999 &neighbor_soft_reconfiguration_cmd
);
13000 install_element(BGP_FLOWSPECV6_NODE
,
13001 &no_neighbor_soft_reconfiguration_cmd
);
13003 /* "neighbor attribute-unchanged" commands. */
13004 install_element(BGP_NODE
, &neighbor_attr_unchanged_hidden_cmd
);
13005 install_element(BGP_NODE
, &no_neighbor_attr_unchanged_hidden_cmd
);
13006 install_element(BGP_IPV4_NODE
, &neighbor_attr_unchanged_cmd
);
13007 install_element(BGP_IPV4_NODE
, &no_neighbor_attr_unchanged_cmd
);
13008 install_element(BGP_IPV4M_NODE
, &neighbor_attr_unchanged_cmd
);
13009 install_element(BGP_IPV4M_NODE
, &no_neighbor_attr_unchanged_cmd
);
13010 install_element(BGP_IPV4L_NODE
, &neighbor_attr_unchanged_cmd
);
13011 install_element(BGP_IPV4L_NODE
, &no_neighbor_attr_unchanged_cmd
);
13012 install_element(BGP_IPV6_NODE
, &neighbor_attr_unchanged_cmd
);
13013 install_element(BGP_IPV6_NODE
, &no_neighbor_attr_unchanged_cmd
);
13014 install_element(BGP_IPV6M_NODE
, &neighbor_attr_unchanged_cmd
);
13015 install_element(BGP_IPV6M_NODE
, &no_neighbor_attr_unchanged_cmd
);
13016 install_element(BGP_IPV6L_NODE
, &neighbor_attr_unchanged_cmd
);
13017 install_element(BGP_IPV6L_NODE
, &no_neighbor_attr_unchanged_cmd
);
13018 install_element(BGP_VPNV4_NODE
, &neighbor_attr_unchanged_cmd
);
13019 install_element(BGP_VPNV4_NODE
, &no_neighbor_attr_unchanged_cmd
);
13020 install_element(BGP_VPNV6_NODE
, &neighbor_attr_unchanged_cmd
);
13021 install_element(BGP_VPNV6_NODE
, &no_neighbor_attr_unchanged_cmd
);
13023 install_element(BGP_EVPN_NODE
, &neighbor_attr_unchanged_cmd
);
13024 install_element(BGP_EVPN_NODE
, &no_neighbor_attr_unchanged_cmd
);
13026 /* "nexthop-local unchanged" commands */
13027 install_element(BGP_IPV6_NODE
, &neighbor_nexthop_local_unchanged_cmd
);
13028 install_element(BGP_IPV6_NODE
,
13029 &no_neighbor_nexthop_local_unchanged_cmd
);
13031 /* "neighbor next-hop-self" commands. */
13032 install_element(BGP_NODE
, &neighbor_nexthop_self_hidden_cmd
);
13033 install_element(BGP_NODE
, &no_neighbor_nexthop_self_hidden_cmd
);
13034 install_element(BGP_IPV4_NODE
, &neighbor_nexthop_self_cmd
);
13035 install_element(BGP_IPV4_NODE
, &no_neighbor_nexthop_self_cmd
);
13036 install_element(BGP_IPV4M_NODE
, &neighbor_nexthop_self_cmd
);
13037 install_element(BGP_IPV4M_NODE
, &no_neighbor_nexthop_self_cmd
);
13038 install_element(BGP_IPV4L_NODE
, &neighbor_nexthop_self_cmd
);
13039 install_element(BGP_IPV4L_NODE
, &no_neighbor_nexthop_self_cmd
);
13040 install_element(BGP_IPV6_NODE
, &neighbor_nexthop_self_cmd
);
13041 install_element(BGP_IPV6_NODE
, &no_neighbor_nexthop_self_cmd
);
13042 install_element(BGP_IPV6M_NODE
, &neighbor_nexthop_self_cmd
);
13043 install_element(BGP_IPV6M_NODE
, &no_neighbor_nexthop_self_cmd
);
13044 install_element(BGP_IPV6L_NODE
, &neighbor_nexthop_self_cmd
);
13045 install_element(BGP_IPV6L_NODE
, &no_neighbor_nexthop_self_cmd
);
13046 install_element(BGP_VPNV4_NODE
, &neighbor_nexthop_self_cmd
);
13047 install_element(BGP_VPNV4_NODE
, &no_neighbor_nexthop_self_cmd
);
13048 install_element(BGP_VPNV6_NODE
, &neighbor_nexthop_self_cmd
);
13049 install_element(BGP_VPNV6_NODE
, &no_neighbor_nexthop_self_cmd
);
13050 install_element(BGP_EVPN_NODE
, &neighbor_nexthop_self_cmd
);
13051 install_element(BGP_EVPN_NODE
, &no_neighbor_nexthop_self_cmd
);
13053 /* "neighbor next-hop-self force" commands. */
13054 install_element(BGP_NODE
, &neighbor_nexthop_self_force_hidden_cmd
);
13055 install_element(BGP_NODE
, &no_neighbor_nexthop_self_force_hidden_cmd
);
13056 install_element(BGP_IPV4_NODE
, &neighbor_nexthop_self_force_cmd
);
13057 install_element(BGP_IPV4_NODE
, &no_neighbor_nexthop_self_force_cmd
);
13058 install_element(BGP_IPV4M_NODE
, &neighbor_nexthop_self_force_cmd
);
13059 install_element(BGP_IPV4M_NODE
, &no_neighbor_nexthop_self_force_cmd
);
13060 install_element(BGP_IPV4L_NODE
, &neighbor_nexthop_self_force_cmd
);
13061 install_element(BGP_IPV4L_NODE
, &no_neighbor_nexthop_self_force_cmd
);
13062 install_element(BGP_IPV6_NODE
, &neighbor_nexthop_self_force_cmd
);
13063 install_element(BGP_IPV6_NODE
, &no_neighbor_nexthop_self_force_cmd
);
13064 install_element(BGP_IPV6M_NODE
, &neighbor_nexthop_self_force_cmd
);
13065 install_element(BGP_IPV6M_NODE
, &no_neighbor_nexthop_self_force_cmd
);
13066 install_element(BGP_IPV6L_NODE
, &neighbor_nexthop_self_force_cmd
);
13067 install_element(BGP_IPV6L_NODE
, &no_neighbor_nexthop_self_force_cmd
);
13068 install_element(BGP_VPNV4_NODE
, &neighbor_nexthop_self_force_cmd
);
13069 install_element(BGP_VPNV4_NODE
, &no_neighbor_nexthop_self_force_cmd
);
13070 install_element(BGP_VPNV6_NODE
, &neighbor_nexthop_self_force_cmd
);
13071 install_element(BGP_VPNV6_NODE
, &no_neighbor_nexthop_self_force_cmd
);
13073 /* "neighbor as-override" commands. */
13074 install_element(BGP_NODE
, &neighbor_as_override_hidden_cmd
);
13075 install_element(BGP_NODE
, &no_neighbor_as_override_hidden_cmd
);
13076 install_element(BGP_IPV4_NODE
, &neighbor_as_override_cmd
);
13077 install_element(BGP_IPV4_NODE
, &no_neighbor_as_override_cmd
);
13078 install_element(BGP_IPV4M_NODE
, &neighbor_as_override_cmd
);
13079 install_element(BGP_IPV4M_NODE
, &no_neighbor_as_override_cmd
);
13080 install_element(BGP_IPV4L_NODE
, &neighbor_as_override_cmd
);
13081 install_element(BGP_IPV4L_NODE
, &no_neighbor_as_override_cmd
);
13082 install_element(BGP_IPV6_NODE
, &neighbor_as_override_cmd
);
13083 install_element(BGP_IPV6_NODE
, &no_neighbor_as_override_cmd
);
13084 install_element(BGP_IPV6M_NODE
, &neighbor_as_override_cmd
);
13085 install_element(BGP_IPV6M_NODE
, &no_neighbor_as_override_cmd
);
13086 install_element(BGP_IPV6L_NODE
, &neighbor_as_override_cmd
);
13087 install_element(BGP_IPV6L_NODE
, &no_neighbor_as_override_cmd
);
13088 install_element(BGP_VPNV4_NODE
, &neighbor_as_override_cmd
);
13089 install_element(BGP_VPNV4_NODE
, &no_neighbor_as_override_cmd
);
13090 install_element(BGP_VPNV6_NODE
, &neighbor_as_override_cmd
);
13091 install_element(BGP_VPNV6_NODE
, &no_neighbor_as_override_cmd
);
13093 /* "neighbor remove-private-AS" commands. */
13094 install_element(BGP_NODE
, &neighbor_remove_private_as_hidden_cmd
);
13095 install_element(BGP_NODE
, &no_neighbor_remove_private_as_hidden_cmd
);
13096 install_element(BGP_NODE
, &neighbor_remove_private_as_all_hidden_cmd
);
13097 install_element(BGP_NODE
,
13098 &no_neighbor_remove_private_as_all_hidden_cmd
);
13099 install_element(BGP_NODE
,
13100 &neighbor_remove_private_as_replace_as_hidden_cmd
);
13101 install_element(BGP_NODE
,
13102 &no_neighbor_remove_private_as_replace_as_hidden_cmd
);
13103 install_element(BGP_NODE
,
13104 &neighbor_remove_private_as_all_replace_as_hidden_cmd
);
13107 &no_neighbor_remove_private_as_all_replace_as_hidden_cmd
);
13108 install_element(BGP_IPV4_NODE
, &neighbor_remove_private_as_cmd
);
13109 install_element(BGP_IPV4_NODE
, &no_neighbor_remove_private_as_cmd
);
13110 install_element(BGP_IPV4_NODE
, &neighbor_remove_private_as_all_cmd
);
13111 install_element(BGP_IPV4_NODE
, &no_neighbor_remove_private_as_all_cmd
);
13112 install_element(BGP_IPV4_NODE
,
13113 &neighbor_remove_private_as_replace_as_cmd
);
13114 install_element(BGP_IPV4_NODE
,
13115 &no_neighbor_remove_private_as_replace_as_cmd
);
13116 install_element(BGP_IPV4_NODE
,
13117 &neighbor_remove_private_as_all_replace_as_cmd
);
13118 install_element(BGP_IPV4_NODE
,
13119 &no_neighbor_remove_private_as_all_replace_as_cmd
);
13120 install_element(BGP_IPV4M_NODE
, &neighbor_remove_private_as_cmd
);
13121 install_element(BGP_IPV4M_NODE
, &no_neighbor_remove_private_as_cmd
);
13122 install_element(BGP_IPV4M_NODE
, &neighbor_remove_private_as_all_cmd
);
13123 install_element(BGP_IPV4M_NODE
, &no_neighbor_remove_private_as_all_cmd
);
13124 install_element(BGP_IPV4M_NODE
,
13125 &neighbor_remove_private_as_replace_as_cmd
);
13126 install_element(BGP_IPV4M_NODE
,
13127 &no_neighbor_remove_private_as_replace_as_cmd
);
13128 install_element(BGP_IPV4M_NODE
,
13129 &neighbor_remove_private_as_all_replace_as_cmd
);
13130 install_element(BGP_IPV4M_NODE
,
13131 &no_neighbor_remove_private_as_all_replace_as_cmd
);
13132 install_element(BGP_IPV4L_NODE
, &neighbor_remove_private_as_cmd
);
13133 install_element(BGP_IPV4L_NODE
, &no_neighbor_remove_private_as_cmd
);
13134 install_element(BGP_IPV4L_NODE
, &neighbor_remove_private_as_all_cmd
);
13135 install_element(BGP_IPV4L_NODE
, &no_neighbor_remove_private_as_all_cmd
);
13136 install_element(BGP_IPV4L_NODE
,
13137 &neighbor_remove_private_as_replace_as_cmd
);
13138 install_element(BGP_IPV4L_NODE
,
13139 &no_neighbor_remove_private_as_replace_as_cmd
);
13140 install_element(BGP_IPV4L_NODE
,
13141 &neighbor_remove_private_as_all_replace_as_cmd
);
13142 install_element(BGP_IPV4L_NODE
,
13143 &no_neighbor_remove_private_as_all_replace_as_cmd
);
13144 install_element(BGP_IPV6_NODE
, &neighbor_remove_private_as_cmd
);
13145 install_element(BGP_IPV6_NODE
, &no_neighbor_remove_private_as_cmd
);
13146 install_element(BGP_IPV6_NODE
, &neighbor_remove_private_as_all_cmd
);
13147 install_element(BGP_IPV6_NODE
, &no_neighbor_remove_private_as_all_cmd
);
13148 install_element(BGP_IPV6_NODE
,
13149 &neighbor_remove_private_as_replace_as_cmd
);
13150 install_element(BGP_IPV6_NODE
,
13151 &no_neighbor_remove_private_as_replace_as_cmd
);
13152 install_element(BGP_IPV6_NODE
,
13153 &neighbor_remove_private_as_all_replace_as_cmd
);
13154 install_element(BGP_IPV6_NODE
,
13155 &no_neighbor_remove_private_as_all_replace_as_cmd
);
13156 install_element(BGP_IPV6M_NODE
, &neighbor_remove_private_as_cmd
);
13157 install_element(BGP_IPV6M_NODE
, &no_neighbor_remove_private_as_cmd
);
13158 install_element(BGP_IPV6M_NODE
, &neighbor_remove_private_as_all_cmd
);
13159 install_element(BGP_IPV6M_NODE
, &no_neighbor_remove_private_as_all_cmd
);
13160 install_element(BGP_IPV6M_NODE
,
13161 &neighbor_remove_private_as_replace_as_cmd
);
13162 install_element(BGP_IPV6M_NODE
,
13163 &no_neighbor_remove_private_as_replace_as_cmd
);
13164 install_element(BGP_IPV6M_NODE
,
13165 &neighbor_remove_private_as_all_replace_as_cmd
);
13166 install_element(BGP_IPV6M_NODE
,
13167 &no_neighbor_remove_private_as_all_replace_as_cmd
);
13168 install_element(BGP_IPV6L_NODE
, &neighbor_remove_private_as_cmd
);
13169 install_element(BGP_IPV6L_NODE
, &no_neighbor_remove_private_as_cmd
);
13170 install_element(BGP_IPV6L_NODE
, &neighbor_remove_private_as_all_cmd
);
13171 install_element(BGP_IPV6L_NODE
, &no_neighbor_remove_private_as_all_cmd
);
13172 install_element(BGP_IPV6L_NODE
,
13173 &neighbor_remove_private_as_replace_as_cmd
);
13174 install_element(BGP_IPV6L_NODE
,
13175 &no_neighbor_remove_private_as_replace_as_cmd
);
13176 install_element(BGP_IPV6L_NODE
,
13177 &neighbor_remove_private_as_all_replace_as_cmd
);
13178 install_element(BGP_IPV6L_NODE
,
13179 &no_neighbor_remove_private_as_all_replace_as_cmd
);
13180 install_element(BGP_VPNV4_NODE
, &neighbor_remove_private_as_cmd
);
13181 install_element(BGP_VPNV4_NODE
, &no_neighbor_remove_private_as_cmd
);
13182 install_element(BGP_VPNV4_NODE
, &neighbor_remove_private_as_all_cmd
);
13183 install_element(BGP_VPNV4_NODE
, &no_neighbor_remove_private_as_all_cmd
);
13184 install_element(BGP_VPNV4_NODE
,
13185 &neighbor_remove_private_as_replace_as_cmd
);
13186 install_element(BGP_VPNV4_NODE
,
13187 &no_neighbor_remove_private_as_replace_as_cmd
);
13188 install_element(BGP_VPNV4_NODE
,
13189 &neighbor_remove_private_as_all_replace_as_cmd
);
13190 install_element(BGP_VPNV4_NODE
,
13191 &no_neighbor_remove_private_as_all_replace_as_cmd
);
13192 install_element(BGP_VPNV6_NODE
, &neighbor_remove_private_as_cmd
);
13193 install_element(BGP_VPNV6_NODE
, &no_neighbor_remove_private_as_cmd
);
13194 install_element(BGP_VPNV6_NODE
, &neighbor_remove_private_as_all_cmd
);
13195 install_element(BGP_VPNV6_NODE
, &no_neighbor_remove_private_as_all_cmd
);
13196 install_element(BGP_VPNV6_NODE
,
13197 &neighbor_remove_private_as_replace_as_cmd
);
13198 install_element(BGP_VPNV6_NODE
,
13199 &no_neighbor_remove_private_as_replace_as_cmd
);
13200 install_element(BGP_VPNV6_NODE
,
13201 &neighbor_remove_private_as_all_replace_as_cmd
);
13202 install_element(BGP_VPNV6_NODE
,
13203 &no_neighbor_remove_private_as_all_replace_as_cmd
);
13205 /* "neighbor send-community" commands.*/
13206 install_element(BGP_NODE
, &neighbor_send_community_hidden_cmd
);
13207 install_element(BGP_NODE
, &neighbor_send_community_type_hidden_cmd
);
13208 install_element(BGP_NODE
, &no_neighbor_send_community_hidden_cmd
);
13209 install_element(BGP_NODE
, &no_neighbor_send_community_type_hidden_cmd
);
13210 install_element(BGP_IPV4_NODE
, &neighbor_send_community_cmd
);
13211 install_element(BGP_IPV4_NODE
, &neighbor_send_community_type_cmd
);
13212 install_element(BGP_IPV4_NODE
, &no_neighbor_send_community_cmd
);
13213 install_element(BGP_IPV4_NODE
, &no_neighbor_send_community_type_cmd
);
13214 install_element(BGP_IPV4M_NODE
, &neighbor_send_community_cmd
);
13215 install_element(BGP_IPV4M_NODE
, &neighbor_send_community_type_cmd
);
13216 install_element(BGP_IPV4M_NODE
, &no_neighbor_send_community_cmd
);
13217 install_element(BGP_IPV4M_NODE
, &no_neighbor_send_community_type_cmd
);
13218 install_element(BGP_IPV4L_NODE
, &neighbor_send_community_cmd
);
13219 install_element(BGP_IPV4L_NODE
, &neighbor_send_community_type_cmd
);
13220 install_element(BGP_IPV4L_NODE
, &no_neighbor_send_community_cmd
);
13221 install_element(BGP_IPV4L_NODE
, &no_neighbor_send_community_type_cmd
);
13222 install_element(BGP_IPV6_NODE
, &neighbor_send_community_cmd
);
13223 install_element(BGP_IPV6_NODE
, &neighbor_send_community_type_cmd
);
13224 install_element(BGP_IPV6_NODE
, &no_neighbor_send_community_cmd
);
13225 install_element(BGP_IPV6_NODE
, &no_neighbor_send_community_type_cmd
);
13226 install_element(BGP_IPV6M_NODE
, &neighbor_send_community_cmd
);
13227 install_element(BGP_IPV6M_NODE
, &neighbor_send_community_type_cmd
);
13228 install_element(BGP_IPV6M_NODE
, &no_neighbor_send_community_cmd
);
13229 install_element(BGP_IPV6M_NODE
, &no_neighbor_send_community_type_cmd
);
13230 install_element(BGP_IPV6L_NODE
, &neighbor_send_community_cmd
);
13231 install_element(BGP_IPV6L_NODE
, &neighbor_send_community_type_cmd
);
13232 install_element(BGP_IPV6L_NODE
, &no_neighbor_send_community_cmd
);
13233 install_element(BGP_IPV6L_NODE
, &no_neighbor_send_community_type_cmd
);
13234 install_element(BGP_VPNV4_NODE
, &neighbor_send_community_cmd
);
13235 install_element(BGP_VPNV4_NODE
, &neighbor_send_community_type_cmd
);
13236 install_element(BGP_VPNV4_NODE
, &no_neighbor_send_community_cmd
);
13237 install_element(BGP_VPNV4_NODE
, &no_neighbor_send_community_type_cmd
);
13238 install_element(BGP_VPNV6_NODE
, &neighbor_send_community_cmd
);
13239 install_element(BGP_VPNV6_NODE
, &neighbor_send_community_type_cmd
);
13240 install_element(BGP_VPNV6_NODE
, &no_neighbor_send_community_cmd
);
13241 install_element(BGP_VPNV6_NODE
, &no_neighbor_send_community_type_cmd
);
13243 /* "neighbor route-reflector" commands.*/
13244 install_element(BGP_NODE
, &neighbor_route_reflector_client_hidden_cmd
);
13245 install_element(BGP_NODE
,
13246 &no_neighbor_route_reflector_client_hidden_cmd
);
13247 install_element(BGP_IPV4_NODE
, &neighbor_route_reflector_client_cmd
);
13248 install_element(BGP_IPV4_NODE
, &no_neighbor_route_reflector_client_cmd
);
13249 install_element(BGP_IPV4M_NODE
, &neighbor_route_reflector_client_cmd
);
13250 install_element(BGP_IPV4M_NODE
,
13251 &no_neighbor_route_reflector_client_cmd
);
13252 install_element(BGP_IPV4L_NODE
, &neighbor_route_reflector_client_cmd
);
13253 install_element(BGP_IPV4L_NODE
,
13254 &no_neighbor_route_reflector_client_cmd
);
13255 install_element(BGP_IPV6_NODE
, &neighbor_route_reflector_client_cmd
);
13256 install_element(BGP_IPV6_NODE
, &no_neighbor_route_reflector_client_cmd
);
13257 install_element(BGP_IPV6M_NODE
, &neighbor_route_reflector_client_cmd
);
13258 install_element(BGP_IPV6M_NODE
,
13259 &no_neighbor_route_reflector_client_cmd
);
13260 install_element(BGP_IPV6L_NODE
, &neighbor_route_reflector_client_cmd
);
13261 install_element(BGP_IPV6L_NODE
,
13262 &no_neighbor_route_reflector_client_cmd
);
13263 install_element(BGP_VPNV4_NODE
, &neighbor_route_reflector_client_cmd
);
13264 install_element(BGP_VPNV4_NODE
,
13265 &no_neighbor_route_reflector_client_cmd
);
13266 install_element(BGP_VPNV6_NODE
, &neighbor_route_reflector_client_cmd
);
13267 install_element(BGP_VPNV6_NODE
,
13268 &no_neighbor_route_reflector_client_cmd
);
13269 install_element(BGP_FLOWSPECV4_NODE
,
13270 &neighbor_route_reflector_client_cmd
);
13271 install_element(BGP_FLOWSPECV4_NODE
,
13272 &no_neighbor_route_reflector_client_cmd
);
13273 install_element(BGP_FLOWSPECV6_NODE
,
13274 &neighbor_route_reflector_client_cmd
);
13275 install_element(BGP_FLOWSPECV6_NODE
,
13276 &no_neighbor_route_reflector_client_cmd
);
13277 install_element(BGP_EVPN_NODE
, &neighbor_route_reflector_client_cmd
);
13278 install_element(BGP_EVPN_NODE
, &no_neighbor_route_reflector_client_cmd
);
13280 /* "neighbor route-server" commands.*/
13281 install_element(BGP_NODE
, &neighbor_route_server_client_hidden_cmd
);
13282 install_element(BGP_NODE
, &no_neighbor_route_server_client_hidden_cmd
);
13283 install_element(BGP_IPV4_NODE
, &neighbor_route_server_client_cmd
);
13284 install_element(BGP_IPV4_NODE
, &no_neighbor_route_server_client_cmd
);
13285 install_element(BGP_IPV4M_NODE
, &neighbor_route_server_client_cmd
);
13286 install_element(BGP_IPV4M_NODE
, &no_neighbor_route_server_client_cmd
);
13287 install_element(BGP_IPV4L_NODE
, &neighbor_route_server_client_cmd
);
13288 install_element(BGP_IPV4L_NODE
, &no_neighbor_route_server_client_cmd
);
13289 install_element(BGP_IPV6_NODE
, &neighbor_route_server_client_cmd
);
13290 install_element(BGP_IPV6_NODE
, &no_neighbor_route_server_client_cmd
);
13291 install_element(BGP_IPV6M_NODE
, &neighbor_route_server_client_cmd
);
13292 install_element(BGP_IPV6M_NODE
, &no_neighbor_route_server_client_cmd
);
13293 install_element(BGP_IPV6L_NODE
, &neighbor_route_server_client_cmd
);
13294 install_element(BGP_IPV6L_NODE
, &no_neighbor_route_server_client_cmd
);
13295 install_element(BGP_VPNV4_NODE
, &neighbor_route_server_client_cmd
);
13296 install_element(BGP_VPNV4_NODE
, &no_neighbor_route_server_client_cmd
);
13297 install_element(BGP_VPNV6_NODE
, &neighbor_route_server_client_cmd
);
13298 install_element(BGP_VPNV6_NODE
, &no_neighbor_route_server_client_cmd
);
13299 install_element(BGP_EVPN_NODE
, &neighbor_route_server_client_cmd
);
13300 install_element(BGP_EVPN_NODE
, &no_neighbor_route_server_client_cmd
);
13301 install_element(BGP_FLOWSPECV4_NODE
, &neighbor_route_server_client_cmd
);
13302 install_element(BGP_FLOWSPECV4_NODE
,
13303 &no_neighbor_route_server_client_cmd
);
13304 install_element(BGP_FLOWSPECV6_NODE
, &neighbor_route_server_client_cmd
);
13305 install_element(BGP_FLOWSPECV6_NODE
,
13306 &no_neighbor_route_server_client_cmd
);
13308 /* "neighbor addpath-tx-all-paths" commands.*/
13309 install_element(BGP_NODE
, &neighbor_addpath_tx_all_paths_hidden_cmd
);
13310 install_element(BGP_NODE
, &no_neighbor_addpath_tx_all_paths_hidden_cmd
);
13311 install_element(BGP_IPV4_NODE
, &neighbor_addpath_tx_all_paths_cmd
);
13312 install_element(BGP_IPV4_NODE
, &no_neighbor_addpath_tx_all_paths_cmd
);
13313 install_element(BGP_IPV4M_NODE
, &neighbor_addpath_tx_all_paths_cmd
);
13314 install_element(BGP_IPV4M_NODE
, &no_neighbor_addpath_tx_all_paths_cmd
);
13315 install_element(BGP_IPV4L_NODE
, &neighbor_addpath_tx_all_paths_cmd
);
13316 install_element(BGP_IPV4L_NODE
, &no_neighbor_addpath_tx_all_paths_cmd
);
13317 install_element(BGP_IPV6_NODE
, &neighbor_addpath_tx_all_paths_cmd
);
13318 install_element(BGP_IPV6_NODE
, &no_neighbor_addpath_tx_all_paths_cmd
);
13319 install_element(BGP_IPV6M_NODE
, &neighbor_addpath_tx_all_paths_cmd
);
13320 install_element(BGP_IPV6M_NODE
, &no_neighbor_addpath_tx_all_paths_cmd
);
13321 install_element(BGP_IPV6L_NODE
, &neighbor_addpath_tx_all_paths_cmd
);
13322 install_element(BGP_IPV6L_NODE
, &no_neighbor_addpath_tx_all_paths_cmd
);
13323 install_element(BGP_VPNV4_NODE
, &neighbor_addpath_tx_all_paths_cmd
);
13324 install_element(BGP_VPNV4_NODE
, &no_neighbor_addpath_tx_all_paths_cmd
);
13325 install_element(BGP_VPNV6_NODE
, &neighbor_addpath_tx_all_paths_cmd
);
13326 install_element(BGP_VPNV6_NODE
, &no_neighbor_addpath_tx_all_paths_cmd
);
13328 /* "neighbor addpath-tx-bestpath-per-AS" commands.*/
13329 install_element(BGP_NODE
,
13330 &neighbor_addpath_tx_bestpath_per_as_hidden_cmd
);
13331 install_element(BGP_NODE
,
13332 &no_neighbor_addpath_tx_bestpath_per_as_hidden_cmd
);
13333 install_element(BGP_IPV4_NODE
,
13334 &neighbor_addpath_tx_bestpath_per_as_cmd
);
13335 install_element(BGP_IPV4_NODE
,
13336 &no_neighbor_addpath_tx_bestpath_per_as_cmd
);
13337 install_element(BGP_IPV4M_NODE
,
13338 &neighbor_addpath_tx_bestpath_per_as_cmd
);
13339 install_element(BGP_IPV4M_NODE
,
13340 &no_neighbor_addpath_tx_bestpath_per_as_cmd
);
13341 install_element(BGP_IPV4L_NODE
,
13342 &neighbor_addpath_tx_bestpath_per_as_cmd
);
13343 install_element(BGP_IPV4L_NODE
,
13344 &no_neighbor_addpath_tx_bestpath_per_as_cmd
);
13345 install_element(BGP_IPV6_NODE
,
13346 &neighbor_addpath_tx_bestpath_per_as_cmd
);
13347 install_element(BGP_IPV6_NODE
,
13348 &no_neighbor_addpath_tx_bestpath_per_as_cmd
);
13349 install_element(BGP_IPV6M_NODE
,
13350 &neighbor_addpath_tx_bestpath_per_as_cmd
);
13351 install_element(BGP_IPV6M_NODE
,
13352 &no_neighbor_addpath_tx_bestpath_per_as_cmd
);
13353 install_element(BGP_IPV6L_NODE
,
13354 &neighbor_addpath_tx_bestpath_per_as_cmd
);
13355 install_element(BGP_IPV6L_NODE
,
13356 &no_neighbor_addpath_tx_bestpath_per_as_cmd
);
13357 install_element(BGP_VPNV4_NODE
,
13358 &neighbor_addpath_tx_bestpath_per_as_cmd
);
13359 install_element(BGP_VPNV4_NODE
,
13360 &no_neighbor_addpath_tx_bestpath_per_as_cmd
);
13361 install_element(BGP_VPNV6_NODE
,
13362 &neighbor_addpath_tx_bestpath_per_as_cmd
);
13363 install_element(BGP_VPNV6_NODE
,
13364 &no_neighbor_addpath_tx_bestpath_per_as_cmd
);
13366 /* "neighbor passive" commands. */
13367 install_element(BGP_NODE
, &neighbor_passive_cmd
);
13368 install_element(BGP_NODE
, &no_neighbor_passive_cmd
);
13371 /* "neighbor shutdown" commands. */
13372 install_element(BGP_NODE
, &neighbor_shutdown_cmd
);
13373 install_element(BGP_NODE
, &no_neighbor_shutdown_cmd
);
13374 install_element(BGP_NODE
, &neighbor_shutdown_msg_cmd
);
13375 install_element(BGP_NODE
, &no_neighbor_shutdown_msg_cmd
);
13377 /* "neighbor capability extended-nexthop" commands.*/
13378 install_element(BGP_NODE
, &neighbor_capability_enhe_cmd
);
13379 install_element(BGP_NODE
, &no_neighbor_capability_enhe_cmd
);
13381 /* "neighbor capability orf prefix-list" commands.*/
13382 install_element(BGP_NODE
, &neighbor_capability_orf_prefix_hidden_cmd
);
13383 install_element(BGP_NODE
,
13384 &no_neighbor_capability_orf_prefix_hidden_cmd
);
13385 install_element(BGP_IPV4_NODE
, &neighbor_capability_orf_prefix_cmd
);
13386 install_element(BGP_IPV4_NODE
, &no_neighbor_capability_orf_prefix_cmd
);
13387 install_element(BGP_IPV4M_NODE
, &neighbor_capability_orf_prefix_cmd
);
13388 install_element(BGP_IPV4M_NODE
, &no_neighbor_capability_orf_prefix_cmd
);
13389 install_element(BGP_IPV4L_NODE
, &neighbor_capability_orf_prefix_cmd
);
13390 install_element(BGP_IPV4L_NODE
, &no_neighbor_capability_orf_prefix_cmd
);
13391 install_element(BGP_IPV6_NODE
, &neighbor_capability_orf_prefix_cmd
);
13392 install_element(BGP_IPV6_NODE
, &no_neighbor_capability_orf_prefix_cmd
);
13393 install_element(BGP_IPV6M_NODE
, &neighbor_capability_orf_prefix_cmd
);
13394 install_element(BGP_IPV6M_NODE
, &no_neighbor_capability_orf_prefix_cmd
);
13395 install_element(BGP_IPV6L_NODE
, &neighbor_capability_orf_prefix_cmd
);
13396 install_element(BGP_IPV6L_NODE
, &no_neighbor_capability_orf_prefix_cmd
);
13398 /* "neighbor capability dynamic" commands.*/
13399 install_element(BGP_NODE
, &neighbor_capability_dynamic_cmd
);
13400 install_element(BGP_NODE
, &no_neighbor_capability_dynamic_cmd
);
13402 /* "neighbor dont-capability-negotiate" commands. */
13403 install_element(BGP_NODE
, &neighbor_dont_capability_negotiate_cmd
);
13404 install_element(BGP_NODE
, &no_neighbor_dont_capability_negotiate_cmd
);
13406 /* "neighbor ebgp-multihop" commands. */
13407 install_element(BGP_NODE
, &neighbor_ebgp_multihop_cmd
);
13408 install_element(BGP_NODE
, &neighbor_ebgp_multihop_ttl_cmd
);
13409 install_element(BGP_NODE
, &no_neighbor_ebgp_multihop_cmd
);
13411 /* "neighbor disable-connected-check" commands. */
13412 install_element(BGP_NODE
, &neighbor_disable_connected_check_cmd
);
13413 install_element(BGP_NODE
, &no_neighbor_disable_connected_check_cmd
);
13415 /* "neighbor enforce-first-as" commands. */
13416 install_element(BGP_NODE
, &neighbor_enforce_first_as_cmd
);
13417 install_element(BGP_NODE
, &no_neighbor_enforce_first_as_cmd
);
13419 /* "neighbor description" commands. */
13420 install_element(BGP_NODE
, &neighbor_description_cmd
);
13421 install_element(BGP_NODE
, &no_neighbor_description_cmd
);
13422 install_element(BGP_NODE
, &no_neighbor_description_comment_cmd
);
13424 /* "neighbor update-source" commands. "*/
13425 install_element(BGP_NODE
, &neighbor_update_source_cmd
);
13426 install_element(BGP_NODE
, &no_neighbor_update_source_cmd
);
13428 /* "neighbor default-originate" commands. */
13429 install_element(BGP_NODE
, &neighbor_default_originate_hidden_cmd
);
13430 install_element(BGP_NODE
, &neighbor_default_originate_rmap_hidden_cmd
);
13431 install_element(BGP_NODE
, &no_neighbor_default_originate_hidden_cmd
);
13432 install_element(BGP_IPV4_NODE
, &neighbor_default_originate_cmd
);
13433 install_element(BGP_IPV4_NODE
, &neighbor_default_originate_rmap_cmd
);
13434 install_element(BGP_IPV4_NODE
, &no_neighbor_default_originate_cmd
);
13435 install_element(BGP_IPV4M_NODE
, &neighbor_default_originate_cmd
);
13436 install_element(BGP_IPV4M_NODE
, &neighbor_default_originate_rmap_cmd
);
13437 install_element(BGP_IPV4M_NODE
, &no_neighbor_default_originate_cmd
);
13438 install_element(BGP_IPV4L_NODE
, &neighbor_default_originate_cmd
);
13439 install_element(BGP_IPV4L_NODE
, &neighbor_default_originate_rmap_cmd
);
13440 install_element(BGP_IPV4L_NODE
, &no_neighbor_default_originate_cmd
);
13441 install_element(BGP_IPV6_NODE
, &neighbor_default_originate_cmd
);
13442 install_element(BGP_IPV6_NODE
, &neighbor_default_originate_rmap_cmd
);
13443 install_element(BGP_IPV6_NODE
, &no_neighbor_default_originate_cmd
);
13444 install_element(BGP_IPV6M_NODE
, &neighbor_default_originate_cmd
);
13445 install_element(BGP_IPV6M_NODE
, &neighbor_default_originate_rmap_cmd
);
13446 install_element(BGP_IPV6M_NODE
, &no_neighbor_default_originate_cmd
);
13447 install_element(BGP_IPV6L_NODE
, &neighbor_default_originate_cmd
);
13448 install_element(BGP_IPV6L_NODE
, &neighbor_default_originate_rmap_cmd
);
13449 install_element(BGP_IPV6L_NODE
, &no_neighbor_default_originate_cmd
);
13451 /* "neighbor port" commands. */
13452 install_element(BGP_NODE
, &neighbor_port_cmd
);
13453 install_element(BGP_NODE
, &no_neighbor_port_cmd
);
13455 /* "neighbor weight" commands. */
13456 install_element(BGP_NODE
, &neighbor_weight_hidden_cmd
);
13457 install_element(BGP_NODE
, &no_neighbor_weight_hidden_cmd
);
13459 install_element(BGP_IPV4_NODE
, &neighbor_weight_cmd
);
13460 install_element(BGP_IPV4_NODE
, &no_neighbor_weight_cmd
);
13461 install_element(BGP_IPV4M_NODE
, &neighbor_weight_cmd
);
13462 install_element(BGP_IPV4M_NODE
, &no_neighbor_weight_cmd
);
13463 install_element(BGP_IPV4L_NODE
, &neighbor_weight_cmd
);
13464 install_element(BGP_IPV4L_NODE
, &no_neighbor_weight_cmd
);
13465 install_element(BGP_IPV6_NODE
, &neighbor_weight_cmd
);
13466 install_element(BGP_IPV6_NODE
, &no_neighbor_weight_cmd
);
13467 install_element(BGP_IPV6M_NODE
, &neighbor_weight_cmd
);
13468 install_element(BGP_IPV6M_NODE
, &no_neighbor_weight_cmd
);
13469 install_element(BGP_IPV6L_NODE
, &neighbor_weight_cmd
);
13470 install_element(BGP_IPV6L_NODE
, &no_neighbor_weight_cmd
);
13471 install_element(BGP_VPNV4_NODE
, &neighbor_weight_cmd
);
13472 install_element(BGP_VPNV4_NODE
, &no_neighbor_weight_cmd
);
13473 install_element(BGP_VPNV6_NODE
, &neighbor_weight_cmd
);
13474 install_element(BGP_VPNV6_NODE
, &no_neighbor_weight_cmd
);
13476 /* "neighbor override-capability" commands. */
13477 install_element(BGP_NODE
, &neighbor_override_capability_cmd
);
13478 install_element(BGP_NODE
, &no_neighbor_override_capability_cmd
);
13480 /* "neighbor strict-capability-match" commands. */
13481 install_element(BGP_NODE
, &neighbor_strict_capability_cmd
);
13482 install_element(BGP_NODE
, &no_neighbor_strict_capability_cmd
);
13484 /* "neighbor timers" commands. */
13485 install_element(BGP_NODE
, &neighbor_timers_cmd
);
13486 install_element(BGP_NODE
, &no_neighbor_timers_cmd
);
13488 /* "neighbor timers connect" commands. */
13489 install_element(BGP_NODE
, &neighbor_timers_connect_cmd
);
13490 install_element(BGP_NODE
, &no_neighbor_timers_connect_cmd
);
13492 /* "neighbor advertisement-interval" commands. */
13493 install_element(BGP_NODE
, &neighbor_advertise_interval_cmd
);
13494 install_element(BGP_NODE
, &no_neighbor_advertise_interval_cmd
);
13496 /* "neighbor interface" commands. */
13497 install_element(BGP_NODE
, &neighbor_interface_cmd
);
13498 install_element(BGP_NODE
, &no_neighbor_interface_cmd
);
13500 /* "neighbor distribute" commands. */
13501 install_element(BGP_NODE
, &neighbor_distribute_list_hidden_cmd
);
13502 install_element(BGP_NODE
, &no_neighbor_distribute_list_hidden_cmd
);
13503 install_element(BGP_IPV4_NODE
, &neighbor_distribute_list_cmd
);
13504 install_element(BGP_IPV4_NODE
, &no_neighbor_distribute_list_cmd
);
13505 install_element(BGP_IPV4M_NODE
, &neighbor_distribute_list_cmd
);
13506 install_element(BGP_IPV4M_NODE
, &no_neighbor_distribute_list_cmd
);
13507 install_element(BGP_IPV4L_NODE
, &neighbor_distribute_list_cmd
);
13508 install_element(BGP_IPV4L_NODE
, &no_neighbor_distribute_list_cmd
);
13509 install_element(BGP_IPV6_NODE
, &neighbor_distribute_list_cmd
);
13510 install_element(BGP_IPV6_NODE
, &no_neighbor_distribute_list_cmd
);
13511 install_element(BGP_IPV6M_NODE
, &neighbor_distribute_list_cmd
);
13512 install_element(BGP_IPV6M_NODE
, &no_neighbor_distribute_list_cmd
);
13513 install_element(BGP_IPV6L_NODE
, &neighbor_distribute_list_cmd
);
13514 install_element(BGP_IPV6L_NODE
, &no_neighbor_distribute_list_cmd
);
13515 install_element(BGP_VPNV4_NODE
, &neighbor_distribute_list_cmd
);
13516 install_element(BGP_VPNV4_NODE
, &no_neighbor_distribute_list_cmd
);
13517 install_element(BGP_VPNV6_NODE
, &neighbor_distribute_list_cmd
);
13518 install_element(BGP_VPNV6_NODE
, &no_neighbor_distribute_list_cmd
);
13520 /* "neighbor prefix-list" commands. */
13521 install_element(BGP_NODE
, &neighbor_prefix_list_hidden_cmd
);
13522 install_element(BGP_NODE
, &no_neighbor_prefix_list_hidden_cmd
);
13523 install_element(BGP_IPV4_NODE
, &neighbor_prefix_list_cmd
);
13524 install_element(BGP_IPV4_NODE
, &no_neighbor_prefix_list_cmd
);
13525 install_element(BGP_IPV4M_NODE
, &neighbor_prefix_list_cmd
);
13526 install_element(BGP_IPV4M_NODE
, &no_neighbor_prefix_list_cmd
);
13527 install_element(BGP_IPV4L_NODE
, &neighbor_prefix_list_cmd
);
13528 install_element(BGP_IPV4L_NODE
, &no_neighbor_prefix_list_cmd
);
13529 install_element(BGP_IPV6_NODE
, &neighbor_prefix_list_cmd
);
13530 install_element(BGP_IPV6_NODE
, &no_neighbor_prefix_list_cmd
);
13531 install_element(BGP_IPV6M_NODE
, &neighbor_prefix_list_cmd
);
13532 install_element(BGP_IPV6M_NODE
, &no_neighbor_prefix_list_cmd
);
13533 install_element(BGP_IPV6L_NODE
, &neighbor_prefix_list_cmd
);
13534 install_element(BGP_IPV6L_NODE
, &no_neighbor_prefix_list_cmd
);
13535 install_element(BGP_VPNV4_NODE
, &neighbor_prefix_list_cmd
);
13536 install_element(BGP_VPNV4_NODE
, &no_neighbor_prefix_list_cmd
);
13537 install_element(BGP_VPNV6_NODE
, &neighbor_prefix_list_cmd
);
13538 install_element(BGP_VPNV6_NODE
, &no_neighbor_prefix_list_cmd
);
13539 install_element(BGP_FLOWSPECV4_NODE
, &neighbor_prefix_list_cmd
);
13540 install_element(BGP_FLOWSPECV4_NODE
, &no_neighbor_prefix_list_cmd
);
13541 install_element(BGP_FLOWSPECV6_NODE
, &neighbor_prefix_list_cmd
);
13542 install_element(BGP_FLOWSPECV6_NODE
, &no_neighbor_prefix_list_cmd
);
13544 /* "neighbor filter-list" commands. */
13545 install_element(BGP_NODE
, &neighbor_filter_list_hidden_cmd
);
13546 install_element(BGP_NODE
, &no_neighbor_filter_list_hidden_cmd
);
13547 install_element(BGP_IPV4_NODE
, &neighbor_filter_list_cmd
);
13548 install_element(BGP_IPV4_NODE
, &no_neighbor_filter_list_cmd
);
13549 install_element(BGP_IPV4M_NODE
, &neighbor_filter_list_cmd
);
13550 install_element(BGP_IPV4M_NODE
, &no_neighbor_filter_list_cmd
);
13551 install_element(BGP_IPV4L_NODE
, &neighbor_filter_list_cmd
);
13552 install_element(BGP_IPV4L_NODE
, &no_neighbor_filter_list_cmd
);
13553 install_element(BGP_IPV6_NODE
, &neighbor_filter_list_cmd
);
13554 install_element(BGP_IPV6_NODE
, &no_neighbor_filter_list_cmd
);
13555 install_element(BGP_IPV6M_NODE
, &neighbor_filter_list_cmd
);
13556 install_element(BGP_IPV6M_NODE
, &no_neighbor_filter_list_cmd
);
13557 install_element(BGP_IPV6L_NODE
, &neighbor_filter_list_cmd
);
13558 install_element(BGP_IPV6L_NODE
, &no_neighbor_filter_list_cmd
);
13559 install_element(BGP_VPNV4_NODE
, &neighbor_filter_list_cmd
);
13560 install_element(BGP_VPNV4_NODE
, &no_neighbor_filter_list_cmd
);
13561 install_element(BGP_VPNV6_NODE
, &neighbor_filter_list_cmd
);
13562 install_element(BGP_VPNV6_NODE
, &no_neighbor_filter_list_cmd
);
13563 install_element(BGP_FLOWSPECV4_NODE
, &neighbor_filter_list_cmd
);
13564 install_element(BGP_FLOWSPECV4_NODE
, &no_neighbor_filter_list_cmd
);
13565 install_element(BGP_FLOWSPECV6_NODE
, &neighbor_filter_list_cmd
);
13566 install_element(BGP_FLOWSPECV6_NODE
, &no_neighbor_filter_list_cmd
);
13568 /* "neighbor route-map" commands. */
13569 install_element(BGP_NODE
, &neighbor_route_map_hidden_cmd
);
13570 install_element(BGP_NODE
, &no_neighbor_route_map_hidden_cmd
);
13571 install_element(BGP_IPV4_NODE
, &neighbor_route_map_cmd
);
13572 install_element(BGP_IPV4_NODE
, &no_neighbor_route_map_cmd
);
13573 install_element(BGP_IPV4M_NODE
, &neighbor_route_map_cmd
);
13574 install_element(BGP_IPV4M_NODE
, &no_neighbor_route_map_cmd
);
13575 install_element(BGP_IPV4L_NODE
, &neighbor_route_map_cmd
);
13576 install_element(BGP_IPV4L_NODE
, &no_neighbor_route_map_cmd
);
13577 install_element(BGP_IPV6_NODE
, &neighbor_route_map_cmd
);
13578 install_element(BGP_IPV6_NODE
, &no_neighbor_route_map_cmd
);
13579 install_element(BGP_IPV6M_NODE
, &neighbor_route_map_cmd
);
13580 install_element(BGP_IPV6M_NODE
, &no_neighbor_route_map_cmd
);
13581 install_element(BGP_IPV6L_NODE
, &neighbor_route_map_cmd
);
13582 install_element(BGP_IPV6L_NODE
, &no_neighbor_route_map_cmd
);
13583 install_element(BGP_VPNV4_NODE
, &neighbor_route_map_cmd
);
13584 install_element(BGP_VPNV4_NODE
, &no_neighbor_route_map_cmd
);
13585 install_element(BGP_VPNV6_NODE
, &neighbor_route_map_cmd
);
13586 install_element(BGP_VPNV6_NODE
, &no_neighbor_route_map_cmd
);
13587 install_element(BGP_FLOWSPECV4_NODE
, &neighbor_route_map_cmd
);
13588 install_element(BGP_FLOWSPECV4_NODE
, &no_neighbor_route_map_cmd
);
13589 install_element(BGP_FLOWSPECV6_NODE
, &neighbor_route_map_cmd
);
13590 install_element(BGP_FLOWSPECV6_NODE
, &no_neighbor_route_map_cmd
);
13591 install_element(BGP_EVPN_NODE
, &neighbor_route_map_cmd
);
13592 install_element(BGP_EVPN_NODE
, &no_neighbor_route_map_cmd
);
13594 /* "neighbor unsuppress-map" commands. */
13595 install_element(BGP_NODE
, &neighbor_unsuppress_map_hidden_cmd
);
13596 install_element(BGP_NODE
, &no_neighbor_unsuppress_map_hidden_cmd
);
13597 install_element(BGP_IPV4_NODE
, &neighbor_unsuppress_map_cmd
);
13598 install_element(BGP_IPV4_NODE
, &no_neighbor_unsuppress_map_cmd
);
13599 install_element(BGP_IPV4M_NODE
, &neighbor_unsuppress_map_cmd
);
13600 install_element(BGP_IPV4M_NODE
, &no_neighbor_unsuppress_map_cmd
);
13601 install_element(BGP_IPV4L_NODE
, &neighbor_unsuppress_map_cmd
);
13602 install_element(BGP_IPV4L_NODE
, &no_neighbor_unsuppress_map_cmd
);
13603 install_element(BGP_IPV6_NODE
, &neighbor_unsuppress_map_cmd
);
13604 install_element(BGP_IPV6_NODE
, &no_neighbor_unsuppress_map_cmd
);
13605 install_element(BGP_IPV6M_NODE
, &neighbor_unsuppress_map_cmd
);
13606 install_element(BGP_IPV6M_NODE
, &no_neighbor_unsuppress_map_cmd
);
13607 install_element(BGP_IPV6L_NODE
, &neighbor_unsuppress_map_cmd
);
13608 install_element(BGP_IPV6L_NODE
, &no_neighbor_unsuppress_map_cmd
);
13609 install_element(BGP_VPNV4_NODE
, &neighbor_unsuppress_map_cmd
);
13610 install_element(BGP_VPNV4_NODE
, &no_neighbor_unsuppress_map_cmd
);
13611 install_element(BGP_VPNV6_NODE
, &neighbor_unsuppress_map_cmd
);
13612 install_element(BGP_VPNV6_NODE
, &no_neighbor_unsuppress_map_cmd
);
13614 /* "neighbor maximum-prefix" commands. */
13615 install_element(BGP_NODE
, &neighbor_maximum_prefix_hidden_cmd
);
13616 install_element(BGP_NODE
,
13617 &neighbor_maximum_prefix_threshold_hidden_cmd
);
13618 install_element(BGP_NODE
, &neighbor_maximum_prefix_warning_hidden_cmd
);
13619 install_element(BGP_NODE
,
13620 &neighbor_maximum_prefix_threshold_warning_hidden_cmd
);
13621 install_element(BGP_NODE
, &neighbor_maximum_prefix_restart_hidden_cmd
);
13622 install_element(BGP_NODE
,
13623 &neighbor_maximum_prefix_threshold_restart_hidden_cmd
);
13624 install_element(BGP_NODE
, &no_neighbor_maximum_prefix_hidden_cmd
);
13625 install_element(BGP_IPV4_NODE
, &neighbor_maximum_prefix_cmd
);
13626 install_element(BGP_IPV4_NODE
, &neighbor_maximum_prefix_threshold_cmd
);
13627 install_element(BGP_IPV4_NODE
, &neighbor_maximum_prefix_warning_cmd
);
13628 install_element(BGP_IPV4_NODE
,
13629 &neighbor_maximum_prefix_threshold_warning_cmd
);
13630 install_element(BGP_IPV4_NODE
, &neighbor_maximum_prefix_restart_cmd
);
13631 install_element(BGP_IPV4_NODE
,
13632 &neighbor_maximum_prefix_threshold_restart_cmd
);
13633 install_element(BGP_IPV4_NODE
, &no_neighbor_maximum_prefix_cmd
);
13634 install_element(BGP_IPV4M_NODE
, &neighbor_maximum_prefix_cmd
);
13635 install_element(BGP_IPV4M_NODE
, &neighbor_maximum_prefix_threshold_cmd
);
13636 install_element(BGP_IPV4M_NODE
, &neighbor_maximum_prefix_warning_cmd
);
13637 install_element(BGP_IPV4M_NODE
,
13638 &neighbor_maximum_prefix_threshold_warning_cmd
);
13639 install_element(BGP_IPV4M_NODE
, &neighbor_maximum_prefix_restart_cmd
);
13640 install_element(BGP_IPV4M_NODE
,
13641 &neighbor_maximum_prefix_threshold_restart_cmd
);
13642 install_element(BGP_IPV4M_NODE
, &no_neighbor_maximum_prefix_cmd
);
13643 install_element(BGP_IPV4L_NODE
, &neighbor_maximum_prefix_cmd
);
13644 install_element(BGP_IPV4L_NODE
, &neighbor_maximum_prefix_threshold_cmd
);
13645 install_element(BGP_IPV4L_NODE
, &neighbor_maximum_prefix_warning_cmd
);
13646 install_element(BGP_IPV4L_NODE
,
13647 &neighbor_maximum_prefix_threshold_warning_cmd
);
13648 install_element(BGP_IPV4L_NODE
, &neighbor_maximum_prefix_restart_cmd
);
13649 install_element(BGP_IPV4L_NODE
,
13650 &neighbor_maximum_prefix_threshold_restart_cmd
);
13651 install_element(BGP_IPV4L_NODE
, &no_neighbor_maximum_prefix_cmd
);
13652 install_element(BGP_IPV6_NODE
, &neighbor_maximum_prefix_cmd
);
13653 install_element(BGP_IPV6_NODE
, &neighbor_maximum_prefix_threshold_cmd
);
13654 install_element(BGP_IPV6_NODE
, &neighbor_maximum_prefix_warning_cmd
);
13655 install_element(BGP_IPV6_NODE
,
13656 &neighbor_maximum_prefix_threshold_warning_cmd
);
13657 install_element(BGP_IPV6_NODE
, &neighbor_maximum_prefix_restart_cmd
);
13658 install_element(BGP_IPV6_NODE
,
13659 &neighbor_maximum_prefix_threshold_restart_cmd
);
13660 install_element(BGP_IPV6_NODE
, &no_neighbor_maximum_prefix_cmd
);
13661 install_element(BGP_IPV6M_NODE
, &neighbor_maximum_prefix_cmd
);
13662 install_element(BGP_IPV6M_NODE
, &neighbor_maximum_prefix_threshold_cmd
);
13663 install_element(BGP_IPV6M_NODE
, &neighbor_maximum_prefix_warning_cmd
);
13664 install_element(BGP_IPV6M_NODE
,
13665 &neighbor_maximum_prefix_threshold_warning_cmd
);
13666 install_element(BGP_IPV6M_NODE
, &neighbor_maximum_prefix_restart_cmd
);
13667 install_element(BGP_IPV6M_NODE
,
13668 &neighbor_maximum_prefix_threshold_restart_cmd
);
13669 install_element(BGP_IPV6M_NODE
, &no_neighbor_maximum_prefix_cmd
);
13670 install_element(BGP_IPV6L_NODE
, &neighbor_maximum_prefix_cmd
);
13671 install_element(BGP_IPV6L_NODE
, &neighbor_maximum_prefix_threshold_cmd
);
13672 install_element(BGP_IPV6L_NODE
, &neighbor_maximum_prefix_warning_cmd
);
13673 install_element(BGP_IPV6L_NODE
,
13674 &neighbor_maximum_prefix_threshold_warning_cmd
);
13675 install_element(BGP_IPV6L_NODE
, &neighbor_maximum_prefix_restart_cmd
);
13676 install_element(BGP_IPV6L_NODE
,
13677 &neighbor_maximum_prefix_threshold_restart_cmd
);
13678 install_element(BGP_IPV6L_NODE
, &no_neighbor_maximum_prefix_cmd
);
13679 install_element(BGP_VPNV4_NODE
, &neighbor_maximum_prefix_cmd
);
13680 install_element(BGP_VPNV4_NODE
, &neighbor_maximum_prefix_threshold_cmd
);
13681 install_element(BGP_VPNV4_NODE
, &neighbor_maximum_prefix_warning_cmd
);
13682 install_element(BGP_VPNV4_NODE
,
13683 &neighbor_maximum_prefix_threshold_warning_cmd
);
13684 install_element(BGP_VPNV4_NODE
, &neighbor_maximum_prefix_restart_cmd
);
13685 install_element(BGP_VPNV4_NODE
,
13686 &neighbor_maximum_prefix_threshold_restart_cmd
);
13687 install_element(BGP_VPNV4_NODE
, &no_neighbor_maximum_prefix_cmd
);
13688 install_element(BGP_VPNV6_NODE
, &neighbor_maximum_prefix_cmd
);
13689 install_element(BGP_VPNV6_NODE
, &neighbor_maximum_prefix_threshold_cmd
);
13690 install_element(BGP_VPNV6_NODE
, &neighbor_maximum_prefix_warning_cmd
);
13691 install_element(BGP_VPNV6_NODE
,
13692 &neighbor_maximum_prefix_threshold_warning_cmd
);
13693 install_element(BGP_VPNV6_NODE
, &neighbor_maximum_prefix_restart_cmd
);
13694 install_element(BGP_VPNV6_NODE
,
13695 &neighbor_maximum_prefix_threshold_restart_cmd
);
13696 install_element(BGP_VPNV6_NODE
, &no_neighbor_maximum_prefix_cmd
);
13698 /* "neighbor allowas-in" */
13699 install_element(BGP_NODE
, &neighbor_allowas_in_hidden_cmd
);
13700 install_element(BGP_NODE
, &no_neighbor_allowas_in_hidden_cmd
);
13701 install_element(BGP_IPV4_NODE
, &neighbor_allowas_in_cmd
);
13702 install_element(BGP_IPV4_NODE
, &no_neighbor_allowas_in_cmd
);
13703 install_element(BGP_IPV4M_NODE
, &neighbor_allowas_in_cmd
);
13704 install_element(BGP_IPV4M_NODE
, &no_neighbor_allowas_in_cmd
);
13705 install_element(BGP_IPV4L_NODE
, &neighbor_allowas_in_cmd
);
13706 install_element(BGP_IPV4L_NODE
, &no_neighbor_allowas_in_cmd
);
13707 install_element(BGP_IPV6_NODE
, &neighbor_allowas_in_cmd
);
13708 install_element(BGP_IPV6_NODE
, &no_neighbor_allowas_in_cmd
);
13709 install_element(BGP_IPV6M_NODE
, &neighbor_allowas_in_cmd
);
13710 install_element(BGP_IPV6M_NODE
, &no_neighbor_allowas_in_cmd
);
13711 install_element(BGP_IPV6L_NODE
, &neighbor_allowas_in_cmd
);
13712 install_element(BGP_IPV6L_NODE
, &no_neighbor_allowas_in_cmd
);
13713 install_element(BGP_VPNV4_NODE
, &neighbor_allowas_in_cmd
);
13714 install_element(BGP_VPNV4_NODE
, &no_neighbor_allowas_in_cmd
);
13715 install_element(BGP_VPNV6_NODE
, &neighbor_allowas_in_cmd
);
13716 install_element(BGP_VPNV6_NODE
, &no_neighbor_allowas_in_cmd
);
13717 install_element(BGP_EVPN_NODE
, &neighbor_allowas_in_cmd
);
13718 install_element(BGP_EVPN_NODE
, &no_neighbor_allowas_in_cmd
);
13720 /* address-family commands. */
13721 install_element(BGP_NODE
, &address_family_ipv4_safi_cmd
);
13722 install_element(BGP_NODE
, &address_family_ipv6_safi_cmd
);
13723 #ifdef KEEP_OLD_VPN_COMMANDS
13724 install_element(BGP_NODE
, &address_family_vpnv4_cmd
);
13725 install_element(BGP_NODE
, &address_family_vpnv6_cmd
);
13726 #endif /* KEEP_OLD_VPN_COMMANDS */
13728 install_element(BGP_NODE
, &address_family_evpn_cmd
);
13730 /* "exit-address-family" command. */
13731 install_element(BGP_IPV4_NODE
, &exit_address_family_cmd
);
13732 install_element(BGP_IPV4M_NODE
, &exit_address_family_cmd
);
13733 install_element(BGP_IPV4L_NODE
, &exit_address_family_cmd
);
13734 install_element(BGP_IPV6_NODE
, &exit_address_family_cmd
);
13735 install_element(BGP_IPV6M_NODE
, &exit_address_family_cmd
);
13736 install_element(BGP_IPV6L_NODE
, &exit_address_family_cmd
);
13737 install_element(BGP_VPNV4_NODE
, &exit_address_family_cmd
);
13738 install_element(BGP_VPNV6_NODE
, &exit_address_family_cmd
);
13739 install_element(BGP_FLOWSPECV4_NODE
, &exit_address_family_cmd
);
13740 install_element(BGP_FLOWSPECV6_NODE
, &exit_address_family_cmd
);
13741 install_element(BGP_EVPN_NODE
, &exit_address_family_cmd
);
13743 /* "clear ip bgp commands" */
13744 install_element(ENABLE_NODE
, &clear_ip_bgp_all_cmd
);
13746 /* clear ip bgp prefix */
13747 install_element(ENABLE_NODE
, &clear_ip_bgp_prefix_cmd
);
13748 install_element(ENABLE_NODE
, &clear_bgp_ipv6_safi_prefix_cmd
);
13749 install_element(ENABLE_NODE
, &clear_bgp_instance_ipv6_safi_prefix_cmd
);
13751 /* "show [ip] bgp summary" commands. */
13752 install_element(VIEW_NODE
, &show_bgp_instance_all_ipv6_updgrps_cmd
);
13753 install_element(VIEW_NODE
, &show_bgp_l2vpn_evpn_updgrps_cmd
);
13754 install_element(VIEW_NODE
, &show_bgp_instance_updgrps_stats_cmd
);
13755 install_element(VIEW_NODE
, &show_bgp_updgrps_stats_cmd
);
13756 install_element(VIEW_NODE
, &show_ip_bgp_instance_updgrps_adj_s_cmd
);
13757 install_element(VIEW_NODE
, &show_ip_bgp_summary_cmd
);
13758 install_element(VIEW_NODE
, &show_ip_bgp_updgrps_cmd
);
13760 /* "show [ip] bgp neighbors" commands. */
13761 install_element(VIEW_NODE
, &show_ip_bgp_neighbors_cmd
);
13763 /* "show [ip] bgp peer-group" commands. */
13764 install_element(VIEW_NODE
, &show_ip_bgp_peer_groups_cmd
);
13766 /* "show [ip] bgp paths" commands. */
13767 install_element(VIEW_NODE
, &show_ip_bgp_paths_cmd
);
13769 /* "show [ip] bgp community" commands. */
13770 install_element(VIEW_NODE
, &show_ip_bgp_community_info_cmd
);
13772 /* "show ip bgp large-community" commands. */
13773 install_element(VIEW_NODE
, &show_ip_bgp_lcommunity_info_cmd
);
13774 /* "show [ip] bgp attribute-info" commands. */
13775 install_element(VIEW_NODE
, &show_ip_bgp_attr_info_cmd
);
13776 /* "show [ip] bgp route-leak" command */
13777 install_element(VIEW_NODE
, &show_ip_bgp_route_leak_cmd
);
13779 /* "redistribute" commands. */
13780 install_element(BGP_NODE
, &bgp_redistribute_ipv4_hidden_cmd
);
13781 install_element(BGP_NODE
, &no_bgp_redistribute_ipv4_hidden_cmd
);
13782 install_element(BGP_NODE
, &bgp_redistribute_ipv4_rmap_hidden_cmd
);
13783 install_element(BGP_NODE
, &bgp_redistribute_ipv4_metric_hidden_cmd
);
13784 install_element(BGP_NODE
,
13785 &bgp_redistribute_ipv4_rmap_metric_hidden_cmd
);
13786 install_element(BGP_NODE
,
13787 &bgp_redistribute_ipv4_metric_rmap_hidden_cmd
);
13788 install_element(BGP_NODE
, &bgp_redistribute_ipv4_ospf_hidden_cmd
);
13789 install_element(BGP_NODE
, &no_bgp_redistribute_ipv4_ospf_hidden_cmd
);
13790 install_element(BGP_NODE
, &bgp_redistribute_ipv4_ospf_rmap_hidden_cmd
);
13791 install_element(BGP_NODE
,
13792 &bgp_redistribute_ipv4_ospf_metric_hidden_cmd
);
13793 install_element(BGP_NODE
,
13794 &bgp_redistribute_ipv4_ospf_rmap_metric_hidden_cmd
);
13795 install_element(BGP_NODE
,
13796 &bgp_redistribute_ipv4_ospf_metric_rmap_hidden_cmd
);
13797 install_element(BGP_IPV4_NODE
, &bgp_redistribute_ipv4_cmd
);
13798 install_element(BGP_IPV4_NODE
, &no_bgp_redistribute_ipv4_cmd
);
13799 install_element(BGP_IPV4_NODE
, &bgp_redistribute_ipv4_rmap_cmd
);
13800 install_element(BGP_IPV4_NODE
, &bgp_redistribute_ipv4_metric_cmd
);
13801 install_element(BGP_IPV4_NODE
, &bgp_redistribute_ipv4_rmap_metric_cmd
);
13802 install_element(BGP_IPV4_NODE
, &bgp_redistribute_ipv4_metric_rmap_cmd
);
13803 install_element(BGP_IPV4_NODE
, &bgp_redistribute_ipv4_ospf_cmd
);
13804 install_element(BGP_IPV4_NODE
, &no_bgp_redistribute_ipv4_ospf_cmd
);
13805 install_element(BGP_IPV4_NODE
, &bgp_redistribute_ipv4_ospf_rmap_cmd
);
13806 install_element(BGP_IPV4_NODE
, &bgp_redistribute_ipv4_ospf_metric_cmd
);
13807 install_element(BGP_IPV4_NODE
,
13808 &bgp_redistribute_ipv4_ospf_rmap_metric_cmd
);
13809 install_element(BGP_IPV4_NODE
,
13810 &bgp_redistribute_ipv4_ospf_metric_rmap_cmd
);
13811 install_element(BGP_IPV6_NODE
, &bgp_redistribute_ipv6_cmd
);
13812 install_element(BGP_IPV6_NODE
, &no_bgp_redistribute_ipv6_cmd
);
13813 install_element(BGP_IPV6_NODE
, &bgp_redistribute_ipv6_rmap_cmd
);
13814 install_element(BGP_IPV6_NODE
, &bgp_redistribute_ipv6_metric_cmd
);
13815 install_element(BGP_IPV6_NODE
, &bgp_redistribute_ipv6_rmap_metric_cmd
);
13816 install_element(BGP_IPV6_NODE
, &bgp_redistribute_ipv6_metric_rmap_cmd
);
13818 /* import|export vpn [route-map WORD] */
13819 install_element(BGP_IPV4_NODE
, &bgp_imexport_vpn_cmd
);
13820 install_element(BGP_IPV6_NODE
, &bgp_imexport_vpn_cmd
);
13822 install_element(BGP_IPV4_NODE
, &bgp_imexport_vrf_cmd
);
13823 install_element(BGP_IPV6_NODE
, &bgp_imexport_vrf_cmd
);
13825 /* ttl_security commands */
13826 install_element(BGP_NODE
, &neighbor_ttl_security_cmd
);
13827 install_element(BGP_NODE
, &no_neighbor_ttl_security_cmd
);
13829 /* "show [ip] bgp memory" commands. */
13830 install_element(VIEW_NODE
, &show_bgp_memory_cmd
);
13832 /* "show bgp martian next-hop" */
13833 install_element(VIEW_NODE
, &show_bgp_martian_nexthop_db_cmd
);
13835 /* "show [ip] bgp views" commands. */
13836 install_element(VIEW_NODE
, &show_bgp_views_cmd
);
13838 /* "show [ip] bgp vrfs" commands. */
13839 install_element(VIEW_NODE
, &show_bgp_vrfs_cmd
);
13841 /* Community-list. */
13842 community_list_vty();
13844 /* vpn-policy commands */
13845 install_element(BGP_IPV4_NODE
, &af_rd_vpn_export_cmd
);
13846 install_element(BGP_IPV6_NODE
, &af_rd_vpn_export_cmd
);
13847 install_element(BGP_IPV4_NODE
, &af_label_vpn_export_cmd
);
13848 install_element(BGP_IPV6_NODE
, &af_label_vpn_export_cmd
);
13849 install_element(BGP_IPV4_NODE
, &af_nexthop_vpn_export_cmd
);
13850 install_element(BGP_IPV6_NODE
, &af_nexthop_vpn_export_cmd
);
13851 install_element(BGP_IPV4_NODE
, &af_rt_vpn_imexport_cmd
);
13852 install_element(BGP_IPV6_NODE
, &af_rt_vpn_imexport_cmd
);
13853 install_element(BGP_IPV4_NODE
, &af_route_map_vpn_imexport_cmd
);
13854 install_element(BGP_IPV6_NODE
, &af_route_map_vpn_imexport_cmd
);
13855 install_element(BGP_IPV4_NODE
, &af_import_vrf_route_map_cmd
);
13856 install_element(BGP_IPV6_NODE
, &af_import_vrf_route_map_cmd
);
13858 install_element(BGP_IPV4_NODE
, &af_routetarget_import_cmd
);
13859 install_element(BGP_IPV6_NODE
, &af_routetarget_import_cmd
);
13861 install_element(BGP_IPV4_NODE
, &af_no_rd_vpn_export_cmd
);
13862 install_element(BGP_IPV6_NODE
, &af_no_rd_vpn_export_cmd
);
13863 install_element(BGP_IPV4_NODE
, &af_no_label_vpn_export_cmd
);
13864 install_element(BGP_IPV6_NODE
, &af_no_label_vpn_export_cmd
);
13865 install_element(BGP_IPV4_NODE
, &af_no_nexthop_vpn_export_cmd
);
13866 install_element(BGP_IPV6_NODE
, &af_no_nexthop_vpn_export_cmd
);
13867 install_element(BGP_IPV4_NODE
, &af_no_rt_vpn_imexport_cmd
);
13868 install_element(BGP_IPV6_NODE
, &af_no_rt_vpn_imexport_cmd
);
13869 install_element(BGP_IPV4_NODE
, &af_no_route_map_vpn_imexport_cmd
);
13870 install_element(BGP_IPV6_NODE
, &af_no_route_map_vpn_imexport_cmd
);
13871 install_element(BGP_IPV4_NODE
, &af_no_import_vrf_route_map_cmd
);
13872 install_element(BGP_IPV6_NODE
, &af_no_import_vrf_route_map_cmd
);
13875 #include "memory.h"
13876 #include "bgp_regex.h"
13877 #include "bgp_clist.h"
13878 #include "bgp_ecommunity.h"
13880 /* VTY functions. */
13882 /* Direction value to string conversion. */
13883 static const char *community_direct_str(int direct
)
13886 case COMMUNITY_DENY
:
13888 case COMMUNITY_PERMIT
:
13895 /* Display error string. */
13896 static void community_list_perror(struct vty
*vty
, int ret
)
13899 case COMMUNITY_LIST_ERR_CANT_FIND_LIST
:
13900 vty_out(vty
, "%% Can't find community-list\n");
13902 case COMMUNITY_LIST_ERR_MALFORMED_VAL
:
13903 vty_out(vty
, "%% Malformed community-list value\n");
13905 case COMMUNITY_LIST_ERR_STANDARD_CONFLICT
:
13907 "%% Community name conflict, previously defined as standard community\n");
13909 case COMMUNITY_LIST_ERR_EXPANDED_CONFLICT
:
13911 "%% Community name conflict, previously defined as expanded community\n");
13916 /* "community-list" keyword help string. */
13917 #define COMMUNITY_LIST_STR "Add a community list entry\n"
13919 /*community-list standard */
13920 DEFUN (community_list_standard
,
13921 bgp_community_list_standard_cmd
,
13922 "bgp community-list <(1-99)|standard WORD> <deny|permit> AA:NN...",
13925 "Community list number (standard)\n"
13926 "Add an standard community-list entry\n"
13927 "Community list name\n"
13928 "Specify community to reject\n"
13929 "Specify community to accept\n"
13932 char *cl_name_or_number
= NULL
;
13934 int style
= COMMUNITY_LIST_STANDARD
;
13938 if (argv_find(argv
, argc
, "ip", &idx
)) {
13939 vty_out(vty
, "This config option is deprecated, and is scheduled for removal.\n");
13940 vty_out(vty
, "if you are using this please migrate to the below command.\n");
13941 vty_out(vty
, "'bgp community-list <(1-99)|(100-500)|standard|expanded> <deny|permit> AA:NN'\n");
13942 zlog_warn("Deprecated option: 'ip community-list <(1-99)|(100-500)|standard|expanded> <deny|permit> AA:NN' being used");
13945 argv_find(argv
, argc
, "(1-99)", &idx
);
13946 argv_find(argv
, argc
, "WORD", &idx
);
13947 cl_name_or_number
= argv
[idx
]->arg
;
13948 direct
= argv_find(argv
, argc
, "permit", &idx
) ? COMMUNITY_PERMIT
13950 argv_find(argv
, argc
, "AA:NN", &idx
);
13951 char *str
= argv_concat(argv
, argc
, idx
);
13953 int ret
= community_list_set(bgp_clist
, cl_name_or_number
, str
, direct
,
13956 XFREE(MTYPE_TMP
, str
);
13959 /* Display error string. */
13960 community_list_perror(vty
, ret
);
13961 return CMD_WARNING_CONFIG_FAILED
;
13964 return CMD_SUCCESS
;
13967 #if CONFDATE > 20191005
13968 CPP_NOTICE("bgpd: remove deprecated 'ip community-list <(1-99)|(100-500)|standard|expanded> <deny|permit> AA:NN' command")
13970 ALIAS (community_list_standard
,
13971 ip_community_list_standard_cmd
,
13972 "ip community-list <(1-99)|standard WORD> <deny|permit> AA:NN...",
13975 "Community list number (standard)\n"
13976 "Add an standard community-list entry\n"
13977 "Community list name\n"
13978 "Specify community to reject\n"
13979 "Specify community to accept\n"
13982 DEFUN (no_community_list_standard_all
,
13983 no_bgp_community_list_standard_all_cmd
,
13984 "no bgp community-list <(1-99)|standard WORD> <deny|permit> AA:NN...",
13988 "Community list number (standard)\n"
13989 "Add an standard community-list entry\n"
13990 "Community list name\n"
13991 "Specify community to reject\n"
13992 "Specify community to accept\n"
13995 char *cl_name_or_number
= NULL
;
13998 int style
= COMMUNITY_LIST_STANDARD
;
14002 if (argv_find(argv
, argc
, "ip", &idx
)) {
14003 vty_out(vty
, "This config option is deprecated, and is scheduled for removal\n");
14004 vty_out(vty
, "if you are using this please migrate to the below command.\n");
14005 vty_out(vty
, "'no bgp community-list <(1-99)|(100-500)|standard|expanded> <deny|permit> AA:NN'\n");
14006 zlog_warn("Deprecated option: 'no ip community-list <(1-99)|(100-500)|standard|expanded> <deny|permit> |AA:NN' being used");
14009 argv_find(argv
, argc
, "permit", &idx
);
14010 argv_find(argv
, argc
, "deny", &idx
);
14013 direct
= argv_find(argv
, argc
, "permit", &idx
)
14018 argv_find(argv
, argc
, "AA:NN", &idx
);
14019 str
= argv_concat(argv
, argc
, idx
);
14023 argv_find(argv
, argc
, "(1-99)", &idx
);
14024 argv_find(argv
, argc
, "WORD", &idx
);
14025 cl_name_or_number
= argv
[idx
]->arg
;
14027 int ret
= community_list_unset(bgp_clist
, cl_name_or_number
, str
,
14030 XFREE(MTYPE_TMP
, str
);
14033 community_list_perror(vty
, ret
);
14034 return CMD_WARNING_CONFIG_FAILED
;
14037 return CMD_SUCCESS
;
14039 ALIAS (no_community_list_standard_all
,
14040 no_ip_community_list_standard_all_cmd
,
14041 "no ip community-list <(1-99)|standard WORD> <deny|permit> AA:NN...",
14045 "Community list number (standard)\n"
14046 "Add an standard community-list entry\n"
14047 "Community list name\n"
14048 "Specify community to reject\n"
14049 "Specify community to accept\n"
14052 ALIAS(no_community_list_standard_all
, no_bgp_community_list_standard_all_list_cmd
,
14053 "no bgp community-list <(1-99)|standard WORD>",
14054 NO_STR BGP_STR COMMUNITY_LIST_STR
14055 "Community list number (standard)\n"
14056 "Add an standard community-list entry\n"
14057 "Community list name\n")
14059 ALIAS(no_community_list_standard_all
, no_ip_community_list_standard_all_list_cmd
,
14060 "no ip community-list <(1-99)|standard WORD>",
14061 NO_STR BGP_STR COMMUNITY_LIST_STR
14062 "Community list number (standard)\n"
14063 "Add an standard community-list entry\n"
14064 "Community list name\n")
14066 /*community-list expanded */
14067 DEFUN (community_list_expanded_all
,
14068 bgp_community_list_expanded_all_cmd
,
14069 "bgp community-list <(100-500)|expanded WORD> <deny|permit> AA:NN...",
14072 "Community list number (expanded)\n"
14073 "Add an expanded community-list entry\n"
14074 "Community list name\n"
14075 "Specify community to reject\n"
14076 "Specify community to accept\n"
14079 char *cl_name_or_number
= NULL
;
14081 int style
= COMMUNITY_LIST_EXPANDED
;
14084 if (argv_find(argv
, argc
, "ip", &idx
)) {
14085 vty_out(vty
, "This config option is deprecated, and is scheduled for removal.\n");
14086 vty_out(vty
, "if you are using this please migrate to the below command.\n");
14087 vty_out(vty
, "'bgp community-list <(1-99)|(100-500)|standard|expanded> <deny|permit> AA:NN'\n");
14088 zlog_warn("Deprecated option: 'ip community-list <(1-99)|(100-500)|standard|expanded> <deny|permit> AA:NN' being used");
14090 argv_find(argv
, argc
, "(100-500)", &idx
);
14091 argv_find(argv
, argc
, "WORD", &idx
);
14092 cl_name_or_number
= argv
[idx
]->arg
;
14093 direct
= argv_find(argv
, argc
, "permit", &idx
) ? COMMUNITY_PERMIT
14095 argv_find(argv
, argc
, "AA:NN", &idx
);
14096 char *str
= argv_concat(argv
, argc
, idx
);
14098 int ret
= community_list_set(bgp_clist
, cl_name_or_number
, str
, direct
,
14101 XFREE(MTYPE_TMP
, str
);
14104 /* Display error string. */
14105 community_list_perror(vty
, ret
);
14106 return CMD_WARNING_CONFIG_FAILED
;
14109 return CMD_SUCCESS
;
14112 ALIAS (community_list_expanded_all
,
14113 ip_community_list_expanded_all_cmd
,
14114 "ip community-list <(100-500)|expanded WORD> <deny|permit> AA:NN...",
14117 "Community list number (expanded)\n"
14118 "Add an expanded community-list entry\n"
14119 "Community list name\n"
14120 "Specify community to reject\n"
14121 "Specify community to accept\n"
14124 DEFUN (no_community_list_expanded_all
,
14125 no_bgp_community_list_expanded_all_cmd
,
14126 "no bgp community-list <(100-500)|expanded WORD> <deny|permit> AA:NN...",
14130 "Community list number (expanded)\n"
14131 "Add an expanded community-list entry\n"
14132 "Community list name\n"
14133 "Specify community to reject\n"
14134 "Specify community to accept\n"
14137 char *cl_name_or_number
= NULL
;
14140 int style
= COMMUNITY_LIST_EXPANDED
;
14143 if (argv_find(argv
, argc
, "ip", &idx
)) {
14144 vty_out(vty
, "This config option is deprecated, and is scheduled for removal.\n");
14145 vty_out(vty
, "if you are using this please migrate to the below command.\n");
14146 vty_out(vty
, "'no bgp community-list <(1-99)|(100-500)|standard|expanded> <deny|permit> AA:NN'\n");
14147 zlog_warn("Deprecated option: 'no ip community-list <(1-99)|(100-500)|standard|expanded> <deny|permit> AA:NN' being used");
14151 argv_find(argv
, argc
, "permit", &idx
);
14152 argv_find(argv
, argc
, "deny", &idx
);
14155 direct
= argv_find(argv
, argc
, "permit", &idx
)
14160 argv_find(argv
, argc
, "AA:NN", &idx
);
14161 str
= argv_concat(argv
, argc
, idx
);
14165 argv_find(argv
, argc
, "(100-500)", &idx
);
14166 argv_find(argv
, argc
, "WORD", &idx
);
14167 cl_name_or_number
= argv
[idx
]->arg
;
14169 int ret
= community_list_unset(bgp_clist
, cl_name_or_number
, str
,
14172 XFREE(MTYPE_TMP
, str
);
14175 community_list_perror(vty
, ret
);
14176 return CMD_WARNING_CONFIG_FAILED
;
14179 return CMD_SUCCESS
;
14182 ALIAS (no_community_list_expanded_all
,
14183 no_ip_community_list_expanded_all_cmd
,
14184 "no ip community-list <(100-500)|expanded WORD> <deny|permit> AA:NN...",
14188 "Community list number (expanded)\n"
14189 "Add an expanded community-list entry\n"
14190 "Community list name\n"
14191 "Specify community to reject\n"
14192 "Specify community to accept\n"
14195 ALIAS(no_community_list_expanded_all
, no_bgp_community_list_expanded_all_list_cmd
,
14196 "no bgp community-list <(100-500)|expanded WORD>",
14197 NO_STR IP_STR COMMUNITY_LIST_STR
14198 "Community list number (expanded)\n"
14199 "Add an expanded community-list entry\n"
14200 "Community list name\n")
14202 ALIAS(no_community_list_expanded_all
, no_ip_community_list_expanded_all_list_cmd
,
14203 "no ip community-list <(100-500)|expanded WORD>",
14204 NO_STR IP_STR COMMUNITY_LIST_STR
14205 "Community list number (expanded)\n"
14206 "Add an expanded community-list entry\n"
14207 "Community list name\n")
14209 /* Return configuration string of community-list entry. */
14210 static const char *community_list_config_str(struct community_entry
*entry
)
14217 if (entry
->style
== COMMUNITY_LIST_STANDARD
)
14218 str
= community_str(entry
->u
.com
, false);
14219 else if (entry
->style
== LARGE_COMMUNITY_LIST_STANDARD
)
14220 str
= lcommunity_str(entry
->u
.lcom
, false);
14222 str
= entry
->config
;
14227 static void community_list_show(struct vty
*vty
, struct community_list
*list
)
14229 struct community_entry
*entry
;
14231 for (entry
= list
->head
; entry
; entry
= entry
->next
) {
14232 if (entry
== list
->head
) {
14233 if (all_digit(list
->name
))
14234 vty_out(vty
, "Community %s list %s\n",
14235 entry
->style
== COMMUNITY_LIST_STANDARD
14237 : "(expanded) access",
14240 vty_out(vty
, "Named Community %s list %s\n",
14241 entry
->style
== COMMUNITY_LIST_STANDARD
14247 vty_out(vty
, " %s\n",
14248 community_direct_str(entry
->direct
));
14250 vty_out(vty
, " %s %s\n",
14251 community_direct_str(entry
->direct
),
14252 community_list_config_str(entry
));
14256 DEFUN (show_community_list
,
14257 show_bgp_community_list_cmd
,
14258 "show bgp community-list",
14261 "List community-list\n")
14263 struct community_list
*list
;
14264 struct community_list_master
*cm
;
14267 if (argv_find(argv
, argc
, "ip", &idx
)) {
14268 vty_out(vty
, "This config option is deprecated, and is scheduled for removal.\n");
14269 vty_out(vty
, "if you are using this please migrate to the below command.\n");
14270 vty_out(vty
, "'show bgp community-list <(1-500)|WORD>'\n");
14271 zlog_warn("Deprecated option: 'ip show community-list <(1-500)|WORD>' being used");
14273 cm
= community_list_master_lookup(bgp_clist
, COMMUNITY_LIST_MASTER
);
14275 return CMD_SUCCESS
;
14277 for (list
= cm
->num
.head
; list
; list
= list
->next
)
14278 community_list_show(vty
, list
);
14280 for (list
= cm
->str
.head
; list
; list
= list
->next
)
14281 community_list_show(vty
, list
);
14283 return CMD_SUCCESS
;
14286 ALIAS (show_community_list
,
14287 show_ip_community_list_cmd
,
14288 "show ip community-list",
14291 "List community-list\n")
14293 DEFUN (show_community_list_arg
,
14294 show_bgp_community_list_arg_cmd
,
14295 "show bgp community-list <(1-500)|WORD>",
14298 "List community-list\n"
14299 "Community-list number\n"
14300 "Community-list name\n")
14302 int idx_comm_list
= 3;
14303 struct community_list
*list
;
14306 if (argv_find(argv
, argc
, "ip", &idx
)) {
14307 vty_out(vty
, "This config option is deprecated, and is scheduled for removal.\n");
14308 vty_out(vty
, "if you are using this please migrate to the below command.\n");
14309 vty_out(vty
, "'show bgp community-list <(1-500)|WORD>'\n");
14310 zlog_warn("Deprecated option: 'ip show community-list <(1-500)|WORD>' being used");
14312 list
= community_list_lookup(bgp_clist
, argv
[idx_comm_list
]->arg
,
14313 COMMUNITY_LIST_MASTER
);
14315 vty_out(vty
, "%% Can't find community-list\n");
14316 return CMD_WARNING
;
14319 community_list_show(vty
, list
);
14321 return CMD_SUCCESS
;
14324 ALIAS (show_community_list_arg
,
14325 show_ip_community_list_arg_cmd
,
14326 "show ip community-list <(1-500)|WORD>",
14329 "List community-list\n"
14330 "Community-list number\n"
14331 "Community-list name\n")
14334 * Large Community code.
14336 static int lcommunity_list_set_vty(struct vty
*vty
, int argc
,
14337 struct cmd_token
**argv
, int style
,
14338 int reject_all_digit_name
)
14346 if (argv_find(argv
, argc
, "ip", &idx
)) {
14347 vty_out(vty
, "This config option is deprecated, and is scheduled for removal.\n");
14348 vty_out(vty
, "if you are using this please migrate to the below command.\n");
14349 vty_out(vty
, "'bgp large-community-list <(1-99)|(100-500)|standard|expanded> <deny|permit> <LINE|AA:BB:CC>'\n");
14350 zlog_warn("Deprecated option: 'large-community-list <(1-99)|(100-500)|standard|expanded> <deny|permit> <LINE|AA:BB:CC>' being used");
14352 direct
= argv_find(argv
, argc
, "permit", &idx
) ? COMMUNITY_PERMIT
14355 /* All digit name check. */
14357 argv_find(argv
, argc
, "WORD", &idx
);
14358 argv_find(argv
, argc
, "(1-99)", &idx
);
14359 argv_find(argv
, argc
, "(100-500)", &idx
);
14360 cl_name
= argv
[idx
]->arg
;
14361 if (reject_all_digit_name
&& all_digit(cl_name
)) {
14362 vty_out(vty
, "%% Community name cannot have all digits\n");
14363 return CMD_WARNING_CONFIG_FAILED
;
14367 argv_find(argv
, argc
, "AA:BB:CC", &idx
);
14368 argv_find(argv
, argc
, "LINE", &idx
);
14369 /* Concat community string argument. */
14371 str
= argv_concat(argv
, argc
, idx
);
14375 ret
= lcommunity_list_set(bgp_clist
, cl_name
, str
, direct
, style
);
14377 /* Free temporary community list string allocated by
14380 XFREE(MTYPE_TMP
, str
);
14383 community_list_perror(vty
, ret
);
14384 return CMD_WARNING_CONFIG_FAILED
;
14386 return CMD_SUCCESS
;
14389 static int lcommunity_list_unset_vty(struct vty
*vty
, int argc
,
14390 struct cmd_token
**argv
, int style
)
14397 if (argv_find(argv
, argc
, "ip", &idx
)) {
14398 vty_out(vty
, "This config option is deprecated, and is scheduled for removal.\n");
14399 vty_out(vty
, "if you are using this please migrate to the below command.\n");
14400 vty_out(vty
, "'no bgp large-community-list <(1-99)|(100-500)|standard|expanded> <deny|permit> <LINE|AA:BB:CC>'\n");
14401 zlog_warn("Deprecated option: 'no ip large-community-list <(1-99)|(100-500)|standard|expanded> <deny|permit> <LINE|AA:BB:CC>' being used");
14403 argv_find(argv
, argc
, "permit", &idx
);
14404 argv_find(argv
, argc
, "deny", &idx
);
14407 /* Check the list direct. */
14408 if (strncmp(argv
[idx
]->arg
, "p", 1) == 0)
14409 direct
= COMMUNITY_PERMIT
;
14411 direct
= COMMUNITY_DENY
;
14414 argv_find(argv
, argc
, "LINE", &idx
);
14415 argv_find(argv
, argc
, "AA:AA:NN", &idx
);
14416 /* Concat community string argument. */
14417 str
= argv_concat(argv
, argc
, idx
);
14421 argv_find(argv
, argc
, "(1-99)", &idx
);
14422 argv_find(argv
, argc
, "(100-500)", &idx
);
14423 argv_find(argv
, argc
, "WORD", &idx
);
14425 /* Unset community list. */
14426 ret
= lcommunity_list_unset(bgp_clist
, argv
[idx
]->arg
, str
, direct
,
14429 /* Free temporary community list string allocated by
14432 XFREE(MTYPE_TMP
, str
);
14435 community_list_perror(vty
, ret
);
14436 return CMD_WARNING_CONFIG_FAILED
;
14439 return CMD_SUCCESS
;
14442 /* "large-community-list" keyword help string. */
14443 #define LCOMMUNITY_LIST_STR "Add a large community list entry\n"
14444 #define LCOMMUNITY_VAL_STR "large community in 'aa:bb:cc' format\n"
14446 #if CONFDATE > 20191005
14447 CPP_NOTICE("bgpd: remove deprecated 'ip large-community-list <(1-99)|(100-500)|standard|expanded> <deny|permit> <LINE|AA:BB:CC>' command")
14449 DEFUN (lcommunity_list_standard
,
14450 bgp_lcommunity_list_standard_cmd
,
14451 "bgp large-community-list (1-99) <deny|permit>",
14453 LCOMMUNITY_LIST_STR
14454 "Large Community list number (standard)\n"
14455 "Specify large community to reject\n"
14456 "Specify large community to accept\n")
14458 return lcommunity_list_set_vty(vty
, argc
, argv
,
14459 LARGE_COMMUNITY_LIST_STANDARD
, 0);
14462 ALIAS (lcommunity_list_standard
,
14463 ip_lcommunity_list_standard_cmd
,
14464 "ip large-community-list (1-99) <deny|permit>",
14466 LCOMMUNITY_LIST_STR
14467 "Large Community list number (standard)\n"
14468 "Specify large community to reject\n"
14469 "Specify large community to accept\n")
14471 DEFUN (lcommunity_list_standard1
,
14472 bgp_lcommunity_list_standard1_cmd
,
14473 "bgp large-community-list (1-99) <deny|permit> AA:BB:CC...",
14475 LCOMMUNITY_LIST_STR
14476 "Large Community list number (standard)\n"
14477 "Specify large community to reject\n"
14478 "Specify large community to accept\n"
14479 LCOMMUNITY_VAL_STR
)
14481 return lcommunity_list_set_vty(vty
, argc
, argv
,
14482 LARGE_COMMUNITY_LIST_STANDARD
, 0);
14485 ALIAS (lcommunity_list_standard1
,
14486 ip_lcommunity_list_standard1_cmd
,
14487 "ip large-community-list (1-99) <deny|permit> AA:BB:CC...",
14489 LCOMMUNITY_LIST_STR
14490 "Large Community list number (standard)\n"
14491 "Specify large community to reject\n"
14492 "Specify large community to accept\n"
14493 LCOMMUNITY_VAL_STR
)
14495 DEFUN (lcommunity_list_expanded
,
14496 bgp_lcommunity_list_expanded_cmd
,
14497 "bgp large-community-list (100-500) <deny|permit> LINE...",
14499 LCOMMUNITY_LIST_STR
14500 "Large Community list number (expanded)\n"
14501 "Specify large community to reject\n"
14502 "Specify large community to accept\n"
14503 "An ordered list as a regular-expression\n")
14505 return lcommunity_list_set_vty(vty
, argc
, argv
,
14506 LARGE_COMMUNITY_LIST_EXPANDED
, 0);
14509 ALIAS (lcommunity_list_expanded
,
14510 ip_lcommunity_list_expanded_cmd
,
14511 "ip large-community-list (100-500) <deny|permit> LINE...",
14513 LCOMMUNITY_LIST_STR
14514 "Large Community list number (expanded)\n"
14515 "Specify large community to reject\n"
14516 "Specify large community to accept\n"
14517 "An ordered list as a regular-expression\n")
14519 DEFUN (lcommunity_list_name_standard
,
14520 bgp_lcommunity_list_name_standard_cmd
,
14521 "bgp large-community-list standard WORD <deny|permit>",
14523 LCOMMUNITY_LIST_STR
14524 "Specify standard large-community-list\n"
14525 "Large Community list name\n"
14526 "Specify large community to reject\n"
14527 "Specify large community to accept\n")
14529 return lcommunity_list_set_vty(vty
, argc
, argv
,
14530 LARGE_COMMUNITY_LIST_STANDARD
, 1);
14533 ALIAS (lcommunity_list_name_standard
,
14534 ip_lcommunity_list_name_standard_cmd
,
14535 "ip large-community-list standard WORD <deny|permit>",
14537 LCOMMUNITY_LIST_STR
14538 "Specify standard large-community-list\n"
14539 "Large Community list name\n"
14540 "Specify large community to reject\n"
14541 "Specify large community to accept\n")
14543 DEFUN (lcommunity_list_name_standard1
,
14544 bgp_lcommunity_list_name_standard1_cmd
,
14545 "bgp large-community-list standard WORD <deny|permit> AA:BB:CC...",
14547 LCOMMUNITY_LIST_STR
14548 "Specify standard large-community-list\n"
14549 "Large Community list name\n"
14550 "Specify large community to reject\n"
14551 "Specify large community to accept\n"
14552 LCOMMUNITY_VAL_STR
)
14554 return lcommunity_list_set_vty(vty
, argc
, argv
,
14555 LARGE_COMMUNITY_LIST_STANDARD
, 1);
14558 ALIAS (lcommunity_list_name_standard1
,
14559 ip_lcommunity_list_name_standard1_cmd
,
14560 "ip large-community-list standard WORD <deny|permit> AA:BB:CC...",
14562 LCOMMUNITY_LIST_STR
14563 "Specify standard large-community-list\n"
14564 "Large Community list name\n"
14565 "Specify large community to reject\n"
14566 "Specify large community to accept\n"
14567 LCOMMUNITY_VAL_STR
)
14569 DEFUN (lcommunity_list_name_expanded
,
14570 bgp_lcommunity_list_name_expanded_cmd
,
14571 "bgp large-community-list expanded WORD <deny|permit> LINE...",
14573 LCOMMUNITY_LIST_STR
14574 "Specify expanded large-community-list\n"
14575 "Large Community list name\n"
14576 "Specify large community to reject\n"
14577 "Specify large community to accept\n"
14578 "An ordered list as a regular-expression\n")
14580 return lcommunity_list_set_vty(vty
, argc
, argv
,
14581 LARGE_COMMUNITY_LIST_EXPANDED
, 1);
14584 ALIAS (lcommunity_list_name_expanded
,
14585 ip_lcommunity_list_name_expanded_cmd
,
14586 "ip large-community-list expanded WORD <deny|permit> LINE...",
14588 LCOMMUNITY_LIST_STR
14589 "Specify expanded large-community-list\n"
14590 "Large Community list name\n"
14591 "Specify large community to reject\n"
14592 "Specify large community to accept\n"
14593 "An ordered list as a regular-expression\n")
14595 DEFUN (no_lcommunity_list_standard_all
,
14596 no_bgp_lcommunity_list_standard_all_cmd
,
14597 "no bgp large-community-list <(1-99)|(100-500)|WORD>",
14600 LCOMMUNITY_LIST_STR
14601 "Large Community list number (standard)\n"
14602 "Large Community list number (expanded)\n"
14603 "Large Community list name\n")
14605 return lcommunity_list_unset_vty(vty
, argc
, argv
,
14606 LARGE_COMMUNITY_LIST_STANDARD
);
14609 ALIAS (no_lcommunity_list_standard_all
,
14610 no_ip_lcommunity_list_standard_all_cmd
,
14611 "no ip large-community-list <(1-99)|(100-500)|WORD>",
14614 LCOMMUNITY_LIST_STR
14615 "Large Community list number (standard)\n"
14616 "Large Community list number (expanded)\n"
14617 "Large Community list name\n")
14619 DEFUN (no_lcommunity_list_name_expanded_all
,
14620 no_bgp_lcommunity_list_name_expanded_all_cmd
,
14621 "no bgp large-community-list expanded WORD",
14624 LCOMMUNITY_LIST_STR
14625 "Specify expanded large-community-list\n"
14626 "Large Community list name\n")
14628 return lcommunity_list_unset_vty(vty
, argc
, argv
,
14629 LARGE_COMMUNITY_LIST_EXPANDED
);
14632 ALIAS (no_lcommunity_list_name_expanded_all
,
14633 no_ip_lcommunity_list_name_expanded_all_cmd
,
14634 "no ip large-community-list expanded WORD",
14637 LCOMMUNITY_LIST_STR
14638 "Specify expanded large-community-list\n"
14639 "Large Community list name\n")
14641 DEFUN (no_lcommunity_list_standard
,
14642 no_bgp_lcommunity_list_standard_cmd
,
14643 "no bgp large-community-list (1-99) <deny|permit> AA:AA:NN...",
14646 LCOMMUNITY_LIST_STR
14647 "Large Community list number (standard)\n"
14648 "Specify large community to reject\n"
14649 "Specify large community to accept\n"
14650 LCOMMUNITY_VAL_STR
)
14652 return lcommunity_list_unset_vty(vty
, argc
, argv
,
14653 LARGE_COMMUNITY_LIST_STANDARD
);
14656 ALIAS (no_lcommunity_list_standard
,
14657 no_ip_lcommunity_list_standard_cmd
,
14658 "no ip large-community-list (1-99) <deny|permit> AA:AA:NN...",
14661 LCOMMUNITY_LIST_STR
14662 "Large Community list number (standard)\n"
14663 "Specify large community to reject\n"
14664 "Specify large community to accept\n"
14665 LCOMMUNITY_VAL_STR
)
14667 DEFUN (no_lcommunity_list_expanded
,
14668 no_bgp_lcommunity_list_expanded_cmd
,
14669 "no bgp large-community-list (100-500) <deny|permit> LINE...",
14672 LCOMMUNITY_LIST_STR
14673 "Large Community list number (expanded)\n"
14674 "Specify large community to reject\n"
14675 "Specify large community to accept\n"
14676 "An ordered list as a regular-expression\n")
14678 return lcommunity_list_unset_vty(vty
, argc
, argv
,
14679 LARGE_COMMUNITY_LIST_EXPANDED
);
14682 ALIAS (no_lcommunity_list_expanded
,
14683 no_ip_lcommunity_list_expanded_cmd
,
14684 "no ip large-community-list (100-500) <deny|permit> LINE...",
14687 LCOMMUNITY_LIST_STR
14688 "Large Community list number (expanded)\n"
14689 "Specify large community to reject\n"
14690 "Specify large community to accept\n"
14691 "An ordered list as a regular-expression\n")
14693 DEFUN (no_lcommunity_list_name_standard
,
14694 no_bgp_lcommunity_list_name_standard_cmd
,
14695 "no bgp large-community-list standard WORD <deny|permit> AA:AA:NN...",
14698 LCOMMUNITY_LIST_STR
14699 "Specify standard large-community-list\n"
14700 "Large Community list name\n"
14701 "Specify large community to reject\n"
14702 "Specify large community to accept\n"
14703 LCOMMUNITY_VAL_STR
)
14705 return lcommunity_list_unset_vty(vty
, argc
, argv
,
14706 LARGE_COMMUNITY_LIST_STANDARD
);
14709 ALIAS (no_lcommunity_list_name_standard
,
14710 no_ip_lcommunity_list_name_standard_cmd
,
14711 "no ip large-community-list standard WORD <deny|permit> AA:AA:NN...",
14714 LCOMMUNITY_LIST_STR
14715 "Specify standard large-community-list\n"
14716 "Large Community list name\n"
14717 "Specify large community to reject\n"
14718 "Specify large community to accept\n"
14719 LCOMMUNITY_VAL_STR
)
14721 DEFUN (no_lcommunity_list_name_expanded
,
14722 no_bgp_lcommunity_list_name_expanded_cmd
,
14723 "no bgp large-community-list expanded WORD <deny|permit> LINE...",
14726 LCOMMUNITY_LIST_STR
14727 "Specify expanded large-community-list\n"
14728 "Large community list name\n"
14729 "Specify large community to reject\n"
14730 "Specify large community to accept\n"
14731 "An ordered list as a regular-expression\n")
14733 return lcommunity_list_unset_vty(vty
, argc
, argv
,
14734 LARGE_COMMUNITY_LIST_EXPANDED
);
14737 ALIAS (no_lcommunity_list_name_expanded
,
14738 no_ip_lcommunity_list_name_expanded_cmd
,
14739 "no ip large-community-list expanded WORD <deny|permit> LINE...",
14742 LCOMMUNITY_LIST_STR
14743 "Specify expanded large-community-list\n"
14744 "Large community list name\n"
14745 "Specify large community to reject\n"
14746 "Specify large community to accept\n"
14747 "An ordered list as a regular-expression\n")
14749 static void lcommunity_list_show(struct vty
*vty
, struct community_list
*list
)
14751 struct community_entry
*entry
;
14753 for (entry
= list
->head
; entry
; entry
= entry
->next
) {
14754 if (entry
== list
->head
) {
14755 if (all_digit(list
->name
))
14756 vty_out(vty
, "Large community %s list %s\n",
14757 entry
->style
== EXTCOMMUNITY_LIST_STANDARD
14759 : "(expanded) access",
14763 "Named large community %s list %s\n",
14764 entry
->style
== EXTCOMMUNITY_LIST_STANDARD
14770 vty_out(vty
, " %s\n",
14771 community_direct_str(entry
->direct
));
14773 vty_out(vty
, " %s %s\n",
14774 community_direct_str(entry
->direct
),
14775 community_list_config_str(entry
));
14779 DEFUN (show_lcommunity_list
,
14780 show_bgp_lcommunity_list_cmd
,
14781 "show bgp large-community-list",
14784 "List large-community list\n")
14786 struct community_list
*list
;
14787 struct community_list_master
*cm
;
14790 if (argv_find(argv
, argc
, "ip", &idx
)) {
14791 vty_out(vty
, "This config option is deprecated, and is scheduled for removal.\n");
14792 vty_out(vty
, "if you are using this please migrate to the below command.\n");
14793 vty_out(vty
, "'show bgp large-community-list <(1-500)|WORD>'\n");
14794 zlog_warn("Deprecated option: 'ip show large-community-list <(1-500)|WORD>' being used");
14797 cm
= community_list_master_lookup(bgp_clist
,
14798 LARGE_COMMUNITY_LIST_MASTER
);
14800 return CMD_SUCCESS
;
14802 for (list
= cm
->num
.head
; list
; list
= list
->next
)
14803 lcommunity_list_show(vty
, list
);
14805 for (list
= cm
->str
.head
; list
; list
= list
->next
)
14806 lcommunity_list_show(vty
, list
);
14808 return CMD_SUCCESS
;
14811 ALIAS (show_lcommunity_list
,
14812 show_ip_lcommunity_list_cmd
,
14813 "show ip large-community-list",
14816 "List large-community list\n")
14818 DEFUN (show_lcommunity_list_arg
,
14819 show_bgp_lcommunity_list_arg_cmd
,
14820 "show bgp large-community-list <(1-500)|WORD>",
14823 "List large-community list\n"
14824 "large-community-list number\n"
14825 "large-community-list name\n")
14827 struct community_list
*list
;
14830 if (argv_find(argv
, argc
, "ip", &idx
)) {
14831 vty_out(vty
, "This config option is deprecated, and is scheduled for removal.\n");
14832 vty_out(vty
, "if you are using this please migrate to the below command.\n");
14833 vty_out(vty
, "'show bgp large-community-list <(1-500)|WORD>'\n");
14834 zlog_warn("Deprecated option: 'ip show large-community-list <(1-500)|WORD>' being used");
14837 list
= community_list_lookup(bgp_clist
, argv
[3]->arg
,
14838 LARGE_COMMUNITY_LIST_MASTER
);
14840 vty_out(vty
, "%% Can't find extcommunity-list\n");
14841 return CMD_WARNING
;
14844 lcommunity_list_show(vty
, list
);
14846 return CMD_SUCCESS
;
14849 ALIAS (show_lcommunity_list_arg
,
14850 show_ip_lcommunity_list_arg_cmd
,
14851 "show ip large-community-list <(1-500)|WORD>",
14854 "List large-community list\n"
14855 "large-community-list number\n"
14856 "large-community-list name\n")
14858 /* "extcommunity-list" keyword help string. */
14859 #define EXTCOMMUNITY_LIST_STR "Add a extended community list entry\n"
14860 #define EXTCOMMUNITY_VAL_STR "Extended community attribute in 'rt aa:nn_or_IPaddr:nn' OR 'soo aa:nn_or_IPaddr:nn' format\n"
14862 DEFUN (extcommunity_list_standard
,
14863 bgp_extcommunity_list_standard_cmd
,
14864 "bgp extcommunity-list <(1-99)|standard WORD> <deny|permit> AA:NN...",
14866 EXTCOMMUNITY_LIST_STR
14867 "Extended Community list number (standard)\n"
14868 "Specify standard extcommunity-list\n"
14869 "Community list name\n"
14870 "Specify community to reject\n"
14871 "Specify community to accept\n"
14872 EXTCOMMUNITY_VAL_STR
)
14874 int style
= EXTCOMMUNITY_LIST_STANDARD
;
14876 char *cl_number_or_name
= NULL
;
14879 if (argv_find(argv
, argc
, "ip", &idx
)) {
14880 vty_out(vty
, "This config option is deprecated, and is scheduled for removal.\n");
14881 vty_out(vty
, "if you are using this please migrate to the below command.\n");
14882 vty_out(vty
, "'bgp extcommunity-list <(1-99)|(100-500)|standard|expanded> <deny|permit> <LINE|AA:NN>'\n");
14883 zlog_warn("Deprecated option: 'ip extcommunity-list <(1-99)|(100-500)|standard|expanded> <deny|permit> <LINE|AA:NN>' being used");
14885 argv_find(argv
, argc
, "(1-99)", &idx
);
14886 argv_find(argv
, argc
, "WORD", &idx
);
14887 cl_number_or_name
= argv
[idx
]->arg
;
14888 direct
= argv_find(argv
, argc
, "permit", &idx
) ? COMMUNITY_PERMIT
14890 argv_find(argv
, argc
, "AA:NN", &idx
);
14891 char *str
= argv_concat(argv
, argc
, idx
);
14893 int ret
= extcommunity_list_set(bgp_clist
, cl_number_or_name
, str
,
14896 XFREE(MTYPE_TMP
, str
);
14899 community_list_perror(vty
, ret
);
14900 return CMD_WARNING_CONFIG_FAILED
;
14903 return CMD_SUCCESS
;
14906 #if CONFDATE > 20191005
14907 CPP_NOTICE("bgpd: remove deprecated 'ip extcommunity-list <(1-99)|(100-500)|standard|expanded> <deny|permit> <LINE|AA:NN>' command")
14909 ALIAS (extcommunity_list_standard
,
14910 ip_extcommunity_list_standard_cmd
,
14911 "ip extcommunity-list <(1-99)|standard WORD> <deny|permit> AA:NN...",
14913 EXTCOMMUNITY_LIST_STR
14914 "Extended Community list number (standard)\n"
14915 "Specify standard extcommunity-list\n"
14916 "Community list name\n"
14917 "Specify community to reject\n"
14918 "Specify community to accept\n"
14919 EXTCOMMUNITY_VAL_STR
)
14921 DEFUN (extcommunity_list_name_expanded
,
14922 bgp_extcommunity_list_name_expanded_cmd
,
14923 "bgp extcommunity-list <(100-500)|expanded WORD> <deny|permit> LINE...",
14925 EXTCOMMUNITY_LIST_STR
14926 "Extended Community list number (expanded)\n"
14927 "Specify expanded extcommunity-list\n"
14928 "Extended Community list name\n"
14929 "Specify community to reject\n"
14930 "Specify community to accept\n"
14931 "An ordered list as a regular-expression\n")
14933 int style
= EXTCOMMUNITY_LIST_EXPANDED
;
14935 char *cl_number_or_name
= NULL
;
14938 if (argv_find(argv
, argc
, "ip", &idx
)) {
14939 vty_out(vty
, "This config option is deprecated, and is scheduled for removal.\n");
14940 vty_out(vty
, "if you are using this please migrate to the below command.\n");
14941 vty_out(vty
, "'extcommunity-list <(1-99)|(100-500)|standard|expanded> <deny|permit> <LINE|AA:NN>'\n");
14942 zlog_warn("Deprecated option: ‘ip extcommunity-list <(1-99)|(100-500)|standard|expanded> <deny|permit> <LINE|AA:NN>' being used");
14945 argv_find(argv
, argc
, "(100-500)", &idx
);
14946 argv_find(argv
, argc
, "WORD", &idx
);
14947 cl_number_or_name
= argv
[idx
]->arg
;
14948 direct
= argv_find(argv
, argc
, "permit", &idx
) ? COMMUNITY_PERMIT
14950 argv_find(argv
, argc
, "LINE", &idx
);
14951 char *str
= argv_concat(argv
, argc
, idx
);
14953 int ret
= extcommunity_list_set(bgp_clist
, cl_number_or_name
, str
,
14956 XFREE(MTYPE_TMP
, str
);
14959 community_list_perror(vty
, ret
);
14960 return CMD_WARNING_CONFIG_FAILED
;
14963 return CMD_SUCCESS
;
14966 ALIAS (extcommunity_list_name_expanded
,
14967 ip_extcommunity_list_name_expanded_cmd
,
14968 "ip extcommunity-list <(100-500)|expanded WORD> <deny|permit> LINE...",
14970 EXTCOMMUNITY_LIST_STR
14971 "Extended Community list number (expanded)\n"
14972 "Specify expanded extcommunity-list\n"
14973 "Extended Community list name\n"
14974 "Specify community to reject\n"
14975 "Specify community to accept\n"
14976 "An ordered list as a regular-expression\n")
14978 DEFUN (no_extcommunity_list_standard_all
,
14979 no_bgp_extcommunity_list_standard_all_cmd
,
14980 "no bgp extcommunity-list <(1-99)|standard WORD> <deny|permit> AA:NN...",
14983 EXTCOMMUNITY_LIST_STR
14984 "Extended Community list number (standard)\n"
14985 "Specify standard extcommunity-list\n"
14986 "Community list name\n"
14987 "Specify community to reject\n"
14988 "Specify community to accept\n"
14989 EXTCOMMUNITY_VAL_STR
)
14991 int style
= EXTCOMMUNITY_LIST_STANDARD
;
14993 char *cl_number_or_name
= NULL
;
14997 if (argv_find(argv
, argc
, "ip", &idx
)) {
14998 vty_out(vty
, "This config option is deprecated, and is scheduled for removal\n");
14999 vty_out(vty
, "if you are using this please migrate to the below command.\n");
15000 vty_out(vty
, "'no bgp extcommunity-list <(1-99)|(100-500)|standard|expanded> <deny|permit> <LINE|AA:NN>'\n");
15001 zlog_warn("Deprecated option: ‘no ip extcommunity-list <(1-99)|(100-500)|standard|expanded> <deny|permit> <LINE|AA:NN>' being used");
15005 argv_find(argv
, argc
, "permit", &idx
);
15006 argv_find(argv
, argc
, "deny", &idx
);
15009 direct
= argv_find(argv
, argc
, "permit", &idx
)
15014 argv_find(argv
, argc
, "AA:NN", &idx
);
15015 str
= argv_concat(argv
, argc
, idx
);
15019 argv_find(argv
, argc
, "(1-99)", &idx
);
15020 argv_find(argv
, argc
, "WORD", &idx
);
15021 cl_number_or_name
= argv
[idx
]->arg
;
15023 int ret
= extcommunity_list_unset(bgp_clist
, cl_number_or_name
, str
,
15026 XFREE(MTYPE_TMP
, str
);
15029 community_list_perror(vty
, ret
);
15030 return CMD_WARNING_CONFIG_FAILED
;
15033 return CMD_SUCCESS
;
15036 ALIAS (no_extcommunity_list_standard_all
,
15037 no_ip_extcommunity_list_standard_all_cmd
,
15038 "no ip extcommunity-list <(1-99)|standard WORD> <deny|permit> AA:NN...",
15041 EXTCOMMUNITY_LIST_STR
15042 "Extended Community list number (standard)\n"
15043 "Specify standard extcommunity-list\n"
15044 "Community list name\n"
15045 "Specify community to reject\n"
15046 "Specify community to accept\n"
15047 EXTCOMMUNITY_VAL_STR
)
15049 ALIAS(no_extcommunity_list_standard_all
,
15050 no_bgp_extcommunity_list_standard_all_list_cmd
,
15051 "no bgp extcommunity-list <(1-99)|standard WORD>",
15052 NO_STR IP_STR EXTCOMMUNITY_LIST_STR
15053 "Extended Community list number (standard)\n"
15054 "Specify standard extcommunity-list\n"
15055 "Community list name\n")
15057 ALIAS(no_extcommunity_list_standard_all
,
15058 no_ip_extcommunity_list_standard_all_list_cmd
,
15059 "no ip extcommunity-list <(1-99)|standard WORD>",
15060 NO_STR IP_STR EXTCOMMUNITY_LIST_STR
15061 "Extended Community list number (standard)\n"
15062 "Specify standard extcommunity-list\n"
15063 "Community list name\n")
15065 DEFUN (no_extcommunity_list_expanded_all
,
15066 no_bgp_extcommunity_list_expanded_all_cmd
,
15067 "no bgp extcommunity-list <(100-500)|expanded WORD> <deny|permit> LINE...",
15070 EXTCOMMUNITY_LIST_STR
15071 "Extended Community list number (expanded)\n"
15072 "Specify expanded extcommunity-list\n"
15073 "Extended Community list name\n"
15074 "Specify community to reject\n"
15075 "Specify community to accept\n"
15076 "An ordered list as a regular-expression\n")
15078 int style
= EXTCOMMUNITY_LIST_EXPANDED
;
15080 char *cl_number_or_name
= NULL
;
15084 if (argv_find(argv
, argc
, "ip", &idx
)) {
15085 vty_out(vty
, "This config option is deprecated, and is scheduled for removal.\n");
15086 vty_out(vty
, "if you are using this please migrate to the below command.\n");
15087 vty_out(vty
, "'no bgp extcommunity-list <(1-99)|(100-500)|standard|expanded> <deny|permit> <LINE|AA:NN>'\n");
15088 zlog_warn("Deprecated option: ‘no ip extcommunity-list <(1-99)|(100-500)|standard|expanded> <deny|permit> <LINE|AA:NN>' being used");
15092 argv_find(argv
, argc
, "permit", &idx
);
15093 argv_find(argv
, argc
, "deny", &idx
);
15096 direct
= argv_find(argv
, argc
, "permit", &idx
)
15101 argv_find(argv
, argc
, "LINE", &idx
);
15102 str
= argv_concat(argv
, argc
, idx
);
15106 argv_find(argv
, argc
, "(100-500)", &idx
);
15107 argv_find(argv
, argc
, "WORD", &idx
);
15108 cl_number_or_name
= argv
[idx
]->arg
;
15110 int ret
= extcommunity_list_unset(bgp_clist
, cl_number_or_name
, str
,
15113 XFREE(MTYPE_TMP
, str
);
15116 community_list_perror(vty
, ret
);
15117 return CMD_WARNING_CONFIG_FAILED
;
15120 return CMD_SUCCESS
;
15123 ALIAS (no_extcommunity_list_expanded_all
,
15124 no_ip_extcommunity_list_expanded_all_cmd
,
15125 "no ip extcommunity-list <(100-500)|expanded WORD> <deny|permit> LINE...",
15128 EXTCOMMUNITY_LIST_STR
15129 "Extended Community list number (expanded)\n"
15130 "Specify expanded extcommunity-list\n"
15131 "Extended Community list name\n"
15132 "Specify community to reject\n"
15133 "Specify community to accept\n"
15134 "An ordered list as a regular-expression\n")
15136 ALIAS(no_extcommunity_list_expanded_all
,
15137 no_ip_extcommunity_list_expanded_all_list_cmd
,
15138 "no ip extcommunity-list <(100-500)|expanded WORD>",
15139 NO_STR IP_STR EXTCOMMUNITY_LIST_STR
15140 "Extended Community list number (expanded)\n"
15141 "Specify expanded extcommunity-list\n"
15142 "Extended Community list name\n")
15144 ALIAS(no_extcommunity_list_expanded_all
,
15145 no_bgp_extcommunity_list_expanded_all_list_cmd
,
15146 "no bgp extcommunity-list <(100-500)|expanded WORD>",
15147 NO_STR IP_STR EXTCOMMUNITY_LIST_STR
15148 "Extended Community list number (expanded)\n"
15149 "Specify expanded extcommunity-list\n"
15150 "Extended Community list name\n")
15152 static void extcommunity_list_show(struct vty
*vty
, struct community_list
*list
)
15154 struct community_entry
*entry
;
15156 for (entry
= list
->head
; entry
; entry
= entry
->next
) {
15157 if (entry
== list
->head
) {
15158 if (all_digit(list
->name
))
15159 vty_out(vty
, "Extended community %s list %s\n",
15160 entry
->style
== EXTCOMMUNITY_LIST_STANDARD
15162 : "(expanded) access",
15166 "Named extended community %s list %s\n",
15167 entry
->style
== EXTCOMMUNITY_LIST_STANDARD
15173 vty_out(vty
, " %s\n",
15174 community_direct_str(entry
->direct
));
15176 vty_out(vty
, " %s %s\n",
15177 community_direct_str(entry
->direct
),
15178 community_list_config_str(entry
));
15182 DEFUN (show_extcommunity_list
,
15183 show_bgp_extcommunity_list_cmd
,
15184 "show bgp extcommunity-list",
15187 "List extended-community list\n")
15189 struct community_list
*list
;
15190 struct community_list_master
*cm
;
15193 if (argv_find(argv
, argc
, "ip", &idx
)) {
15194 vty_out(vty
, "This config option is deprecated, and is scheduled for removal\n");
15195 vty_out(vty
, "if you are using this please migrate to the below command.\n");
15196 vty_out(vty
, "'show bgp extcommunity-list <(1-500)|WORD>'\n");
15197 zlog_warn("Deprecated option: 'ip show extcommunity-list <(1-500)|WORD>' being used");
15199 cm
= community_list_master_lookup(bgp_clist
, EXTCOMMUNITY_LIST_MASTER
);
15201 return CMD_SUCCESS
;
15203 for (list
= cm
->num
.head
; list
; list
= list
->next
)
15204 extcommunity_list_show(vty
, list
);
15206 for (list
= cm
->str
.head
; list
; list
= list
->next
)
15207 extcommunity_list_show(vty
, list
);
15209 return CMD_SUCCESS
;
15212 ALIAS (show_extcommunity_list
,
15213 show_ip_extcommunity_list_cmd
,
15214 "show ip extcommunity-list",
15217 "List extended-community list\n")
15219 DEFUN (show_extcommunity_list_arg
,
15220 show_bgp_extcommunity_list_arg_cmd
,
15221 "show bgp extcommunity-list <(1-500)|WORD>",
15224 "List extended-community list\n"
15225 "Extcommunity-list number\n"
15226 "Extcommunity-list name\n")
15228 int idx_comm_list
= 3;
15229 struct community_list
*list
;
15232 if (argv_find(argv
, argc
, "ip", &idx
)) {
15233 vty_out(vty
, "This config option is deprecated, and is scheduled for removal.\n");
15234 vty_out(vty
, "if you are using this please migrate to the below command.\n");
15235 vty_out(vty
, "'show bgp extcommunity-list <(1-500)|WORD>'\n");
15236 zlog_warn("Deprecated option: 'ip show extcommunity-list <(1-500)|WORD>' being used");
15238 list
= community_list_lookup(bgp_clist
, argv
[idx_comm_list
]->arg
,
15239 EXTCOMMUNITY_LIST_MASTER
);
15241 vty_out(vty
, "%% Can't find extcommunity-list\n");
15242 return CMD_WARNING
;
15245 extcommunity_list_show(vty
, list
);
15247 return CMD_SUCCESS
;
15250 ALIAS (show_extcommunity_list_arg
,
15251 show_ip_extcommunity_list_arg_cmd
,
15252 "show ip extcommunity-list <(1-500)|WORD>",
15255 "List extended-community list\n"
15256 "Extcommunity-list number\n"
15257 "Extcommunity-list name\n")
15259 /* Display community-list and extcommunity-list configuration. */
15260 static int community_list_config_write(struct vty
*vty
)
15262 struct community_list
*list
;
15263 struct community_entry
*entry
;
15264 struct community_list_master
*cm
;
15267 /* Community-list. */
15268 cm
= community_list_master_lookup(bgp_clist
, COMMUNITY_LIST_MASTER
);
15270 for (list
= cm
->num
.head
; list
; list
= list
->next
)
15271 for (entry
= list
->head
; entry
; entry
= entry
->next
) {
15272 vty_out(vty
, "bgp community-list %s %s %s\n", list
->name
,
15273 community_direct_str(entry
->direct
),
15274 community_list_config_str(entry
));
15277 for (list
= cm
->str
.head
; list
; list
= list
->next
)
15278 for (entry
= list
->head
; entry
; entry
= entry
->next
) {
15279 vty_out(vty
, "bgp community-list %s %s %s %s\n",
15280 entry
->style
== COMMUNITY_LIST_STANDARD
15283 list
->name
, community_direct_str(entry
->direct
),
15284 community_list_config_str(entry
));
15288 /* Extcommunity-list. */
15289 cm
= community_list_master_lookup(bgp_clist
, EXTCOMMUNITY_LIST_MASTER
);
15291 for (list
= cm
->num
.head
; list
; list
= list
->next
)
15292 for (entry
= list
->head
; entry
; entry
= entry
->next
) {
15293 vty_out(vty
, "bgp extcommunity-list %s %s %s\n",
15294 list
->name
, community_direct_str(entry
->direct
),
15295 community_list_config_str(entry
));
15298 for (list
= cm
->str
.head
; list
; list
= list
->next
)
15299 for (entry
= list
->head
; entry
; entry
= entry
->next
) {
15300 vty_out(vty
, "bgp extcommunity-list %s %s %s %s\n",
15301 entry
->style
== EXTCOMMUNITY_LIST_STANDARD
15304 list
->name
, community_direct_str(entry
->direct
),
15305 community_list_config_str(entry
));
15310 /* lcommunity-list. */
15311 cm
= community_list_master_lookup(bgp_clist
,
15312 LARGE_COMMUNITY_LIST_MASTER
);
15314 for (list
= cm
->num
.head
; list
; list
= list
->next
)
15315 for (entry
= list
->head
; entry
; entry
= entry
->next
) {
15316 vty_out(vty
, "bgp large-community-list %s %s %s\n",
15317 list
->name
, community_direct_str(entry
->direct
),
15318 community_list_config_str(entry
));
15321 for (list
= cm
->str
.head
; list
; list
= list
->next
)
15322 for (entry
= list
->head
; entry
; entry
= entry
->next
) {
15323 vty_out(vty
, "bgp large-community-list %s %s %s %s\n",
15324 entry
->style
== LARGE_COMMUNITY_LIST_STANDARD
15327 list
->name
, community_direct_str(entry
->direct
),
15328 community_list_config_str(entry
));
15335 static struct cmd_node community_list_node
= {
15336 COMMUNITY_LIST_NODE
, "", 1 /* Export to vtysh. */
15339 static void community_list_vty(void)
15341 install_node(&community_list_node
, community_list_config_write
);
15343 /* Community-list. */
15344 install_element(CONFIG_NODE
, &bgp_community_list_standard_cmd
);
15345 install_element(CONFIG_NODE
, &bgp_community_list_expanded_all_cmd
);
15346 install_element(CONFIG_NODE
, &no_bgp_community_list_standard_all_cmd
);
15347 install_element(CONFIG_NODE
, &no_bgp_community_list_standard_all_list_cmd
);
15348 install_element(CONFIG_NODE
, &no_bgp_community_list_expanded_all_cmd
);
15349 install_element(CONFIG_NODE
, &no_bgp_community_list_expanded_all_list_cmd
);
15350 install_element(VIEW_NODE
, &show_bgp_community_list_cmd
);
15351 install_element(VIEW_NODE
, &show_bgp_community_list_arg_cmd
);
15352 install_element(CONFIG_NODE
, &ip_community_list_standard_cmd
);
15353 install_element(CONFIG_NODE
, &ip_community_list_expanded_all_cmd
);
15354 install_element(CONFIG_NODE
, &no_ip_community_list_standard_all_cmd
);
15355 install_element(CONFIG_NODE
, &no_ip_community_list_standard_all_list_cmd
);
15356 install_element(CONFIG_NODE
, &no_ip_community_list_expanded_all_cmd
);
15357 install_element(CONFIG_NODE
, &no_ip_community_list_expanded_all_list_cmd
);
15358 install_element(VIEW_NODE
, &show_ip_community_list_cmd
);
15359 install_element(VIEW_NODE
, &show_ip_community_list_arg_cmd
);
15361 /* Extcommunity-list. */
15362 install_element(CONFIG_NODE
, &bgp_extcommunity_list_standard_cmd
);
15363 install_element(CONFIG_NODE
, &bgp_extcommunity_list_name_expanded_cmd
);
15364 install_element(CONFIG_NODE
, &no_bgp_extcommunity_list_standard_all_cmd
);
15365 install_element(CONFIG_NODE
,
15366 &no_bgp_extcommunity_list_standard_all_list_cmd
);
15367 install_element(CONFIG_NODE
, &no_bgp_extcommunity_list_expanded_all_cmd
);
15368 install_element(CONFIG_NODE
,
15369 &no_bgp_extcommunity_list_expanded_all_list_cmd
);
15370 install_element(VIEW_NODE
, &show_bgp_extcommunity_list_cmd
);
15371 install_element(VIEW_NODE
, &show_bgp_extcommunity_list_arg_cmd
);
15372 install_element(CONFIG_NODE
, &ip_extcommunity_list_standard_cmd
);
15373 install_element(CONFIG_NODE
, &ip_extcommunity_list_name_expanded_cmd
);
15374 install_element(CONFIG_NODE
, &no_ip_extcommunity_list_standard_all_cmd
);
15375 install_element(CONFIG_NODE
, &no_ip_extcommunity_list_standard_all_list_cmd
);
15376 install_element(CONFIG_NODE
, &no_ip_extcommunity_list_expanded_all_cmd
);
15377 install_element(CONFIG_NODE
, &no_ip_extcommunity_list_expanded_all_list_cmd
);
15378 install_element(VIEW_NODE
, &show_ip_extcommunity_list_cmd
);
15379 install_element(VIEW_NODE
, &show_ip_extcommunity_list_arg_cmd
);
15381 /* Large Community List */
15382 install_element(CONFIG_NODE
, &bgp_lcommunity_list_standard_cmd
);
15383 install_element(CONFIG_NODE
, &bgp_lcommunity_list_standard1_cmd
);
15384 install_element(CONFIG_NODE
, &bgp_lcommunity_list_expanded_cmd
);
15385 install_element(CONFIG_NODE
, &bgp_lcommunity_list_name_standard_cmd
);
15386 install_element(CONFIG_NODE
, &bgp_lcommunity_list_name_standard1_cmd
);
15387 install_element(CONFIG_NODE
, &bgp_lcommunity_list_name_expanded_cmd
);
15388 install_element(CONFIG_NODE
, &no_bgp_lcommunity_list_standard_all_cmd
);
15389 install_element(CONFIG_NODE
,
15390 &no_bgp_lcommunity_list_name_expanded_all_cmd
);
15391 install_element(CONFIG_NODE
, &no_bgp_lcommunity_list_standard_cmd
);
15392 install_element(CONFIG_NODE
, &no_bgp_lcommunity_list_expanded_cmd
);
15393 install_element(CONFIG_NODE
, &no_bgp_lcommunity_list_name_standard_cmd
);
15394 install_element(CONFIG_NODE
, &no_bgp_lcommunity_list_name_expanded_cmd
);
15395 install_element(VIEW_NODE
, &show_bgp_lcommunity_list_cmd
);
15396 install_element(VIEW_NODE
, &show_bgp_lcommunity_list_arg_cmd
);
15397 install_element(CONFIG_NODE
, &ip_lcommunity_list_standard_cmd
);
15398 install_element(CONFIG_NODE
, &ip_lcommunity_list_standard1_cmd
);
15399 install_element(CONFIG_NODE
, &ip_lcommunity_list_expanded_cmd
);
15400 install_element(CONFIG_NODE
, &ip_lcommunity_list_name_standard_cmd
);
15401 install_element(CONFIG_NODE
, &ip_lcommunity_list_name_standard1_cmd
);
15402 install_element(CONFIG_NODE
, &ip_lcommunity_list_name_expanded_cmd
);
15403 install_element(CONFIG_NODE
, &no_ip_lcommunity_list_standard_all_cmd
);
15404 install_element(CONFIG_NODE
,
15405 &no_ip_lcommunity_list_name_expanded_all_cmd
);
15406 install_element(CONFIG_NODE
, &no_ip_lcommunity_list_standard_cmd
);
15407 install_element(CONFIG_NODE
, &no_ip_lcommunity_list_expanded_cmd
);
15408 install_element(CONFIG_NODE
, &no_ip_lcommunity_list_name_standard_cmd
);
15409 install_element(CONFIG_NODE
, &no_ip_lcommunity_list_name_expanded_cmd
);
15410 install_element(VIEW_NODE
, &show_ip_lcommunity_list_cmd
);
15411 install_element(VIEW_NODE
, &show_ip_lcommunity_list_arg_cmd
);