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",
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;
978 const char *name
= NULL
;
979 enum bgp_instance_type inst_type
;
981 // "router bgp" without an ASN
983 // Pending: Make VRF option available for ASN less config
984 bgp
= bgp_get_default();
987 vty_out(vty
, "%% No BGP process is configured\n");
988 return CMD_WARNING_CONFIG_FAILED
;
991 if (listcount(bm
->bgp
) > 1) {
992 vty_out(vty
, "%% Please specify ASN and VRF\n");
993 return CMD_WARNING_CONFIG_FAILED
;
999 as
= strtoul(argv
[idx_asn
]->arg
, NULL
, 10);
1001 inst_type
= BGP_INSTANCE_TYPE_DEFAULT
;
1003 name
= argv
[idx_vrf
]->arg
;
1005 if (!strcmp(argv
[idx_view_vrf
]->text
, "vrf")) {
1006 if (strmatch(name
, VRF_DEFAULT_NAME
))
1009 inst_type
= BGP_INSTANCE_TYPE_VRF
;
1010 } else if (!strcmp(argv
[idx_view_vrf
]->text
, "view"))
1011 inst_type
= BGP_INSTANCE_TYPE_VIEW
;
1014 ret
= bgp_get(&bgp
, &as
, name
, inst_type
);
1016 case BGP_ERR_MULTIPLE_INSTANCE_NOT_SET
:
1018 "Please specify 'bgp multiple-instance' first\n");
1019 return CMD_WARNING_CONFIG_FAILED
;
1020 case BGP_ERR_AS_MISMATCH
:
1021 vty_out(vty
, "BGP is already running; AS is %u\n", as
);
1022 return CMD_WARNING_CONFIG_FAILED
;
1023 case BGP_ERR_INSTANCE_MISMATCH
:
1025 "BGP instance name and AS number mismatch\n");
1027 "BGP instance is already running; AS is %u\n",
1029 return CMD_WARNING_CONFIG_FAILED
;
1033 * If we just instantiated the default instance, complete
1034 * any pending VRF-VPN leaking that was configured via
1035 * earlier "router bgp X vrf FOO" blocks.
1037 if (inst_type
== BGP_INSTANCE_TYPE_DEFAULT
)
1038 vpn_leak_postchange_all();
1040 /* Pending: handle when user tries to change a view to vrf n vv.
1044 /* unset the auto created flag as the user config is now present */
1045 UNSET_FLAG(bgp
->vrf_flags
, BGP_VRF_AUTO
);
1046 VTY_PUSH_CONTEXT(BGP_NODE
, bgp
);
1051 /* "no router bgp" commands. */
1052 DEFUN (no_router_bgp
,
1054 "no router bgp [(1-4294967295) [<view|vrf> VIEWVRFNAME]]",
1059 BGP_INSTANCE_HELP_STR
)
1065 const char *name
= NULL
;
1067 // "no router bgp" without an ASN
1069 // Pending: Make VRF option available for ASN less config
1070 bgp
= bgp_get_default();
1073 vty_out(vty
, "%% No BGP process is configured\n");
1074 return CMD_WARNING_CONFIG_FAILED
;
1077 if (listcount(bm
->bgp
) > 1) {
1078 vty_out(vty
, "%% Please specify ASN and VRF\n");
1079 return CMD_WARNING_CONFIG_FAILED
;
1083 vty_out(vty
, "%% Please unconfigure l3vni %u",
1085 return CMD_WARNING_CONFIG_FAILED
;
1088 as
= strtoul(argv
[idx_asn
]->arg
, NULL
, 10);
1091 name
= argv
[idx_vrf
]->arg
;
1093 /* Lookup bgp structure. */
1094 bgp
= bgp_lookup(as
, name
);
1096 vty_out(vty
, "%% Can't find BGP instance\n");
1097 return CMD_WARNING_CONFIG_FAILED
;
1101 vty_out(vty
, "%% Please unconfigure l3vni %u",
1103 return CMD_WARNING_CONFIG_FAILED
;
1113 /* BGP router-id. */
1115 DEFPY (bgp_router_id
,
1117 "bgp router-id A.B.C.D",
1119 "Override configured router identifier\n"
1120 "Manually configured router identifier\n")
1122 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1123 bgp_router_id_static_set(bgp
, router_id
);
1127 DEFPY (no_bgp_router_id
,
1128 no_bgp_router_id_cmd
,
1129 "no bgp router-id [A.B.C.D]",
1132 "Override configured router identifier\n"
1133 "Manually configured router identifier\n")
1135 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1137 if (router_id_str
) {
1138 if (!IPV4_ADDR_SAME(&bgp
->router_id_static
, &router_id
)) {
1139 vty_out(vty
, "%% BGP router-id doesn't match\n");
1140 return CMD_WARNING_CONFIG_FAILED
;
1144 router_id
.s_addr
= 0;
1145 bgp_router_id_static_set(bgp
, router_id
);
1151 /* BGP Cluster ID. */
1152 DEFUN (bgp_cluster_id
,
1154 "bgp cluster-id <A.B.C.D|(1-4294967295)>",
1156 "Configure Route-Reflector Cluster-id\n"
1157 "Route-Reflector Cluster-id in IP address format\n"
1158 "Route-Reflector Cluster-id as 32 bit quantity\n")
1160 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1163 struct in_addr cluster
;
1165 ret
= inet_aton(argv
[idx_ipv4
]->arg
, &cluster
);
1167 vty_out(vty
, "%% Malformed bgp cluster identifier\n");
1168 return CMD_WARNING_CONFIG_FAILED
;
1171 bgp_cluster_id_set(bgp
, &cluster
);
1172 bgp_clear_star_soft_out(vty
, bgp
->name
);
1177 DEFUN (no_bgp_cluster_id
,
1178 no_bgp_cluster_id_cmd
,
1179 "no bgp cluster-id [<A.B.C.D|(1-4294967295)>]",
1182 "Configure Route-Reflector Cluster-id\n"
1183 "Route-Reflector Cluster-id in IP address format\n"
1184 "Route-Reflector Cluster-id as 32 bit quantity\n")
1186 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1187 bgp_cluster_id_unset(bgp
);
1188 bgp_clear_star_soft_out(vty
, bgp
->name
);
1193 DEFUN (bgp_confederation_identifier
,
1194 bgp_confederation_identifier_cmd
,
1195 "bgp confederation identifier (1-4294967295)",
1196 "BGP specific commands\n"
1197 "AS confederation parameters\n"
1199 "Set routing domain confederation AS\n")
1201 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1205 as
= strtoul(argv
[idx_number
]->arg
, NULL
, 10);
1207 bgp_confederation_id_set(bgp
, as
);
1212 DEFUN (no_bgp_confederation_identifier
,
1213 no_bgp_confederation_identifier_cmd
,
1214 "no bgp confederation identifier [(1-4294967295)]",
1216 "BGP specific commands\n"
1217 "AS confederation parameters\n"
1219 "Set routing domain confederation AS\n")
1221 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1222 bgp_confederation_id_unset(bgp
);
1227 DEFUN (bgp_confederation_peers
,
1228 bgp_confederation_peers_cmd
,
1229 "bgp confederation peers (1-4294967295)...",
1230 "BGP specific commands\n"
1231 "AS confederation parameters\n"
1232 "Peer ASs in BGP confederation\n"
1235 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1240 for (i
= idx_asn
; i
< argc
; i
++) {
1241 as
= strtoul(argv
[i
]->arg
, NULL
, 10);
1243 if (bgp
->as
== as
) {
1245 "%% Local member-AS not allowed in confed peer list\n");
1249 bgp_confederation_peers_add(bgp
, as
);
1254 DEFUN (no_bgp_confederation_peers
,
1255 no_bgp_confederation_peers_cmd
,
1256 "no bgp confederation peers (1-4294967295)...",
1258 "BGP specific commands\n"
1259 "AS confederation parameters\n"
1260 "Peer ASs in BGP confederation\n"
1263 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1268 for (i
= idx_asn
; i
< argc
; i
++) {
1269 as
= strtoul(argv
[i
]->arg
, NULL
, 10);
1271 bgp_confederation_peers_remove(bgp
, as
);
1277 * Central routine for maximum-paths configuration.
1278 * @peer_type: BGP_PEER_EBGP or BGP_PEER_IBGP
1279 * @set: 1 for setting values, 0 for removing the max-paths config.
1281 static int bgp_maxpaths_config_vty(struct vty
*vty
, int peer_type
,
1282 const char *mpaths
, uint16_t options
,
1285 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1286 uint16_t maxpaths
= 0;
1291 afi
= bgp_node_afi(vty
);
1292 safi
= bgp_node_safi(vty
);
1295 maxpaths
= strtol(mpaths
, NULL
, 10);
1296 if (maxpaths
> multipath_num
) {
1298 "%% Maxpaths Specified: %d is > than multipath num specified on bgp command line %d",
1299 maxpaths
, multipath_num
);
1300 return CMD_WARNING_CONFIG_FAILED
;
1302 ret
= bgp_maximum_paths_set(bgp
, afi
, safi
, peer_type
, maxpaths
,
1305 ret
= bgp_maximum_paths_unset(bgp
, afi
, safi
, peer_type
);
1309 "%% Failed to %sset maximum-paths %s %u for afi %u, safi %u\n",
1310 (set
== 1) ? "" : "un",
1311 (peer_type
== BGP_PEER_EBGP
) ? "ebgp" : "ibgp",
1312 maxpaths
, afi
, safi
);
1313 return CMD_WARNING_CONFIG_FAILED
;
1316 bgp_recalculate_all_bestpaths(bgp
);
1321 DEFUN (bgp_maxmed_admin
,
1322 bgp_maxmed_admin_cmd
,
1323 "bgp max-med administrative ",
1325 "Advertise routes with max-med\n"
1326 "Administratively applied, for an indefinite period\n")
1328 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1330 bgp
->v_maxmed_admin
= 1;
1331 bgp
->maxmed_admin_value
= BGP_MAXMED_VALUE_DEFAULT
;
1333 bgp_maxmed_update(bgp
);
1338 DEFUN (bgp_maxmed_admin_medv
,
1339 bgp_maxmed_admin_medv_cmd
,
1340 "bgp max-med administrative (0-4294967295)",
1342 "Advertise routes with max-med\n"
1343 "Administratively applied, for an indefinite period\n"
1344 "Max MED value to be used\n")
1346 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1349 bgp
->v_maxmed_admin
= 1;
1350 bgp
->maxmed_admin_value
= strtoul(argv
[idx_number
]->arg
, NULL
, 10);
1352 bgp_maxmed_update(bgp
);
1357 DEFUN (no_bgp_maxmed_admin
,
1358 no_bgp_maxmed_admin_cmd
,
1359 "no bgp max-med administrative [(0-4294967295)]",
1362 "Advertise routes with max-med\n"
1363 "Administratively applied, for an indefinite period\n"
1364 "Max MED value to be used\n")
1366 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1367 bgp
->v_maxmed_admin
= BGP_MAXMED_ADMIN_UNCONFIGURED
;
1368 bgp
->maxmed_admin_value
= BGP_MAXMED_VALUE_DEFAULT
;
1369 bgp_maxmed_update(bgp
);
1374 DEFUN (bgp_maxmed_onstartup
,
1375 bgp_maxmed_onstartup_cmd
,
1376 "bgp max-med on-startup (5-86400) [(0-4294967295)]",
1378 "Advertise routes with max-med\n"
1379 "Effective on a startup\n"
1380 "Time (seconds) period for max-med\n"
1381 "Max MED value to be used\n")
1383 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1386 argv_find(argv
, argc
, "(5-86400)", &idx
);
1387 bgp
->v_maxmed_onstartup
= strtoul(argv
[idx
]->arg
, NULL
, 10);
1388 if (argv_find(argv
, argc
, "(0-4294967295)", &idx
))
1389 bgp
->maxmed_onstartup_value
= strtoul(argv
[idx
]->arg
, NULL
, 10);
1391 bgp
->maxmed_onstartup_value
= BGP_MAXMED_VALUE_DEFAULT
;
1393 bgp_maxmed_update(bgp
);
1398 DEFUN (no_bgp_maxmed_onstartup
,
1399 no_bgp_maxmed_onstartup_cmd
,
1400 "no bgp max-med on-startup [(5-86400) [(0-4294967295)]]",
1403 "Advertise routes with max-med\n"
1404 "Effective on a startup\n"
1405 "Time (seconds) period for max-med\n"
1406 "Max MED value to be used\n")
1408 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1410 /* Cancel max-med onstartup if its on */
1411 if (bgp
->t_maxmed_onstartup
) {
1412 THREAD_TIMER_OFF(bgp
->t_maxmed_onstartup
);
1413 bgp
->maxmed_onstartup_over
= 1;
1416 bgp
->v_maxmed_onstartup
= BGP_MAXMED_ONSTARTUP_UNCONFIGURED
;
1417 bgp
->maxmed_onstartup_value
= BGP_MAXMED_VALUE_DEFAULT
;
1419 bgp_maxmed_update(bgp
);
1424 static int bgp_update_delay_config_vty(struct vty
*vty
, const char *delay
,
1427 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1428 uint16_t update_delay
;
1429 uint16_t establish_wait
;
1431 update_delay
= strtoul(delay
, NULL
, 10);
1433 if (!wait
) /* update-delay <delay> */
1435 bgp
->v_update_delay
= update_delay
;
1436 bgp
->v_establish_wait
= bgp
->v_update_delay
;
1440 /* update-delay <delay> <establish-wait> */
1441 establish_wait
= atoi(wait
);
1442 if (update_delay
< establish_wait
) {
1444 "%%Failed: update-delay less than the establish-wait!\n");
1445 return CMD_WARNING_CONFIG_FAILED
;
1448 bgp
->v_update_delay
= update_delay
;
1449 bgp
->v_establish_wait
= establish_wait
;
1454 static int bgp_update_delay_deconfig_vty(struct vty
*vty
)
1456 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1458 bgp
->v_update_delay
= BGP_UPDATE_DELAY_DEF
;
1459 bgp
->v_establish_wait
= bgp
->v_update_delay
;
1464 void bgp_config_write_update_delay(struct vty
*vty
, struct bgp
*bgp
)
1466 if (bgp
->v_update_delay
!= BGP_UPDATE_DELAY_DEF
) {
1467 vty_out(vty
, " update-delay %d", bgp
->v_update_delay
);
1468 if (bgp
->v_update_delay
!= bgp
->v_establish_wait
)
1469 vty_out(vty
, " %d", bgp
->v_establish_wait
);
1475 /* Update-delay configuration */
1476 DEFUN (bgp_update_delay
,
1477 bgp_update_delay_cmd
,
1478 "update-delay (0-3600)",
1479 "Force initial delay for best-path and updates\n"
1483 return bgp_update_delay_config_vty(vty
, argv
[idx_number
]->arg
, NULL
);
1486 DEFUN (bgp_update_delay_establish_wait
,
1487 bgp_update_delay_establish_wait_cmd
,
1488 "update-delay (0-3600) (1-3600)",
1489 "Force initial delay for best-path and updates\n"
1494 int idx_number_2
= 2;
1495 return bgp_update_delay_config_vty(vty
, argv
[idx_number
]->arg
,
1496 argv
[idx_number_2
]->arg
);
1499 /* Update-delay deconfiguration */
1500 DEFUN (no_bgp_update_delay
,
1501 no_bgp_update_delay_cmd
,
1502 "no update-delay [(0-3600) [(1-3600)]]",
1504 "Force initial delay for best-path and updates\n"
1508 return bgp_update_delay_deconfig_vty(vty
);
1512 static int bgp_wpkt_quanta_config_vty(struct vty
*vty
, const char *num
,
1515 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1518 uint32_t quanta
= strtoul(num
, NULL
, 10);
1519 atomic_store_explicit(&bgp
->wpkt_quanta
, quanta
,
1520 memory_order_relaxed
);
1522 atomic_store_explicit(&bgp
->wpkt_quanta
, BGP_WRITE_PACKET_MAX
,
1523 memory_order_relaxed
);
1529 static int bgp_rpkt_quanta_config_vty(struct vty
*vty
, const char *num
,
1532 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1535 uint32_t quanta
= strtoul(num
, NULL
, 10);
1536 atomic_store_explicit(&bgp
->rpkt_quanta
, quanta
,
1537 memory_order_relaxed
);
1539 atomic_store_explicit(&bgp
->rpkt_quanta
, BGP_READ_PACKET_MAX
,
1540 memory_order_relaxed
);
1546 void bgp_config_write_wpkt_quanta(struct vty
*vty
, struct bgp
*bgp
)
1549 atomic_load_explicit(&bgp
->wpkt_quanta
, memory_order_relaxed
);
1550 if (quanta
!= BGP_WRITE_PACKET_MAX
)
1551 vty_out(vty
, " write-quanta %d\n", quanta
);
1554 void bgp_config_write_rpkt_quanta(struct vty
*vty
, struct bgp
*bgp
)
1557 atomic_load_explicit(&bgp
->rpkt_quanta
, memory_order_relaxed
);
1558 if (quanta
!= BGP_READ_PACKET_MAX
)
1559 vty_out(vty
, " read-quanta %d\n", quanta
);
1562 /* Packet quanta configuration */
1563 DEFUN (bgp_wpkt_quanta
,
1564 bgp_wpkt_quanta_cmd
,
1565 "write-quanta (1-10)",
1566 "How many packets to write to peer socket per run\n"
1567 "Number of packets\n")
1570 return bgp_wpkt_quanta_config_vty(vty
, argv
[idx_number
]->arg
, 1);
1573 DEFUN (no_bgp_wpkt_quanta
,
1574 no_bgp_wpkt_quanta_cmd
,
1575 "no write-quanta (1-10)",
1577 "How many packets to write to peer socket per I/O cycle\n"
1578 "Number of packets\n")
1581 return bgp_wpkt_quanta_config_vty(vty
, argv
[idx_number
]->arg
, 0);
1584 DEFUN (bgp_rpkt_quanta
,
1585 bgp_rpkt_quanta_cmd
,
1586 "read-quanta (1-10)",
1587 "How many packets to read from peer socket per I/O cycle\n"
1588 "Number of packets\n")
1591 return bgp_rpkt_quanta_config_vty(vty
, argv
[idx_number
]->arg
, 1);
1594 DEFUN (no_bgp_rpkt_quanta
,
1595 no_bgp_rpkt_quanta_cmd
,
1596 "no read-quanta (1-10)",
1598 "How many packets to read from peer socket per I/O cycle\n"
1599 "Number of packets\n")
1602 return bgp_rpkt_quanta_config_vty(vty
, argv
[idx_number
]->arg
, 0);
1605 void bgp_config_write_coalesce_time(struct vty
*vty
, struct bgp
*bgp
)
1607 if (!bgp
->heuristic_coalesce
)
1608 vty_out(vty
, " coalesce-time %u\n", bgp
->coalesce_time
);
1612 DEFUN (bgp_coalesce_time
,
1613 bgp_coalesce_time_cmd
,
1614 "coalesce-time (0-4294967295)",
1615 "Subgroup coalesce timer\n"
1616 "Subgroup coalesce timer value (in ms)\n")
1618 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1621 argv_find(argv
, argc
, "(0-4294967295)", &idx
);
1622 bgp
->heuristic_coalesce
= false;
1623 bgp
->coalesce_time
= strtoul(argv
[idx
]->arg
, NULL
, 10);
1627 DEFUN (no_bgp_coalesce_time
,
1628 no_bgp_coalesce_time_cmd
,
1629 "no coalesce-time (0-4294967295)",
1631 "Subgroup coalesce timer\n"
1632 "Subgroup coalesce timer value (in ms)\n")
1634 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1636 bgp
->heuristic_coalesce
= true;
1637 bgp
->coalesce_time
= BGP_DEFAULT_SUBGROUP_COALESCE_TIME
;
1641 /* Maximum-paths configuration */
1642 DEFUN (bgp_maxpaths
,
1644 "maximum-paths " CMD_RANGE_STR(1, MULTIPATH_NUM
),
1645 "Forward packets over multiple paths\n"
1646 "Number of paths\n")
1649 return bgp_maxpaths_config_vty(vty
, BGP_PEER_EBGP
,
1650 argv
[idx_number
]->arg
, 0, 1);
1653 ALIAS_HIDDEN(bgp_maxpaths
, bgp_maxpaths_hidden_cmd
,
1654 "maximum-paths " CMD_RANGE_STR(1, MULTIPATH_NUM
),
1655 "Forward packets over multiple paths\n"
1656 "Number of paths\n")
1658 DEFUN (bgp_maxpaths_ibgp
,
1659 bgp_maxpaths_ibgp_cmd
,
1660 "maximum-paths ibgp " CMD_RANGE_STR(1, MULTIPATH_NUM
),
1661 "Forward packets over multiple paths\n"
1663 "Number of paths\n")
1666 return bgp_maxpaths_config_vty(vty
, BGP_PEER_IBGP
,
1667 argv
[idx_number
]->arg
, 0, 1);
1670 ALIAS_HIDDEN(bgp_maxpaths_ibgp
, bgp_maxpaths_ibgp_hidden_cmd
,
1671 "maximum-paths ibgp " CMD_RANGE_STR(1, MULTIPATH_NUM
),
1672 "Forward packets over multiple paths\n"
1674 "Number of paths\n")
1676 DEFUN (bgp_maxpaths_ibgp_cluster
,
1677 bgp_maxpaths_ibgp_cluster_cmd
,
1678 "maximum-paths ibgp " CMD_RANGE_STR(1, MULTIPATH_NUM
) " equal-cluster-length",
1679 "Forward packets over multiple paths\n"
1682 "Match the cluster length\n")
1685 return bgp_maxpaths_config_vty(
1686 vty
, BGP_PEER_IBGP
, argv
[idx_number
]->arg
,
1687 BGP_FLAG_IBGP_MULTIPATH_SAME_CLUSTERLEN
, 1);
1690 ALIAS_HIDDEN(bgp_maxpaths_ibgp_cluster
, bgp_maxpaths_ibgp_cluster_hidden_cmd
,
1691 "maximum-paths ibgp " CMD_RANGE_STR(
1692 1, MULTIPATH_NUM
) " equal-cluster-length",
1693 "Forward packets over multiple paths\n"
1696 "Match the cluster length\n")
1698 DEFUN (no_bgp_maxpaths
,
1699 no_bgp_maxpaths_cmd
,
1700 "no maximum-paths [" CMD_RANGE_STR(1, MULTIPATH_NUM
) "]",
1702 "Forward packets over multiple paths\n"
1703 "Number of paths\n")
1705 return bgp_maxpaths_config_vty(vty
, BGP_PEER_EBGP
, NULL
, 0, 0);
1708 ALIAS_HIDDEN(no_bgp_maxpaths
, no_bgp_maxpaths_hidden_cmd
,
1709 "no maximum-paths [" CMD_RANGE_STR(1, MULTIPATH_NUM
) "]", NO_STR
1710 "Forward packets over multiple paths\n"
1711 "Number of paths\n")
1713 DEFUN (no_bgp_maxpaths_ibgp
,
1714 no_bgp_maxpaths_ibgp_cmd
,
1715 "no maximum-paths ibgp [" CMD_RANGE_STR(1, MULTIPATH_NUM
) " [equal-cluster-length]]",
1717 "Forward packets over multiple paths\n"
1720 "Match the cluster length\n")
1722 return bgp_maxpaths_config_vty(vty
, BGP_PEER_IBGP
, NULL
, 0, 0);
1725 ALIAS_HIDDEN(no_bgp_maxpaths_ibgp
, no_bgp_maxpaths_ibgp_hidden_cmd
,
1726 "no maximum-paths ibgp [" CMD_RANGE_STR(
1727 1, MULTIPATH_NUM
) " [equal-cluster-length]]",
1729 "Forward packets over multiple paths\n"
1732 "Match the cluster length\n")
1734 void bgp_config_write_maxpaths(struct vty
*vty
, struct bgp
*bgp
, afi_t afi
,
1737 if (bgp
->maxpaths
[afi
][safi
].maxpaths_ebgp
!= MULTIPATH_NUM
) {
1738 vty_out(vty
, " maximum-paths %d\n",
1739 bgp
->maxpaths
[afi
][safi
].maxpaths_ebgp
);
1742 if (bgp
->maxpaths
[afi
][safi
].maxpaths_ibgp
!= MULTIPATH_NUM
) {
1743 vty_out(vty
, " maximum-paths ibgp %d",
1744 bgp
->maxpaths
[afi
][safi
].maxpaths_ibgp
);
1745 if (CHECK_FLAG(bgp
->maxpaths
[afi
][safi
].ibgp_flags
,
1746 BGP_FLAG_IBGP_MULTIPATH_SAME_CLUSTERLEN
))
1747 vty_out(vty
, " equal-cluster-length");
1756 "timers bgp (0-65535) (0-65535)",
1757 "Adjust routing timers\n"
1759 "Keepalive interval\n"
1762 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1764 int idx_number_2
= 3;
1765 unsigned long keepalive
= 0;
1766 unsigned long holdtime
= 0;
1768 keepalive
= strtoul(argv
[idx_number
]->arg
, NULL
, 10);
1769 holdtime
= strtoul(argv
[idx_number_2
]->arg
, NULL
, 10);
1771 /* Holdtime value check. */
1772 if (holdtime
< 3 && holdtime
!= 0) {
1774 "%% hold time value must be either 0 or greater than 3\n");
1775 return CMD_WARNING_CONFIG_FAILED
;
1778 bgp_timers_set(bgp
, keepalive
, holdtime
);
1783 DEFUN (no_bgp_timers
,
1785 "no timers bgp [(0-65535) (0-65535)]",
1787 "Adjust routing timers\n"
1789 "Keepalive interval\n"
1792 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1793 bgp_timers_unset(bgp
);
1799 DEFUN (bgp_client_to_client_reflection
,
1800 bgp_client_to_client_reflection_cmd
,
1801 "bgp client-to-client reflection",
1802 "BGP specific commands\n"
1803 "Configure client to client route reflection\n"
1804 "reflection of routes allowed\n")
1806 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1807 bgp_flag_unset(bgp
, BGP_FLAG_NO_CLIENT_TO_CLIENT
);
1808 bgp_clear_star_soft_out(vty
, bgp
->name
);
1813 DEFUN (no_bgp_client_to_client_reflection
,
1814 no_bgp_client_to_client_reflection_cmd
,
1815 "no bgp client-to-client reflection",
1817 "BGP specific commands\n"
1818 "Configure client to client route reflection\n"
1819 "reflection of routes allowed\n")
1821 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1822 bgp_flag_set(bgp
, BGP_FLAG_NO_CLIENT_TO_CLIENT
);
1823 bgp_clear_star_soft_out(vty
, bgp
->name
);
1828 /* "bgp always-compare-med" configuration. */
1829 DEFUN (bgp_always_compare_med
,
1830 bgp_always_compare_med_cmd
,
1831 "bgp always-compare-med",
1832 "BGP specific commands\n"
1833 "Allow comparing MED from different neighbors\n")
1835 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1836 bgp_flag_set(bgp
, BGP_FLAG_ALWAYS_COMPARE_MED
);
1837 bgp_recalculate_all_bestpaths(bgp
);
1842 DEFUN (no_bgp_always_compare_med
,
1843 no_bgp_always_compare_med_cmd
,
1844 "no bgp always-compare-med",
1846 "BGP specific commands\n"
1847 "Allow comparing MED from different neighbors\n")
1849 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1850 bgp_flag_unset(bgp
, BGP_FLAG_ALWAYS_COMPARE_MED
);
1851 bgp_recalculate_all_bestpaths(bgp
);
1856 /* "bgp deterministic-med" configuration. */
1857 DEFUN (bgp_deterministic_med
,
1858 bgp_deterministic_med_cmd
,
1859 "bgp deterministic-med",
1860 "BGP specific commands\n"
1861 "Pick the best-MED path among paths advertised from the neighboring AS\n")
1863 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1865 if (!bgp_flag_check(bgp
, BGP_FLAG_DETERMINISTIC_MED
)) {
1866 bgp_flag_set(bgp
, BGP_FLAG_DETERMINISTIC_MED
);
1867 bgp_recalculate_all_bestpaths(bgp
);
1873 DEFUN (no_bgp_deterministic_med
,
1874 no_bgp_deterministic_med_cmd
,
1875 "no bgp deterministic-med",
1877 "BGP specific commands\n"
1878 "Pick the best-MED path among paths advertised from the neighboring AS\n")
1880 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1881 int bestpath_per_as_used
;
1885 struct listnode
*node
, *nnode
;
1887 if (bgp_flag_check(bgp
, BGP_FLAG_DETERMINISTIC_MED
)) {
1888 bestpath_per_as_used
= 0;
1890 for (ALL_LIST_ELEMENTS(bgp
->peer
, node
, nnode
, peer
)) {
1891 FOREACH_AFI_SAFI (afi
, safi
)
1892 if (bgp_addpath_dmed_required(
1893 peer
->addpath_type
[afi
][safi
])) {
1894 bestpath_per_as_used
= 1;
1898 if (bestpath_per_as_used
)
1902 if (bestpath_per_as_used
) {
1904 "bgp deterministic-med cannot be disabled while addpath-tx-bestpath-per-AS is in use\n");
1905 return CMD_WARNING_CONFIG_FAILED
;
1907 bgp_flag_unset(bgp
, BGP_FLAG_DETERMINISTIC_MED
);
1908 bgp_recalculate_all_bestpaths(bgp
);
1915 /* "bgp graceful-restart" configuration. */
1916 DEFUN (bgp_graceful_restart
,
1917 bgp_graceful_restart_cmd
,
1918 "bgp graceful-restart",
1919 "BGP specific commands\n"
1920 "Graceful restart capability parameters\n")
1922 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1923 bgp_flag_set(bgp
, BGP_FLAG_GRACEFUL_RESTART
);
1927 DEFUN (no_bgp_graceful_restart
,
1928 no_bgp_graceful_restart_cmd
,
1929 "no bgp graceful-restart",
1931 "BGP specific commands\n"
1932 "Graceful restart capability parameters\n")
1934 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1935 bgp_flag_unset(bgp
, BGP_FLAG_GRACEFUL_RESTART
);
1939 DEFUN (bgp_graceful_restart_stalepath_time
,
1940 bgp_graceful_restart_stalepath_time_cmd
,
1941 "bgp graceful-restart stalepath-time (1-3600)",
1942 "BGP specific commands\n"
1943 "Graceful restart capability parameters\n"
1944 "Set the max time to hold onto restarting peer's stale paths\n"
1945 "Delay value (seconds)\n")
1947 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1951 stalepath
= strtoul(argv
[idx_number
]->arg
, NULL
, 10);
1952 bgp
->stalepath_time
= stalepath
;
1956 DEFUN (bgp_graceful_restart_restart_time
,
1957 bgp_graceful_restart_restart_time_cmd
,
1958 "bgp graceful-restart restart-time (1-3600)",
1959 "BGP specific commands\n"
1960 "Graceful restart capability parameters\n"
1961 "Set the time to wait to delete stale routes before a BGP open message is received\n"
1962 "Delay value (seconds)\n")
1964 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1968 restart
= strtoul(argv
[idx_number
]->arg
, NULL
, 10);
1969 bgp
->restart_time
= restart
;
1973 DEFUN (no_bgp_graceful_restart_stalepath_time
,
1974 no_bgp_graceful_restart_stalepath_time_cmd
,
1975 "no bgp graceful-restart stalepath-time [(1-3600)]",
1977 "BGP specific commands\n"
1978 "Graceful restart capability parameters\n"
1979 "Set the max time to hold onto restarting peer's stale paths\n"
1980 "Delay value (seconds)\n")
1982 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1984 bgp
->stalepath_time
= BGP_DEFAULT_STALEPATH_TIME
;
1988 DEFUN (no_bgp_graceful_restart_restart_time
,
1989 no_bgp_graceful_restart_restart_time_cmd
,
1990 "no bgp graceful-restart restart-time [(1-3600)]",
1992 "BGP specific commands\n"
1993 "Graceful restart capability parameters\n"
1994 "Set the time to wait to delete stale routes before a BGP open message is received\n"
1995 "Delay value (seconds)\n")
1997 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1999 bgp
->restart_time
= BGP_DEFAULT_RESTART_TIME
;
2003 DEFUN (bgp_graceful_restart_preserve_fw
,
2004 bgp_graceful_restart_preserve_fw_cmd
,
2005 "bgp graceful-restart preserve-fw-state",
2006 "BGP specific commands\n"
2007 "Graceful restart capability parameters\n"
2008 "Sets F-bit indication that fib is preserved while doing Graceful Restart\n")
2010 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2011 bgp_flag_set(bgp
, BGP_FLAG_GR_PRESERVE_FWD
);
2015 DEFUN (no_bgp_graceful_restart_preserve_fw
,
2016 no_bgp_graceful_restart_preserve_fw_cmd
,
2017 "no bgp graceful-restart preserve-fw-state",
2019 "BGP specific commands\n"
2020 "Graceful restart capability parameters\n"
2021 "Unsets F-bit indication that fib is preserved while doing Graceful Restart\n")
2023 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2024 bgp_flag_unset(bgp
, BGP_FLAG_GR_PRESERVE_FWD
);
2028 static void bgp_redistribute_redo(struct bgp
*bgp
)
2032 struct list
*red_list
;
2033 struct listnode
*node
;
2034 struct bgp_redist
*red
;
2036 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++) {
2037 for (i
= 0; i
< ZEBRA_ROUTE_MAX
; i
++) {
2039 red_list
= bgp
->redist
[afi
][i
];
2043 for (ALL_LIST_ELEMENTS_RO(red_list
, node
, red
)) {
2044 bgp_redistribute_resend(bgp
, afi
, i
,
2051 /* "bgp graceful-shutdown" configuration */
2052 DEFUN (bgp_graceful_shutdown
,
2053 bgp_graceful_shutdown_cmd
,
2054 "bgp graceful-shutdown",
2056 "Graceful shutdown parameters\n")
2058 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2060 if (!bgp_flag_check(bgp
, BGP_FLAG_GRACEFUL_SHUTDOWN
)) {
2061 bgp_flag_set(bgp
, BGP_FLAG_GRACEFUL_SHUTDOWN
);
2062 bgp_static_redo_import_check(bgp
);
2063 bgp_redistribute_redo(bgp
);
2064 bgp_clear_star_soft_out(vty
, bgp
->name
);
2065 bgp_clear_star_soft_in(vty
, bgp
->name
);
2071 DEFUN (no_bgp_graceful_shutdown
,
2072 no_bgp_graceful_shutdown_cmd
,
2073 "no bgp graceful-shutdown",
2076 "Graceful shutdown parameters\n")
2078 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2080 if (bgp_flag_check(bgp
, BGP_FLAG_GRACEFUL_SHUTDOWN
)) {
2081 bgp_flag_unset(bgp
, BGP_FLAG_GRACEFUL_SHUTDOWN
);
2082 bgp_static_redo_import_check(bgp
);
2083 bgp_redistribute_redo(bgp
);
2084 bgp_clear_star_soft_out(vty
, bgp
->name
);
2085 bgp_clear_star_soft_in(vty
, bgp
->name
);
2091 /* "bgp fast-external-failover" configuration. */
2092 DEFUN (bgp_fast_external_failover
,
2093 bgp_fast_external_failover_cmd
,
2094 "bgp fast-external-failover",
2096 "Immediately reset session if a link to a directly connected external peer goes down\n")
2098 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2099 bgp_flag_unset(bgp
, BGP_FLAG_NO_FAST_EXT_FAILOVER
);
2103 DEFUN (no_bgp_fast_external_failover
,
2104 no_bgp_fast_external_failover_cmd
,
2105 "no bgp fast-external-failover",
2108 "Immediately reset session if a link to a directly connected external peer goes down\n")
2110 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2111 bgp_flag_set(bgp
, BGP_FLAG_NO_FAST_EXT_FAILOVER
);
2115 /* "bgp enforce-first-as" configuration. */
2116 #if CONFDATE > 20190517
2117 CPP_NOTICE("bgpd: remove deprecated '[no] bgp enforce-first-as' commands")
2120 DEFUN_HIDDEN (bgp_enforce_first_as
,
2121 bgp_enforce_first_as_cmd
,
2122 "[no] bgp enforce-first-as",
2125 "Enforce the first AS for EBGP routes\n")
2127 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2129 if (strmatch(argv
[0]->text
, "no"))
2130 bgp_flag_unset(bgp
, BGP_FLAG_ENFORCE_FIRST_AS
);
2132 bgp_flag_set(bgp
, BGP_FLAG_ENFORCE_FIRST_AS
);
2137 /* "bgp bestpath compare-routerid" configuration. */
2138 DEFUN (bgp_bestpath_compare_router_id
,
2139 bgp_bestpath_compare_router_id_cmd
,
2140 "bgp bestpath compare-routerid",
2141 "BGP specific commands\n"
2142 "Change the default bestpath selection\n"
2143 "Compare router-id for identical EBGP paths\n")
2145 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2146 bgp_flag_set(bgp
, BGP_FLAG_COMPARE_ROUTER_ID
);
2147 bgp_recalculate_all_bestpaths(bgp
);
2152 DEFUN (no_bgp_bestpath_compare_router_id
,
2153 no_bgp_bestpath_compare_router_id_cmd
,
2154 "no bgp bestpath compare-routerid",
2156 "BGP specific commands\n"
2157 "Change the default bestpath selection\n"
2158 "Compare router-id for identical EBGP paths\n")
2160 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2161 bgp_flag_unset(bgp
, BGP_FLAG_COMPARE_ROUTER_ID
);
2162 bgp_recalculate_all_bestpaths(bgp
);
2167 /* "bgp bestpath as-path ignore" configuration. */
2168 DEFUN (bgp_bestpath_aspath_ignore
,
2169 bgp_bestpath_aspath_ignore_cmd
,
2170 "bgp bestpath as-path ignore",
2171 "BGP specific commands\n"
2172 "Change the default bestpath selection\n"
2173 "AS-path attribute\n"
2174 "Ignore as-path length in selecting a route\n")
2176 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2177 bgp_flag_set(bgp
, BGP_FLAG_ASPATH_IGNORE
);
2178 bgp_recalculate_all_bestpaths(bgp
);
2183 DEFUN (no_bgp_bestpath_aspath_ignore
,
2184 no_bgp_bestpath_aspath_ignore_cmd
,
2185 "no bgp bestpath as-path ignore",
2187 "BGP specific commands\n"
2188 "Change the default bestpath selection\n"
2189 "AS-path attribute\n"
2190 "Ignore as-path length in selecting a route\n")
2192 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2193 bgp_flag_unset(bgp
, BGP_FLAG_ASPATH_IGNORE
);
2194 bgp_recalculate_all_bestpaths(bgp
);
2199 /* "bgp bestpath as-path confed" configuration. */
2200 DEFUN (bgp_bestpath_aspath_confed
,
2201 bgp_bestpath_aspath_confed_cmd
,
2202 "bgp bestpath as-path confed",
2203 "BGP specific commands\n"
2204 "Change the default bestpath selection\n"
2205 "AS-path attribute\n"
2206 "Compare path lengths including confederation sets & sequences in selecting a route\n")
2208 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2209 bgp_flag_set(bgp
, BGP_FLAG_ASPATH_CONFED
);
2210 bgp_recalculate_all_bestpaths(bgp
);
2215 DEFUN (no_bgp_bestpath_aspath_confed
,
2216 no_bgp_bestpath_aspath_confed_cmd
,
2217 "no bgp bestpath as-path confed",
2219 "BGP specific commands\n"
2220 "Change the default bestpath selection\n"
2221 "AS-path attribute\n"
2222 "Compare path lengths including confederation sets & sequences in selecting a route\n")
2224 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2225 bgp_flag_unset(bgp
, BGP_FLAG_ASPATH_CONFED
);
2226 bgp_recalculate_all_bestpaths(bgp
);
2231 /* "bgp bestpath as-path multipath-relax" configuration. */
2232 DEFUN (bgp_bestpath_aspath_multipath_relax
,
2233 bgp_bestpath_aspath_multipath_relax_cmd
,
2234 "bgp bestpath as-path multipath-relax [<as-set|no-as-set>]",
2235 "BGP specific commands\n"
2236 "Change the default bestpath selection\n"
2237 "AS-path attribute\n"
2238 "Allow load sharing across routes that have different AS paths (but same length)\n"
2239 "Generate an AS_SET\n"
2240 "Do not generate an AS_SET\n")
2242 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2244 bgp_flag_set(bgp
, BGP_FLAG_ASPATH_MULTIPATH_RELAX
);
2246 /* no-as-set is now the default behavior so we can silently
2248 if (argv_find(argv
, argc
, "as-set", &idx
))
2249 bgp_flag_set(bgp
, BGP_FLAG_MULTIPATH_RELAX_AS_SET
);
2251 bgp_flag_unset(bgp
, BGP_FLAG_MULTIPATH_RELAX_AS_SET
);
2253 bgp_recalculate_all_bestpaths(bgp
);
2258 DEFUN (no_bgp_bestpath_aspath_multipath_relax
,
2259 no_bgp_bestpath_aspath_multipath_relax_cmd
,
2260 "no bgp bestpath as-path multipath-relax [<as-set|no-as-set>]",
2262 "BGP specific commands\n"
2263 "Change the default bestpath selection\n"
2264 "AS-path attribute\n"
2265 "Allow load sharing across routes that have different AS paths (but same length)\n"
2266 "Generate an AS_SET\n"
2267 "Do not generate an AS_SET\n")
2269 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2270 bgp_flag_unset(bgp
, BGP_FLAG_ASPATH_MULTIPATH_RELAX
);
2271 bgp_flag_unset(bgp
, BGP_FLAG_MULTIPATH_RELAX_AS_SET
);
2272 bgp_recalculate_all_bestpaths(bgp
);
2277 /* "bgp log-neighbor-changes" configuration. */
2278 DEFUN (bgp_log_neighbor_changes
,
2279 bgp_log_neighbor_changes_cmd
,
2280 "bgp log-neighbor-changes",
2281 "BGP specific commands\n"
2282 "Log neighbor up/down and reset reason\n")
2284 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2285 bgp_flag_set(bgp
, BGP_FLAG_LOG_NEIGHBOR_CHANGES
);
2289 DEFUN (no_bgp_log_neighbor_changes
,
2290 no_bgp_log_neighbor_changes_cmd
,
2291 "no bgp log-neighbor-changes",
2293 "BGP specific commands\n"
2294 "Log neighbor up/down and reset reason\n")
2296 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2297 bgp_flag_unset(bgp
, BGP_FLAG_LOG_NEIGHBOR_CHANGES
);
2301 /* "bgp bestpath med" configuration. */
2302 DEFUN (bgp_bestpath_med
,
2303 bgp_bestpath_med_cmd
,
2304 "bgp bestpath med <confed [missing-as-worst]|missing-as-worst [confed]>",
2305 "BGP specific commands\n"
2306 "Change the default bestpath selection\n"
2308 "Compare MED among confederation paths\n"
2309 "Treat missing MED as the least preferred one\n"
2310 "Treat missing MED as the least preferred one\n"
2311 "Compare MED among confederation paths\n")
2313 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2316 if (argv_find(argv
, argc
, "confed", &idx
))
2317 bgp_flag_set(bgp
, BGP_FLAG_MED_CONFED
);
2319 if (argv_find(argv
, argc
, "missing-as-worst", &idx
))
2320 bgp_flag_set(bgp
, BGP_FLAG_MED_MISSING_AS_WORST
);
2322 bgp_recalculate_all_bestpaths(bgp
);
2327 DEFUN (no_bgp_bestpath_med
,
2328 no_bgp_bestpath_med_cmd
,
2329 "no bgp bestpath med <confed [missing-as-worst]|missing-as-worst [confed]>",
2331 "BGP specific commands\n"
2332 "Change the default bestpath selection\n"
2334 "Compare MED among confederation paths\n"
2335 "Treat missing MED as the least preferred one\n"
2336 "Treat missing MED as the least preferred one\n"
2337 "Compare MED among confederation paths\n")
2339 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2342 if (argv_find(argv
, argc
, "confed", &idx
))
2343 bgp_flag_unset(bgp
, BGP_FLAG_MED_CONFED
);
2345 if (argv_find(argv
, argc
, "missing-as-worst", &idx
))
2346 bgp_flag_unset(bgp
, BGP_FLAG_MED_MISSING_AS_WORST
);
2348 bgp_recalculate_all_bestpaths(bgp
);
2353 /* "no bgp default ipv4-unicast". */
2354 DEFUN (no_bgp_default_ipv4_unicast
,
2355 no_bgp_default_ipv4_unicast_cmd
,
2356 "no bgp default ipv4-unicast",
2358 "BGP specific commands\n"
2359 "Configure BGP defaults\n"
2360 "Activate ipv4-unicast for a peer by default\n")
2362 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2363 bgp_flag_set(bgp
, BGP_FLAG_NO_DEFAULT_IPV4
);
2367 DEFUN (bgp_default_ipv4_unicast
,
2368 bgp_default_ipv4_unicast_cmd
,
2369 "bgp default ipv4-unicast",
2370 "BGP specific commands\n"
2371 "Configure BGP defaults\n"
2372 "Activate ipv4-unicast for a peer by default\n")
2374 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2375 bgp_flag_unset(bgp
, BGP_FLAG_NO_DEFAULT_IPV4
);
2379 /* Display hostname in certain command outputs */
2380 DEFUN (bgp_default_show_hostname
,
2381 bgp_default_show_hostname_cmd
,
2382 "bgp default show-hostname",
2383 "BGP specific commands\n"
2384 "Configure BGP defaults\n"
2385 "Show hostname in certain command outputs\n")
2387 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2388 bgp_flag_set(bgp
, BGP_FLAG_SHOW_HOSTNAME
);
2392 DEFUN (no_bgp_default_show_hostname
,
2393 no_bgp_default_show_hostname_cmd
,
2394 "no bgp default show-hostname",
2396 "BGP specific commands\n"
2397 "Configure BGP defaults\n"
2398 "Show hostname in certain command outputs\n")
2400 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2401 bgp_flag_unset(bgp
, BGP_FLAG_SHOW_HOSTNAME
);
2405 /* "bgp network import-check" configuration. */
2406 DEFUN (bgp_network_import_check
,
2407 bgp_network_import_check_cmd
,
2408 "bgp network import-check",
2409 "BGP specific commands\n"
2410 "BGP network command\n"
2411 "Check BGP network route exists in IGP\n")
2413 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2414 if (!bgp_flag_check(bgp
, BGP_FLAG_IMPORT_CHECK
)) {
2415 bgp_flag_set(bgp
, BGP_FLAG_IMPORT_CHECK
);
2416 bgp_static_redo_import_check(bgp
);
2422 ALIAS_HIDDEN(bgp_network_import_check
, bgp_network_import_check_exact_cmd
,
2423 "bgp network import-check exact",
2424 "BGP specific commands\n"
2425 "BGP network command\n"
2426 "Check BGP network route exists in IGP\n"
2427 "Match route precisely\n")
2429 DEFUN (no_bgp_network_import_check
,
2430 no_bgp_network_import_check_cmd
,
2431 "no bgp network import-check",
2433 "BGP specific commands\n"
2434 "BGP network command\n"
2435 "Check BGP network route exists in IGP\n")
2437 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2438 if (bgp_flag_check(bgp
, BGP_FLAG_IMPORT_CHECK
)) {
2439 bgp_flag_unset(bgp
, BGP_FLAG_IMPORT_CHECK
);
2440 bgp_static_redo_import_check(bgp
);
2446 DEFUN (bgp_default_local_preference
,
2447 bgp_default_local_preference_cmd
,
2448 "bgp default local-preference (0-4294967295)",
2449 "BGP specific commands\n"
2450 "Configure BGP defaults\n"
2451 "local preference (higher=more preferred)\n"
2452 "Configure default local preference value\n")
2454 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2456 uint32_t local_pref
;
2458 local_pref
= strtoul(argv
[idx_number
]->arg
, NULL
, 10);
2460 bgp_default_local_preference_set(bgp
, local_pref
);
2461 bgp_clear_star_soft_in(vty
, bgp
->name
);
2466 DEFUN (no_bgp_default_local_preference
,
2467 no_bgp_default_local_preference_cmd
,
2468 "no bgp default local-preference [(0-4294967295)]",
2470 "BGP specific commands\n"
2471 "Configure BGP defaults\n"
2472 "local preference (higher=more preferred)\n"
2473 "Configure default local preference value\n")
2475 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2476 bgp_default_local_preference_unset(bgp
);
2477 bgp_clear_star_soft_in(vty
, bgp
->name
);
2483 DEFUN (bgp_default_subgroup_pkt_queue_max
,
2484 bgp_default_subgroup_pkt_queue_max_cmd
,
2485 "bgp default subgroup-pkt-queue-max (20-100)",
2486 "BGP specific commands\n"
2487 "Configure BGP defaults\n"
2488 "subgroup-pkt-queue-max\n"
2489 "Configure subgroup packet queue max\n")
2491 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2495 max_size
= strtoul(argv
[idx_number
]->arg
, NULL
, 10);
2497 bgp_default_subgroup_pkt_queue_max_set(bgp
, max_size
);
2502 DEFUN (no_bgp_default_subgroup_pkt_queue_max
,
2503 no_bgp_default_subgroup_pkt_queue_max_cmd
,
2504 "no bgp default subgroup-pkt-queue-max [(20-100)]",
2506 "BGP specific commands\n"
2507 "Configure BGP defaults\n"
2508 "subgroup-pkt-queue-max\n"
2509 "Configure subgroup packet queue max\n")
2511 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2512 bgp_default_subgroup_pkt_queue_max_unset(bgp
);
2517 DEFUN (bgp_rr_allow_outbound_policy
,
2518 bgp_rr_allow_outbound_policy_cmd
,
2519 "bgp route-reflector allow-outbound-policy",
2520 "BGP specific commands\n"
2521 "Allow modifications made by out route-map\n"
2522 "on ibgp neighbors\n")
2524 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2526 if (!bgp_flag_check(bgp
, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY
)) {
2527 bgp_flag_set(bgp
, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY
);
2528 update_group_announce_rrclients(bgp
);
2529 bgp_clear_star_soft_out(vty
, bgp
->name
);
2535 DEFUN (no_bgp_rr_allow_outbound_policy
,
2536 no_bgp_rr_allow_outbound_policy_cmd
,
2537 "no bgp route-reflector allow-outbound-policy",
2539 "BGP specific commands\n"
2540 "Allow modifications made by out route-map\n"
2541 "on ibgp neighbors\n")
2543 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2545 if (bgp_flag_check(bgp
, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY
)) {
2546 bgp_flag_unset(bgp
, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY
);
2547 update_group_announce_rrclients(bgp
);
2548 bgp_clear_star_soft_out(vty
, bgp
->name
);
2554 DEFUN (bgp_listen_limit
,
2555 bgp_listen_limit_cmd
,
2556 "bgp listen limit (1-5000)",
2557 "BGP specific commands\n"
2558 "Configure BGP defaults\n"
2559 "maximum number of BGP Dynamic Neighbors that can be created\n"
2560 "Configure Dynamic Neighbors listen limit value\n")
2562 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2566 listen_limit
= strtoul(argv
[idx_number
]->arg
, NULL
, 10);
2568 bgp_listen_limit_set(bgp
, listen_limit
);
2573 DEFUN (no_bgp_listen_limit
,
2574 no_bgp_listen_limit_cmd
,
2575 "no bgp listen limit [(1-5000)]",
2576 "BGP specific commands\n"
2577 "Configure BGP defaults\n"
2578 "unset maximum number of BGP Dynamic Neighbors that can be created\n"
2579 "Configure Dynamic Neighbors listen limit value to default\n"
2580 "Configure Dynamic Neighbors listen limit value\n")
2582 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2583 bgp_listen_limit_unset(bgp
);
2589 * Check if this listen range is already configured. Check for exact
2590 * match or overlap based on input.
2592 static struct peer_group
*listen_range_exists(struct bgp
*bgp
,
2593 struct prefix
*range
, int exact
)
2595 struct listnode
*node
, *nnode
;
2596 struct listnode
*node1
, *nnode1
;
2597 struct peer_group
*group
;
2602 afi
= family2afi(range
->family
);
2603 for (ALL_LIST_ELEMENTS(bgp
->group
, node
, nnode
, group
)) {
2604 for (ALL_LIST_ELEMENTS(group
->listen_range
[afi
], node1
, nnode1
,
2607 match
= prefix_same(range
, lr
);
2609 match
= (prefix_match(range
, lr
)
2610 || prefix_match(lr
, range
));
2619 DEFUN (bgp_listen_range
,
2620 bgp_listen_range_cmd
,
2621 "bgp listen range <A.B.C.D/M|X:X::X:X/M> peer-group WORD",
2622 "BGP specific commands\n"
2623 "Configure BGP dynamic neighbors listen range\n"
2624 "Configure BGP dynamic neighbors listen range\n"
2626 "Member of the peer-group\n"
2627 "Peer-group name\n")
2629 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2630 struct prefix range
;
2631 struct peer_group
*group
, *existing_group
;
2636 argv_find(argv
, argc
, "A.B.C.D/M", &idx
);
2637 argv_find(argv
, argc
, "X:X::X:X/M", &idx
);
2638 char *prefix
= argv
[idx
]->arg
;
2639 argv_find(argv
, argc
, "WORD", &idx
);
2640 char *peergroup
= argv
[idx
]->arg
;
2642 /* Convert IP prefix string to struct prefix. */
2643 ret
= str2prefix(prefix
, &range
);
2645 vty_out(vty
, "%% Malformed listen range\n");
2646 return CMD_WARNING_CONFIG_FAILED
;
2649 afi
= family2afi(range
.family
);
2651 if (afi
== AFI_IP6
&& IN6_IS_ADDR_LINKLOCAL(&range
.u
.prefix6
)) {
2653 "%% Malformed listen range (link-local address)\n");
2654 return CMD_WARNING_CONFIG_FAILED
;
2659 /* Check if same listen range is already configured. */
2660 existing_group
= listen_range_exists(bgp
, &range
, 1);
2661 if (existing_group
) {
2662 if (strcmp(existing_group
->name
, peergroup
) == 0)
2666 "%% Same listen range is attached to peer-group %s\n",
2667 existing_group
->name
);
2668 return CMD_WARNING_CONFIG_FAILED
;
2672 /* Check if an overlapping listen range exists. */
2673 if (listen_range_exists(bgp
, &range
, 0)) {
2675 "%% Listen range overlaps with existing listen range\n");
2676 return CMD_WARNING_CONFIG_FAILED
;
2679 group
= peer_group_lookup(bgp
, peergroup
);
2681 vty_out(vty
, "%% Configure the peer-group first\n");
2682 return CMD_WARNING_CONFIG_FAILED
;
2685 ret
= peer_group_listen_range_add(group
, &range
);
2686 return bgp_vty_return(vty
, ret
);
2689 DEFUN (no_bgp_listen_range
,
2690 no_bgp_listen_range_cmd
,
2691 "no bgp listen range <A.B.C.D/M|X:X::X:X/M> peer-group WORD",
2693 "BGP specific commands\n"
2694 "Unconfigure BGP dynamic neighbors listen range\n"
2695 "Unconfigure BGP dynamic neighbors listen range\n"
2697 "Member of the peer-group\n"
2698 "Peer-group name\n")
2700 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2701 struct prefix range
;
2702 struct peer_group
*group
;
2707 argv_find(argv
, argc
, "A.B.C.D/M", &idx
);
2708 argv_find(argv
, argc
, "X:X::X:X/M", &idx
);
2709 char *prefix
= argv
[idx
]->arg
;
2710 argv_find(argv
, argc
, "WORD", &idx
);
2711 char *peergroup
= argv
[idx
]->arg
;
2713 /* Convert IP prefix string to struct prefix. */
2714 ret
= str2prefix(prefix
, &range
);
2716 vty_out(vty
, "%% Malformed listen range\n");
2717 return CMD_WARNING_CONFIG_FAILED
;
2720 afi
= family2afi(range
.family
);
2722 if (afi
== AFI_IP6
&& IN6_IS_ADDR_LINKLOCAL(&range
.u
.prefix6
)) {
2724 "%% Malformed listen range (link-local address)\n");
2725 return CMD_WARNING_CONFIG_FAILED
;
2730 group
= peer_group_lookup(bgp
, peergroup
);
2732 vty_out(vty
, "%% Peer-group does not exist\n");
2733 return CMD_WARNING_CONFIG_FAILED
;
2736 ret
= peer_group_listen_range_del(group
, &range
);
2737 return bgp_vty_return(vty
, ret
);
2740 void bgp_config_write_listen(struct vty
*vty
, struct bgp
*bgp
)
2742 struct peer_group
*group
;
2743 struct listnode
*node
, *nnode
, *rnode
, *nrnode
;
2744 struct prefix
*range
;
2746 char buf
[PREFIX2STR_BUFFER
];
2748 if (bgp
->dynamic_neighbors_limit
!= BGP_DYNAMIC_NEIGHBORS_LIMIT_DEFAULT
)
2749 vty_out(vty
, " bgp listen limit %d\n",
2750 bgp
->dynamic_neighbors_limit
);
2752 for (ALL_LIST_ELEMENTS(bgp
->group
, node
, nnode
, group
)) {
2753 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++) {
2754 for (ALL_LIST_ELEMENTS(group
->listen_range
[afi
], rnode
,
2756 prefix2str(range
, buf
, sizeof(buf
));
2758 " bgp listen range %s peer-group %s\n",
2766 DEFUN (bgp_disable_connected_route_check
,
2767 bgp_disable_connected_route_check_cmd
,
2768 "bgp disable-ebgp-connected-route-check",
2769 "BGP specific commands\n"
2770 "Disable checking if nexthop is connected on ebgp sessions\n")
2772 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2773 bgp_flag_set(bgp
, BGP_FLAG_DISABLE_NH_CONNECTED_CHK
);
2774 bgp_clear_star_soft_in(vty
, bgp
->name
);
2779 DEFUN (no_bgp_disable_connected_route_check
,
2780 no_bgp_disable_connected_route_check_cmd
,
2781 "no bgp disable-ebgp-connected-route-check",
2783 "BGP specific commands\n"
2784 "Disable checking if nexthop is connected on ebgp sessions\n")
2786 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2787 bgp_flag_unset(bgp
, BGP_FLAG_DISABLE_NH_CONNECTED_CHK
);
2788 bgp_clear_star_soft_in(vty
, bgp
->name
);
2794 static int peer_remote_as_vty(struct vty
*vty
, const char *peer_str
,
2795 const char *as_str
, afi_t afi
, safi_t safi
)
2797 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2800 int as_type
= AS_SPECIFIED
;
2803 if (as_str
[0] == 'i') {
2805 as_type
= AS_INTERNAL
;
2806 } else if (as_str
[0] == 'e') {
2808 as_type
= AS_EXTERNAL
;
2810 /* Get AS number. */
2811 as
= strtoul(as_str
, NULL
, 10);
2814 /* If peer is peer group, call proper function. */
2815 ret
= str2sockunion(peer_str
, &su
);
2817 /* Check for peer by interface */
2818 ret
= peer_remote_as(bgp
, NULL
, peer_str
, &as
, as_type
, afi
,
2821 ret
= peer_group_remote_as(bgp
, peer_str
, &as
, as_type
);
2824 "%% Create the peer-group or interface first or specify \"interface\" keyword\n");
2825 vty_out(vty
, "%% if using an unnumbered interface neighbor\n");
2826 return CMD_WARNING_CONFIG_FAILED
;
2831 if (peer_address_self_check(bgp
, &su
)) {
2833 "%% Can not configure the local system as neighbor\n");
2834 return CMD_WARNING_CONFIG_FAILED
;
2836 ret
= peer_remote_as(bgp
, &su
, NULL
, &as
, as_type
, afi
, safi
);
2839 /* This peer belongs to peer group. */
2841 case BGP_ERR_PEER_GROUP_MEMBER
:
2843 "%% Peer-group AS %u. Cannot configure remote-as for member\n",
2845 return CMD_WARNING_CONFIG_FAILED
;
2846 case BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT
:
2848 "%% The AS# can not be changed from %u to %s, peer-group members must be all internal or all external\n",
2850 return CMD_WARNING_CONFIG_FAILED
;
2852 return bgp_vty_return(vty
, ret
);
2855 DEFUN (bgp_default_shutdown
,
2856 bgp_default_shutdown_cmd
,
2857 "[no] bgp default shutdown",
2860 "Configure BGP defaults\n"
2861 "Apply administrative shutdown to newly configured peers\n")
2863 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2864 bgp
->autoshutdown
= !strmatch(argv
[0]->text
, "no");
2868 DEFUN (neighbor_remote_as
,
2869 neighbor_remote_as_cmd
,
2870 "neighbor <A.B.C.D|X:X::X:X|WORD> remote-as <(1-4294967295)|internal|external>",
2873 "Specify a BGP neighbor\n"
2875 "Internal BGP peer\n"
2876 "External BGP peer\n")
2879 int idx_remote_as
= 3;
2880 return peer_remote_as_vty(vty
, argv
[idx_peer
]->arg
,
2881 argv
[idx_remote_as
]->arg
, AFI_IP
,
2885 static int peer_conf_interface_get(struct vty
*vty
, const char *conf_if
,
2886 afi_t afi
, safi_t safi
, int v6only
,
2887 const char *peer_group_name
,
2890 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2892 int as_type
= AS_UNSPECIFIED
;
2894 struct peer_group
*group
;
2898 group
= peer_group_lookup(bgp
, conf_if
);
2901 vty_out(vty
, "%% Name conflict with peer-group \n");
2902 return CMD_WARNING_CONFIG_FAILED
;
2906 if (as_str
[0] == 'i') {
2907 as_type
= AS_INTERNAL
;
2908 } else if (as_str
[0] == 'e') {
2909 as_type
= AS_EXTERNAL
;
2911 /* Get AS number. */
2912 as
= strtoul(as_str
, NULL
, 10);
2913 as_type
= AS_SPECIFIED
;
2917 peer
= peer_lookup_by_conf_if(bgp
, conf_if
);
2920 ret
= peer_remote_as(bgp
, NULL
, conf_if
, &as
, as_type
,
2923 if (bgp_flag_check(bgp
, BGP_FLAG_NO_DEFAULT_IPV4
)
2924 && afi
== AFI_IP
&& safi
== SAFI_UNICAST
)
2925 peer
= peer_create(NULL
, conf_if
, bgp
, bgp
->as
, as
,
2926 as_type
, 0, 0, NULL
);
2928 peer
= peer_create(NULL
, conf_if
, bgp
, bgp
->as
, as
,
2929 as_type
, afi
, safi
, NULL
);
2932 vty_out(vty
, "%% BGP failed to create peer\n");
2933 return CMD_WARNING_CONFIG_FAILED
;
2937 peer_flag_set(peer
, PEER_FLAG_IFPEER_V6ONLY
);
2939 /* Request zebra to initiate IPv6 RAs on this interface. We do
2941 * any unnumbered peer in order to not worry about run-time
2943 * (e.g., peering is initially IPv4, but the IPv4 /30 or /31
2945 * gets deleted later etc.)
2948 bgp_zebra_initiate_radv(bgp
, peer
);
2951 if ((v6only
&& !CHECK_FLAG(peer
->flags
, PEER_FLAG_IFPEER_V6ONLY
))
2952 || (!v6only
&& CHECK_FLAG(peer
->flags
, PEER_FLAG_IFPEER_V6ONLY
))) {
2954 peer_flag_set(peer
, PEER_FLAG_IFPEER_V6ONLY
);
2956 peer_flag_unset(peer
, PEER_FLAG_IFPEER_V6ONLY
);
2958 /* v6only flag changed. Reset bgp seesion */
2959 if (BGP_IS_VALID_STATE_FOR_NOTIF(peer
->status
)) {
2960 peer
->last_reset
= PEER_DOWN_V6ONLY_CHANGE
;
2961 bgp_notify_send(peer
, BGP_NOTIFY_CEASE
,
2962 BGP_NOTIFY_CEASE_CONFIG_CHANGE
);
2964 bgp_session_reset(peer
);
2967 if (!CHECK_FLAG(peer
->flags_invert
, PEER_FLAG_CAPABILITY_ENHE
)) {
2968 SET_FLAG(peer
->flags
, PEER_FLAG_CAPABILITY_ENHE
);
2969 SET_FLAG(peer
->flags_invert
, PEER_FLAG_CAPABILITY_ENHE
);
2970 UNSET_FLAG(peer
->flags_override
, PEER_FLAG_CAPABILITY_ENHE
);
2973 if (peer_group_name
) {
2974 group
= peer_group_lookup(bgp
, peer_group_name
);
2976 vty_out(vty
, "%% Configure the peer-group first\n");
2977 return CMD_WARNING_CONFIG_FAILED
;
2980 ret
= peer_group_bind(bgp
, &su
, peer
, group
, &as
);
2983 return bgp_vty_return(vty
, ret
);
2986 DEFUN (neighbor_interface_config
,
2987 neighbor_interface_config_cmd
,
2988 "neighbor WORD interface [peer-group WORD]",
2990 "Interface name or neighbor tag\n"
2991 "Enable BGP on interface\n"
2992 "Member of the peer-group\n"
2993 "Peer-group name\n")
2996 int idx_peer_group_word
= 4;
2998 if (argc
> idx_peer_group_word
)
2999 return peer_conf_interface_get(
3000 vty
, argv
[idx_word
]->arg
, AFI_IP
, SAFI_UNICAST
, 0,
3001 argv
[idx_peer_group_word
]->arg
, NULL
);
3003 return peer_conf_interface_get(vty
, argv
[idx_word
]->arg
, AFI_IP
,
3004 SAFI_UNICAST
, 0, NULL
, NULL
);
3007 DEFUN (neighbor_interface_config_v6only
,
3008 neighbor_interface_config_v6only_cmd
,
3009 "neighbor WORD interface v6only [peer-group WORD]",
3011 "Interface name or neighbor tag\n"
3012 "Enable BGP on interface\n"
3013 "Enable BGP with v6 link-local only\n"
3014 "Member of the peer-group\n"
3015 "Peer-group name\n")
3018 int idx_peer_group_word
= 5;
3020 if (argc
> idx_peer_group_word
)
3021 return peer_conf_interface_get(
3022 vty
, argv
[idx_word
]->arg
, AFI_IP
, SAFI_UNICAST
, 1,
3023 argv
[idx_peer_group_word
]->arg
, NULL
);
3025 return peer_conf_interface_get(vty
, argv
[idx_word
]->arg
, AFI_IP
,
3026 SAFI_UNICAST
, 1, NULL
, NULL
);
3030 DEFUN (neighbor_interface_config_remote_as
,
3031 neighbor_interface_config_remote_as_cmd
,
3032 "neighbor WORD interface remote-as <(1-4294967295)|internal|external>",
3034 "Interface name or neighbor tag\n"
3035 "Enable BGP on interface\n"
3036 "Specify a BGP neighbor\n"
3038 "Internal BGP peer\n"
3039 "External BGP peer\n")
3042 int idx_remote_as
= 4;
3043 return peer_conf_interface_get(vty
, argv
[idx_word
]->arg
, AFI_IP
,
3044 SAFI_UNICAST
, 0, NULL
,
3045 argv
[idx_remote_as
]->arg
);
3048 DEFUN (neighbor_interface_v6only_config_remote_as
,
3049 neighbor_interface_v6only_config_remote_as_cmd
,
3050 "neighbor WORD interface v6only remote-as <(1-4294967295)|internal|external>",
3052 "Interface name or neighbor tag\n"
3053 "Enable BGP with v6 link-local only\n"
3054 "Enable BGP on interface\n"
3055 "Specify a BGP neighbor\n"
3057 "Internal BGP peer\n"
3058 "External BGP peer\n")
3061 int idx_remote_as
= 5;
3062 return peer_conf_interface_get(vty
, argv
[idx_word
]->arg
, AFI_IP
,
3063 SAFI_UNICAST
, 1, NULL
,
3064 argv
[idx_remote_as
]->arg
);
3067 DEFUN (neighbor_peer_group
,
3068 neighbor_peer_group_cmd
,
3069 "neighbor WORD peer-group",
3071 "Interface name or neighbor tag\n"
3072 "Configure peer-group\n")
3074 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
3077 struct peer_group
*group
;
3079 peer
= peer_lookup_by_conf_if(bgp
, argv
[idx_word
]->arg
);
3081 vty_out(vty
, "%% Name conflict with interface: \n");
3082 return CMD_WARNING_CONFIG_FAILED
;
3085 group
= peer_group_get(bgp
, argv
[idx_word
]->arg
);
3087 vty_out(vty
, "%% BGP failed to find or create peer-group\n");
3088 return CMD_WARNING_CONFIG_FAILED
;
3096 "no neighbor <WORD|<A.B.C.D|X:X::X:X> [remote-as <(1-4294967295)|internal|external>]>",
3100 "Specify a BGP neighbor\n"
3102 "Internal BGP peer\n"
3103 "External BGP peer\n")
3105 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
3109 struct peer_group
*group
;
3113 ret
= str2sockunion(argv
[idx_peer
]->arg
, &su
);
3115 /* look up for neighbor by interface name config. */
3116 peer
= peer_lookup_by_conf_if(bgp
, argv
[idx_peer
]->arg
);
3118 /* Request zebra to terminate IPv6 RAs on this
3121 bgp_zebra_terminate_radv(peer
->bgp
, peer
);
3126 group
= peer_group_lookup(bgp
, argv
[idx_peer
]->arg
);
3128 peer_group_delete(group
);
3130 vty_out(vty
, "%% Create the peer-group first\n");
3131 return CMD_WARNING_CONFIG_FAILED
;
3134 peer
= peer_lookup(bgp
, &su
);
3136 if (peer_dynamic_neighbor(peer
)) {
3138 "%% Operation not allowed on a dynamic neighbor\n");
3139 return CMD_WARNING_CONFIG_FAILED
;
3142 other
= peer
->doppelganger
;
3144 if (other
&& other
->status
!= Deleted
)
3152 DEFUN (no_neighbor_interface_config
,
3153 no_neighbor_interface_config_cmd
,
3154 "no neighbor WORD interface [v6only] [peer-group WORD] [remote-as <(1-4294967295)|internal|external>]",
3158 "Configure BGP on interface\n"
3159 "Enable BGP with v6 link-local only\n"
3160 "Member of the peer-group\n"
3162 "Specify a BGP neighbor\n"
3164 "Internal BGP peer\n"
3165 "External BGP peer\n")
3167 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
3171 /* look up for neighbor by interface name config. */
3172 peer
= peer_lookup_by_conf_if(bgp
, argv
[idx_word
]->arg
);
3174 /* Request zebra to terminate IPv6 RAs on this interface. */
3176 bgp_zebra_terminate_radv(peer
->bgp
, peer
);
3179 vty_out(vty
, "%% Create the bgp interface first\n");
3180 return CMD_WARNING_CONFIG_FAILED
;
3185 DEFUN (no_neighbor_peer_group
,
3186 no_neighbor_peer_group_cmd
,
3187 "no neighbor WORD peer-group",
3191 "Configure peer-group\n")
3193 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
3195 struct peer_group
*group
;
3197 group
= peer_group_lookup(bgp
, argv
[idx_word
]->arg
);
3199 peer_group_delete(group
);
3201 vty_out(vty
, "%% Create the peer-group first\n");
3202 return CMD_WARNING_CONFIG_FAILED
;
3207 DEFUN (no_neighbor_interface_peer_group_remote_as
,
3208 no_neighbor_interface_peer_group_remote_as_cmd
,
3209 "no neighbor WORD remote-as <(1-4294967295)|internal|external>",
3212 "Interface name or neighbor tag\n"
3213 "Specify a BGP neighbor\n"
3215 "Internal BGP peer\n"
3216 "External BGP peer\n")
3218 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
3220 struct peer_group
*group
;
3223 /* look up for neighbor by interface name config. */
3224 peer
= peer_lookup_by_conf_if(bgp
, argv
[idx_word
]->arg
);
3226 peer_as_change(peer
, 0, AS_SPECIFIED
);
3230 group
= peer_group_lookup(bgp
, argv
[idx_word
]->arg
);
3232 peer_group_remote_as_delete(group
);
3234 vty_out(vty
, "%% Create the peer-group or interface first\n");
3235 return CMD_WARNING_CONFIG_FAILED
;
3240 DEFUN (neighbor_local_as
,
3241 neighbor_local_as_cmd
,
3242 "neighbor <A.B.C.D|X:X::X:X|WORD> local-as (1-4294967295)",
3245 "Specify a local-as number\n"
3246 "AS number used as local AS\n")
3254 peer
= peer_and_group_lookup_vty(vty
, argv
[idx_peer
]->arg
);
3256 return CMD_WARNING_CONFIG_FAILED
;
3258 as
= strtoul(argv
[idx_number
]->arg
, NULL
, 10);
3259 ret
= peer_local_as_set(peer
, as
, 0, 0);
3260 return bgp_vty_return(vty
, ret
);
3263 DEFUN (neighbor_local_as_no_prepend
,
3264 neighbor_local_as_no_prepend_cmd
,
3265 "neighbor <A.B.C.D|X:X::X:X|WORD> local-as (1-4294967295) no-prepend",
3268 "Specify a local-as number\n"
3269 "AS number used as local AS\n"
3270 "Do not prepend local-as to updates from ebgp peers\n")
3278 peer
= peer_and_group_lookup_vty(vty
, argv
[idx_peer
]->arg
);
3280 return CMD_WARNING_CONFIG_FAILED
;
3282 as
= strtoul(argv
[idx_number
]->arg
, NULL
, 10);
3283 ret
= peer_local_as_set(peer
, as
, 1, 0);
3284 return bgp_vty_return(vty
, ret
);
3287 DEFUN (neighbor_local_as_no_prepend_replace_as
,
3288 neighbor_local_as_no_prepend_replace_as_cmd
,
3289 "neighbor <A.B.C.D|X:X::X:X|WORD> local-as (1-4294967295) no-prepend replace-as",
3292 "Specify a local-as number\n"
3293 "AS number used as local AS\n"
3294 "Do not prepend local-as to updates from ebgp peers\n"
3295 "Do not prepend local-as to updates from ibgp peers\n")
3303 peer
= peer_and_group_lookup_vty(vty
, argv
[idx_peer
]->arg
);
3305 return CMD_WARNING_CONFIG_FAILED
;
3307 as
= strtoul(argv
[idx_number
]->arg
, NULL
, 10);
3308 ret
= peer_local_as_set(peer
, as
, 1, 1);
3309 return bgp_vty_return(vty
, ret
);
3312 DEFUN (no_neighbor_local_as
,
3313 no_neighbor_local_as_cmd
,
3314 "no neighbor <A.B.C.D|X:X::X:X|WORD> local-as [(1-4294967295) [no-prepend [replace-as]]]",
3318 "Specify a local-as number\n"
3319 "AS number used as local AS\n"
3320 "Do not prepend local-as to updates from ebgp peers\n"
3321 "Do not prepend local-as to updates from ibgp peers\n")
3327 peer
= peer_and_group_lookup_vty(vty
, argv
[idx_peer
]->arg
);
3329 return CMD_WARNING_CONFIG_FAILED
;
3331 ret
= peer_local_as_unset(peer
);
3332 return bgp_vty_return(vty
, ret
);
3336 DEFUN (neighbor_solo
,
3338 "neighbor <A.B.C.D|X:X::X:X|WORD> solo",
3341 "Solo peer - part of its own update group\n")
3347 peer
= peer_and_group_lookup_vty(vty
, argv
[idx_peer
]->arg
);
3349 return CMD_WARNING_CONFIG_FAILED
;
3351 ret
= update_group_adjust_soloness(peer
, 1);
3352 return bgp_vty_return(vty
, ret
);
3355 DEFUN (no_neighbor_solo
,
3356 no_neighbor_solo_cmd
,
3357 "no neighbor <A.B.C.D|X:X::X:X|WORD> solo",
3361 "Solo peer - part of its own update group\n")
3367 peer
= peer_and_group_lookup_vty(vty
, argv
[idx_peer
]->arg
);
3369 return CMD_WARNING_CONFIG_FAILED
;
3371 ret
= update_group_adjust_soloness(peer
, 0);
3372 return bgp_vty_return(vty
, ret
);
3375 DEFUN (neighbor_password
,
3376 neighbor_password_cmd
,
3377 "neighbor <A.B.C.D|X:X::X:X|WORD> password LINE",
3388 peer
= peer_and_group_lookup_vty(vty
, argv
[idx_peer
]->arg
);
3390 return CMD_WARNING_CONFIG_FAILED
;
3392 ret
= peer_password_set(peer
, argv
[idx_line
]->arg
);
3393 return bgp_vty_return(vty
, ret
);
3396 DEFUN (no_neighbor_password
,
3397 no_neighbor_password_cmd
,
3398 "no neighbor <A.B.C.D|X:X::X:X|WORD> password [LINE]",
3409 peer
= peer_and_group_lookup_vty(vty
, argv
[idx_peer
]->arg
);
3411 return CMD_WARNING_CONFIG_FAILED
;
3413 ret
= peer_password_unset(peer
);
3414 return bgp_vty_return(vty
, ret
);
3417 DEFUN (neighbor_activate
,
3418 neighbor_activate_cmd
,
3419 "neighbor <A.B.C.D|X:X::X:X|WORD> activate",
3422 "Enable the Address Family for this Neighbor\n")
3428 peer
= peer_and_group_lookup_vty(vty
, argv
[idx_peer
]->arg
);
3430 return CMD_WARNING_CONFIG_FAILED
;
3432 ret
= peer_activate(peer
, bgp_node_afi(vty
), bgp_node_safi(vty
));
3433 return bgp_vty_return(vty
, ret
);
3436 ALIAS_HIDDEN(neighbor_activate
, neighbor_activate_hidden_cmd
,
3437 "neighbor <A.B.C.D|X:X::X:X|WORD> activate",
3438 NEIGHBOR_STR NEIGHBOR_ADDR_STR2
3439 "Enable the Address Family for this Neighbor\n")
3441 DEFUN (no_neighbor_activate
,
3442 no_neighbor_activate_cmd
,
3443 "no neighbor <A.B.C.D|X:X::X:X|WORD> activate",
3447 "Enable the Address Family for this Neighbor\n")
3454 peer
= peer_and_group_lookup_vty(vty
, argv
[idx_peer
]->arg
);
3456 return CMD_WARNING_CONFIG_FAILED
;
3458 ret
= peer_deactivate(peer
, bgp_node_afi(vty
), bgp_node_safi(vty
));
3459 return bgp_vty_return(vty
, ret
);
3462 ALIAS_HIDDEN(no_neighbor_activate
, no_neighbor_activate_hidden_cmd
,
3463 "no neighbor <A.B.C.D|X:X::X:X|WORD> activate",
3464 NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2
3465 "Enable the Address Family for this Neighbor\n")
3467 DEFUN (neighbor_set_peer_group
,
3468 neighbor_set_peer_group_cmd
,
3469 "neighbor <A.B.C.D|X:X::X:X|WORD> peer-group WORD",
3472 "Member of the peer-group\n"
3473 "Peer-group name\n")
3475 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
3482 struct peer_group
*group
;
3484 ret
= str2sockunion(argv
[idx_peer
]->arg
, &su
);
3486 peer
= peer_lookup_by_conf_if(bgp
, argv
[idx_peer
]->arg
);
3488 vty_out(vty
, "%% Malformed address or name: %s\n",
3489 argv
[idx_peer
]->arg
);
3490 return CMD_WARNING_CONFIG_FAILED
;
3493 if (peer_address_self_check(bgp
, &su
)) {
3495 "%% Can not configure the local system as neighbor\n");
3496 return CMD_WARNING_CONFIG_FAILED
;
3499 /* Disallow for dynamic neighbor. */
3500 peer
= peer_lookup(bgp
, &su
);
3501 if (peer
&& peer_dynamic_neighbor(peer
)) {
3503 "%% Operation not allowed on a dynamic neighbor\n");
3504 return CMD_WARNING_CONFIG_FAILED
;
3508 group
= peer_group_lookup(bgp
, argv
[idx_word
]->arg
);
3510 vty_out(vty
, "%% Configure the peer-group first\n");
3511 return CMD_WARNING_CONFIG_FAILED
;
3514 ret
= peer_group_bind(bgp
, &su
, peer
, group
, &as
);
3516 if (ret
== BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT
) {
3518 "%% Peer with AS %u cannot be in this peer-group, members must be all internal or all external\n",
3520 return CMD_WARNING_CONFIG_FAILED
;
3523 return bgp_vty_return(vty
, ret
);
3526 ALIAS_HIDDEN(neighbor_set_peer_group
, neighbor_set_peer_group_hidden_cmd
,
3527 "neighbor <A.B.C.D|X:X::X:X|WORD> peer-group WORD",
3528 NEIGHBOR_STR NEIGHBOR_ADDR_STR2
3529 "Member of the peer-group\n"
3530 "Peer-group name\n")
3532 DEFUN (no_neighbor_set_peer_group
,
3533 no_neighbor_set_peer_group_cmd
,
3534 "no neighbor <A.B.C.D|X:X::X:X|WORD> peer-group WORD",
3538 "Member of the peer-group\n"
3539 "Peer-group name\n")
3541 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
3546 struct peer_group
*group
;
3548 peer
= peer_lookup_vty(vty
, argv
[idx_peer
]->arg
);
3550 return CMD_WARNING_CONFIG_FAILED
;
3552 group
= peer_group_lookup(bgp
, argv
[idx_word
]->arg
);
3554 vty_out(vty
, "%% Configure the peer-group first\n");
3555 return CMD_WARNING_CONFIG_FAILED
;
3558 ret
= peer_delete(peer
);
3560 return bgp_vty_return(vty
, ret
);
3563 ALIAS_HIDDEN(no_neighbor_set_peer_group
, no_neighbor_set_peer_group_hidden_cmd
,
3564 "no neighbor <A.B.C.D|X:X::X:X|WORD> peer-group WORD",
3565 NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2
3566 "Member of the peer-group\n"
3567 "Peer-group name\n")
3569 static int peer_flag_modify_vty(struct vty
*vty
, const char *ip_str
,
3570 uint32_t flag
, int set
)
3575 peer
= peer_and_group_lookup_vty(vty
, ip_str
);
3577 return CMD_WARNING_CONFIG_FAILED
;
3580 * If 'neighbor <interface>', then this is for directly connected peers,
3581 * we should not accept disable-connected-check.
3583 if (peer
->conf_if
&& (flag
== PEER_FLAG_DISABLE_CONNECTED_CHECK
)) {
3585 "%s is directly connected peer, cannot accept disable-"
3586 "connected-check\n",
3588 return CMD_WARNING_CONFIG_FAILED
;
3591 if (!set
&& flag
== PEER_FLAG_SHUTDOWN
)
3592 peer_tx_shutdown_message_unset(peer
);
3595 ret
= peer_flag_set(peer
, flag
);
3597 ret
= peer_flag_unset(peer
, flag
);
3599 return bgp_vty_return(vty
, ret
);
3602 static int peer_flag_set_vty(struct vty
*vty
, const char *ip_str
, uint32_t flag
)
3604 return peer_flag_modify_vty(vty
, ip_str
, flag
, 1);
3607 static int peer_flag_unset_vty(struct vty
*vty
, const char *ip_str
,
3610 return peer_flag_modify_vty(vty
, ip_str
, flag
, 0);
3613 /* neighbor passive. */
3614 DEFUN (neighbor_passive
,
3615 neighbor_passive_cmd
,
3616 "neighbor <A.B.C.D|X:X::X:X|WORD> passive",
3619 "Don't send open messages to this neighbor\n")
3622 return peer_flag_set_vty(vty
, argv
[idx_peer
]->arg
, PEER_FLAG_PASSIVE
);
3625 DEFUN (no_neighbor_passive
,
3626 no_neighbor_passive_cmd
,
3627 "no neighbor <A.B.C.D|X:X::X:X|WORD> passive",
3631 "Don't send open messages to this neighbor\n")
3634 return peer_flag_unset_vty(vty
, argv
[idx_peer
]->arg
, PEER_FLAG_PASSIVE
);
3637 /* neighbor shutdown. */
3638 DEFUN (neighbor_shutdown_msg
,
3639 neighbor_shutdown_msg_cmd
,
3640 "neighbor <A.B.C.D|X:X::X:X|WORD> shutdown message MSG...",
3643 "Administratively shut down this neighbor\n"
3644 "Add a shutdown message (draft-ietf-idr-shutdown-06)\n"
3645 "Shutdown message\n")
3651 peer_and_group_lookup_vty(vty
, argv
[idx_peer
]->arg
);
3655 return CMD_WARNING_CONFIG_FAILED
;
3656 message
= argv_concat(argv
, argc
, 4);
3657 peer_tx_shutdown_message_set(peer
, message
);
3658 XFREE(MTYPE_TMP
, message
);
3661 return peer_flag_set_vty(vty
, argv
[idx_peer
]->arg
, PEER_FLAG_SHUTDOWN
);
3664 ALIAS(neighbor_shutdown_msg
, neighbor_shutdown_cmd
,
3665 "neighbor <A.B.C.D|X:X::X:X|WORD> shutdown",
3666 NEIGHBOR_STR NEIGHBOR_ADDR_STR2
3667 "Administratively shut down this neighbor\n")
3669 DEFUN (no_neighbor_shutdown_msg
,
3670 no_neighbor_shutdown_msg_cmd
,
3671 "no neighbor <A.B.C.D|X:X::X:X|WORD> shutdown message MSG...",
3675 "Administratively shut down this neighbor\n"
3676 "Remove a shutdown message (draft-ietf-idr-shutdown-06)\n"
3677 "Shutdown message\n")
3681 return peer_flag_unset_vty(vty
, argv
[idx_peer
]->arg
,
3682 PEER_FLAG_SHUTDOWN
);
3685 ALIAS(no_neighbor_shutdown_msg
, no_neighbor_shutdown_cmd
,
3686 "no neighbor <A.B.C.D|X:X::X:X|WORD> shutdown",
3687 NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2
3688 "Administratively shut down this neighbor\n")
3690 /* neighbor capability dynamic. */
3691 DEFUN (neighbor_capability_dynamic
,
3692 neighbor_capability_dynamic_cmd
,
3693 "neighbor <A.B.C.D|X:X::X:X|WORD> capability dynamic",
3696 "Advertise capability to the peer\n"
3697 "Advertise dynamic capability to this neighbor\n")
3700 return peer_flag_set_vty(vty
, argv
[idx_peer
]->arg
,
3701 PEER_FLAG_DYNAMIC_CAPABILITY
);
3704 DEFUN (no_neighbor_capability_dynamic
,
3705 no_neighbor_capability_dynamic_cmd
,
3706 "no neighbor <A.B.C.D|X:X::X:X|WORD> capability dynamic",
3710 "Advertise capability to the peer\n"
3711 "Advertise dynamic capability to this neighbor\n")
3714 return peer_flag_unset_vty(vty
, argv
[idx_peer
]->arg
,
3715 PEER_FLAG_DYNAMIC_CAPABILITY
);
3718 /* neighbor dont-capability-negotiate */
3719 DEFUN (neighbor_dont_capability_negotiate
,
3720 neighbor_dont_capability_negotiate_cmd
,
3721 "neighbor <A.B.C.D|X:X::X:X|WORD> dont-capability-negotiate",
3724 "Do not perform capability negotiation\n")
3727 return peer_flag_set_vty(vty
, argv
[idx_peer
]->arg
,
3728 PEER_FLAG_DONT_CAPABILITY
);
3731 DEFUN (no_neighbor_dont_capability_negotiate
,
3732 no_neighbor_dont_capability_negotiate_cmd
,
3733 "no neighbor <A.B.C.D|X:X::X:X|WORD> dont-capability-negotiate",
3737 "Do not perform capability negotiation\n")
3740 return peer_flag_unset_vty(vty
, argv
[idx_peer
]->arg
,
3741 PEER_FLAG_DONT_CAPABILITY
);
3744 /* neighbor capability extended next hop encoding */
3745 DEFUN (neighbor_capability_enhe
,
3746 neighbor_capability_enhe_cmd
,
3747 "neighbor <A.B.C.D|X:X::X:X|WORD> capability extended-nexthop",
3750 "Advertise capability to the peer\n"
3751 "Advertise extended next-hop capability to the peer\n")
3754 return peer_flag_set_vty(vty
, argv
[idx_peer
]->arg
,
3755 PEER_FLAG_CAPABILITY_ENHE
);
3758 DEFUN (no_neighbor_capability_enhe
,
3759 no_neighbor_capability_enhe_cmd
,
3760 "no neighbor <A.B.C.D|X:X::X:X|WORD> capability extended-nexthop",
3764 "Advertise capability to the peer\n"
3765 "Advertise extended next-hop capability to the peer\n")
3768 return peer_flag_unset_vty(vty
, argv
[idx_peer
]->arg
,
3769 PEER_FLAG_CAPABILITY_ENHE
);
3772 static int peer_af_flag_modify_vty(struct vty
*vty
, const char *peer_str
,
3773 afi_t afi
, safi_t safi
, uint32_t flag
,
3779 peer
= peer_and_group_lookup_vty(vty
, peer_str
);
3781 return CMD_WARNING_CONFIG_FAILED
;
3784 ret
= peer_af_flag_set(peer
, afi
, safi
, flag
);
3786 ret
= peer_af_flag_unset(peer
, afi
, safi
, flag
);
3788 return bgp_vty_return(vty
, ret
);
3791 static int peer_af_flag_set_vty(struct vty
*vty
, const char *peer_str
,
3792 afi_t afi
, safi_t safi
, uint32_t flag
)
3794 return peer_af_flag_modify_vty(vty
, peer_str
, afi
, safi
, flag
, 1);
3797 static int peer_af_flag_unset_vty(struct vty
*vty
, const char *peer_str
,
3798 afi_t afi
, safi_t safi
, uint32_t flag
)
3800 return peer_af_flag_modify_vty(vty
, peer_str
, afi
, safi
, flag
, 0);
3803 /* neighbor capability orf prefix-list. */
3804 DEFUN (neighbor_capability_orf_prefix
,
3805 neighbor_capability_orf_prefix_cmd
,
3806 "neighbor <A.B.C.D|X:X::X:X|WORD> capability orf prefix-list <both|send|receive>",
3809 "Advertise capability to the peer\n"
3810 "Advertise ORF capability to the peer\n"
3811 "Advertise prefixlist ORF capability to this neighbor\n"
3812 "Capability to SEND and RECEIVE the ORF to/from this neighbor\n"
3813 "Capability to RECEIVE the ORF from this neighbor\n"
3814 "Capability to SEND the ORF to this neighbor\n")
3817 int idx_send_recv
= 5;
3820 if (strmatch(argv
[idx_send_recv
]->text
, "send"))
3821 flag
= PEER_FLAG_ORF_PREFIX_SM
;
3822 else if (strmatch(argv
[idx_send_recv
]->text
, "receive"))
3823 flag
= PEER_FLAG_ORF_PREFIX_RM
;
3824 else if (strmatch(argv
[idx_send_recv
]->text
, "both"))
3825 flag
= PEER_FLAG_ORF_PREFIX_SM
| PEER_FLAG_ORF_PREFIX_RM
;
3827 vty_out(vty
, "%% BGP invalid orf prefix-list option\n");
3828 return CMD_WARNING_CONFIG_FAILED
;
3831 return peer_af_flag_set_vty(vty
, argv
[idx_peer
]->arg
, bgp_node_afi(vty
),
3832 bgp_node_safi(vty
), flag
);
3836 neighbor_capability_orf_prefix
,
3837 neighbor_capability_orf_prefix_hidden_cmd
,
3838 "neighbor <A.B.C.D|X:X::X:X|WORD> capability orf prefix-list <both|send|receive>",
3839 NEIGHBOR_STR NEIGHBOR_ADDR_STR2
3840 "Advertise capability to the peer\n"
3841 "Advertise ORF capability to the peer\n"
3842 "Advertise prefixlist ORF capability to this neighbor\n"
3843 "Capability to SEND and RECEIVE the ORF to/from this neighbor\n"
3844 "Capability to RECEIVE the ORF from this neighbor\n"
3845 "Capability to SEND the ORF to this neighbor\n")
3847 DEFUN (no_neighbor_capability_orf_prefix
,
3848 no_neighbor_capability_orf_prefix_cmd
,
3849 "no neighbor <A.B.C.D|X:X::X:X|WORD> capability orf prefix-list <both|send|receive>",
3853 "Advertise capability to the peer\n"
3854 "Advertise ORF capability to the peer\n"
3855 "Advertise prefixlist ORF capability to this neighbor\n"
3856 "Capability to SEND and RECEIVE the ORF to/from this neighbor\n"
3857 "Capability to RECEIVE the ORF from this neighbor\n"
3858 "Capability to SEND the ORF to this neighbor\n")
3861 int idx_send_recv
= 6;
3864 if (strmatch(argv
[idx_send_recv
]->text
, "send"))
3865 flag
= PEER_FLAG_ORF_PREFIX_SM
;
3866 else if (strmatch(argv
[idx_send_recv
]->text
, "receive"))
3867 flag
= PEER_FLAG_ORF_PREFIX_RM
;
3868 else if (strmatch(argv
[idx_send_recv
]->text
, "both"))
3869 flag
= PEER_FLAG_ORF_PREFIX_SM
| PEER_FLAG_ORF_PREFIX_RM
;
3871 vty_out(vty
, "%% BGP invalid orf prefix-list option\n");
3872 return CMD_WARNING_CONFIG_FAILED
;
3875 return peer_af_flag_unset_vty(vty
, argv
[idx_peer
]->arg
,
3876 bgp_node_afi(vty
), bgp_node_safi(vty
),
3881 no_neighbor_capability_orf_prefix
,
3882 no_neighbor_capability_orf_prefix_hidden_cmd
,
3883 "no neighbor <A.B.C.D|X:X::X:X|WORD> capability orf prefix-list <both|send|receive>",
3884 NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2
3885 "Advertise capability to the peer\n"
3886 "Advertise ORF capability to the peer\n"
3887 "Advertise prefixlist ORF capability to this neighbor\n"
3888 "Capability to SEND and RECEIVE the ORF to/from this neighbor\n"
3889 "Capability to RECEIVE the ORF from this neighbor\n"
3890 "Capability to SEND the ORF to this neighbor\n")
3892 /* neighbor next-hop-self. */
3893 DEFUN (neighbor_nexthop_self
,
3894 neighbor_nexthop_self_cmd
,
3895 "neighbor <A.B.C.D|X:X::X:X|WORD> next-hop-self",
3898 "Disable the next hop calculation for this neighbor\n")
3901 return peer_af_flag_set_vty(vty
, argv
[idx_peer
]->arg
, bgp_node_afi(vty
),
3902 bgp_node_safi(vty
), PEER_FLAG_NEXTHOP_SELF
);
3905 ALIAS_HIDDEN(neighbor_nexthop_self
, neighbor_nexthop_self_hidden_cmd
,
3906 "neighbor <A.B.C.D|X:X::X:X|WORD> next-hop-self",
3907 NEIGHBOR_STR NEIGHBOR_ADDR_STR2
3908 "Disable the next hop calculation for this neighbor\n")
3910 /* neighbor next-hop-self. */
3911 DEFUN (neighbor_nexthop_self_force
,
3912 neighbor_nexthop_self_force_cmd
,
3913 "neighbor <A.B.C.D|X:X::X:X|WORD> next-hop-self force",
3916 "Disable the next hop calculation for this neighbor\n"
3917 "Set the next hop to self for reflected routes\n")
3920 return peer_af_flag_set_vty(vty
, argv
[idx_peer
]->arg
, bgp_node_afi(vty
),
3922 PEER_FLAG_FORCE_NEXTHOP_SELF
);
3925 ALIAS_HIDDEN(neighbor_nexthop_self_force
,
3926 neighbor_nexthop_self_force_hidden_cmd
,
3927 "neighbor <A.B.C.D|X:X::X:X|WORD> next-hop-self force",
3928 NEIGHBOR_STR NEIGHBOR_ADDR_STR2
3929 "Disable the next hop calculation for this neighbor\n"
3930 "Set the next hop to self for reflected routes\n")
3932 DEFUN (no_neighbor_nexthop_self
,
3933 no_neighbor_nexthop_self_cmd
,
3934 "no neighbor <A.B.C.D|X:X::X:X|WORD> next-hop-self",
3938 "Disable the next hop calculation for this neighbor\n")
3941 return peer_af_flag_unset_vty(vty
, argv
[idx_peer
]->arg
,
3942 bgp_node_afi(vty
), bgp_node_safi(vty
),
3943 PEER_FLAG_NEXTHOP_SELF
);
3946 ALIAS_HIDDEN(no_neighbor_nexthop_self
, no_neighbor_nexthop_self_hidden_cmd
,
3947 "no neighbor <A.B.C.D|X:X::X:X|WORD> next-hop-self",
3948 NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2
3949 "Disable the next hop calculation for this neighbor\n")
3951 DEFUN (no_neighbor_nexthop_self_force
,
3952 no_neighbor_nexthop_self_force_cmd
,
3953 "no neighbor <A.B.C.D|X:X::X:X|WORD> next-hop-self force",
3957 "Disable the next hop calculation for this neighbor\n"
3958 "Set the next hop to self for reflected routes\n")
3961 return peer_af_flag_unset_vty(vty
, argv
[idx_peer
]->arg
,
3962 bgp_node_afi(vty
), bgp_node_safi(vty
),
3963 PEER_FLAG_FORCE_NEXTHOP_SELF
);
3966 ALIAS_HIDDEN(no_neighbor_nexthop_self_force
,
3967 no_neighbor_nexthop_self_force_hidden_cmd
,
3968 "no neighbor <A.B.C.D|X:X::X:X|WORD> next-hop-self force",
3969 NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2
3970 "Disable the next hop calculation for this neighbor\n"
3971 "Set the next hop to self for reflected routes\n")
3973 /* neighbor as-override */
3974 DEFUN (neighbor_as_override
,
3975 neighbor_as_override_cmd
,
3976 "neighbor <A.B.C.D|X:X::X:X|WORD> as-override",
3979 "Override ASNs in outbound updates if aspath equals remote-as\n")
3982 return peer_af_flag_set_vty(vty
, argv
[idx_peer
]->arg
, bgp_node_afi(vty
),
3983 bgp_node_safi(vty
), PEER_FLAG_AS_OVERRIDE
);
3986 ALIAS_HIDDEN(neighbor_as_override
, neighbor_as_override_hidden_cmd
,
3987 "neighbor <A.B.C.D|X:X::X:X|WORD> as-override",
3988 NEIGHBOR_STR NEIGHBOR_ADDR_STR2
3989 "Override ASNs in outbound updates if aspath equals remote-as\n")
3991 DEFUN (no_neighbor_as_override
,
3992 no_neighbor_as_override_cmd
,
3993 "no neighbor <A.B.C.D|X:X::X:X|WORD> as-override",
3997 "Override ASNs in outbound updates if aspath equals remote-as\n")
4000 return peer_af_flag_unset_vty(vty
, argv
[idx_peer
]->arg
,
4001 bgp_node_afi(vty
), bgp_node_safi(vty
),
4002 PEER_FLAG_AS_OVERRIDE
);
4005 ALIAS_HIDDEN(no_neighbor_as_override
, no_neighbor_as_override_hidden_cmd
,
4006 "no neighbor <A.B.C.D|X:X::X:X|WORD> as-override",
4007 NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2
4008 "Override ASNs in outbound updates if aspath equals remote-as\n")
4010 /* neighbor remove-private-AS. */
4011 DEFUN (neighbor_remove_private_as
,
4012 neighbor_remove_private_as_cmd
,
4013 "neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS",
4016 "Remove private ASNs in outbound updates\n")
4019 return peer_af_flag_set_vty(vty
, argv
[idx_peer
]->arg
, bgp_node_afi(vty
),
4021 PEER_FLAG_REMOVE_PRIVATE_AS
);
4024 ALIAS_HIDDEN(neighbor_remove_private_as
, neighbor_remove_private_as_hidden_cmd
,
4025 "neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS",
4026 NEIGHBOR_STR NEIGHBOR_ADDR_STR2
4027 "Remove private ASNs in outbound updates\n")
4029 DEFUN (neighbor_remove_private_as_all
,
4030 neighbor_remove_private_as_all_cmd
,
4031 "neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS all",
4034 "Remove private ASNs in outbound updates\n"
4035 "Apply to all AS numbers\n")
4038 return peer_af_flag_set_vty(vty
, argv
[idx_peer
]->arg
, bgp_node_afi(vty
),
4040 PEER_FLAG_REMOVE_PRIVATE_AS_ALL
);
4043 ALIAS_HIDDEN(neighbor_remove_private_as_all
,
4044 neighbor_remove_private_as_all_hidden_cmd
,
4045 "neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS all",
4046 NEIGHBOR_STR NEIGHBOR_ADDR_STR2
4047 "Remove private ASNs in outbound updates\n"
4048 "Apply to all AS numbers")
4050 DEFUN (neighbor_remove_private_as_replace_as
,
4051 neighbor_remove_private_as_replace_as_cmd
,
4052 "neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS replace-AS",
4055 "Remove private ASNs in outbound updates\n"
4056 "Replace private ASNs with our ASN in outbound updates\n")
4059 return peer_af_flag_set_vty(vty
, argv
[idx_peer
]->arg
, bgp_node_afi(vty
),
4061 PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE
);
4064 ALIAS_HIDDEN(neighbor_remove_private_as_replace_as
,
4065 neighbor_remove_private_as_replace_as_hidden_cmd
,
4066 "neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS replace-AS",
4067 NEIGHBOR_STR NEIGHBOR_ADDR_STR2
4068 "Remove private ASNs in outbound updates\n"
4069 "Replace private ASNs with our ASN in outbound updates\n")
4071 DEFUN (neighbor_remove_private_as_all_replace_as
,
4072 neighbor_remove_private_as_all_replace_as_cmd
,
4073 "neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS all replace-AS",
4076 "Remove private ASNs in outbound updates\n"
4077 "Apply to all AS numbers\n"
4078 "Replace private ASNs with our ASN in outbound updates\n")
4081 return peer_af_flag_set_vty(vty
, argv
[idx_peer
]->arg
, bgp_node_afi(vty
),
4083 PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE
);
4087 neighbor_remove_private_as_all_replace_as
,
4088 neighbor_remove_private_as_all_replace_as_hidden_cmd
,
4089 "neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS all replace-AS",
4090 NEIGHBOR_STR NEIGHBOR_ADDR_STR2
4091 "Remove private ASNs in outbound updates\n"
4092 "Apply to all AS numbers\n"
4093 "Replace private ASNs with our ASN in outbound updates\n")
4095 DEFUN (no_neighbor_remove_private_as
,
4096 no_neighbor_remove_private_as_cmd
,
4097 "no neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS",
4101 "Remove private ASNs in outbound updates\n")
4104 return peer_af_flag_unset_vty(vty
, argv
[idx_peer
]->arg
,
4105 bgp_node_afi(vty
), bgp_node_safi(vty
),
4106 PEER_FLAG_REMOVE_PRIVATE_AS
);
4109 ALIAS_HIDDEN(no_neighbor_remove_private_as
,
4110 no_neighbor_remove_private_as_hidden_cmd
,
4111 "no neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS",
4112 NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2
4113 "Remove private ASNs in outbound updates\n")
4115 DEFUN (no_neighbor_remove_private_as_all
,
4116 no_neighbor_remove_private_as_all_cmd
,
4117 "no neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS all",
4121 "Remove private ASNs in outbound updates\n"
4122 "Apply to all AS numbers\n")
4125 return peer_af_flag_unset_vty(vty
, argv
[idx_peer
]->arg
,
4126 bgp_node_afi(vty
), bgp_node_safi(vty
),
4127 PEER_FLAG_REMOVE_PRIVATE_AS_ALL
);
4130 ALIAS_HIDDEN(no_neighbor_remove_private_as_all
,
4131 no_neighbor_remove_private_as_all_hidden_cmd
,
4132 "no neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS all",
4133 NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2
4134 "Remove private ASNs in outbound updates\n"
4135 "Apply to all AS numbers\n")
4137 DEFUN (no_neighbor_remove_private_as_replace_as
,
4138 no_neighbor_remove_private_as_replace_as_cmd
,
4139 "no neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS replace-AS",
4143 "Remove private ASNs in outbound updates\n"
4144 "Replace private ASNs with our ASN in outbound updates\n")
4147 return peer_af_flag_unset_vty(vty
, argv
[idx_peer
]->arg
,
4148 bgp_node_afi(vty
), bgp_node_safi(vty
),
4149 PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE
);
4152 ALIAS_HIDDEN(no_neighbor_remove_private_as_replace_as
,
4153 no_neighbor_remove_private_as_replace_as_hidden_cmd
,
4154 "no neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS replace-AS",
4155 NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2
4156 "Remove private ASNs in outbound updates\n"
4157 "Replace private ASNs with our ASN in outbound updates\n")
4159 DEFUN (no_neighbor_remove_private_as_all_replace_as
,
4160 no_neighbor_remove_private_as_all_replace_as_cmd
,
4161 "no neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS all replace-AS",
4165 "Remove private ASNs in outbound updates\n"
4166 "Apply to all AS numbers\n"
4167 "Replace private ASNs with our ASN in outbound updates\n")
4170 return peer_af_flag_unset_vty(vty
, argv
[idx_peer
]->arg
,
4171 bgp_node_afi(vty
), bgp_node_safi(vty
),
4172 PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE
);
4176 no_neighbor_remove_private_as_all_replace_as
,
4177 no_neighbor_remove_private_as_all_replace_as_hidden_cmd
,
4178 "no neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS all replace-AS",
4179 NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2
4180 "Remove private ASNs in outbound updates\n"
4181 "Apply to all AS numbers\n"
4182 "Replace private ASNs with our ASN in outbound updates\n")
4185 /* neighbor send-community. */
4186 DEFUN (neighbor_send_community
,
4187 neighbor_send_community_cmd
,
4188 "neighbor <A.B.C.D|X:X::X:X|WORD> send-community",
4191 "Send Community attribute to this neighbor\n")
4195 return peer_af_flag_set_vty(vty
, argv
[idx_peer
]->arg
, bgp_node_afi(vty
),
4197 PEER_FLAG_SEND_COMMUNITY
);
4200 ALIAS_HIDDEN(neighbor_send_community
, neighbor_send_community_hidden_cmd
,
4201 "neighbor <A.B.C.D|X:X::X:X|WORD> send-community",
4202 NEIGHBOR_STR NEIGHBOR_ADDR_STR2
4203 "Send Community attribute to this neighbor\n")
4205 DEFUN (no_neighbor_send_community
,
4206 no_neighbor_send_community_cmd
,
4207 "no neighbor <A.B.C.D|X:X::X:X|WORD> send-community",
4211 "Send Community attribute to this neighbor\n")
4215 return peer_af_flag_unset_vty(vty
, argv
[idx_peer
]->arg
,
4216 bgp_node_afi(vty
), bgp_node_safi(vty
),
4217 PEER_FLAG_SEND_COMMUNITY
);
4220 ALIAS_HIDDEN(no_neighbor_send_community
, no_neighbor_send_community_hidden_cmd
,
4221 "no neighbor <A.B.C.D|X:X::X:X|WORD> send-community",
4222 NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2
4223 "Send Community attribute to this neighbor\n")
4225 /* neighbor send-community extended. */
4226 DEFUN (neighbor_send_community_type
,
4227 neighbor_send_community_type_cmd
,
4228 "neighbor <A.B.C.D|X:X::X:X|WORD> send-community <both|all|extended|standard|large>",
4231 "Send Community attribute to this neighbor\n"
4232 "Send Standard and Extended Community attributes\n"
4233 "Send Standard, Large and Extended Community attributes\n"
4234 "Send Extended Community attributes\n"
4235 "Send Standard Community attributes\n"
4236 "Send Large Community attributes\n")
4240 const char *type
= argv
[argc
- 1]->text
;
4242 if (strmatch(type
, "standard")) {
4243 SET_FLAG(flag
, PEER_FLAG_SEND_COMMUNITY
);
4244 } else if (strmatch(type
, "extended")) {
4245 SET_FLAG(flag
, PEER_FLAG_SEND_EXT_COMMUNITY
);
4246 } else if (strmatch(type
, "large")) {
4247 SET_FLAG(flag
, PEER_FLAG_SEND_LARGE_COMMUNITY
);
4248 } else if (strmatch(type
, "both")) {
4249 SET_FLAG(flag
, PEER_FLAG_SEND_COMMUNITY
);
4250 SET_FLAG(flag
, PEER_FLAG_SEND_EXT_COMMUNITY
);
4251 } else { /* if (strmatch(type, "all")) */
4252 SET_FLAG(flag
, PEER_FLAG_SEND_COMMUNITY
);
4253 SET_FLAG(flag
, PEER_FLAG_SEND_EXT_COMMUNITY
);
4254 SET_FLAG(flag
, PEER_FLAG_SEND_LARGE_COMMUNITY
);
4257 return peer_af_flag_set_vty(vty
, argv
[idx_peer
]->arg
, bgp_node_afi(vty
),
4258 bgp_node_safi(vty
), flag
);
4262 neighbor_send_community_type
, neighbor_send_community_type_hidden_cmd
,
4263 "neighbor <A.B.C.D|X:X::X:X|WORD> send-community <both|all|extended|standard|large>",
4264 NEIGHBOR_STR NEIGHBOR_ADDR_STR2
4265 "Send Community attribute to this neighbor\n"
4266 "Send Standard and Extended Community attributes\n"
4267 "Send Standard, Large and Extended Community attributes\n"
4268 "Send Extended Community attributes\n"
4269 "Send Standard Community attributes\n"
4270 "Send Large Community attributes\n")
4272 DEFUN (no_neighbor_send_community_type
,
4273 no_neighbor_send_community_type_cmd
,
4274 "no neighbor <A.B.C.D|X:X::X:X|WORD> send-community <both|all|extended|standard|large>",
4278 "Send Community attribute to this neighbor\n"
4279 "Send Standard and Extended Community attributes\n"
4280 "Send Standard, Large and Extended Community attributes\n"
4281 "Send Extended Community attributes\n"
4282 "Send Standard Community attributes\n"
4283 "Send Large Community attributes\n")
4287 const char *type
= argv
[argc
- 1]->text
;
4289 if (strmatch(type
, "standard")) {
4290 SET_FLAG(flag
, PEER_FLAG_SEND_COMMUNITY
);
4291 } else if (strmatch(type
, "extended")) {
4292 SET_FLAG(flag
, PEER_FLAG_SEND_EXT_COMMUNITY
);
4293 } else if (strmatch(type
, "large")) {
4294 SET_FLAG(flag
, PEER_FLAG_SEND_LARGE_COMMUNITY
);
4295 } else if (strmatch(type
, "both")) {
4296 SET_FLAG(flag
, PEER_FLAG_SEND_COMMUNITY
);
4297 SET_FLAG(flag
, PEER_FLAG_SEND_EXT_COMMUNITY
);
4298 } else { /* if (strmatch(type, "all")) */
4299 SET_FLAG(flag
, PEER_FLAG_SEND_COMMUNITY
);
4300 SET_FLAG(flag
, PEER_FLAG_SEND_EXT_COMMUNITY
);
4301 SET_FLAG(flag
, PEER_FLAG_SEND_LARGE_COMMUNITY
);
4304 return peer_af_flag_unset_vty(vty
, argv
[idx_peer
]->arg
,
4305 bgp_node_afi(vty
), bgp_node_safi(vty
),
4310 no_neighbor_send_community_type
,
4311 no_neighbor_send_community_type_hidden_cmd
,
4312 "no neighbor <A.B.C.D|X:X::X:X|WORD> send-community <both|all|extended|standard|large>",
4313 NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2
4314 "Send Community attribute to this neighbor\n"
4315 "Send Standard and Extended Community attributes\n"
4316 "Send Standard, Large and Extended Community attributes\n"
4317 "Send Extended Community attributes\n"
4318 "Send Standard Community attributes\n"
4319 "Send Large Community attributes\n")
4321 /* neighbor soft-reconfig. */
4322 DEFUN (neighbor_soft_reconfiguration
,
4323 neighbor_soft_reconfiguration_cmd
,
4324 "neighbor <A.B.C.D|X:X::X:X|WORD> soft-reconfiguration inbound",
4327 "Per neighbor soft reconfiguration\n"
4328 "Allow inbound soft reconfiguration for this neighbor\n")
4331 return peer_af_flag_set_vty(vty
, argv
[idx_peer
]->arg
, bgp_node_afi(vty
),
4333 PEER_FLAG_SOFT_RECONFIG
);
4336 ALIAS_HIDDEN(neighbor_soft_reconfiguration
,
4337 neighbor_soft_reconfiguration_hidden_cmd
,
4338 "neighbor <A.B.C.D|X:X::X:X|WORD> soft-reconfiguration inbound",
4339 NEIGHBOR_STR NEIGHBOR_ADDR_STR2
4340 "Per neighbor soft reconfiguration\n"
4341 "Allow inbound soft reconfiguration for this neighbor\n")
4343 DEFUN (no_neighbor_soft_reconfiguration
,
4344 no_neighbor_soft_reconfiguration_cmd
,
4345 "no neighbor <A.B.C.D|X:X::X:X|WORD> soft-reconfiguration inbound",
4349 "Per neighbor soft reconfiguration\n"
4350 "Allow inbound soft reconfiguration for this neighbor\n")
4353 return peer_af_flag_unset_vty(vty
, argv
[idx_peer
]->arg
,
4354 bgp_node_afi(vty
), bgp_node_safi(vty
),
4355 PEER_FLAG_SOFT_RECONFIG
);
4358 ALIAS_HIDDEN(no_neighbor_soft_reconfiguration
,
4359 no_neighbor_soft_reconfiguration_hidden_cmd
,
4360 "no neighbor <A.B.C.D|X:X::X:X|WORD> soft-reconfiguration inbound",
4361 NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2
4362 "Per neighbor soft reconfiguration\n"
4363 "Allow inbound soft reconfiguration for this neighbor\n")
4365 DEFUN (neighbor_route_reflector_client
,
4366 neighbor_route_reflector_client_cmd
,
4367 "neighbor <A.B.C.D|X:X::X:X|WORD> route-reflector-client",
4370 "Configure a neighbor as Route Reflector client\n")
4376 peer
= peer_and_group_lookup_vty(vty
, argv
[idx_peer
]->arg
);
4378 return CMD_WARNING_CONFIG_FAILED
;
4380 return peer_af_flag_set_vty(vty
, argv
[idx_peer
]->arg
, bgp_node_afi(vty
),
4382 PEER_FLAG_REFLECTOR_CLIENT
);
4385 ALIAS_HIDDEN(neighbor_route_reflector_client
,
4386 neighbor_route_reflector_client_hidden_cmd
,
4387 "neighbor <A.B.C.D|X:X::X:X|WORD> route-reflector-client",
4388 NEIGHBOR_STR NEIGHBOR_ADDR_STR2
4389 "Configure a neighbor as Route Reflector client\n")
4391 DEFUN (no_neighbor_route_reflector_client
,
4392 no_neighbor_route_reflector_client_cmd
,
4393 "no neighbor <A.B.C.D|X:X::X:X|WORD> route-reflector-client",
4397 "Configure a neighbor as Route Reflector client\n")
4400 return peer_af_flag_unset_vty(vty
, argv
[idx_peer
]->arg
,
4401 bgp_node_afi(vty
), bgp_node_safi(vty
),
4402 PEER_FLAG_REFLECTOR_CLIENT
);
4405 ALIAS_HIDDEN(no_neighbor_route_reflector_client
,
4406 no_neighbor_route_reflector_client_hidden_cmd
,
4407 "no neighbor <A.B.C.D|X:X::X:X|WORD> route-reflector-client",
4408 NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2
4409 "Configure a neighbor as Route Reflector client\n")
4411 /* neighbor route-server-client. */
4412 DEFUN (neighbor_route_server_client
,
4413 neighbor_route_server_client_cmd
,
4414 "neighbor <A.B.C.D|X:X::X:X|WORD> route-server-client",
4417 "Configure a neighbor as Route Server client\n")
4422 peer
= peer_and_group_lookup_vty(vty
, argv
[idx_peer
]->arg
);
4424 return CMD_WARNING_CONFIG_FAILED
;
4425 return peer_af_flag_set_vty(vty
, argv
[idx_peer
]->arg
, bgp_node_afi(vty
),
4427 PEER_FLAG_RSERVER_CLIENT
);
4430 ALIAS_HIDDEN(neighbor_route_server_client
,
4431 neighbor_route_server_client_hidden_cmd
,
4432 "neighbor <A.B.C.D|X:X::X:X|WORD> route-server-client",
4433 NEIGHBOR_STR NEIGHBOR_ADDR_STR2
4434 "Configure a neighbor as Route Server client\n")
4436 DEFUN (no_neighbor_route_server_client
,
4437 no_neighbor_route_server_client_cmd
,
4438 "no neighbor <A.B.C.D|X:X::X:X|WORD> route-server-client",
4442 "Configure a neighbor as Route Server client\n")
4445 return peer_af_flag_unset_vty(vty
, argv
[idx_peer
]->arg
,
4446 bgp_node_afi(vty
), bgp_node_safi(vty
),
4447 PEER_FLAG_RSERVER_CLIENT
);
4450 ALIAS_HIDDEN(no_neighbor_route_server_client
,
4451 no_neighbor_route_server_client_hidden_cmd
,
4452 "no neighbor <A.B.C.D|X:X::X:X|WORD> route-server-client",
4453 NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2
4454 "Configure a neighbor as Route Server client\n")
4456 DEFUN (neighbor_nexthop_local_unchanged
,
4457 neighbor_nexthop_local_unchanged_cmd
,
4458 "neighbor <A.B.C.D|X:X::X:X|WORD> nexthop-local unchanged",
4461 "Configure treatment of outgoing link-local nexthop attribute\n"
4462 "Leave link-local nexthop unchanged for this peer\n")
4465 return peer_af_flag_set_vty(vty
, argv
[idx_peer
]->arg
, bgp_node_afi(vty
),
4467 PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED
);
4470 DEFUN (no_neighbor_nexthop_local_unchanged
,
4471 no_neighbor_nexthop_local_unchanged_cmd
,
4472 "no neighbor <A.B.C.D|X:X::X:X|WORD> nexthop-local unchanged",
4476 "Configure treatment of outgoing link-local-nexthop attribute\n"
4477 "Leave link-local nexthop unchanged for this peer\n")
4480 return peer_af_flag_unset_vty(vty
, argv
[idx_peer
]->arg
,
4481 bgp_node_afi(vty
), bgp_node_safi(vty
),
4482 PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED
);
4485 DEFUN (neighbor_attr_unchanged
,
4486 neighbor_attr_unchanged_cmd
,
4487 "neighbor <A.B.C.D|X:X::X:X|WORD> attribute-unchanged [{as-path|next-hop|med}]",
4490 "BGP attribute is propagated unchanged to this neighbor\n"
4491 "As-path attribute\n"
4492 "Nexthop attribute\n"
4496 char *peer_str
= argv
[1]->arg
;
4499 afi_t afi
= bgp_node_afi(vty
);
4500 safi_t safi
= bgp_node_safi(vty
);
4502 peer
= peer_and_group_lookup_vty(vty
, peer_str
);
4504 return CMD_WARNING_CONFIG_FAILED
;
4506 if (argv_find(argv
, argc
, "as-path", &idx
))
4507 SET_FLAG(flags
, PEER_FLAG_AS_PATH_UNCHANGED
);
4509 if (argv_find(argv
, argc
, "next-hop", &idx
))
4510 SET_FLAG(flags
, PEER_FLAG_NEXTHOP_UNCHANGED
);
4512 if (argv_find(argv
, argc
, "med", &idx
))
4513 SET_FLAG(flags
, PEER_FLAG_MED_UNCHANGED
);
4515 /* no flags means all of them! */
4517 SET_FLAG(flags
, PEER_FLAG_AS_PATH_UNCHANGED
);
4518 SET_FLAG(flags
, PEER_FLAG_NEXTHOP_UNCHANGED
);
4519 SET_FLAG(flags
, PEER_FLAG_MED_UNCHANGED
);
4521 if (!CHECK_FLAG(flags
, PEER_FLAG_AS_PATH_UNCHANGED
)
4522 && peer_af_flag_check(peer
, afi
, safi
,
4523 PEER_FLAG_AS_PATH_UNCHANGED
)) {
4524 peer_af_flag_unset_vty(vty
, peer_str
, afi
, safi
,
4525 PEER_FLAG_AS_PATH_UNCHANGED
);
4528 if (!CHECK_FLAG(flags
, PEER_FLAG_NEXTHOP_UNCHANGED
)
4529 && peer_af_flag_check(peer
, afi
, safi
,
4530 PEER_FLAG_NEXTHOP_UNCHANGED
)) {
4531 peer_af_flag_unset_vty(vty
, peer_str
, afi
, safi
,
4532 PEER_FLAG_NEXTHOP_UNCHANGED
);
4535 if (!CHECK_FLAG(flags
, PEER_FLAG_MED_UNCHANGED
)
4536 && peer_af_flag_check(peer
, afi
, safi
,
4537 PEER_FLAG_MED_UNCHANGED
)) {
4538 peer_af_flag_unset_vty(vty
, peer_str
, afi
, safi
,
4539 PEER_FLAG_MED_UNCHANGED
);
4543 return peer_af_flag_set_vty(vty
, peer_str
, afi
, safi
, flags
);
4547 neighbor_attr_unchanged
, neighbor_attr_unchanged_hidden_cmd
,
4548 "neighbor <A.B.C.D|X:X::X:X|WORD> attribute-unchanged [{as-path|next-hop|med}]",
4549 NEIGHBOR_STR NEIGHBOR_ADDR_STR2
4550 "BGP attribute is propagated unchanged to this neighbor\n"
4551 "As-path attribute\n"
4552 "Nexthop attribute\n"
4555 DEFUN (no_neighbor_attr_unchanged
,
4556 no_neighbor_attr_unchanged_cmd
,
4557 "no neighbor <A.B.C.D|X:X::X:X|WORD> attribute-unchanged [{as-path|next-hop|med}]",
4561 "BGP attribute is propagated unchanged to this neighbor\n"
4562 "As-path attribute\n"
4563 "Nexthop attribute\n"
4567 char *peer
= argv
[2]->arg
;
4570 if (argv_find(argv
, argc
, "as-path", &idx
))
4571 SET_FLAG(flags
, PEER_FLAG_AS_PATH_UNCHANGED
);
4573 if (argv_find(argv
, argc
, "next-hop", &idx
))
4574 SET_FLAG(flags
, PEER_FLAG_NEXTHOP_UNCHANGED
);
4576 if (argv_find(argv
, argc
, "med", &idx
))
4577 SET_FLAG(flags
, PEER_FLAG_MED_UNCHANGED
);
4579 if (!flags
) // no flags means all of them!
4581 SET_FLAG(flags
, PEER_FLAG_AS_PATH_UNCHANGED
);
4582 SET_FLAG(flags
, PEER_FLAG_NEXTHOP_UNCHANGED
);
4583 SET_FLAG(flags
, PEER_FLAG_MED_UNCHANGED
);
4586 return peer_af_flag_unset_vty(vty
, peer
, bgp_node_afi(vty
),
4587 bgp_node_safi(vty
), flags
);
4591 no_neighbor_attr_unchanged
, no_neighbor_attr_unchanged_hidden_cmd
,
4592 "no neighbor <A.B.C.D|X:X::X:X|WORD> attribute-unchanged [{as-path|next-hop|med}]",
4593 NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2
4594 "BGP attribute is propagated unchanged to this neighbor\n"
4595 "As-path attribute\n"
4596 "Nexthop attribute\n"
4599 /* EBGP multihop configuration. */
4600 static int peer_ebgp_multihop_set_vty(struct vty
*vty
, const char *ip_str
,
4601 const char *ttl_str
)
4606 peer
= peer_and_group_lookup_vty(vty
, ip_str
);
4608 return CMD_WARNING_CONFIG_FAILED
;
4611 return bgp_vty_return(vty
, BGP_ERR_INVALID_FOR_DIRECT_PEER
);
4616 ttl
= strtoul(ttl_str
, NULL
, 10);
4618 return bgp_vty_return(vty
, peer_ebgp_multihop_set(peer
, ttl
));
4621 static int peer_ebgp_multihop_unset_vty(struct vty
*vty
, const char *ip_str
)
4625 peer
= peer_and_group_lookup_vty(vty
, ip_str
);
4627 return CMD_WARNING_CONFIG_FAILED
;
4629 return bgp_vty_return(vty
, peer_ebgp_multihop_unset(peer
));
4632 /* neighbor ebgp-multihop. */
4633 DEFUN (neighbor_ebgp_multihop
,
4634 neighbor_ebgp_multihop_cmd
,
4635 "neighbor <A.B.C.D|X:X::X:X|WORD> ebgp-multihop",
4638 "Allow EBGP neighbors not on directly connected networks\n")
4641 return peer_ebgp_multihop_set_vty(vty
, argv
[idx_peer
]->arg
, NULL
);
4644 DEFUN (neighbor_ebgp_multihop_ttl
,
4645 neighbor_ebgp_multihop_ttl_cmd
,
4646 "neighbor <A.B.C.D|X:X::X:X|WORD> ebgp-multihop (1-255)",
4649 "Allow EBGP neighbors not on directly connected networks\n"
4650 "maximum hop count\n")
4654 return peer_ebgp_multihop_set_vty(vty
, argv
[idx_peer
]->arg
,
4655 argv
[idx_number
]->arg
);
4658 DEFUN (no_neighbor_ebgp_multihop
,
4659 no_neighbor_ebgp_multihop_cmd
,
4660 "no neighbor <A.B.C.D|X:X::X:X|WORD> ebgp-multihop [(1-255)]",
4664 "Allow EBGP neighbors not on directly connected networks\n"
4665 "maximum hop count\n")
4668 return peer_ebgp_multihop_unset_vty(vty
, argv
[idx_peer
]->arg
);
4672 /* disable-connected-check */
4673 DEFUN (neighbor_disable_connected_check
,
4674 neighbor_disable_connected_check_cmd
,
4675 "neighbor <A.B.C.D|X:X::X:X|WORD> <disable-connected-check|enforce-multihop>",
4678 "one-hop away EBGP peer using loopback address\n"
4679 "Enforce EBGP neighbors perform multihop\n")
4682 return peer_flag_set_vty(vty
, argv
[idx_peer
]->arg
,
4683 PEER_FLAG_DISABLE_CONNECTED_CHECK
);
4686 DEFUN (no_neighbor_disable_connected_check
,
4687 no_neighbor_disable_connected_check_cmd
,
4688 "no neighbor <A.B.C.D|X:X::X:X|WORD> <disable-connected-check|enforce-multihop>",
4692 "one-hop away EBGP peer using loopback address\n"
4693 "Enforce EBGP neighbors perform multihop\n")
4696 return peer_flag_unset_vty(vty
, argv
[idx_peer
]->arg
,
4697 PEER_FLAG_DISABLE_CONNECTED_CHECK
);
4701 /* enforce-first-as */
4702 DEFUN (neighbor_enforce_first_as
,
4703 neighbor_enforce_first_as_cmd
,
4704 "neighbor <A.B.C.D|X:X::X:X|WORD> enforce-first-as",
4707 "Enforce the first AS for EBGP routes\n")
4711 return peer_flag_set_vty(vty
, argv
[idx_peer
]->arg
,
4712 PEER_FLAG_ENFORCE_FIRST_AS
);
4715 DEFUN (no_neighbor_enforce_first_as
,
4716 no_neighbor_enforce_first_as_cmd
,
4717 "no neighbor <A.B.C.D|X:X::X:X|WORD> enforce-first-as",
4721 "Enforce the first AS for EBGP routes\n")
4725 return peer_flag_unset_vty(vty
, argv
[idx_peer
]->arg
,
4726 PEER_FLAG_ENFORCE_FIRST_AS
);
4730 DEFUN (neighbor_description
,
4731 neighbor_description_cmd
,
4732 "neighbor <A.B.C.D|X:X::X:X|WORD> description LINE...",
4735 "Neighbor specific description\n"
4736 "Up to 80 characters describing this neighbor\n")
4743 peer
= peer_and_group_lookup_vty(vty
, argv
[idx_peer
]->arg
);
4745 return CMD_WARNING_CONFIG_FAILED
;
4747 str
= argv_concat(argv
, argc
, idx_line
);
4749 peer_description_set(peer
, str
);
4751 XFREE(MTYPE_TMP
, str
);
4756 DEFUN (no_neighbor_description
,
4757 no_neighbor_description_cmd
,
4758 "no neighbor <A.B.C.D|X:X::X:X|WORD> description",
4762 "Neighbor specific description\n")
4767 peer
= peer_and_group_lookup_vty(vty
, argv
[idx_peer
]->arg
);
4769 return CMD_WARNING_CONFIG_FAILED
;
4771 peer_description_unset(peer
);
4776 ALIAS(no_neighbor_description
, no_neighbor_description_comment_cmd
,
4777 "no neighbor <A.B.C.D|X:X::X:X|WORD> description LINE...",
4778 NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2
4779 "Neighbor specific description\n"
4780 "Up to 80 characters describing this neighbor\n")
4782 /* Neighbor update-source. */
4783 static int peer_update_source_vty(struct vty
*vty
, const char *peer_str
,
4784 const char *source_str
)
4790 peer
= peer_and_group_lookup_vty(vty
, peer_str
);
4792 return CMD_WARNING_CONFIG_FAILED
;
4798 if (str2sockunion(source_str
, &su
) == 0)
4799 peer_update_source_addr_set(peer
, &su
);
4801 if (str2prefix(source_str
, &p
)) {
4803 "%% Invalid update-source, remove prefix length \n");
4804 return CMD_WARNING_CONFIG_FAILED
;
4806 peer_update_source_if_set(peer
, source_str
);
4809 peer_update_source_unset(peer
);
4814 #define BGP_UPDATE_SOURCE_HELP_STR \
4817 "Interface name (requires zebra to be running)\n"
4819 DEFUN (neighbor_update_source
,
4820 neighbor_update_source_cmd
,
4821 "neighbor <A.B.C.D|X:X::X:X|WORD> update-source <A.B.C.D|X:X::X:X|WORD>",
4824 "Source of routing updates\n"
4825 BGP_UPDATE_SOURCE_HELP_STR
)
4829 return peer_update_source_vty(vty
, argv
[idx_peer
]->arg
,
4830 argv
[idx_peer_2
]->arg
);
4833 DEFUN (no_neighbor_update_source
,
4834 no_neighbor_update_source_cmd
,
4835 "no neighbor <A.B.C.D|X:X::X:X|WORD> update-source [<A.B.C.D|X:X::X:X|WORD>]",
4839 "Source of routing updates\n"
4840 BGP_UPDATE_SOURCE_HELP_STR
)
4843 return peer_update_source_vty(vty
, argv
[idx_peer
]->arg
, NULL
);
4846 static int peer_default_originate_set_vty(struct vty
*vty
, const char *peer_str
,
4847 afi_t afi
, safi_t safi
,
4848 const char *rmap
, int set
)
4852 struct route_map
*route_map
;
4854 peer
= peer_and_group_lookup_vty(vty
, peer_str
);
4856 return CMD_WARNING_CONFIG_FAILED
;
4859 route_map
= route_map_lookup_warn_noexist(vty
, rmap
);
4860 ret
= peer_default_originate_set(peer
, afi
, safi
,
4863 ret
= peer_default_originate_unset(peer
, afi
, safi
);
4865 return bgp_vty_return(vty
, ret
);
4868 /* neighbor default-originate. */
4869 DEFUN (neighbor_default_originate
,
4870 neighbor_default_originate_cmd
,
4871 "neighbor <A.B.C.D|X:X::X:X|WORD> default-originate",
4874 "Originate default route to this neighbor\n")
4877 return peer_default_originate_set_vty(vty
, argv
[idx_peer
]->arg
,
4879 bgp_node_safi(vty
), NULL
, 1);
4882 ALIAS_HIDDEN(neighbor_default_originate
, neighbor_default_originate_hidden_cmd
,
4883 "neighbor <A.B.C.D|X:X::X:X|WORD> default-originate",
4884 NEIGHBOR_STR NEIGHBOR_ADDR_STR2
4885 "Originate default route to this neighbor\n")
4887 DEFUN (neighbor_default_originate_rmap
,
4888 neighbor_default_originate_rmap_cmd
,
4889 "neighbor <A.B.C.D|X:X::X:X|WORD> default-originate route-map WORD",
4892 "Originate default route to this neighbor\n"
4893 "Route-map to specify criteria to originate default\n"
4898 return peer_default_originate_set_vty(
4899 vty
, argv
[idx_peer
]->arg
, bgp_node_afi(vty
), bgp_node_safi(vty
),
4900 argv
[idx_word
]->arg
, 1);
4904 neighbor_default_originate_rmap
,
4905 neighbor_default_originate_rmap_hidden_cmd
,
4906 "neighbor <A.B.C.D|X:X::X:X|WORD> default-originate route-map WORD",
4907 NEIGHBOR_STR NEIGHBOR_ADDR_STR2
4908 "Originate default route to this neighbor\n"
4909 "Route-map to specify criteria to originate default\n"
4912 DEFUN (no_neighbor_default_originate
,
4913 no_neighbor_default_originate_cmd
,
4914 "no neighbor <A.B.C.D|X:X::X:X|WORD> default-originate [route-map WORD]",
4918 "Originate default route to this neighbor\n"
4919 "Route-map to specify criteria to originate default\n"
4923 return peer_default_originate_set_vty(vty
, argv
[idx_peer
]->arg
,
4925 bgp_node_safi(vty
), NULL
, 0);
4929 no_neighbor_default_originate
, no_neighbor_default_originate_hidden_cmd
,
4930 "no neighbor <A.B.C.D|X:X::X:X|WORD> default-originate [route-map WORD]",
4931 NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2
4932 "Originate default route to this neighbor\n"
4933 "Route-map to specify criteria to originate default\n"
4937 /* Set neighbor's BGP port. */
4938 static int peer_port_vty(struct vty
*vty
, const char *ip_str
, int afi
,
4939 const char *port_str
)
4945 peer
= peer_lookup_vty(vty
, ip_str
);
4947 return CMD_WARNING_CONFIG_FAILED
;
4950 sp
= getservbyname("bgp", "tcp");
4951 port
= (sp
== NULL
) ? BGP_PORT_DEFAULT
: ntohs(sp
->s_port
);
4953 port
= strtoul(port_str
, NULL
, 10);
4956 peer_port_set(peer
, port
);
4961 /* Set specified peer's BGP port. */
4962 DEFUN (neighbor_port
,
4964 "neighbor <A.B.C.D|X:X::X:X> port (0-65535)",
4967 "Neighbor's BGP port\n"
4968 "TCP port number\n")
4972 return peer_port_vty(vty
, argv
[idx_ip
]->arg
, AFI_IP
,
4973 argv
[idx_number
]->arg
);
4976 DEFUN (no_neighbor_port
,
4977 no_neighbor_port_cmd
,
4978 "no neighbor <A.B.C.D|X:X::X:X> port [(0-65535)]",
4982 "Neighbor's BGP port\n"
4983 "TCP port number\n")
4986 return peer_port_vty(vty
, argv
[idx_ip
]->arg
, AFI_IP
, NULL
);
4990 /* neighbor weight. */
4991 static int peer_weight_set_vty(struct vty
*vty
, const char *ip_str
, afi_t afi
,
4992 safi_t safi
, const char *weight_str
)
4996 unsigned long weight
;
4998 peer
= peer_and_group_lookup_vty(vty
, ip_str
);
5000 return CMD_WARNING_CONFIG_FAILED
;
5002 weight
= strtoul(weight_str
, NULL
, 10);
5004 ret
= peer_weight_set(peer
, afi
, safi
, weight
);
5005 return bgp_vty_return(vty
, ret
);
5008 static int peer_weight_unset_vty(struct vty
*vty
, const char *ip_str
, afi_t afi
,
5014 peer
= peer_and_group_lookup_vty(vty
, ip_str
);
5016 return CMD_WARNING_CONFIG_FAILED
;
5018 ret
= peer_weight_unset(peer
, afi
, safi
);
5019 return bgp_vty_return(vty
, ret
);
5022 DEFUN (neighbor_weight
,
5023 neighbor_weight_cmd
,
5024 "neighbor <A.B.C.D|X:X::X:X|WORD> weight (0-65535)",
5027 "Set default weight for routes from this neighbor\n"
5032 return peer_weight_set_vty(vty
, argv
[idx_peer
]->arg
, bgp_node_afi(vty
),
5033 bgp_node_safi(vty
), argv
[idx_number
]->arg
);
5036 ALIAS_HIDDEN(neighbor_weight
, neighbor_weight_hidden_cmd
,
5037 "neighbor <A.B.C.D|X:X::X:X|WORD> weight (0-65535)",
5038 NEIGHBOR_STR NEIGHBOR_ADDR_STR2
5039 "Set default weight for routes from this neighbor\n"
5042 DEFUN (no_neighbor_weight
,
5043 no_neighbor_weight_cmd
,
5044 "no neighbor <A.B.C.D|X:X::X:X|WORD> weight [(0-65535)]",
5048 "Set default weight for routes from this neighbor\n"
5052 return peer_weight_unset_vty(vty
, argv
[idx_peer
]->arg
,
5053 bgp_node_afi(vty
), bgp_node_safi(vty
));
5056 ALIAS_HIDDEN(no_neighbor_weight
, no_neighbor_weight_hidden_cmd
,
5057 "no neighbor <A.B.C.D|X:X::X:X|WORD> weight [(0-65535)]",
5058 NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2
5059 "Set default weight for routes from this neighbor\n"
5063 /* Override capability negotiation. */
5064 DEFUN (neighbor_override_capability
,
5065 neighbor_override_capability_cmd
,
5066 "neighbor <A.B.C.D|X:X::X:X|WORD> override-capability",
5069 "Override capability negotiation result\n")
5072 return peer_flag_set_vty(vty
, argv
[idx_peer
]->arg
,
5073 PEER_FLAG_OVERRIDE_CAPABILITY
);
5076 DEFUN (no_neighbor_override_capability
,
5077 no_neighbor_override_capability_cmd
,
5078 "no neighbor <A.B.C.D|X:X::X:X|WORD> override-capability",
5082 "Override capability negotiation result\n")
5085 return peer_flag_unset_vty(vty
, argv
[idx_peer
]->arg
,
5086 PEER_FLAG_OVERRIDE_CAPABILITY
);
5089 DEFUN (neighbor_strict_capability
,
5090 neighbor_strict_capability_cmd
,
5091 "neighbor <A.B.C.D|X:X::X:X|WORD> strict-capability-match",
5094 "Strict capability negotiation match\n")
5098 return peer_flag_set_vty(vty
, argv
[idx_peer
]->arg
,
5099 PEER_FLAG_STRICT_CAP_MATCH
);
5102 DEFUN (no_neighbor_strict_capability
,
5103 no_neighbor_strict_capability_cmd
,
5104 "no neighbor <A.B.C.D|X:X::X:X|WORD> strict-capability-match",
5108 "Strict capability negotiation match\n")
5112 return peer_flag_unset_vty(vty
, argv
[idx_peer
]->arg
,
5113 PEER_FLAG_STRICT_CAP_MATCH
);
5116 static int peer_timers_set_vty(struct vty
*vty
, const char *ip_str
,
5117 const char *keep_str
, const char *hold_str
)
5124 peer
= peer_and_group_lookup_vty(vty
, ip_str
);
5126 return CMD_WARNING_CONFIG_FAILED
;
5128 keepalive
= strtoul(keep_str
, NULL
, 10);
5129 holdtime
= strtoul(hold_str
, NULL
, 10);
5131 ret
= peer_timers_set(peer
, keepalive
, holdtime
);
5133 return bgp_vty_return(vty
, ret
);
5136 static int peer_timers_unset_vty(struct vty
*vty
, const char *ip_str
)
5141 peer
= peer_and_group_lookup_vty(vty
, ip_str
);
5143 return CMD_WARNING_CONFIG_FAILED
;
5145 ret
= peer_timers_unset(peer
);
5147 return bgp_vty_return(vty
, ret
);
5150 DEFUN (neighbor_timers
,
5151 neighbor_timers_cmd
,
5152 "neighbor <A.B.C.D|X:X::X:X|WORD> timers (0-65535) (0-65535)",
5155 "BGP per neighbor timers\n"
5156 "Keepalive interval\n"
5161 int idx_number_2
= 4;
5162 return peer_timers_set_vty(vty
, argv
[idx_peer
]->arg
,
5163 argv
[idx_number
]->arg
,
5164 argv
[idx_number_2
]->arg
);
5167 DEFUN (no_neighbor_timers
,
5168 no_neighbor_timers_cmd
,
5169 "no neighbor <A.B.C.D|X:X::X:X|WORD> timers [(0-65535) (0-65535)]",
5173 "BGP per neighbor timers\n"
5174 "Keepalive interval\n"
5178 return peer_timers_unset_vty(vty
, argv
[idx_peer
]->arg
);
5182 static int peer_timers_connect_set_vty(struct vty
*vty
, const char *ip_str
,
5183 const char *time_str
)
5189 peer
= peer_and_group_lookup_vty(vty
, ip_str
);
5191 return CMD_WARNING_CONFIG_FAILED
;
5193 connect
= strtoul(time_str
, NULL
, 10);
5195 ret
= peer_timers_connect_set(peer
, connect
);
5197 return bgp_vty_return(vty
, ret
);
5200 static int peer_timers_connect_unset_vty(struct vty
*vty
, const char *ip_str
)
5205 peer
= peer_and_group_lookup_vty(vty
, ip_str
);
5207 return CMD_WARNING_CONFIG_FAILED
;
5209 ret
= peer_timers_connect_unset(peer
);
5211 return bgp_vty_return(vty
, ret
);
5214 DEFUN (neighbor_timers_connect
,
5215 neighbor_timers_connect_cmd
,
5216 "neighbor <A.B.C.D|X:X::X:X|WORD> timers connect (1-65535)",
5219 "BGP per neighbor timers\n"
5220 "BGP connect timer\n"
5225 return peer_timers_connect_set_vty(vty
, argv
[idx_peer
]->arg
,
5226 argv
[idx_number
]->arg
);
5229 DEFUN (no_neighbor_timers_connect
,
5230 no_neighbor_timers_connect_cmd
,
5231 "no neighbor <A.B.C.D|X:X::X:X|WORD> timers connect [(1-65535)]",
5235 "BGP per neighbor timers\n"
5236 "BGP connect timer\n"
5240 return peer_timers_connect_unset_vty(vty
, argv
[idx_peer
]->arg
);
5244 static int peer_advertise_interval_vty(struct vty
*vty
, const char *ip_str
,
5245 const char *time_str
, int set
)
5249 uint32_t routeadv
= 0;
5251 peer
= peer_and_group_lookup_vty(vty
, ip_str
);
5253 return CMD_WARNING_CONFIG_FAILED
;
5256 routeadv
= strtoul(time_str
, NULL
, 10);
5259 ret
= peer_advertise_interval_set(peer
, routeadv
);
5261 ret
= peer_advertise_interval_unset(peer
);
5263 return bgp_vty_return(vty
, ret
);
5266 DEFUN (neighbor_advertise_interval
,
5267 neighbor_advertise_interval_cmd
,
5268 "neighbor <A.B.C.D|X:X::X:X|WORD> advertisement-interval (0-600)",
5271 "Minimum interval between sending BGP routing updates\n"
5272 "time in seconds\n")
5276 return peer_advertise_interval_vty(vty
, argv
[idx_peer
]->arg
,
5277 argv
[idx_number
]->arg
, 1);
5280 DEFUN (no_neighbor_advertise_interval
,
5281 no_neighbor_advertise_interval_cmd
,
5282 "no neighbor <A.B.C.D|X:X::X:X|WORD> advertisement-interval [(0-600)]",
5286 "Minimum interval between sending BGP routing updates\n"
5287 "time in seconds\n")
5290 return peer_advertise_interval_vty(vty
, argv
[idx_peer
]->arg
, NULL
, 0);
5294 /* Time to wait before processing route-map updates */
5295 DEFUN (bgp_set_route_map_delay_timer
,
5296 bgp_set_route_map_delay_timer_cmd
,
5297 "bgp route-map delay-timer (0-600)",
5299 "BGP route-map delay timer\n"
5300 "Time in secs to wait before processing route-map changes\n"
5301 "0 disables the timer, no route updates happen when route-maps change\n")
5304 uint32_t rmap_delay_timer
;
5306 if (argv
[idx_number
]->arg
) {
5307 rmap_delay_timer
= strtoul(argv
[idx_number
]->arg
, NULL
, 10);
5308 bm
->rmap_update_timer
= rmap_delay_timer
;
5310 /* if the dynamic update handling is being disabled, and a timer
5312 * running, stop the timer and act as if the timer has already
5315 if (!rmap_delay_timer
&& bm
->t_rmap_update
) {
5316 BGP_TIMER_OFF(bm
->t_rmap_update
);
5317 thread_execute(bm
->master
, bgp_route_map_update_timer
,
5322 vty_out(vty
, "%% BGP invalid route-map delay-timer\n");
5323 return CMD_WARNING_CONFIG_FAILED
;
5327 DEFUN (no_bgp_set_route_map_delay_timer
,
5328 no_bgp_set_route_map_delay_timer_cmd
,
5329 "no bgp route-map delay-timer [(0-600)]",
5332 "Default BGP route-map delay timer\n"
5333 "Reset to default time to wait for processing route-map changes\n"
5334 "0 disables the timer, no route updates happen when route-maps change\n")
5337 bm
->rmap_update_timer
= RMAP_DEFAULT_UPDATE_TIMER
;
5343 /* neighbor interface */
5344 static int peer_interface_vty(struct vty
*vty
, const char *ip_str
,
5349 peer
= peer_lookup_vty(vty
, ip_str
);
5350 if (!peer
|| peer
->conf_if
) {
5351 vty_out(vty
, "%% BGP invalid peer %s\n", ip_str
);
5352 return CMD_WARNING_CONFIG_FAILED
;
5356 peer_interface_set(peer
, str
);
5358 peer_interface_unset(peer
);
5363 DEFUN (neighbor_interface
,
5364 neighbor_interface_cmd
,
5365 "neighbor <A.B.C.D|X:X::X:X> interface WORD",
5373 return peer_interface_vty(vty
, argv
[idx_ip
]->arg
, argv
[idx_word
]->arg
);
5376 DEFUN (no_neighbor_interface
,
5377 no_neighbor_interface_cmd
,
5378 "no neighbor <A.B.C.D|X:X::X:X|WORD> interface WORD",
5386 return peer_interface_vty(vty
, argv
[idx_peer
]->arg
, NULL
);
5389 DEFUN (neighbor_distribute_list
,
5390 neighbor_distribute_list_cmd
,
5391 "neighbor <A.B.C.D|X:X::X:X|WORD> distribute-list <(1-199)|(1300-2699)|WORD> <in|out>",
5394 "Filter updates to/from this neighbor\n"
5395 "IP access-list number\n"
5396 "IP access-list number (expanded range)\n"
5397 "IP Access-list name\n"
5398 "Filter incoming updates\n"
5399 "Filter outgoing updates\n")
5406 const char *pstr
= argv
[idx_peer
]->arg
;
5407 const char *acl
= argv
[idx_acl
]->arg
;
5408 const char *inout
= argv
[argc
- 1]->text
;
5410 peer
= peer_and_group_lookup_vty(vty
, pstr
);
5412 return CMD_WARNING_CONFIG_FAILED
;
5414 /* Check filter direction. */
5415 direct
= strmatch(inout
, "in") ? FILTER_IN
: FILTER_OUT
;
5416 ret
= peer_distribute_set(peer
, bgp_node_afi(vty
), bgp_node_safi(vty
),
5419 return bgp_vty_return(vty
, ret
);
5423 neighbor_distribute_list
, neighbor_distribute_list_hidden_cmd
,
5424 "neighbor <A.B.C.D|X:X::X:X|WORD> distribute-list <(1-199)|(1300-2699)|WORD> <in|out>",
5425 NEIGHBOR_STR NEIGHBOR_ADDR_STR2
5426 "Filter updates to/from this neighbor\n"
5427 "IP access-list number\n"
5428 "IP access-list number (expanded range)\n"
5429 "IP Access-list name\n"
5430 "Filter incoming updates\n"
5431 "Filter outgoing updates\n")
5433 DEFUN (no_neighbor_distribute_list
,
5434 no_neighbor_distribute_list_cmd
,
5435 "no neighbor <A.B.C.D|X:X::X:X|WORD> distribute-list <(1-199)|(1300-2699)|WORD> <in|out>",
5439 "Filter updates to/from this neighbor\n"
5440 "IP access-list number\n"
5441 "IP access-list number (expanded range)\n"
5442 "IP Access-list name\n"
5443 "Filter incoming updates\n"
5444 "Filter outgoing updates\n")
5450 const char *pstr
= argv
[idx_peer
]->arg
;
5451 const char *inout
= argv
[argc
- 1]->text
;
5453 peer
= peer_and_group_lookup_vty(vty
, pstr
);
5455 return CMD_WARNING_CONFIG_FAILED
;
5457 /* Check filter direction. */
5458 direct
= strmatch(inout
, "in") ? FILTER_IN
: FILTER_OUT
;
5459 ret
= peer_distribute_unset(peer
, bgp_node_afi(vty
), bgp_node_safi(vty
),
5462 return bgp_vty_return(vty
, ret
);
5466 no_neighbor_distribute_list
, no_neighbor_distribute_list_hidden_cmd
,
5467 "no neighbor <A.B.C.D|X:X::X:X|WORD> distribute-list <(1-199)|(1300-2699)|WORD> <in|out>",
5468 NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2
5469 "Filter updates to/from this neighbor\n"
5470 "IP access-list number\n"
5471 "IP access-list number (expanded range)\n"
5472 "IP Access-list name\n"
5473 "Filter incoming updates\n"
5474 "Filter outgoing updates\n")
5476 /* Set prefix list to the peer. */
5477 static int peer_prefix_list_set_vty(struct vty
*vty
, const char *ip_str
,
5478 afi_t afi
, safi_t safi
,
5479 const char *name_str
,
5480 const char *direct_str
)
5483 int direct
= FILTER_IN
;
5486 peer
= peer_and_group_lookup_vty(vty
, ip_str
);
5488 return CMD_WARNING_CONFIG_FAILED
;
5490 /* Check filter direction. */
5491 if (strncmp(direct_str
, "i", 1) == 0)
5493 else if (strncmp(direct_str
, "o", 1) == 0)
5494 direct
= FILTER_OUT
;
5496 ret
= peer_prefix_list_set(peer
, afi
, safi
, direct
, name_str
);
5498 return bgp_vty_return(vty
, ret
);
5501 static int peer_prefix_list_unset_vty(struct vty
*vty
, const char *ip_str
,
5502 afi_t afi
, safi_t safi
,
5503 const char *direct_str
)
5507 int direct
= FILTER_IN
;
5509 peer
= peer_and_group_lookup_vty(vty
, ip_str
);
5511 return CMD_WARNING_CONFIG_FAILED
;
5513 /* Check filter direction. */
5514 if (strncmp(direct_str
, "i", 1) == 0)
5516 else if (strncmp(direct_str
, "o", 1) == 0)
5517 direct
= FILTER_OUT
;
5519 ret
= peer_prefix_list_unset(peer
, afi
, safi
, direct
);
5521 return bgp_vty_return(vty
, ret
);
5524 DEFUN (neighbor_prefix_list
,
5525 neighbor_prefix_list_cmd
,
5526 "neighbor <A.B.C.D|X:X::X:X|WORD> prefix-list WORD <in|out>",
5529 "Filter updates to/from this neighbor\n"
5530 "Name of a prefix list\n"
5531 "Filter incoming updates\n"
5532 "Filter outgoing updates\n")
5537 return peer_prefix_list_set_vty(
5538 vty
, argv
[idx_peer
]->arg
, bgp_node_afi(vty
), bgp_node_safi(vty
),
5539 argv
[idx_word
]->arg
, argv
[idx_in_out
]->arg
);
5542 ALIAS_HIDDEN(neighbor_prefix_list
, neighbor_prefix_list_hidden_cmd
,
5543 "neighbor <A.B.C.D|X:X::X:X|WORD> prefix-list WORD <in|out>",
5544 NEIGHBOR_STR NEIGHBOR_ADDR_STR2
5545 "Filter updates to/from this neighbor\n"
5546 "Name of a prefix list\n"
5547 "Filter incoming updates\n"
5548 "Filter outgoing updates\n")
5550 DEFUN (no_neighbor_prefix_list
,
5551 no_neighbor_prefix_list_cmd
,
5552 "no neighbor <A.B.C.D|X:X::X:X|WORD> prefix-list WORD <in|out>",
5556 "Filter updates to/from this neighbor\n"
5557 "Name of a prefix list\n"
5558 "Filter incoming updates\n"
5559 "Filter outgoing updates\n")
5563 return peer_prefix_list_unset_vty(vty
, argv
[idx_peer
]->arg
,
5564 bgp_node_afi(vty
), bgp_node_safi(vty
),
5565 argv
[idx_in_out
]->arg
);
5568 ALIAS_HIDDEN(no_neighbor_prefix_list
, no_neighbor_prefix_list_hidden_cmd
,
5569 "no neighbor <A.B.C.D|X:X::X:X|WORD> prefix-list WORD <in|out>",
5570 NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2
5571 "Filter updates to/from this neighbor\n"
5572 "Name of a prefix list\n"
5573 "Filter incoming updates\n"
5574 "Filter outgoing updates\n")
5576 static int peer_aslist_set_vty(struct vty
*vty
, const char *ip_str
, afi_t afi
,
5577 safi_t safi
, const char *name_str
,
5578 const char *direct_str
)
5582 int direct
= FILTER_IN
;
5584 peer
= peer_and_group_lookup_vty(vty
, ip_str
);
5586 return CMD_WARNING_CONFIG_FAILED
;
5588 /* Check filter direction. */
5589 if (strncmp(direct_str
, "i", 1) == 0)
5591 else if (strncmp(direct_str
, "o", 1) == 0)
5592 direct
= FILTER_OUT
;
5594 ret
= peer_aslist_set(peer
, afi
, safi
, direct
, name_str
);
5596 return bgp_vty_return(vty
, ret
);
5599 static int peer_aslist_unset_vty(struct vty
*vty
, const char *ip_str
, afi_t afi
,
5600 safi_t safi
, const char *direct_str
)
5604 int direct
= FILTER_IN
;
5606 peer
= peer_and_group_lookup_vty(vty
, ip_str
);
5608 return CMD_WARNING_CONFIG_FAILED
;
5610 /* Check filter direction. */
5611 if (strncmp(direct_str
, "i", 1) == 0)
5613 else if (strncmp(direct_str
, "o", 1) == 0)
5614 direct
= FILTER_OUT
;
5616 ret
= peer_aslist_unset(peer
, afi
, safi
, direct
);
5618 return bgp_vty_return(vty
, ret
);
5621 DEFUN (neighbor_filter_list
,
5622 neighbor_filter_list_cmd
,
5623 "neighbor <A.B.C.D|X:X::X:X|WORD> filter-list WORD <in|out>",
5626 "Establish BGP filters\n"
5627 "AS path access-list name\n"
5628 "Filter incoming routes\n"
5629 "Filter outgoing routes\n")
5634 return peer_aslist_set_vty(vty
, argv
[idx_peer
]->arg
, bgp_node_afi(vty
),
5635 bgp_node_safi(vty
), argv
[idx_word
]->arg
,
5636 argv
[idx_in_out
]->arg
);
5639 ALIAS_HIDDEN(neighbor_filter_list
, neighbor_filter_list_hidden_cmd
,
5640 "neighbor <A.B.C.D|X:X::X:X|WORD> filter-list WORD <in|out>",
5641 NEIGHBOR_STR NEIGHBOR_ADDR_STR2
5642 "Establish BGP filters\n"
5643 "AS path access-list name\n"
5644 "Filter incoming routes\n"
5645 "Filter outgoing routes\n")
5647 DEFUN (no_neighbor_filter_list
,
5648 no_neighbor_filter_list_cmd
,
5649 "no neighbor <A.B.C.D|X:X::X:X|WORD> filter-list WORD <in|out>",
5653 "Establish BGP filters\n"
5654 "AS path access-list name\n"
5655 "Filter incoming routes\n"
5656 "Filter outgoing routes\n")
5660 return peer_aslist_unset_vty(vty
, argv
[idx_peer
]->arg
,
5661 bgp_node_afi(vty
), bgp_node_safi(vty
),
5662 argv
[idx_in_out
]->arg
);
5665 ALIAS_HIDDEN(no_neighbor_filter_list
, no_neighbor_filter_list_hidden_cmd
,
5666 "no neighbor <A.B.C.D|X:X::X:X|WORD> filter-list WORD <in|out>",
5667 NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2
5668 "Establish BGP filters\n"
5669 "AS path access-list name\n"
5670 "Filter incoming routes\n"
5671 "Filter outgoing routes\n")
5673 /* Set route-map to the peer. */
5674 static int peer_route_map_set_vty(struct vty
*vty
, const char *ip_str
,
5675 afi_t afi
, safi_t safi
, const char *name_str
,
5676 const char *direct_str
)
5680 int direct
= RMAP_IN
;
5681 struct route_map
*route_map
;
5683 peer
= peer_and_group_lookup_vty(vty
, ip_str
);
5685 return CMD_WARNING_CONFIG_FAILED
;
5687 /* Check filter direction. */
5688 if (strncmp(direct_str
, "in", 2) == 0)
5690 else if (strncmp(direct_str
, "o", 1) == 0)
5693 route_map
= route_map_lookup_warn_noexist(vty
, name_str
);
5694 ret
= peer_route_map_set(peer
, afi
, safi
, direct
, name_str
, route_map
);
5696 return bgp_vty_return(vty
, ret
);
5699 static int peer_route_map_unset_vty(struct vty
*vty
, const char *ip_str
,
5700 afi_t afi
, safi_t safi
,
5701 const char *direct_str
)
5705 int direct
= RMAP_IN
;
5707 peer
= peer_and_group_lookup_vty(vty
, ip_str
);
5709 return CMD_WARNING_CONFIG_FAILED
;
5711 /* Check filter direction. */
5712 if (strncmp(direct_str
, "in", 2) == 0)
5714 else if (strncmp(direct_str
, "o", 1) == 0)
5717 ret
= peer_route_map_unset(peer
, afi
, safi
, direct
);
5719 return bgp_vty_return(vty
, ret
);
5722 DEFUN (neighbor_route_map
,
5723 neighbor_route_map_cmd
,
5724 "neighbor <A.B.C.D|X:X::X:X|WORD> route-map WORD <in|out>",
5727 "Apply route map to neighbor\n"
5728 "Name of route map\n"
5729 "Apply map to incoming routes\n"
5730 "Apply map to outbound routes\n")
5735 return peer_route_map_set_vty(
5736 vty
, argv
[idx_peer
]->arg
, bgp_node_afi(vty
), bgp_node_safi(vty
),
5737 argv
[idx_word
]->arg
, argv
[idx_in_out
]->arg
);
5740 ALIAS_HIDDEN(neighbor_route_map
, neighbor_route_map_hidden_cmd
,
5741 "neighbor <A.B.C.D|X:X::X:X|WORD> route-map WORD <in|out>",
5742 NEIGHBOR_STR NEIGHBOR_ADDR_STR2
5743 "Apply route map to neighbor\n"
5744 "Name of route map\n"
5745 "Apply map to incoming routes\n"
5746 "Apply map to outbound routes\n")
5748 DEFUN (no_neighbor_route_map
,
5749 no_neighbor_route_map_cmd
,
5750 "no neighbor <A.B.C.D|X:X::X:X|WORD> route-map WORD <in|out>",
5754 "Apply route map to neighbor\n"
5755 "Name of route map\n"
5756 "Apply map to incoming routes\n"
5757 "Apply map to outbound routes\n")
5761 return peer_route_map_unset_vty(vty
, argv
[idx_peer
]->arg
,
5762 bgp_node_afi(vty
), bgp_node_safi(vty
),
5763 argv
[idx_in_out
]->arg
);
5766 ALIAS_HIDDEN(no_neighbor_route_map
, no_neighbor_route_map_hidden_cmd
,
5767 "no neighbor <A.B.C.D|X:X::X:X|WORD> route-map WORD <in|out>",
5768 NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2
5769 "Apply route map to neighbor\n"
5770 "Name of route map\n"
5771 "Apply map to incoming routes\n"
5772 "Apply map to outbound routes\n")
5774 /* Set unsuppress-map to the peer. */
5775 static int peer_unsuppress_map_set_vty(struct vty
*vty
, const char *ip_str
,
5776 afi_t afi
, safi_t safi
,
5777 const char *name_str
)
5781 struct route_map
*route_map
;
5783 peer
= peer_and_group_lookup_vty(vty
, ip_str
);
5785 return CMD_WARNING_CONFIG_FAILED
;
5787 route_map
= route_map_lookup_warn_noexist(vty
, name_str
);
5788 ret
= peer_unsuppress_map_set(peer
, afi
, safi
, name_str
, route_map
);
5790 return bgp_vty_return(vty
, ret
);
5793 /* Unset route-map from the peer. */
5794 static int peer_unsuppress_map_unset_vty(struct vty
*vty
, const char *ip_str
,
5795 afi_t afi
, safi_t safi
)
5800 peer
= peer_and_group_lookup_vty(vty
, ip_str
);
5802 return CMD_WARNING_CONFIG_FAILED
;
5804 ret
= peer_unsuppress_map_unset(peer
, afi
, safi
);
5806 return bgp_vty_return(vty
, ret
);
5809 DEFUN (neighbor_unsuppress_map
,
5810 neighbor_unsuppress_map_cmd
,
5811 "neighbor <A.B.C.D|X:X::X:X|WORD> unsuppress-map WORD",
5814 "Route-map to selectively unsuppress suppressed routes\n"
5815 "Name of route map\n")
5819 return peer_unsuppress_map_set_vty(
5820 vty
, argv
[idx_peer
]->arg
, bgp_node_afi(vty
), bgp_node_safi(vty
),
5821 argv
[idx_word
]->arg
);
5824 ALIAS_HIDDEN(neighbor_unsuppress_map
, neighbor_unsuppress_map_hidden_cmd
,
5825 "neighbor <A.B.C.D|X:X::X:X|WORD> unsuppress-map WORD",
5826 NEIGHBOR_STR NEIGHBOR_ADDR_STR2
5827 "Route-map to selectively unsuppress suppressed routes\n"
5828 "Name of route map\n")
5830 DEFUN (no_neighbor_unsuppress_map
,
5831 no_neighbor_unsuppress_map_cmd
,
5832 "no neighbor <A.B.C.D|X:X::X:X|WORD> unsuppress-map WORD",
5836 "Route-map to selectively unsuppress suppressed routes\n"
5837 "Name of route map\n")
5840 return peer_unsuppress_map_unset_vty(vty
, argv
[idx_peer
]->arg
,
5842 bgp_node_safi(vty
));
5845 ALIAS_HIDDEN(no_neighbor_unsuppress_map
, no_neighbor_unsuppress_map_hidden_cmd
,
5846 "no neighbor <A.B.C.D|X:X::X:X|WORD> unsuppress-map WORD",
5847 NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2
5848 "Route-map to selectively unsuppress suppressed routes\n"
5849 "Name of route map\n")
5851 static int peer_maximum_prefix_set_vty(struct vty
*vty
, const char *ip_str
,
5852 afi_t afi
, safi_t safi
,
5853 const char *num_str
,
5854 const char *threshold_str
, int warning
,
5855 const char *restart_str
)
5863 peer
= peer_and_group_lookup_vty(vty
, ip_str
);
5865 return CMD_WARNING_CONFIG_FAILED
;
5867 max
= strtoul(num_str
, NULL
, 10);
5869 threshold
= atoi(threshold_str
);
5871 threshold
= MAXIMUM_PREFIX_THRESHOLD_DEFAULT
;
5874 restart
= atoi(restart_str
);
5878 ret
= peer_maximum_prefix_set(peer
, afi
, safi
, max
, threshold
, warning
,
5881 return bgp_vty_return(vty
, ret
);
5884 static int peer_maximum_prefix_unset_vty(struct vty
*vty
, const char *ip_str
,
5885 afi_t afi
, safi_t safi
)
5890 peer
= peer_and_group_lookup_vty(vty
, ip_str
);
5892 return CMD_WARNING_CONFIG_FAILED
;
5894 ret
= peer_maximum_prefix_unset(peer
, afi
, safi
);
5896 return bgp_vty_return(vty
, ret
);
5899 /* Maximum number of prefix configuration. prefix count is different
5900 for each peer configuration. So this configuration can be set for
5901 each peer configuration. */
5902 DEFUN (neighbor_maximum_prefix
,
5903 neighbor_maximum_prefix_cmd
,
5904 "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295)",
5907 "Maximum number of prefix accept from this peer\n"
5908 "maximum no. of prefix limit\n")
5912 return peer_maximum_prefix_set_vty(
5913 vty
, argv
[idx_peer
]->arg
, bgp_node_afi(vty
), bgp_node_safi(vty
),
5914 argv
[idx_number
]->arg
, NULL
, 0, NULL
);
5917 ALIAS_HIDDEN(neighbor_maximum_prefix
, neighbor_maximum_prefix_hidden_cmd
,
5918 "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295)",
5919 NEIGHBOR_STR NEIGHBOR_ADDR_STR2
5920 "Maximum number of prefix accept from this peer\n"
5921 "maximum no. of prefix limit\n")
5923 DEFUN (neighbor_maximum_prefix_threshold
,
5924 neighbor_maximum_prefix_threshold_cmd
,
5925 "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295) (1-100)",
5928 "Maximum number of prefix accept from this peer\n"
5929 "maximum no. of prefix limit\n"
5930 "Threshold value (%) at which to generate a warning msg\n")
5934 int idx_number_2
= 4;
5935 return peer_maximum_prefix_set_vty(
5936 vty
, argv
[idx_peer
]->arg
, bgp_node_afi(vty
), bgp_node_safi(vty
),
5937 argv
[idx_number
]->arg
, argv
[idx_number_2
]->arg
, 0, NULL
);
5941 neighbor_maximum_prefix_threshold
,
5942 neighbor_maximum_prefix_threshold_hidden_cmd
,
5943 "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295) (1-100)",
5944 NEIGHBOR_STR NEIGHBOR_ADDR_STR2
5945 "Maximum number of prefix accept from this peer\n"
5946 "maximum no. of prefix limit\n"
5947 "Threshold value (%) at which to generate a warning msg\n")
5949 DEFUN (neighbor_maximum_prefix_warning
,
5950 neighbor_maximum_prefix_warning_cmd
,
5951 "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295) warning-only",
5954 "Maximum number of prefix accept from this peer\n"
5955 "maximum no. of prefix limit\n"
5956 "Only give warning message when limit is exceeded\n")
5960 return peer_maximum_prefix_set_vty(
5961 vty
, argv
[idx_peer
]->arg
, bgp_node_afi(vty
), bgp_node_safi(vty
),
5962 argv
[idx_number
]->arg
, NULL
, 1, NULL
);
5966 neighbor_maximum_prefix_warning
,
5967 neighbor_maximum_prefix_warning_hidden_cmd
,
5968 "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295) warning-only",
5969 NEIGHBOR_STR NEIGHBOR_ADDR_STR2
5970 "Maximum number of prefix accept from this peer\n"
5971 "maximum no. of prefix limit\n"
5972 "Only give warning message when limit is exceeded\n")
5974 DEFUN (neighbor_maximum_prefix_threshold_warning
,
5975 neighbor_maximum_prefix_threshold_warning_cmd
,
5976 "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295) (1-100) warning-only",
5979 "Maximum number of prefix accept from this peer\n"
5980 "maximum no. of prefix limit\n"
5981 "Threshold value (%) at which to generate a warning msg\n"
5982 "Only give warning message when limit is exceeded\n")
5986 int idx_number_2
= 4;
5987 return peer_maximum_prefix_set_vty(
5988 vty
, argv
[idx_peer
]->arg
, bgp_node_afi(vty
), bgp_node_safi(vty
),
5989 argv
[idx_number
]->arg
, argv
[idx_number_2
]->arg
, 1, NULL
);
5993 neighbor_maximum_prefix_threshold_warning
,
5994 neighbor_maximum_prefix_threshold_warning_hidden_cmd
,
5995 "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295) (1-100) warning-only",
5996 NEIGHBOR_STR NEIGHBOR_ADDR_STR2
5997 "Maximum number of prefix accept from this peer\n"
5998 "maximum no. of prefix limit\n"
5999 "Threshold value (%) at which to generate a warning msg\n"
6000 "Only give warning message when limit is exceeded\n")
6002 DEFUN (neighbor_maximum_prefix_restart
,
6003 neighbor_maximum_prefix_restart_cmd
,
6004 "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295) restart (1-65535)",
6007 "Maximum number of prefix accept from this peer\n"
6008 "maximum no. of prefix limit\n"
6009 "Restart bgp connection after limit is exceeded\n"
6010 "Restart interval in minutes\n")
6014 int idx_number_2
= 5;
6015 return peer_maximum_prefix_set_vty(
6016 vty
, argv
[idx_peer
]->arg
, bgp_node_afi(vty
), bgp_node_safi(vty
),
6017 argv
[idx_number
]->arg
, NULL
, 0, argv
[idx_number_2
]->arg
);
6021 neighbor_maximum_prefix_restart
,
6022 neighbor_maximum_prefix_restart_hidden_cmd
,
6023 "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295) restart (1-65535)",
6024 NEIGHBOR_STR NEIGHBOR_ADDR_STR2
6025 "Maximum number of prefix accept from this peer\n"
6026 "maximum no. of prefix limit\n"
6027 "Restart bgp connection after limit is exceeded\n"
6028 "Restart interval in minutes\n")
6030 DEFUN (neighbor_maximum_prefix_threshold_restart
,
6031 neighbor_maximum_prefix_threshold_restart_cmd
,
6032 "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295) (1-100) restart (1-65535)",
6035 "Maximum number of prefixes to accept from this peer\n"
6036 "maximum no. of prefix limit\n"
6037 "Threshold value (%) at which to generate a warning msg\n"
6038 "Restart bgp connection after limit is exceeded\n"
6039 "Restart interval in minutes\n")
6043 int idx_number_2
= 4;
6044 int idx_number_3
= 6;
6045 return peer_maximum_prefix_set_vty(
6046 vty
, argv
[idx_peer
]->arg
, bgp_node_afi(vty
), bgp_node_safi(vty
),
6047 argv
[idx_number
]->arg
, argv
[idx_number_2
]->arg
, 0,
6048 argv
[idx_number_3
]->arg
);
6052 neighbor_maximum_prefix_threshold_restart
,
6053 neighbor_maximum_prefix_threshold_restart_hidden_cmd
,
6054 "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295) (1-100) restart (1-65535)",
6055 NEIGHBOR_STR NEIGHBOR_ADDR_STR2
6056 "Maximum number of prefixes to accept from this peer\n"
6057 "maximum no. of prefix limit\n"
6058 "Threshold value (%) at which to generate a warning msg\n"
6059 "Restart bgp connection after limit is exceeded\n"
6060 "Restart interval in minutes\n")
6062 DEFUN (no_neighbor_maximum_prefix
,
6063 no_neighbor_maximum_prefix_cmd
,
6064 "no neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix [(1-4294967295) [(1-100)] [restart (1-65535)] [warning-only]]",
6068 "Maximum number of prefixes to accept from this peer\n"
6069 "maximum no. of prefix limit\n"
6070 "Threshold value (%) at which to generate a warning msg\n"
6071 "Restart bgp connection after limit is exceeded\n"
6072 "Restart interval in minutes\n"
6073 "Only give warning message when limit is exceeded\n")
6076 return peer_maximum_prefix_unset_vty(vty
, argv
[idx_peer
]->arg
,
6078 bgp_node_safi(vty
));
6082 no_neighbor_maximum_prefix
, no_neighbor_maximum_prefix_hidden_cmd
,
6083 "no neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix [(1-4294967295) [(1-100)] [restart (1-65535)] [warning-only]]",
6084 NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2
6085 "Maximum number of prefixes to accept from this peer\n"
6086 "maximum no. of prefix limit\n"
6087 "Threshold value (%) at which to generate a warning msg\n"
6088 "Restart bgp connection after limit is exceeded\n"
6089 "Restart interval in minutes\n"
6090 "Only give warning message when limit is exceeded\n")
6093 /* "neighbor allowas-in" */
6094 DEFUN (neighbor_allowas_in
,
6095 neighbor_allowas_in_cmd
,
6096 "neighbor <A.B.C.D|X:X::X:X|WORD> allowas-in [<(1-10)|origin>]",
6099 "Accept as-path with my AS present in it\n"
6100 "Number of occurences of AS number\n"
6101 "Only accept my AS in the as-path if the route was originated in my AS\n")
6104 int idx_number_origin
= 3;
6110 peer
= peer_and_group_lookup_vty(vty
, argv
[idx_peer
]->arg
);
6112 return CMD_WARNING_CONFIG_FAILED
;
6114 if (argc
<= idx_number_origin
)
6117 if (argv
[idx_number_origin
]->type
== WORD_TKN
)
6120 allow_num
= atoi(argv
[idx_number_origin
]->arg
);
6123 ret
= peer_allowas_in_set(peer
, bgp_node_afi(vty
), bgp_node_safi(vty
),
6126 return bgp_vty_return(vty
, ret
);
6130 neighbor_allowas_in
, neighbor_allowas_in_hidden_cmd
,
6131 "neighbor <A.B.C.D|X:X::X:X|WORD> allowas-in [<(1-10)|origin>]",
6132 NEIGHBOR_STR NEIGHBOR_ADDR_STR2
6133 "Accept as-path with my AS present in it\n"
6134 "Number of occurences of AS number\n"
6135 "Only accept my AS in the as-path if the route was originated in my AS\n")
6137 DEFUN (no_neighbor_allowas_in
,
6138 no_neighbor_allowas_in_cmd
,
6139 "no neighbor <A.B.C.D|X:X::X:X|WORD> allowas-in [<(1-10)|origin>]",
6143 "allow local ASN appears in aspath attribute\n"
6144 "Number of occurences of AS number\n"
6145 "Only accept my AS in the as-path if the route was originated in my AS\n")
6151 peer
= peer_and_group_lookup_vty(vty
, argv
[idx_peer
]->arg
);
6153 return CMD_WARNING_CONFIG_FAILED
;
6155 ret
= peer_allowas_in_unset(peer
, bgp_node_afi(vty
),
6156 bgp_node_safi(vty
));
6158 return bgp_vty_return(vty
, ret
);
6162 no_neighbor_allowas_in
, no_neighbor_allowas_in_hidden_cmd
,
6163 "no neighbor <A.B.C.D|X:X::X:X|WORD> allowas-in [<(1-10)|origin>]",
6164 NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2
6165 "allow local ASN appears in aspath attribute\n"
6166 "Number of occurences of AS number\n"
6167 "Only accept my AS in the as-path if the route was originated in my AS\n")
6169 DEFUN (neighbor_ttl_security
,
6170 neighbor_ttl_security_cmd
,
6171 "neighbor <A.B.C.D|X:X::X:X|WORD> ttl-security hops (1-254)",
6174 "BGP ttl-security parameters\n"
6175 "Specify the maximum number of hops to the BGP peer\n"
6176 "Number of hops to BGP peer\n")
6183 peer
= peer_and_group_lookup_vty(vty
, argv
[idx_peer
]->arg
);
6185 return CMD_WARNING_CONFIG_FAILED
;
6187 gtsm_hops
= strtoul(argv
[idx_number
]->arg
, NULL
, 10);
6190 * If 'neighbor swpX', then this is for directly connected peers,
6191 * we should not accept a ttl-security hops value greater than 1.
6193 if (peer
->conf_if
&& (gtsm_hops
> 1)) {
6195 "%s is directly connected peer, hops cannot exceed 1\n",
6196 argv
[idx_peer
]->arg
);
6197 return CMD_WARNING_CONFIG_FAILED
;
6200 return bgp_vty_return(vty
, peer_ttl_security_hops_set(peer
, gtsm_hops
));
6203 DEFUN (no_neighbor_ttl_security
,
6204 no_neighbor_ttl_security_cmd
,
6205 "no neighbor <A.B.C.D|X:X::X:X|WORD> ttl-security hops (1-254)",
6209 "BGP ttl-security parameters\n"
6210 "Specify the maximum number of hops to the BGP peer\n"
6211 "Number of hops to BGP peer\n")
6216 peer
= peer_and_group_lookup_vty(vty
, argv
[idx_peer
]->arg
);
6218 return CMD_WARNING_CONFIG_FAILED
;
6220 return bgp_vty_return(vty
, peer_ttl_security_hops_unset(peer
));
6223 DEFUN (neighbor_addpath_tx_all_paths
,
6224 neighbor_addpath_tx_all_paths_cmd
,
6225 "neighbor <A.B.C.D|X:X::X:X|WORD> addpath-tx-all-paths",
6228 "Use addpath to advertise all paths to a neighbor\n")
6233 peer
= peer_and_group_lookup_vty(vty
, argv
[idx_peer
]->arg
);
6235 return CMD_WARNING_CONFIG_FAILED
;
6237 bgp_addpath_set_peer_type(peer
, bgp_node_afi(vty
), bgp_node_safi(vty
),
6242 ALIAS_HIDDEN(neighbor_addpath_tx_all_paths
,
6243 neighbor_addpath_tx_all_paths_hidden_cmd
,
6244 "neighbor <A.B.C.D|X:X::X:X|WORD> addpath-tx-all-paths",
6245 NEIGHBOR_STR NEIGHBOR_ADDR_STR2
6246 "Use addpath to advertise all paths to a neighbor\n")
6248 DEFUN (no_neighbor_addpath_tx_all_paths
,
6249 no_neighbor_addpath_tx_all_paths_cmd
,
6250 "no neighbor <A.B.C.D|X:X::X:X|WORD> addpath-tx-all-paths",
6254 "Use addpath to advertise all paths to a neighbor\n")
6259 peer
= peer_and_group_lookup_vty(vty
, argv
[idx_peer
]->arg
);
6261 return CMD_WARNING_CONFIG_FAILED
;
6263 if (peer
->addpath_type
[bgp_node_afi(vty
)][bgp_node_safi(vty
)]
6264 != BGP_ADDPATH_ALL
) {
6266 "%% Peer not currently configured to transmit all paths.");
6267 return CMD_WARNING_CONFIG_FAILED
;
6270 bgp_addpath_set_peer_type(peer
, bgp_node_afi(vty
), bgp_node_safi(vty
),
6276 ALIAS_HIDDEN(no_neighbor_addpath_tx_all_paths
,
6277 no_neighbor_addpath_tx_all_paths_hidden_cmd
,
6278 "no neighbor <A.B.C.D|X:X::X:X|WORD> addpath-tx-all-paths",
6279 NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2
6280 "Use addpath to advertise all paths to a neighbor\n")
6282 DEFUN (neighbor_addpath_tx_bestpath_per_as
,
6283 neighbor_addpath_tx_bestpath_per_as_cmd
,
6284 "neighbor <A.B.C.D|X:X::X:X|WORD> addpath-tx-bestpath-per-AS",
6287 "Use addpath to advertise the bestpath per each neighboring AS\n")
6292 peer
= peer_and_group_lookup_vty(vty
, argv
[idx_peer
]->arg
);
6294 return CMD_WARNING_CONFIG_FAILED
;
6296 bgp_addpath_set_peer_type(peer
, bgp_node_afi(vty
), bgp_node_safi(vty
),
6297 BGP_ADDPATH_BEST_PER_AS
);
6302 ALIAS_HIDDEN(neighbor_addpath_tx_bestpath_per_as
,
6303 neighbor_addpath_tx_bestpath_per_as_hidden_cmd
,
6304 "neighbor <A.B.C.D|X:X::X:X|WORD> addpath-tx-bestpath-per-AS",
6305 NEIGHBOR_STR NEIGHBOR_ADDR_STR2
6306 "Use addpath to advertise the bestpath per each neighboring AS\n")
6308 DEFUN (no_neighbor_addpath_tx_bestpath_per_as
,
6309 no_neighbor_addpath_tx_bestpath_per_as_cmd
,
6310 "no neighbor <A.B.C.D|X:X::X:X|WORD> addpath-tx-bestpath-per-AS",
6314 "Use addpath to advertise the bestpath per each neighboring AS\n")
6319 peer
= peer_and_group_lookup_vty(vty
, argv
[idx_peer
]->arg
);
6321 return CMD_WARNING_CONFIG_FAILED
;
6323 if (peer
->addpath_type
[bgp_node_afi(vty
)][bgp_node_safi(vty
)]
6324 != BGP_ADDPATH_BEST_PER_AS
) {
6326 "%% Peer not currently configured to transmit all best path per as.");
6327 return CMD_WARNING_CONFIG_FAILED
;
6330 bgp_addpath_set_peer_type(peer
, bgp_node_afi(vty
), bgp_node_safi(vty
),
6336 ALIAS_HIDDEN(no_neighbor_addpath_tx_bestpath_per_as
,
6337 no_neighbor_addpath_tx_bestpath_per_as_hidden_cmd
,
6338 "no neighbor <A.B.C.D|X:X::X:X|WORD> addpath-tx-bestpath-per-AS",
6339 NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2
6340 "Use addpath to advertise the bestpath per each neighboring AS\n")
6342 static int set_ecom_list(struct vty
*vty
, int argc
, struct cmd_token
**argv
,
6343 struct ecommunity
**list
)
6345 struct ecommunity
*ecom
= NULL
;
6346 struct ecommunity
*ecomadd
;
6348 for (; argc
; --argc
, ++argv
) {
6350 ecomadd
= ecommunity_str2com(argv
[0]->arg
,
6351 ECOMMUNITY_ROUTE_TARGET
, 0);
6353 vty_out(vty
, "Malformed community-list value\n");
6355 ecommunity_free(&ecom
);
6356 return CMD_WARNING_CONFIG_FAILED
;
6360 ecommunity_merge(ecom
, ecomadd
);
6361 ecommunity_free(&ecomadd
);
6368 ecommunity_free(&*list
);
6376 * v2vimport is true if we are handling a `import vrf ...` command
6378 static afi_t
vpn_policy_getafi(struct vty
*vty
, struct bgp
*bgp
, bool v2vimport
)
6382 switch (vty
->node
) {
6391 "%% context error: valid only in address-family <ipv4|ipv6> unicast block\n");
6396 if (CHECK_FLAG(bgp
->af_flags
[afi
][SAFI_UNICAST
],
6397 BGP_CONFIG_VRF_TO_VRF_IMPORT
)
6398 || CHECK_FLAG(bgp
->af_flags
[afi
][SAFI_UNICAST
],
6399 BGP_CONFIG_VRF_TO_VRF_EXPORT
)) {
6401 "%% error: Please unconfigure import vrf commands before using vpn commands\n");
6405 if (CHECK_FLAG(bgp
->af_flags
[afi
][SAFI_UNICAST
],
6406 BGP_CONFIG_VRF_TO_MPLSVPN_EXPORT
)
6407 || CHECK_FLAG(bgp
->af_flags
[afi
][SAFI_UNICAST
],
6408 BGP_CONFIG_MPLSVPN_TO_VRF_IMPORT
)) {
6410 "%% error: Please unconfigure vpn to vrf commands before using import vrf commands\n");
6417 DEFPY (af_rd_vpn_export
,
6418 af_rd_vpn_export_cmd
,
6419 "[no] rd vpn export ASN:NN_OR_IP-ADDRESS:NN$rd_str",
6421 "Specify route distinguisher\n"
6422 "Between current address-family and vpn\n"
6423 "For routes leaked from current address-family to vpn\n"
6424 "Route Distinguisher (<as-number>:<number> | <ip-address>:<number>)\n")
6426 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
6427 struct prefix_rd prd
;
6433 if (argv_find(argv
, argc
, "no", &idx
))
6437 ret
= str2prefix_rd(rd_str
, &prd
);
6439 vty_out(vty
, "%% Malformed rd\n");
6440 return CMD_WARNING_CONFIG_FAILED
;
6444 afi
= vpn_policy_getafi(vty
, bgp
, false);
6446 return CMD_WARNING_CONFIG_FAILED
;
6449 * pre-change: un-export vpn routes (vpn->vrf routes unaffected)
6451 vpn_leak_prechange(BGP_VPN_POLICY_DIR_TOVPN
, afi
,
6452 bgp_get_default(), bgp
);
6455 bgp
->vpn_policy
[afi
].tovpn_rd
= prd
;
6456 SET_FLAG(bgp
->vpn_policy
[afi
].flags
,
6457 BGP_VPN_POLICY_TOVPN_RD_SET
);
6459 UNSET_FLAG(bgp
->vpn_policy
[afi
].flags
,
6460 BGP_VPN_POLICY_TOVPN_RD_SET
);
6463 /* post-change: re-export vpn routes */
6464 vpn_leak_postchange(BGP_VPN_POLICY_DIR_TOVPN
, afi
,
6465 bgp_get_default(), bgp
);
6470 ALIAS (af_rd_vpn_export
,
6471 af_no_rd_vpn_export_cmd
,
6474 "Specify route distinguisher\n"
6475 "Between current address-family and vpn\n"
6476 "For routes leaked from current address-family to vpn\n")
6478 DEFPY (af_label_vpn_export
,
6479 af_label_vpn_export_cmd
,
6480 "[no] label vpn export <(0-1048575)$label_val|auto$label_auto>",
6482 "label value for VRF\n"
6483 "Between current address-family and vpn\n"
6484 "For routes leaked from current address-family to vpn\n"
6485 "Label Value <0-1048575>\n"
6486 "Automatically assign a label\n")
6488 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
6489 mpls_label_t label
= MPLS_LABEL_NONE
;
6494 if (argv_find(argv
, argc
, "no", &idx
))
6497 /* If "no ...", squash trailing parameter */
6503 label
= label_val
; /* parser should force unsigned */
6506 afi
= vpn_policy_getafi(vty
, bgp
, false);
6508 return CMD_WARNING_CONFIG_FAILED
;
6511 if (label_auto
&& CHECK_FLAG(bgp
->vpn_policy
[afi
].flags
,
6512 BGP_VPN_POLICY_TOVPN_LABEL_AUTO
))
6517 * pre-change: un-export vpn routes (vpn->vrf routes unaffected)
6519 vpn_leak_prechange(BGP_VPN_POLICY_DIR_TOVPN
, afi
,
6520 bgp_get_default(), bgp
);
6522 if (!label_auto
&& CHECK_FLAG(bgp
->vpn_policy
[afi
].flags
,
6523 BGP_VPN_POLICY_TOVPN_LABEL_AUTO
)) {
6525 if (bgp
->vpn_policy
[afi
].tovpn_label
!= MPLS_LABEL_NONE
) {
6528 * label has previously been automatically
6529 * assigned by labelpool: release it
6531 * NB if tovpn_label == MPLS_LABEL_NONE it
6532 * means the automatic assignment is in flight
6533 * and therefore the labelpool callback must
6534 * detect that the auto label is not needed.
6537 bgp_lp_release(LP_TYPE_VRF
,
6538 &bgp
->vpn_policy
[afi
],
6539 bgp
->vpn_policy
[afi
].tovpn_label
);
6541 UNSET_FLAG(bgp
->vpn_policy
[afi
].flags
,
6542 BGP_VPN_POLICY_TOVPN_LABEL_AUTO
);
6545 bgp
->vpn_policy
[afi
].tovpn_label
= label
;
6547 SET_FLAG(bgp
->vpn_policy
[afi
].flags
,
6548 BGP_VPN_POLICY_TOVPN_LABEL_AUTO
);
6549 bgp_lp_get(LP_TYPE_VRF
, &bgp
->vpn_policy
[afi
],
6550 vpn_leak_label_callback
);
6553 /* post-change: re-export vpn routes */
6554 vpn_leak_postchange(BGP_VPN_POLICY_DIR_TOVPN
, afi
,
6555 bgp_get_default(), bgp
);
6560 ALIAS (af_label_vpn_export
,
6561 af_no_label_vpn_export_cmd
,
6562 "no label vpn export",
6564 "label value for VRF\n"
6565 "Between current address-family and vpn\n"
6566 "For routes leaked from current address-family to vpn\n")
6568 DEFPY (af_nexthop_vpn_export
,
6569 af_nexthop_vpn_export_cmd
,
6570 "[no] nexthop vpn export <A.B.C.D|X:X::X:X>$nexthop_str",
6572 "Specify next hop to use for VRF advertised prefixes\n"
6573 "Between current address-family and vpn\n"
6574 "For routes leaked from current address-family to vpn\n"
6578 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
6584 if (argv_find(argv
, argc
, "no", &idx
))
6588 if (!sockunion2hostprefix(nexthop_str
, &p
))
6589 return CMD_WARNING_CONFIG_FAILED
;
6592 afi
= vpn_policy_getafi(vty
, bgp
, false);
6594 return CMD_WARNING_CONFIG_FAILED
;
6597 * pre-change: un-export vpn routes (vpn->vrf routes unaffected)
6599 vpn_leak_prechange(BGP_VPN_POLICY_DIR_TOVPN
, afi
,
6600 bgp_get_default(), bgp
);
6603 bgp
->vpn_policy
[afi
].tovpn_nexthop
= p
;
6604 SET_FLAG(bgp
->vpn_policy
[afi
].flags
,
6605 BGP_VPN_POLICY_TOVPN_NEXTHOP_SET
);
6607 UNSET_FLAG(bgp
->vpn_policy
[afi
].flags
,
6608 BGP_VPN_POLICY_TOVPN_NEXTHOP_SET
);
6611 /* post-change: re-export vpn routes */
6612 vpn_leak_postchange(BGP_VPN_POLICY_DIR_TOVPN
, afi
,
6613 bgp_get_default(), bgp
);
6618 ALIAS (af_nexthop_vpn_export
,
6619 af_no_nexthop_vpn_export_cmd
,
6620 "no nexthop vpn export",
6622 "Specify next hop to use for VRF advertised prefixes\n"
6623 "Between current address-family and vpn\n"
6624 "For routes leaked from current address-family to vpn\n")
6626 static int vpn_policy_getdirs(struct vty
*vty
, const char *dstr
, int *dodir
)
6628 if (!strcmp(dstr
, "import")) {
6629 dodir
[BGP_VPN_POLICY_DIR_FROMVPN
] = 1;
6630 } else if (!strcmp(dstr
, "export")) {
6631 dodir
[BGP_VPN_POLICY_DIR_TOVPN
] = 1;
6632 } else if (!strcmp(dstr
, "both")) {
6633 dodir
[BGP_VPN_POLICY_DIR_FROMVPN
] = 1;
6634 dodir
[BGP_VPN_POLICY_DIR_TOVPN
] = 1;
6636 vty_out(vty
, "%% direction parse error\n");
6637 return CMD_WARNING_CONFIG_FAILED
;
6642 DEFPY (af_rt_vpn_imexport
,
6643 af_rt_vpn_imexport_cmd
,
6644 "[no] <rt|route-target> vpn <import|export|both>$direction_str RTLIST...",
6646 "Specify route target list\n"
6647 "Specify route target list\n"
6648 "Between current address-family and vpn\n"
6649 "For routes leaked from vpn to current address-family: match any\n"
6650 "For routes leaked from current address-family to vpn: set\n"
6651 "both import: match any and export: set\n"
6652 "Space separated route target list (A.B.C.D:MN|EF:OPQR|GHJK:MN)\n")
6654 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
6656 struct ecommunity
*ecom
= NULL
;
6657 int dodir
[BGP_VPN_POLICY_DIR_MAX
] = {0};
6658 vpn_policy_direction_t dir
;
6663 if (argv_find(argv
, argc
, "no", &idx
))
6666 afi
= vpn_policy_getafi(vty
, bgp
, false);
6668 return CMD_WARNING_CONFIG_FAILED
;
6670 ret
= vpn_policy_getdirs(vty
, direction_str
, dodir
);
6671 if (ret
!= CMD_SUCCESS
)
6675 if (!argv_find(argv
, argc
, "RTLIST", &idx
)) {
6676 vty_out(vty
, "%% Missing RTLIST\n");
6677 return CMD_WARNING_CONFIG_FAILED
;
6679 ret
= set_ecom_list(vty
, argc
- idx
, argv
+ idx
, &ecom
);
6680 if (ret
!= CMD_SUCCESS
) {
6685 for (dir
= 0; dir
< BGP_VPN_POLICY_DIR_MAX
; ++dir
) {
6689 vpn_leak_prechange(dir
, afi
, bgp_get_default(), bgp
);
6692 if (bgp
->vpn_policy
[afi
].rtlist
[dir
])
6694 &bgp
->vpn_policy
[afi
].rtlist
[dir
]);
6695 bgp
->vpn_policy
[afi
].rtlist
[dir
] =
6696 ecommunity_dup(ecom
);
6698 if (bgp
->vpn_policy
[afi
].rtlist
[dir
])
6700 &bgp
->vpn_policy
[afi
].rtlist
[dir
]);
6701 bgp
->vpn_policy
[afi
].rtlist
[dir
] = NULL
;
6704 vpn_leak_postchange(dir
, afi
, bgp_get_default(), bgp
);
6708 ecommunity_free(&ecom
);
6713 ALIAS (af_rt_vpn_imexport
,
6714 af_no_rt_vpn_imexport_cmd
,
6715 "no <rt|route-target> vpn <import|export|both>$direction_str",
6717 "Specify route target list\n"
6718 "Specify route target list\n"
6719 "Between current address-family and vpn\n"
6720 "For routes leaked from vpn to current address-family\n"
6721 "For routes leaked from current address-family to vpn\n"
6722 "both import and export\n")
6724 DEFPY (af_route_map_vpn_imexport
,
6725 af_route_map_vpn_imexport_cmd
,
6726 /* future: "route-map <vpn|evpn|vrf NAME> <import|export> RMAP" */
6727 "[no] route-map vpn <import|export>$direction_str RMAP$rmap_str",
6729 "Specify route map\n"
6730 "Between current address-family and vpn\n"
6731 "For routes leaked from vpn to current address-family\n"
6732 "For routes leaked from current address-family to vpn\n"
6733 "name of route-map\n")
6735 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
6737 int dodir
[BGP_VPN_POLICY_DIR_MAX
] = {0};
6738 vpn_policy_direction_t dir
;
6743 if (argv_find(argv
, argc
, "no", &idx
))
6746 afi
= vpn_policy_getafi(vty
, bgp
, false);
6748 return CMD_WARNING_CONFIG_FAILED
;
6750 ret
= vpn_policy_getdirs(vty
, direction_str
, dodir
);
6751 if (ret
!= CMD_SUCCESS
)
6754 for (dir
= 0; dir
< BGP_VPN_POLICY_DIR_MAX
; ++dir
) {
6758 vpn_leak_prechange(dir
, afi
, bgp_get_default(), bgp
);
6761 if (bgp
->vpn_policy
[afi
].rmap_name
[dir
])
6762 XFREE(MTYPE_ROUTE_MAP_NAME
,
6763 bgp
->vpn_policy
[afi
].rmap_name
[dir
]);
6764 bgp
->vpn_policy
[afi
].rmap_name
[dir
] = XSTRDUP(
6765 MTYPE_ROUTE_MAP_NAME
, rmap_str
);
6766 bgp
->vpn_policy
[afi
].rmap
[dir
] =
6767 route_map_lookup_warn_noexist(vty
, rmap_str
);
6768 if (!bgp
->vpn_policy
[afi
].rmap
[dir
])
6771 if (bgp
->vpn_policy
[afi
].rmap_name
[dir
])
6772 XFREE(MTYPE_ROUTE_MAP_NAME
,
6773 bgp
->vpn_policy
[afi
].rmap_name
[dir
]);
6774 bgp
->vpn_policy
[afi
].rmap_name
[dir
] = NULL
;
6775 bgp
->vpn_policy
[afi
].rmap
[dir
] = NULL
;
6778 vpn_leak_postchange(dir
, afi
, bgp_get_default(), bgp
);
6784 ALIAS (af_route_map_vpn_imexport
,
6785 af_no_route_map_vpn_imexport_cmd
,
6786 "no route-map vpn <import|export>$direction_str",
6788 "Specify route map\n"
6789 "Between current address-family and vpn\n"
6790 "For routes leaked from vpn to current address-family\n"
6791 "For routes leaked from current address-family to vpn\n")
6793 DEFPY(af_import_vrf_route_map
, af_import_vrf_route_map_cmd
,
6794 "[no] import vrf route-map RMAP$rmap_str",
6796 "Import routes from another VRF\n"
6797 "Vrf routes being filtered\n"
6798 "Specify route map\n"
6799 "name of route-map\n")
6801 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
6802 vpn_policy_direction_t dir
= BGP_VPN_POLICY_DIR_FROMVPN
;
6806 struct bgp
*bgp_default
;
6808 if (argv_find(argv
, argc
, "no", &idx
))
6811 afi
= vpn_policy_getafi(vty
, bgp
, true);
6813 return CMD_WARNING_CONFIG_FAILED
;
6815 bgp_default
= bgp_get_default();
6820 /* Auto-create assuming the same AS */
6821 ret
= bgp_get(&bgp_default
, &as
, NULL
,
6822 BGP_INSTANCE_TYPE_DEFAULT
);
6826 "VRF default is not configured as a bgp instance\n");
6831 vpn_leak_prechange(dir
, afi
, bgp_get_default(), bgp
);
6834 if (bgp
->vpn_policy
[afi
].rmap_name
[dir
])
6835 XFREE(MTYPE_ROUTE_MAP_NAME
,
6836 bgp
->vpn_policy
[afi
].rmap_name
[dir
]);
6837 bgp
->vpn_policy
[afi
].rmap_name
[dir
] =
6838 XSTRDUP(MTYPE_ROUTE_MAP_NAME
, rmap_str
);
6839 bgp
->vpn_policy
[afi
].rmap
[dir
] =
6840 route_map_lookup_warn_noexist(vty
, rmap_str
);
6841 if (!bgp
->vpn_policy
[afi
].rmap
[dir
])
6844 if (bgp
->vpn_policy
[afi
].rmap_name
[dir
])
6845 XFREE(MTYPE_ROUTE_MAP_NAME
,
6846 bgp
->vpn_policy
[afi
].rmap_name
[dir
]);
6847 bgp
->vpn_policy
[afi
].rmap_name
[dir
] = NULL
;
6848 bgp
->vpn_policy
[afi
].rmap
[dir
] = NULL
;
6851 vpn_leak_postchange(dir
, afi
, bgp_get_default(), bgp
);
6856 ALIAS(af_import_vrf_route_map
, af_no_import_vrf_route_map_cmd
,
6857 "no import vrf route-map",
6859 "Import routes from another VRF\n"
6860 "Vrf routes being filtered\n"
6861 "Specify route map\n")
6863 DEFPY(bgp_imexport_vrf
, bgp_imexport_vrf_cmd
,
6864 "[no] import vrf VIEWVRFNAME$import_name",
6866 "Import routes from another VRF\n"
6867 "VRF to import from\n"
6868 "The name of the VRF\n")
6870 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
6871 struct listnode
*node
;
6872 struct bgp
*vrf_bgp
, *bgp_default
;
6875 bool remove
= false;
6878 enum bgp_instance_type bgp_type
= BGP_INSTANCE_TYPE_VRF
;
6882 if (import_name
== NULL
) {
6883 vty_out(vty
, "%% Missing import name\n");
6887 if (argv_find(argv
, argc
, "no", &idx
))
6890 afi
= vpn_policy_getafi(vty
, bgp
, true);
6892 return CMD_WARNING_CONFIG_FAILED
;
6894 safi
= bgp_node_safi(vty
);
6896 if (((BGP_INSTANCE_TYPE_DEFAULT
== bgp
->inst_type
)
6897 && (strcmp(import_name
, VRF_DEFAULT_NAME
) == 0))
6898 || (bgp
->name
&& (strcmp(import_name
, bgp
->name
) == 0))) {
6899 vty_out(vty
, "%% Cannot %s vrf %s into itself\n",
6900 remove
? "unimport" : "import", import_name
);
6904 bgp_default
= bgp_get_default();
6906 /* Auto-create assuming the same AS */
6907 ret
= bgp_get(&bgp_default
, &as
, NULL
,
6908 BGP_INSTANCE_TYPE_DEFAULT
);
6912 "VRF default is not configured as a bgp instance\n");
6917 vrf_bgp
= bgp_lookup_by_name(import_name
);
6919 if (strcmp(import_name
, VRF_DEFAULT_NAME
) == 0)
6920 vrf_bgp
= bgp_default
;
6922 /* Auto-create assuming the same AS */
6923 ret
= bgp_get(&vrf_bgp
, &as
, import_name
, bgp_type
);
6927 "VRF %s is not configured as a bgp instance\n",
6934 vrf_unimport_from_vrf(bgp
, vrf_bgp
, afi
, safi
);
6936 /* Already importing from "import_vrf"? */
6937 for (ALL_LIST_ELEMENTS_RO(bgp
->vpn_policy
[afi
].import_vrf
, node
,
6939 if (strcmp(vname
, import_name
) == 0)
6943 vrf_import_from_vrf(bgp
, vrf_bgp
, afi
, safi
);
6949 /* This command is valid only in a bgp vrf instance or the default instance */
6950 DEFPY (bgp_imexport_vpn
,
6951 bgp_imexport_vpn_cmd
,
6952 "[no] <import|export>$direction_str vpn",
6954 "Import routes to this address-family\n"
6955 "Export routes from this address-family\n"
6956 "to/from default instance VPN RIB\n")
6958 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
6965 vpn_policy_direction_t dir
;
6967 if (argv_find(argv
, argc
, "no", &idx
))
6970 if (BGP_INSTANCE_TYPE_VRF
!= bgp
->inst_type
&&
6971 BGP_INSTANCE_TYPE_DEFAULT
!= bgp
->inst_type
) {
6973 vty_out(vty
, "%% import|export vpn valid only for bgp vrf or default instance\n");
6974 return CMD_WARNING_CONFIG_FAILED
;
6977 afi
= bgp_node_afi(vty
);
6978 safi
= bgp_node_safi(vty
);
6979 if ((SAFI_UNICAST
!= safi
) || ((AFI_IP
!= afi
) && (AFI_IP6
!= afi
))) {
6980 vty_out(vty
, "%% import|export vpn valid only for unicast ipv4|ipv6\n");
6981 return CMD_WARNING_CONFIG_FAILED
;
6984 if (!strcmp(direction_str
, "import")) {
6985 flag
= BGP_CONFIG_MPLSVPN_TO_VRF_IMPORT
;
6986 dir
= BGP_VPN_POLICY_DIR_FROMVPN
;
6987 } else if (!strcmp(direction_str
, "export")) {
6988 flag
= BGP_CONFIG_VRF_TO_MPLSVPN_EXPORT
;
6989 dir
= BGP_VPN_POLICY_DIR_TOVPN
;
6991 vty_out(vty
, "%% unknown direction %s\n", direction_str
);
6992 return CMD_WARNING_CONFIG_FAILED
;
6995 previous_state
= CHECK_FLAG(bgp
->af_flags
[afi
][safi
], flag
);
6998 SET_FLAG(bgp
->af_flags
[afi
][safi
], flag
);
6999 if (!previous_state
) {
7000 /* trigger export current vrf */
7001 vpn_leak_postchange(dir
, afi
, bgp_get_default(), bgp
);
7004 if (previous_state
) {
7005 /* trigger un-export current vrf */
7006 vpn_leak_prechange(dir
, afi
, bgp_get_default(), bgp
);
7008 UNSET_FLAG(bgp
->af_flags
[afi
][safi
], flag
);
7014 DEFPY (af_routetarget_import
,
7015 af_routetarget_import_cmd
,
7016 "[no] <rt|route-target> redirect import RTLIST...",
7018 "Specify route target list\n"
7019 "Specify route target list\n"
7020 "Flow-spec redirect type route target\n"
7021 "Import routes to this address-family\n"
7022 "Space separated route target list (A.B.C.D:MN|EF:OPQR|GHJK:MN)\n")
7024 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
7026 struct ecommunity
*ecom
= NULL
;
7031 if (argv_find(argv
, argc
, "no", &idx
))
7034 afi
= vpn_policy_getafi(vty
, bgp
, false);
7036 return CMD_WARNING_CONFIG_FAILED
;
7039 if (!argv_find(argv
, argc
, "RTLIST", &idx
)) {
7040 vty_out(vty
, "%% Missing RTLIST\n");
7041 return CMD_WARNING_CONFIG_FAILED
;
7043 ret
= set_ecom_list(vty
, argc
- idx
, argv
+ idx
, &ecom
);
7044 if (ret
!= CMD_SUCCESS
)
7049 if (bgp
->vpn_policy
[afi
].import_redirect_rtlist
)
7050 ecommunity_free(&bgp
->vpn_policy
[afi
]
7051 .import_redirect_rtlist
);
7052 bgp
->vpn_policy
[afi
].import_redirect_rtlist
=
7053 ecommunity_dup(ecom
);
7055 if (bgp
->vpn_policy
[afi
].import_redirect_rtlist
)
7056 ecommunity_free(&bgp
->vpn_policy
[afi
]
7057 .import_redirect_rtlist
);
7058 bgp
->vpn_policy
[afi
].import_redirect_rtlist
= NULL
;
7062 ecommunity_free(&ecom
);
7067 DEFUN_NOSH (address_family_ipv4_safi
,
7068 address_family_ipv4_safi_cmd
,
7069 "address-family ipv4 [<unicast|multicast|vpn|labeled-unicast|flowspec>]",
7070 "Enter Address Family command mode\n"
7072 BGP_SAFI_WITH_LABEL_HELP_STR
)
7076 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
7077 safi_t safi
= bgp_vty_safi_from_str(argv
[2]->text
);
7078 if (bgp
->inst_type
!= BGP_INSTANCE_TYPE_DEFAULT
7079 && safi
!= SAFI_UNICAST
&& safi
!= SAFI_MULTICAST
7080 && safi
!= SAFI_EVPN
) {
7082 "Only Unicast/Multicast/EVPN SAFIs supported in non-core instances.\n");
7083 return CMD_WARNING_CONFIG_FAILED
;
7085 vty
->node
= bgp_node_type(AFI_IP
, safi
);
7087 vty
->node
= BGP_IPV4_NODE
;
7092 DEFUN_NOSH (address_family_ipv6_safi
,
7093 address_family_ipv6_safi_cmd
,
7094 "address-family ipv6 [<unicast|multicast|vpn|labeled-unicast|flowspec>]",
7095 "Enter Address Family command mode\n"
7097 BGP_SAFI_WITH_LABEL_HELP_STR
)
7100 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
7101 safi_t safi
= bgp_vty_safi_from_str(argv
[2]->text
);
7102 if (bgp
->inst_type
!= BGP_INSTANCE_TYPE_DEFAULT
7103 && safi
!= SAFI_UNICAST
&& safi
!= SAFI_MULTICAST
7104 && safi
!= SAFI_EVPN
) {
7106 "Only Unicast/Multicast/EVPN SAFIs supported in non-core instances.\n");
7107 return CMD_WARNING_CONFIG_FAILED
;
7109 vty
->node
= bgp_node_type(AFI_IP6
, safi
);
7111 vty
->node
= BGP_IPV6_NODE
;
7116 #ifdef KEEP_OLD_VPN_COMMANDS
7117 DEFUN_NOSH (address_family_vpnv4
,
7118 address_family_vpnv4_cmd
,
7119 "address-family vpnv4 [unicast]",
7120 "Enter Address Family command mode\n"
7122 "Address Family modifier\n")
7124 vty
->node
= BGP_VPNV4_NODE
;
7128 DEFUN_NOSH (address_family_vpnv6
,
7129 address_family_vpnv6_cmd
,
7130 "address-family vpnv6 [unicast]",
7131 "Enter Address Family command mode\n"
7133 "Address Family modifier\n")
7135 vty
->node
= BGP_VPNV6_NODE
;
7140 DEFUN_NOSH (address_family_evpn
,
7141 address_family_evpn_cmd
,
7142 "address-family l2vpn evpn",
7143 "Enter Address Family command mode\n"
7145 "Address Family modifier\n")
7147 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
7148 vty
->node
= BGP_EVPN_NODE
;
7152 DEFUN_NOSH (exit_address_family
,
7153 exit_address_family_cmd
,
7154 "exit-address-family",
7155 "Exit from Address Family configuration mode\n")
7157 if (vty
->node
== BGP_IPV4_NODE
|| vty
->node
== BGP_IPV4M_NODE
7158 || vty
->node
== BGP_IPV4L_NODE
|| vty
->node
== BGP_VPNV4_NODE
7159 || vty
->node
== BGP_IPV6_NODE
|| vty
->node
== BGP_IPV6M_NODE
7160 || vty
->node
== BGP_IPV6L_NODE
|| vty
->node
== BGP_VPNV6_NODE
7161 || vty
->node
== BGP_EVPN_NODE
7162 || vty
->node
== BGP_FLOWSPECV4_NODE
7163 || vty
->node
== BGP_FLOWSPECV6_NODE
)
7164 vty
->node
= BGP_NODE
;
7168 /* Recalculate bestpath and re-advertise a prefix */
7169 static int bgp_clear_prefix(struct vty
*vty
, const char *view_name
,
7170 const char *ip_str
, afi_t afi
, safi_t safi
,
7171 struct prefix_rd
*prd
)
7174 struct prefix match
;
7175 struct bgp_node
*rn
;
7176 struct bgp_node
*rm
;
7178 struct bgp_table
*table
;
7179 struct bgp_table
*rib
;
7181 /* BGP structure lookup. */
7183 bgp
= bgp_lookup_by_name(view_name
);
7185 vty_out(vty
, "%% Can't find BGP instance %s\n",
7190 bgp
= bgp_get_default();
7192 vty_out(vty
, "%% No BGP process is configured\n");
7197 /* Check IP address argument. */
7198 ret
= str2prefix(ip_str
, &match
);
7200 vty_out(vty
, "%% address is malformed\n");
7204 match
.family
= afi2family(afi
);
7205 rib
= bgp
->rib
[afi
][safi
];
7207 if (safi
== SAFI_MPLS_VPN
) {
7208 for (rn
= bgp_table_top(rib
); rn
; rn
= bgp_route_next(rn
)) {
7209 if (prd
&& memcmp(rn
->p
.u
.val
, prd
->val
, 8) != 0)
7212 if ((table
= rn
->info
) != NULL
) {
7213 if ((rm
= bgp_node_match(table
, &match
))
7216 == match
.prefixlen
) {
7218 BGP_NODE_USER_CLEAR
);
7219 bgp_process(bgp
, rm
, afi
, safi
);
7221 bgp_unlock_node(rm
);
7226 if ((rn
= bgp_node_match(rib
, &match
)) != NULL
) {
7227 if (rn
->p
.prefixlen
== match
.prefixlen
) {
7228 SET_FLAG(rn
->flags
, BGP_NODE_USER_CLEAR
);
7229 bgp_process(bgp
, rn
, afi
, safi
);
7231 bgp_unlock_node(rn
);
7238 /* one clear bgp command to rule them all */
7239 DEFUN (clear_ip_bgp_all
,
7240 clear_ip_bgp_all_cmd
,
7241 "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>]",
7245 BGP_INSTANCE_HELP_STR
7247 BGP_SAFI_WITH_LABEL_HELP_STR
7249 "BGP neighbor address to clear\n"
7250 "BGP IPv6 neighbor to clear\n"
7251 "BGP neighbor on interface to clear\n"
7252 "Clear peers with the AS number\n"
7253 "Clear all external peers\n"
7254 "Clear all members of peer-group\n"
7255 "BGP peer-group name\n"
7260 "Push out prefix-list ORF and do inbound soft reconfig\n"
7265 afi_t afi
= AFI_IP6
;
7266 safi_t safi
= SAFI_UNICAST
;
7267 enum clear_sort clr_sort
= clear_peer
;
7268 enum bgp_clear_type clr_type
;
7269 char *clr_arg
= NULL
;
7273 /* clear [ip] bgp */
7274 if (argv_find(argv
, argc
, "ip", &idx
))
7277 /* [<vrf> VIEWVRFNAME] */
7278 if (argv_find(argv
, argc
, "vrf", &idx
)) {
7279 vrf
= argv
[idx
+ 1]->arg
;
7281 if (vrf
&& strmatch(vrf
, VRF_DEFAULT_NAME
))
7283 } else if (argv_find(argv
, argc
, "view", &idx
)) {
7284 /* [<view> VIEWVRFNAME] */
7285 vrf
= argv
[idx
+ 1]->arg
;
7288 /* ["BGP_AFI_CMD_STR" ["BGP_SAFI_CMD_STR"]] */
7289 if (argv_find_and_parse_afi(argv
, argc
, &idx
, &afi
))
7290 argv_find_and_parse_safi(argv
, argc
, &idx
, &safi
);
7292 /* <*|A.B.C.D|X:X::X:X|WORD|(1-4294967295)|external|peer-group WORD> */
7293 if (argv_find(argv
, argc
, "*", &idx
)) {
7294 clr_sort
= clear_all
;
7295 } else if (argv_find(argv
, argc
, "A.B.C.D", &idx
)) {
7296 clr_sort
= clear_peer
;
7297 clr_arg
= argv
[idx
]->arg
;
7298 } else if (argv_find(argv
, argc
, "X:X::X:X", &idx
)) {
7299 clr_sort
= clear_peer
;
7300 clr_arg
= argv
[idx
]->arg
;
7301 } else if (argv_find(argv
, argc
, "peer-group", &idx
)) {
7302 clr_sort
= clear_group
;
7304 clr_arg
= argv
[idx
]->arg
;
7305 } else if (argv_find(argv
, argc
, "WORD", &idx
)) {
7306 clr_sort
= clear_peer
;
7307 clr_arg
= argv
[idx
]->arg
;
7308 } else if (argv_find(argv
, argc
, "(1-4294967295)", &idx
)) {
7309 clr_sort
= clear_as
;
7310 clr_arg
= argv
[idx
]->arg
;
7311 } else if (argv_find(argv
, argc
, "external", &idx
)) {
7312 clr_sort
= clear_external
;
7315 /* [<soft [<in|out>]|in [prefix-filter]|out>] */
7316 if (argv_find(argv
, argc
, "soft", &idx
)) {
7317 if (argv_find(argv
, argc
, "in", &idx
)
7318 || argv_find(argv
, argc
, "out", &idx
))
7319 clr_type
= strmatch(argv
[idx
]->text
, "in")
7321 : BGP_CLEAR_SOFT_OUT
;
7323 clr_type
= BGP_CLEAR_SOFT_BOTH
;
7324 } else if (argv_find(argv
, argc
, "in", &idx
)) {
7325 clr_type
= argv_find(argv
, argc
, "prefix-filter", &idx
)
7326 ? BGP_CLEAR_SOFT_IN_ORF_PREFIX
7327 : BGP_CLEAR_SOFT_IN
;
7328 } else if (argv_find(argv
, argc
, "out", &idx
)) {
7329 clr_type
= BGP_CLEAR_SOFT_OUT
;
7331 clr_type
= BGP_CLEAR_SOFT_NONE
;
7333 return bgp_clear_vty(vty
, vrf
, afi
, safi
, clr_sort
, clr_type
, clr_arg
);
7336 DEFUN (clear_ip_bgp_prefix
,
7337 clear_ip_bgp_prefix_cmd
,
7338 "clear [ip] bgp [<view|vrf> VIEWVRFNAME] prefix A.B.C.D/M",
7342 BGP_INSTANCE_HELP_STR
7343 "Clear bestpath and re-advertise\n"
7347 char *prefix
= NULL
;
7351 /* [<view|vrf> VIEWVRFNAME] */
7352 if (argv_find(argv
, argc
, "vrf", &idx
)) {
7353 vrf
= argv
[idx
+ 1]->arg
;
7355 if (vrf
&& strmatch(vrf
, VRF_DEFAULT_NAME
))
7357 } else if (argv_find(argv
, argc
, "view", &idx
)) {
7358 /* [<view> VIEWVRFNAME] */
7359 vrf
= argv
[idx
+ 1]->arg
;
7363 prefix
= argv
[argc
- 1]->arg
;
7365 return bgp_clear_prefix(vty
, vrf
, prefix
, AFI_IP
, SAFI_UNICAST
, NULL
);
7368 DEFUN (clear_bgp_ipv6_safi_prefix
,
7369 clear_bgp_ipv6_safi_prefix_cmd
,
7370 "clear [ip] bgp ipv6 "BGP_SAFI_CMD_STR
" prefix X:X::X:X/M",
7376 "Clear bestpath and re-advertise\n"
7380 int idx_ipv6_prefix
= 0;
7381 safi_t safi
= SAFI_UNICAST
;
7382 char *prefix
= argv_find(argv
, argc
, "X:X::X:X/M", &idx_ipv6_prefix
) ?
7383 argv
[idx_ipv6_prefix
]->arg
: NULL
;
7385 argv_find_and_parse_safi(argv
, argc
, &idx_safi
, &safi
);
7386 return bgp_clear_prefix(
7387 vty
, NULL
, prefix
, AFI_IP6
,
7391 DEFUN (clear_bgp_instance_ipv6_safi_prefix
,
7392 clear_bgp_instance_ipv6_safi_prefix_cmd
,
7393 "clear [ip] bgp <view|vrf> VIEWVRFNAME ipv6 "BGP_SAFI_CMD_STR
" prefix X:X::X:X/M",
7397 BGP_INSTANCE_HELP_STR
7400 "Clear bestpath and re-advertise\n"
7404 int idx_vrfview
= 0;
7405 int idx_ipv6_prefix
= 0;
7406 safi_t safi
= SAFI_UNICAST
;
7407 char *prefix
= argv_find(argv
, argc
, "X:X::X:X/M", &idx_ipv6_prefix
) ?
7408 argv
[idx_ipv6_prefix
]->arg
: NULL
;
7409 char *vrfview
= NULL
;
7411 /* [<view|vrf> VIEWVRFNAME] */
7412 if (argv_find(argv
, argc
, "vrf", &idx_vrfview
)) {
7413 vrfview
= argv
[idx_vrfview
+ 1]->arg
;
7414 if (vrfview
&& strmatch(vrfview
, VRF_DEFAULT_NAME
))
7416 } else if (argv_find(argv
, argc
, "view", &idx_vrfview
)) {
7417 /* [<view> VIEWVRFNAME] */
7418 vrfview
= argv
[idx_vrfview
+ 1]->arg
;
7420 argv_find_and_parse_safi(argv
, argc
, &idx_safi
, &safi
);
7422 return bgp_clear_prefix(
7423 vty
, vrfview
, prefix
,
7424 AFI_IP6
, safi
, NULL
);
7427 DEFUN (show_bgp_views
,
7429 "show [ip] bgp views",
7433 "Show the defined BGP views\n")
7435 struct list
*inst
= bm
->bgp
;
7436 struct listnode
*node
;
7439 if (!bgp_option_check(BGP_OPT_MULTIPLE_INSTANCE
)) {
7440 vty_out(vty
, "BGP Multiple Instance is not enabled\n");
7444 vty_out(vty
, "Defined BGP views:\n");
7445 for (ALL_LIST_ELEMENTS_RO(inst
, node
, bgp
)) {
7447 if (bgp
->inst_type
== BGP_INSTANCE_TYPE_VRF
)
7449 vty_out(vty
, "\t%s (AS%u)\n", bgp
->name
? bgp
->name
: "(null)",
7456 DEFUN (show_bgp_vrfs
,
7458 "show [ip] bgp vrfs [json]",
7465 char buf
[ETHER_ADDR_STRLEN
];
7466 struct list
*inst
= bm
->bgp
;
7467 struct listnode
*node
;
7469 bool uj
= use_json(argc
, argv
);
7470 json_object
*json
= NULL
;
7471 json_object
*json_vrfs
= NULL
;
7474 if (!bgp_option_check(BGP_OPT_MULTIPLE_INSTANCE
)) {
7475 vty_out(vty
, "BGP Multiple Instance is not enabled\n");
7480 json
= json_object_new_object();
7481 json_vrfs
= json_object_new_object();
7484 for (ALL_LIST_ELEMENTS_RO(inst
, node
, bgp
)) {
7485 const char *name
, *type
;
7487 struct listnode
*node2
, *nnode2
;
7488 int peers_cfg
, peers_estb
;
7489 json_object
*json_vrf
= NULL
;
7492 if (bgp
->inst_type
== BGP_INSTANCE_TYPE_VIEW
)
7496 if (!uj
&& count
== 1)
7498 "%4s %-5s %-16s %9s %10s %-37s %-10s %-15s\n",
7499 "Type", "Id", "routerId", "#PeersVfg",
7500 "#PeersEstb", "Name", "L3-VNI", "Rmac");
7502 peers_cfg
= peers_estb
= 0;
7504 json_vrf
= json_object_new_object();
7507 for (ALL_LIST_ELEMENTS(bgp
->peer
, node2
, nnode2
, peer
)) {
7508 if (!CHECK_FLAG(peer
->flags
, PEER_FLAG_CONFIG_NODE
))
7511 if (peer
->status
== Established
)
7515 if (bgp
->inst_type
== BGP_INSTANCE_TYPE_DEFAULT
) {
7516 name
= VRF_DEFAULT_NAME
;
7525 int64_t vrf_id_ui
= (bgp
->vrf_id
== VRF_UNKNOWN
)
7527 : (int64_t)bgp
->vrf_id
;
7528 json_object_string_add(json_vrf
, "type", type
);
7529 json_object_int_add(json_vrf
, "vrfId", vrf_id_ui
);
7530 json_object_string_add(json_vrf
, "routerId",
7531 inet_ntoa(bgp
->router_id
));
7532 json_object_int_add(json_vrf
, "numConfiguredPeers",
7534 json_object_int_add(json_vrf
, "numEstablishedPeers",
7537 json_object_int_add(json_vrf
, "l3vni", bgp
->l3vni
);
7538 json_object_string_add(
7540 prefix_mac2str(&bgp
->rmac
, buf
, sizeof(buf
)));
7541 json_object_object_add(json_vrfs
, name
, json_vrf
);
7544 "%4s %-5d %-16s %9u %10u %-37s %-10u %-15s\n",
7546 bgp
->vrf_id
== VRF_UNKNOWN
? -1
7548 inet_ntoa(bgp
->router_id
), peers_cfg
,
7549 peers_estb
, name
, bgp
->l3vni
,
7550 prefix_mac2str(&bgp
->rmac
, buf
, sizeof(buf
)));
7554 json_object_object_add(json
, "vrfs", json_vrfs
);
7556 json_object_int_add(json
, "totalVrfs", count
);
7558 vty_out(vty
, "%s\n", json_object_to_json_string_ext(
7559 json
, JSON_C_TO_STRING_PRETTY
));
7560 json_object_free(json
);
7564 "\nTotal number of VRFs (including default): %d\n",
7572 static void show_tip_entry(struct hash_backet
*backet
, void *args
)
7574 struct vty
*vty
= (struct vty
*)args
;
7575 struct tip_addr
*tip
= (struct tip_addr
*)backet
->data
;
7577 vty_out(vty
, "addr: %s, count: %d\n", inet_ntoa(tip
->addr
),
7581 static void bgp_show_martian_nexthops(struct vty
*vty
, struct bgp
*bgp
)
7583 vty_out(vty
, "self nexthop database:\n");
7584 bgp_nexthop_show_address_hash(vty
, bgp
);
7586 vty_out(vty
, "Tunnel-ip database:\n");
7587 hash_iterate(bgp
->tip_hash
,
7588 (void (*)(struct hash_backet
*, void *))show_tip_entry
,
7592 DEFUN(show_bgp_martian_nexthop_db
, show_bgp_martian_nexthop_db_cmd
,
7593 "show bgp [<view|vrf> VIEWVRFNAME] martian next-hop",
7594 SHOW_STR BGP_STR BGP_INSTANCE_HELP_STR
7595 "martian next-hops\n"
7596 "martian next-hop database\n")
7598 struct bgp
*bgp
= NULL
;
7602 /* [<vrf> VIEWVRFNAME] */
7603 if (argv_find(argv
, argc
, "vrf", &idx
)) {
7604 name
= argv
[idx
+ 1]->arg
;
7605 if (name
&& strmatch(name
, VRF_DEFAULT_NAME
))
7607 } else if (argv_find(argv
, argc
, "view", &idx
))
7608 /* [<view> VIEWVRFNAME] */
7609 name
= argv
[idx
+ 1]->arg
;
7611 bgp
= bgp_lookup_by_name(name
);
7613 bgp
= bgp_get_default();
7616 vty_out(vty
, "%% No BGP process is configured\n");
7619 bgp_show_martian_nexthops(vty
, bgp
);
7624 DEFUN (show_bgp_memory
,
7625 show_bgp_memory_cmd
,
7626 "show [ip] bgp memory",
7630 "Global BGP memory statistics\n")
7632 char memstrbuf
[MTYPE_MEMSTR_LEN
];
7633 unsigned long count
;
7635 /* RIB related usage stats */
7636 count
= mtype_stats_alloc(MTYPE_BGP_NODE
);
7637 vty_out(vty
, "%ld RIB nodes, using %s of memory\n", count
,
7638 mtype_memstr(memstrbuf
, sizeof(memstrbuf
),
7639 count
* sizeof(struct bgp_node
)));
7641 count
= mtype_stats_alloc(MTYPE_BGP_ROUTE
);
7642 vty_out(vty
, "%ld BGP routes, using %s of memory\n", count
,
7643 mtype_memstr(memstrbuf
, sizeof(memstrbuf
),
7644 count
* sizeof(struct bgp_path_info
)));
7645 if ((count
= mtype_stats_alloc(MTYPE_BGP_ROUTE_EXTRA
)))
7646 vty_out(vty
, "%ld BGP route ancillaries, using %s of memory\n",
7649 memstrbuf
, sizeof(memstrbuf
),
7650 count
* sizeof(struct bgp_path_info_extra
)));
7652 if ((count
= mtype_stats_alloc(MTYPE_BGP_STATIC
)))
7653 vty_out(vty
, "%ld Static routes, using %s of memory\n", count
,
7654 mtype_memstr(memstrbuf
, sizeof(memstrbuf
),
7655 count
* sizeof(struct bgp_static
)));
7657 if ((count
= mtype_stats_alloc(MTYPE_BGP_PACKET
)))
7658 vty_out(vty
, "%ld Packets, using %s of memory\n", count
,
7659 mtype_memstr(memstrbuf
, sizeof(memstrbuf
),
7660 count
* sizeof(struct bpacket
)));
7663 if ((count
= mtype_stats_alloc(MTYPE_BGP_ADJ_IN
)))
7664 vty_out(vty
, "%ld Adj-In entries, using %s of memory\n", count
,
7665 mtype_memstr(memstrbuf
, sizeof(memstrbuf
),
7666 count
* sizeof(struct bgp_adj_in
)));
7667 if ((count
= mtype_stats_alloc(MTYPE_BGP_ADJ_OUT
)))
7668 vty_out(vty
, "%ld Adj-Out entries, using %s of memory\n", count
,
7669 mtype_memstr(memstrbuf
, sizeof(memstrbuf
),
7670 count
* sizeof(struct bgp_adj_out
)));
7672 if ((count
= mtype_stats_alloc(MTYPE_BGP_NEXTHOP_CACHE
)))
7673 vty_out(vty
, "%ld Nexthop cache entries, using %s of memory\n",
7675 mtype_memstr(memstrbuf
, sizeof(memstrbuf
),
7676 count
* sizeof(struct bgp_nexthop_cache
)));
7678 if ((count
= mtype_stats_alloc(MTYPE_BGP_DAMP_INFO
)))
7679 vty_out(vty
, "%ld Dampening entries, using %s of memory\n",
7681 mtype_memstr(memstrbuf
, sizeof(memstrbuf
),
7682 count
* sizeof(struct bgp_damp_info
)));
7685 count
= attr_count();
7686 vty_out(vty
, "%ld BGP attributes, using %s of memory\n", count
,
7687 mtype_memstr(memstrbuf
, sizeof(memstrbuf
),
7688 count
* sizeof(struct attr
)));
7690 if ((count
= attr_unknown_count()))
7691 vty_out(vty
, "%ld unknown attributes\n", count
);
7693 /* AS_PATH attributes */
7694 count
= aspath_count();
7695 vty_out(vty
, "%ld BGP AS-PATH entries, using %s of memory\n", count
,
7696 mtype_memstr(memstrbuf
, sizeof(memstrbuf
),
7697 count
* sizeof(struct aspath
)));
7699 count
= mtype_stats_alloc(MTYPE_AS_SEG
);
7700 vty_out(vty
, "%ld BGP AS-PATH segments, using %s of memory\n", count
,
7701 mtype_memstr(memstrbuf
, sizeof(memstrbuf
),
7702 count
* sizeof(struct assegment
)));
7704 /* Other attributes */
7705 if ((count
= community_count()))
7706 vty_out(vty
, "%ld BGP community entries, using %s of memory\n",
7707 count
, mtype_memstr(memstrbuf
, sizeof(memstrbuf
),
7708 count
* sizeof(struct community
)));
7709 if ((count
= mtype_stats_alloc(MTYPE_ECOMMUNITY
)))
7710 vty_out(vty
, "%ld BGP community entries, using %s of memory\n",
7711 count
, mtype_memstr(memstrbuf
, sizeof(memstrbuf
),
7712 count
* sizeof(struct ecommunity
)));
7713 if ((count
= mtype_stats_alloc(MTYPE_LCOMMUNITY
)))
7715 "%ld BGP large-community entries, using %s of memory\n",
7716 count
, mtype_memstr(memstrbuf
, sizeof(memstrbuf
),
7717 count
* sizeof(struct lcommunity
)));
7719 if ((count
= mtype_stats_alloc(MTYPE_CLUSTER
)))
7720 vty_out(vty
, "%ld Cluster lists, using %s of memory\n", count
,
7721 mtype_memstr(memstrbuf
, sizeof(memstrbuf
),
7722 count
* sizeof(struct cluster_list
)));
7724 /* Peer related usage */
7725 count
= mtype_stats_alloc(MTYPE_BGP_PEER
);
7726 vty_out(vty
, "%ld peers, using %s of memory\n", count
,
7727 mtype_memstr(memstrbuf
, sizeof(memstrbuf
),
7728 count
* sizeof(struct peer
)));
7730 if ((count
= mtype_stats_alloc(MTYPE_PEER_GROUP
)))
7731 vty_out(vty
, "%ld peer groups, using %s of memory\n", count
,
7732 mtype_memstr(memstrbuf
, sizeof(memstrbuf
),
7733 count
* sizeof(struct peer_group
)));
7736 if ((count
= mtype_stats_alloc(MTYPE_HASH
)))
7737 vty_out(vty
, "%ld hash tables, using %s of memory\n", count
,
7738 mtype_memstr(memstrbuf
, sizeof(memstrbuf
),
7739 count
* sizeof(struct hash
)));
7740 if ((count
= mtype_stats_alloc(MTYPE_HASH_BACKET
)))
7741 vty_out(vty
, "%ld hash buckets, using %s of memory\n", count
,
7742 mtype_memstr(memstrbuf
, sizeof(memstrbuf
),
7743 count
* sizeof(struct hash_backet
)));
7744 if ((count
= mtype_stats_alloc(MTYPE_BGP_REGEXP
)))
7745 vty_out(vty
, "%ld compiled regexes, using %s of memory\n",
7746 count
, mtype_memstr(memstrbuf
, sizeof(memstrbuf
),
7747 count
* sizeof(regex_t
)));
7751 static void bgp_show_bestpath_json(struct bgp
*bgp
, json_object
*json
)
7753 json_object
*bestpath
= json_object_new_object();
7755 if (bgp_flag_check(bgp
, BGP_FLAG_ASPATH_IGNORE
))
7756 json_object_string_add(bestpath
, "asPath", "ignore");
7758 if (bgp_flag_check(bgp
, BGP_FLAG_ASPATH_CONFED
))
7759 json_object_string_add(bestpath
, "asPath", "confed");
7761 if (bgp_flag_check(bgp
, BGP_FLAG_ASPATH_MULTIPATH_RELAX
)) {
7762 if (bgp_flag_check(bgp
, BGP_FLAG_MULTIPATH_RELAX_AS_SET
))
7763 json_object_string_add(bestpath
, "multiPathRelax",
7766 json_object_string_add(bestpath
, "multiPathRelax",
7769 json_object_string_add(bestpath
, "multiPathRelax", "false");
7771 if (bgp_flag_check(bgp
, BGP_FLAG_COMPARE_ROUTER_ID
))
7772 json_object_string_add(bestpath
, "compareRouterId", "true");
7773 if (bgp_flag_check(bgp
, BGP_FLAG_MED_CONFED
)
7774 || bgp_flag_check(bgp
, BGP_FLAG_MED_MISSING_AS_WORST
)) {
7775 if (bgp_flag_check(bgp
, BGP_FLAG_MED_CONFED
))
7776 json_object_string_add(bestpath
, "med", "confed");
7777 if (bgp_flag_check(bgp
, BGP_FLAG_MED_MISSING_AS_WORST
))
7778 json_object_string_add(bestpath
, "med",
7779 "missing-as-worst");
7781 json_object_string_add(bestpath
, "med", "true");
7784 json_object_object_add(json
, "bestPath", bestpath
);
7787 /* Show BGP peer's summary information. */
7788 static int bgp_show_summary(struct vty
*vty
, struct bgp
*bgp
, int afi
, int safi
,
7789 bool use_json
, json_object
*json
)
7792 struct listnode
*node
, *nnode
;
7793 unsigned int count
= 0, dn_count
= 0;
7794 char timebuf
[BGP_UPTIME_LEN
], dn_flag
[2];
7795 char neighbor_buf
[VTY_BUFSIZ
];
7796 int neighbor_col_default_width
= 16;
7798 int max_neighbor_width
= 0;
7800 json_object
*json_peer
= NULL
;
7801 json_object
*json_peers
= NULL
;
7802 struct peer_af
*paf
;
7804 /* labeled-unicast routes are installed in the unicast table so in order
7806 * display the correct PfxRcd value we must look at SAFI_UNICAST
7808 if (safi
== SAFI_LABELED_UNICAST
)
7809 pfx_rcd_safi
= SAFI_UNICAST
;
7811 pfx_rcd_safi
= safi
;
7815 json
= json_object_new_object();
7817 json_peers
= json_object_new_object();
7819 /* Loop over all neighbors that will be displayed to determine
7821 * characters are needed for the Neighbor column
7823 for (ALL_LIST_ELEMENTS(bgp
->peer
, node
, nnode
, peer
)) {
7824 if (!CHECK_FLAG(peer
->flags
, PEER_FLAG_CONFIG_NODE
))
7827 if (peer
->afc
[afi
][safi
]) {
7828 memset(dn_flag
, '\0', sizeof(dn_flag
));
7829 if (peer_dynamic_neighbor(peer
))
7833 && bgp_flag_check(bgp
,
7834 BGP_FLAG_SHOW_HOSTNAME
))
7835 sprintf(neighbor_buf
, "%s%s(%s) ",
7836 dn_flag
, peer
->hostname
,
7839 sprintf(neighbor_buf
, "%s%s ", dn_flag
,
7842 len
= strlen(neighbor_buf
);
7844 if (len
> max_neighbor_width
)
7845 max_neighbor_width
= len
;
7849 /* Originally we displayed the Neighbor column as 16
7850 * characters wide so make that the default
7852 if (max_neighbor_width
< neighbor_col_default_width
)
7853 max_neighbor_width
= neighbor_col_default_width
;
7856 for (ALL_LIST_ELEMENTS(bgp
->peer
, node
, nnode
, peer
)) {
7857 if (!CHECK_FLAG(peer
->flags
, PEER_FLAG_CONFIG_NODE
))
7860 if (!peer
->afc
[afi
][safi
])
7865 char memstrbuf
[MTYPE_MEMSTR_LEN
];
7868 vrf_id_ui
= (bgp
->vrf_id
== VRF_UNKNOWN
)
7870 : (int64_t)bgp
->vrf_id
;
7872 /* Usage summary and header */
7874 json_object_string_add(
7876 inet_ntoa(bgp
->router_id
));
7877 json_object_int_add(json
, "as", bgp
->as
);
7878 json_object_int_add(json
, "vrfId", vrf_id_ui
);
7879 json_object_string_add(
7882 == BGP_INSTANCE_TYPE_DEFAULT
)
7887 "BGP router identifier %s, local AS number %u vrf-id %d",
7888 inet_ntoa(bgp
->router_id
), bgp
->as
,
7889 bgp
->vrf_id
== VRF_UNKNOWN
7891 : (int)bgp
->vrf_id
);
7895 if (bgp_update_delay_configured(bgp
)) {
7897 json_object_int_add(
7898 json
, "updateDelayLimit",
7899 bgp
->v_update_delay
);
7901 if (bgp
->v_update_delay
7902 != bgp
->v_establish_wait
)
7903 json_object_int_add(
7905 "updateDelayEstablishWait",
7906 bgp
->v_establish_wait
);
7908 if (bgp_update_delay_active(bgp
)) {
7909 json_object_string_add(
7911 "updateDelayFirstNeighbor",
7912 bgp
->update_delay_begin_time
);
7913 json_object_boolean_true_add(
7915 "updateDelayInProgress");
7917 if (bgp
->update_delay_over
) {
7918 json_object_string_add(
7920 "updateDelayFirstNeighbor",
7921 bgp
->update_delay_begin_time
);
7922 json_object_string_add(
7924 "updateDelayBestpathResumed",
7925 bgp
->update_delay_end_time
);
7926 json_object_string_add(
7928 "updateDelayZebraUpdateResume",
7929 bgp
->update_delay_zebra_resume_time
);
7930 json_object_string_add(
7932 "updateDelayPeerUpdateResume",
7933 bgp
->update_delay_peers_resume_time
);
7938 "Read-only mode update-delay limit: %d seconds\n",
7939 bgp
->v_update_delay
);
7940 if (bgp
->v_update_delay
7941 != bgp
->v_establish_wait
)
7943 " Establish wait: %d seconds\n",
7944 bgp
->v_establish_wait
);
7946 if (bgp_update_delay_active(bgp
)) {
7948 " First neighbor established: %s\n",
7949 bgp
->update_delay_begin_time
);
7951 " Delay in progress\n");
7953 if (bgp
->update_delay_over
) {
7955 " First neighbor established: %s\n",
7956 bgp
->update_delay_begin_time
);
7958 " Best-paths resumed: %s\n",
7959 bgp
->update_delay_end_time
);
7961 " zebra update resumed: %s\n",
7962 bgp
->update_delay_zebra_resume_time
);
7964 " peers update resumed: %s\n",
7965 bgp
->update_delay_peers_resume_time
);
7972 if (bgp_maxmed_onstartup_configured(bgp
)
7973 && bgp
->maxmed_active
)
7974 json_object_boolean_true_add(
7975 json
, "maxMedOnStartup");
7976 if (bgp
->v_maxmed_admin
)
7977 json_object_boolean_true_add(
7978 json
, "maxMedAdministrative");
7980 json_object_int_add(
7981 json
, "tableVersion",
7982 bgp_table_version(bgp
->rib
[afi
][safi
]));
7984 ents
= bgp_table_count(bgp
->rib
[afi
][safi
]);
7985 json_object_int_add(json
, "ribCount", ents
);
7986 json_object_int_add(
7988 ents
* sizeof(struct bgp_node
));
7990 ents
= listcount(bgp
->peer
);
7991 json_object_int_add(json
, "peerCount", ents
);
7992 json_object_int_add(json
, "peerMemory",
7993 ents
* sizeof(struct peer
));
7995 if ((ents
= listcount(bgp
->group
))) {
7996 json_object_int_add(
7997 json
, "peerGroupCount", ents
);
7998 json_object_int_add(
7999 json
, "peerGroupMemory",
8000 ents
* sizeof(struct
8004 if (CHECK_FLAG(bgp
->af_flags
[afi
][safi
],
8005 BGP_CONFIG_DAMPENING
))
8006 json_object_boolean_true_add(
8007 json
, "dampeningEnabled");
8009 if (bgp_maxmed_onstartup_configured(bgp
)
8010 && bgp
->maxmed_active
)
8012 "Max-med on-startup active\n");
8013 if (bgp
->v_maxmed_admin
)
8015 "Max-med administrative active\n");
8017 vty_out(vty
, "BGP table version %" PRIu64
"\n",
8018 bgp_table_version(bgp
->rib
[afi
][safi
]));
8020 ents
= bgp_table_count(bgp
->rib
[afi
][safi
]);
8022 "RIB entries %ld, using %s of memory\n",
8024 mtype_memstr(memstrbuf
,
8026 ents
* sizeof(struct
8029 /* Peer related usage */
8030 ents
= listcount(bgp
->peer
);
8031 vty_out(vty
, "Peers %ld, using %s of memory\n",
8034 memstrbuf
, sizeof(memstrbuf
),
8035 ents
* sizeof(struct peer
)));
8037 if ((ents
= listcount(bgp
->group
)))
8039 "Peer groups %ld, using %s of memory\n",
8044 ents
* sizeof(struct
8047 if (CHECK_FLAG(bgp
->af_flags
[afi
][safi
],
8048 BGP_CONFIG_DAMPENING
))
8049 vty_out(vty
, "Dampening enabled.\n");
8052 /* Subtract 8 here because 'Neighbor' is
8054 vty_out(vty
, "Neighbor");
8055 vty_out(vty
, "%*s", max_neighbor_width
- 8,
8058 "V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd\n");
8065 json_peer
= json_object_new_object();
8067 if (peer_dynamic_neighbor(peer
)) {
8069 json_object_boolean_true_add(json_peer
,
8074 json_object_string_add(json_peer
, "hostname",
8077 if (peer
->domainname
)
8078 json_object_string_add(json_peer
, "domainname",
8081 json_object_int_add(json_peer
, "remoteAs", peer
->as
);
8082 json_object_int_add(json_peer
, "version", 4);
8083 json_object_int_add(json_peer
, "msgRcvd",
8084 PEER_TOTAL_RX(peer
));
8085 json_object_int_add(json_peer
, "msgSent",
8086 PEER_TOTAL_TX(peer
));
8088 json_object_int_add(json_peer
, "tableVersion",
8089 peer
->version
[afi
][safi
]);
8090 json_object_int_add(json_peer
, "outq",
8092 json_object_int_add(json_peer
, "inq", 0);
8093 peer_uptime(peer
->uptime
, timebuf
, BGP_UPTIME_LEN
,
8094 use_json
, json_peer
);
8097 * Adding "pfxRcd" field to match with the corresponding
8098 * CLI. "prefixReceivedCount" will be deprecated in
8101 json_object_int_add(json_peer
, "prefixReceivedCount",
8102 peer
->pcount
[afi
][pfx_rcd_safi
]);
8103 json_object_int_add(json_peer
, "pfxRcd",
8104 peer
->pcount
[afi
][pfx_rcd_safi
]);
8106 paf
= peer_af_find(peer
, afi
, pfx_rcd_safi
);
8107 if (paf
&& PAF_SUBGRP(paf
))
8108 json_object_int_add(json_peer
,
8110 (PAF_SUBGRP(paf
))->scount
);
8112 if (CHECK_FLAG(peer
->flags
, PEER_FLAG_SHUTDOWN
))
8113 json_object_string_add(json_peer
, "state",
8115 else if (peer
->afc_recv
[afi
][safi
])
8116 json_object_string_add(
8118 lookup_msg(bgp_status_msg
, peer
->status
,
8120 else if (CHECK_FLAG(peer
->sflags
,
8121 PEER_STATUS_PREFIX_OVERFLOW
))
8122 json_object_string_add(json_peer
, "state",
8125 json_object_string_add(
8127 lookup_msg(bgp_status_msg
, peer
->status
,
8131 json_object_string_add(json_peer
, "idType",
8133 else if (peer
->su
.sa
.sa_family
== AF_INET
)
8134 json_object_string_add(json_peer
, "idType",
8136 else if (peer
->su
.sa
.sa_family
== AF_INET6
)
8137 json_object_string_add(json_peer
, "idType",
8140 json_object_object_add(json_peers
, peer
->host
,
8143 memset(dn_flag
, '\0', sizeof(dn_flag
));
8144 if (peer_dynamic_neighbor(peer
)) {
8150 && bgp_flag_check(bgp
, BGP_FLAG_SHOW_HOSTNAME
))
8151 len
= vty_out(vty
, "%s%s(%s)", dn_flag
,
8152 peer
->hostname
, peer
->host
);
8154 len
= vty_out(vty
, "%s%s", dn_flag
, peer
->host
);
8156 /* pad the neighbor column with spaces */
8157 if (len
< max_neighbor_width
)
8158 vty_out(vty
, "%*s", max_neighbor_width
- len
,
8161 vty_out(vty
, "4 %10u %7u %7u %8" PRIu64
" %4d %4zd %8s",
8162 peer
->as
, PEER_TOTAL_RX(peer
),
8163 PEER_TOTAL_TX(peer
), peer
->version
[afi
][safi
],
8164 0, peer
->obuf
->count
,
8165 peer_uptime(peer
->uptime
, timebuf
,
8166 BGP_UPTIME_LEN
, 0, NULL
));
8168 if (peer
->status
== Established
)
8169 if (peer
->afc_recv
[afi
][safi
])
8170 vty_out(vty
, " %12ld",
8174 vty_out(vty
, " NoNeg");
8176 if (CHECK_FLAG(peer
->flags
, PEER_FLAG_SHUTDOWN
))
8177 vty_out(vty
, " Idle (Admin)");
8178 else if (CHECK_FLAG(
8180 PEER_STATUS_PREFIX_OVERFLOW
))
8181 vty_out(vty
, " Idle (PfxCt)");
8183 vty_out(vty
, " %12s",
8184 lookup_msg(bgp_status_msg
,
8185 peer
->status
, NULL
));
8192 json_object_object_add(json
, "peers", json_peers
);
8194 json_object_int_add(json
, "totalPeers", count
);
8195 json_object_int_add(json
, "dynamicPeers", dn_count
);
8197 bgp_show_bestpath_json(bgp
, json
);
8199 vty_out(vty
, "%s\n", json_object_to_json_string_ext(
8200 json
, JSON_C_TO_STRING_PRETTY
));
8201 json_object_free(json
);
8204 vty_out(vty
, "\nTotal number of neighbors %d\n", count
);
8206 vty_out(vty
, "No %s neighbor is configured\n",
8207 afi_safi_print(afi
, safi
));
8211 vty_out(vty
, "* - dynamic neighbor\n");
8212 vty_out(vty
, "%d dynamic neighbor(s), limit %d\n",
8213 dn_count
, bgp
->dynamic_neighbors_limit
);
8220 static void bgp_show_summary_afi_safi(struct vty
*vty
, struct bgp
*bgp
, int afi
,
8221 int safi
, bool use_json
,
8225 int afi_wildcard
= (afi
== AFI_MAX
);
8226 int safi_wildcard
= (safi
== SAFI_MAX
);
8227 int is_wildcard
= (afi_wildcard
|| safi_wildcard
);
8228 bool nbr_output
= false;
8230 if (use_json
&& is_wildcard
)
8231 vty_out(vty
, "{\n");
8233 afi
= 1; /* AFI_IP */
8234 while (afi
< AFI_MAX
) {
8236 safi
= 1; /* SAFI_UNICAST */
8237 while (safi
< SAFI_MAX
) {
8238 if (bgp_afi_safi_peer_exists(bgp
, afi
, safi
)) {
8242 * So limit output to those afi/safi
8244 * actualy have something interesting in
8248 json
= json_object_new_object();
8251 vty_out(vty
, ",\n");
8255 vty_out(vty
, "\"%s\":",
8259 vty_out(vty
, "\n%s Summary:\n",
8264 bgp_show_summary(vty
, bgp
, afi
, safi
, use_json
,
8276 if (use_json
&& is_wildcard
)
8277 vty_out(vty
, "}\n");
8278 else if (!nbr_output
) {
8280 vty_out(vty
, "{}\n");
8282 vty_out(vty
, "%% No BGP neighbors found\n");
8286 static void bgp_show_all_instances_summary_vty(struct vty
*vty
, afi_t afi
,
8287 safi_t safi
, bool use_json
)
8289 struct listnode
*node
, *nnode
;
8291 json_object
*json
= NULL
;
8293 bool nbr_output
= false;
8296 vty_out(vty
, "{\n");
8298 for (ALL_LIST_ELEMENTS(bm
->bgp
, node
, nnode
, bgp
)) {
8301 json
= json_object_new_object();
8304 vty_out(vty
, ",\n");
8308 vty_out(vty
, "\"%s\":",
8309 (bgp
->inst_type
== BGP_INSTANCE_TYPE_DEFAULT
)
8313 vty_out(vty
, "\nInstance %s:\n",
8314 (bgp
->inst_type
== BGP_INSTANCE_TYPE_DEFAULT
)
8318 bgp_show_summary_afi_safi(vty
, bgp
, afi
, safi
, use_json
, json
);
8322 vty_out(vty
, "}\n");
8323 else if (!nbr_output
)
8324 vty_out(vty
, "%% BGP instance not found\n");
8327 int bgp_show_summary_vty(struct vty
*vty
, const char *name
, afi_t afi
,
8328 safi_t safi
, bool use_json
)
8333 if (strmatch(name
, "all")) {
8334 bgp_show_all_instances_summary_vty(vty
, afi
, safi
,
8338 bgp
= bgp_lookup_by_name(name
);
8342 vty_out(vty
, "{}\n");
8345 "%% BGP instance not found\n");
8349 bgp_show_summary_afi_safi(vty
, bgp
, afi
, safi
, use_json
,
8355 bgp
= bgp_get_default();
8358 bgp_show_summary_afi_safi(vty
, bgp
, afi
, safi
, use_json
, NULL
);
8361 vty_out(vty
, "{}\n");
8363 vty_out(vty
, "%% BGP instance not found\n");
8370 /* `show [ip] bgp summary' commands. */
8371 DEFUN (show_ip_bgp_summary
,
8372 show_ip_bgp_summary_cmd
,
8373 "show [ip] bgp [<view|vrf> VIEWVRFNAME] ["BGP_AFI_CMD_STR
" ["BGP_SAFI_WITH_LABEL_CMD_STR
"]] summary [json]",
8377 BGP_INSTANCE_HELP_STR
8379 BGP_SAFI_WITH_LABEL_HELP_STR
8380 "Summary of BGP neighbor status\n"
8384 afi_t afi
= AFI_MAX
;
8385 safi_t safi
= SAFI_MAX
;
8390 if (argv_find(argv
, argc
, "ip", &idx
))
8392 /* [<vrf> VIEWVRFNAME] */
8393 if (argv_find(argv
, argc
, "vrf", &idx
)) {
8394 vrf
= argv
[idx
+ 1]->arg
;
8395 if (vrf
&& strmatch(vrf
, VRF_DEFAULT_NAME
))
8397 } else if (argv_find(argv
, argc
, "view", &idx
))
8398 /* [<view> VIEWVRFNAME] */
8399 vrf
= argv
[idx
+ 1]->arg
;
8400 /* ["BGP_AFI_CMD_STR" ["BGP_SAFI_CMD_STR"]] */
8401 if (argv_find_and_parse_afi(argv
, argc
, &idx
, &afi
)) {
8402 argv_find_and_parse_safi(argv
, argc
, &idx
, &safi
);
8405 bool uj
= use_json(argc
, argv
);
8407 return bgp_show_summary_vty(vty
, vrf
, afi
, safi
, uj
);
8410 const char *afi_safi_print(afi_t afi
, safi_t safi
)
8412 if (afi
== AFI_IP
&& safi
== SAFI_UNICAST
)
8413 return "IPv4 Unicast";
8414 else if (afi
== AFI_IP
&& safi
== SAFI_MULTICAST
)
8415 return "IPv4 Multicast";
8416 else if (afi
== AFI_IP
&& safi
== SAFI_LABELED_UNICAST
)
8417 return "IPv4 Labeled Unicast";
8418 else if (afi
== AFI_IP
&& safi
== SAFI_MPLS_VPN
)
8420 else if (afi
== AFI_IP
&& safi
== SAFI_ENCAP
)
8421 return "IPv4 Encap";
8422 else if (afi
== AFI_IP
&& safi
== SAFI_FLOWSPEC
)
8423 return "IPv4 Flowspec";
8424 else if (afi
== AFI_IP6
&& safi
== SAFI_UNICAST
)
8425 return "IPv6 Unicast";
8426 else if (afi
== AFI_IP6
&& safi
== SAFI_MULTICAST
)
8427 return "IPv6 Multicast";
8428 else if (afi
== AFI_IP6
&& safi
== SAFI_LABELED_UNICAST
)
8429 return "IPv6 Labeled Unicast";
8430 else if (afi
== AFI_IP6
&& safi
== SAFI_MPLS_VPN
)
8432 else if (afi
== AFI_IP6
&& safi
== SAFI_ENCAP
)
8433 return "IPv6 Encap";
8434 else if (afi
== AFI_IP6
&& safi
== SAFI_FLOWSPEC
)
8435 return "IPv6 Flowspec";
8436 else if (afi
== AFI_L2VPN
&& safi
== SAFI_EVPN
)
8437 return "L2VPN EVPN";
8443 * Please note that we have intentionally camelCased
8444 * the return strings here. So if you want
8445 * to use this function, please ensure you
8446 * are doing this within json output
8448 const char *afi_safi_json(afi_t afi
, safi_t safi
)
8450 if (afi
== AFI_IP
&& safi
== SAFI_UNICAST
)
8451 return "ipv4Unicast";
8452 else if (afi
== AFI_IP
&& safi
== SAFI_MULTICAST
)
8453 return "ipv4Multicast";
8454 else if (afi
== AFI_IP
&& safi
== SAFI_LABELED_UNICAST
)
8455 return "ipv4LabeledUnicast";
8456 else if (afi
== AFI_IP
&& safi
== SAFI_MPLS_VPN
)
8458 else if (afi
== AFI_IP
&& safi
== SAFI_ENCAP
)
8460 else if (afi
== AFI_IP
&& safi
== SAFI_FLOWSPEC
)
8461 return "ipv4Flowspec";
8462 else if (afi
== AFI_IP6
&& safi
== SAFI_UNICAST
)
8463 return "ipv6Unicast";
8464 else if (afi
== AFI_IP6
&& safi
== SAFI_MULTICAST
)
8465 return "ipv6Multicast";
8466 else if (afi
== AFI_IP6
&& safi
== SAFI_LABELED_UNICAST
)
8467 return "ipv6LabeledUnicast";
8468 else if (afi
== AFI_IP6
&& safi
== SAFI_MPLS_VPN
)
8470 else if (afi
== AFI_IP6
&& safi
== SAFI_ENCAP
)
8472 else if (afi
== AFI_IP6
&& safi
== SAFI_FLOWSPEC
)
8473 return "ipv6Flowspec";
8474 else if (afi
== AFI_L2VPN
&& safi
== SAFI_EVPN
)
8480 /* Show BGP peer's information. */
8481 enum show_type
{ show_all
, show_peer
};
8483 static void bgp_show_peer_afi_orf_cap(struct vty
*vty
, struct peer
*p
,
8484 afi_t afi
, safi_t safi
,
8485 uint16_t adv_smcap
, uint16_t adv_rmcap
,
8486 uint16_t rcv_smcap
, uint16_t rcv_rmcap
,
8487 bool use_json
, json_object
*json_pref
)
8490 if (CHECK_FLAG(p
->af_cap
[afi
][safi
], adv_smcap
)
8491 || CHECK_FLAG(p
->af_cap
[afi
][safi
], rcv_smcap
)) {
8493 if (CHECK_FLAG(p
->af_cap
[afi
][safi
], adv_smcap
)
8494 && CHECK_FLAG(p
->af_cap
[afi
][safi
], rcv_smcap
))
8495 json_object_string_add(json_pref
, "sendMode",
8496 "advertisedAndReceived");
8497 else if (CHECK_FLAG(p
->af_cap
[afi
][safi
], adv_smcap
))
8498 json_object_string_add(json_pref
, "sendMode",
8500 else if (CHECK_FLAG(p
->af_cap
[afi
][safi
], rcv_smcap
))
8501 json_object_string_add(json_pref
, "sendMode",
8504 vty_out(vty
, " Send-mode: ");
8505 if (CHECK_FLAG(p
->af_cap
[afi
][safi
], adv_smcap
))
8506 vty_out(vty
, "advertised");
8507 if (CHECK_FLAG(p
->af_cap
[afi
][safi
], rcv_smcap
))
8508 vty_out(vty
, "%sreceived",
8509 CHECK_FLAG(p
->af_cap
[afi
][safi
],
8518 if (CHECK_FLAG(p
->af_cap
[afi
][safi
], adv_rmcap
)
8519 || CHECK_FLAG(p
->af_cap
[afi
][safi
], rcv_rmcap
)) {
8521 if (CHECK_FLAG(p
->af_cap
[afi
][safi
], adv_rmcap
)
8522 && CHECK_FLAG(p
->af_cap
[afi
][safi
], rcv_rmcap
))
8523 json_object_string_add(json_pref
, "recvMode",
8524 "advertisedAndReceived");
8525 else if (CHECK_FLAG(p
->af_cap
[afi
][safi
], adv_rmcap
))
8526 json_object_string_add(json_pref
, "recvMode",
8528 else if (CHECK_FLAG(p
->af_cap
[afi
][safi
], rcv_rmcap
))
8529 json_object_string_add(json_pref
, "recvMode",
8532 vty_out(vty
, " Receive-mode: ");
8533 if (CHECK_FLAG(p
->af_cap
[afi
][safi
], adv_rmcap
))
8534 vty_out(vty
, "advertised");
8535 if (CHECK_FLAG(p
->af_cap
[afi
][safi
], rcv_rmcap
))
8536 vty_out(vty
, "%sreceived",
8537 CHECK_FLAG(p
->af_cap
[afi
][safi
],
8546 static void bgp_show_peer_afi(struct vty
*vty
, struct peer
*p
, afi_t afi
,
8547 safi_t safi
, bool use_json
,
8548 json_object
*json_neigh
)
8550 struct bgp_filter
*filter
;
8551 struct peer_af
*paf
;
8552 char orf_pfx_name
[BUFSIZ
];
8554 json_object
*json_af
= NULL
;
8555 json_object
*json_prefA
= NULL
;
8556 json_object
*json_prefB
= NULL
;
8557 json_object
*json_addr
= NULL
;
8560 json_addr
= json_object_new_object();
8561 json_af
= json_object_new_object();
8562 filter
= &p
->filter
[afi
][safi
];
8564 if (peer_group_active(p
))
8565 json_object_string_add(json_addr
, "peerGroupMember",
8568 paf
= peer_af_find(p
, afi
, safi
);
8569 if (paf
&& PAF_SUBGRP(paf
)) {
8570 json_object_int_add(json_addr
, "updateGroupId",
8571 PAF_UPDGRP(paf
)->id
);
8572 json_object_int_add(json_addr
, "subGroupId",
8573 PAF_SUBGRP(paf
)->id
);
8574 json_object_int_add(json_addr
, "packetQueueLength",
8575 bpacket_queue_virtual_length(paf
));
8578 if (CHECK_FLAG(p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_ADV
)
8579 || CHECK_FLAG(p
->af_cap
[afi
][safi
],
8580 PEER_CAP_ORF_PREFIX_SM_RCV
)
8581 || CHECK_FLAG(p
->af_cap
[afi
][safi
],
8582 PEER_CAP_ORF_PREFIX_RM_ADV
)
8583 || CHECK_FLAG(p
->af_cap
[afi
][safi
],
8584 PEER_CAP_ORF_PREFIX_RM_RCV
)) {
8585 json_object_int_add(json_af
, "orfType",
8587 json_prefA
= json_object_new_object();
8588 bgp_show_peer_afi_orf_cap(vty
, p
, afi
, safi
,
8589 PEER_CAP_ORF_PREFIX_SM_ADV
,
8590 PEER_CAP_ORF_PREFIX_RM_ADV
,
8591 PEER_CAP_ORF_PREFIX_SM_RCV
,
8592 PEER_CAP_ORF_PREFIX_RM_RCV
,
8593 use_json
, json_prefA
);
8594 json_object_object_add(json_af
, "orfPrefixList",
8598 if (CHECK_FLAG(p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_ADV
)
8599 || CHECK_FLAG(p
->af_cap
[afi
][safi
],
8600 PEER_CAP_ORF_PREFIX_SM_OLD_RCV
)
8601 || CHECK_FLAG(p
->af_cap
[afi
][safi
],
8602 PEER_CAP_ORF_PREFIX_RM_ADV
)
8603 || CHECK_FLAG(p
->af_cap
[afi
][safi
],
8604 PEER_CAP_ORF_PREFIX_RM_OLD_RCV
)) {
8605 json_object_int_add(json_af
, "orfOldType",
8606 ORF_TYPE_PREFIX_OLD
);
8607 json_prefB
= json_object_new_object();
8608 bgp_show_peer_afi_orf_cap(
8609 vty
, p
, afi
, safi
, PEER_CAP_ORF_PREFIX_SM_ADV
,
8610 PEER_CAP_ORF_PREFIX_RM_ADV
,
8611 PEER_CAP_ORF_PREFIX_SM_OLD_RCV
,
8612 PEER_CAP_ORF_PREFIX_RM_OLD_RCV
, use_json
,
8614 json_object_object_add(json_af
, "orfOldPrefixList",
8618 if (CHECK_FLAG(p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_ADV
)
8619 || CHECK_FLAG(p
->af_cap
[afi
][safi
],
8620 PEER_CAP_ORF_PREFIX_SM_RCV
)
8621 || CHECK_FLAG(p
->af_cap
[afi
][safi
],
8622 PEER_CAP_ORF_PREFIX_SM_OLD_RCV
)
8623 || CHECK_FLAG(p
->af_cap
[afi
][safi
],
8624 PEER_CAP_ORF_PREFIX_RM_ADV
)
8625 || CHECK_FLAG(p
->af_cap
[afi
][safi
],
8626 PEER_CAP_ORF_PREFIX_RM_RCV
)
8627 || CHECK_FLAG(p
->af_cap
[afi
][safi
],
8628 PEER_CAP_ORF_PREFIX_RM_OLD_RCV
))
8629 json_object_object_add(json_addr
, "afDependentCap",
8632 json_object_free(json_af
);
8634 sprintf(orf_pfx_name
, "%s.%d.%d", p
->host
, afi
, safi
);
8635 orf_pfx_count
= prefix_bgp_show_prefix_list(
8636 NULL
, afi
, orf_pfx_name
, use_json
);
8638 if (CHECK_FLAG(p
->af_sflags
[afi
][safi
],
8639 PEER_STATUS_ORF_PREFIX_SEND
)
8641 if (CHECK_FLAG(p
->af_sflags
[afi
][safi
],
8642 PEER_STATUS_ORF_PREFIX_SEND
))
8643 json_object_boolean_true_add(json_neigh
,
8646 json_object_int_add(json_addr
, "orfRecvCounter",
8649 if (CHECK_FLAG(p
->af_sflags
[afi
][safi
],
8650 PEER_STATUS_ORF_WAIT_REFRESH
))
8651 json_object_string_add(
8652 json_addr
, "orfFirstUpdate",
8653 "deferredUntilORFOrRouteRefreshRecvd");
8655 if (CHECK_FLAG(p
->af_flags
[afi
][safi
],
8656 PEER_FLAG_REFLECTOR_CLIENT
))
8657 json_object_boolean_true_add(json_addr
,
8658 "routeReflectorClient");
8659 if (CHECK_FLAG(p
->af_flags
[afi
][safi
],
8660 PEER_FLAG_RSERVER_CLIENT
))
8661 json_object_boolean_true_add(json_addr
,
8662 "routeServerClient");
8663 if (CHECK_FLAG(p
->af_flags
[afi
][safi
], PEER_FLAG_SOFT_RECONFIG
))
8664 json_object_boolean_true_add(json_addr
,
8665 "inboundSoftConfigPermit");
8667 if (CHECK_FLAG(p
->af_flags
[afi
][safi
],
8668 PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE
))
8669 json_object_boolean_true_add(
8671 "privateAsNumsAllReplacedInUpdatesToNbr");
8672 else if (CHECK_FLAG(p
->af_flags
[afi
][safi
],
8673 PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE
))
8674 json_object_boolean_true_add(
8676 "privateAsNumsReplacedInUpdatesToNbr");
8677 else if (CHECK_FLAG(p
->af_flags
[afi
][safi
],
8678 PEER_FLAG_REMOVE_PRIVATE_AS_ALL
))
8679 json_object_boolean_true_add(
8681 "privateAsNumsAllRemovedInUpdatesToNbr");
8682 else if (CHECK_FLAG(p
->af_flags
[afi
][safi
],
8683 PEER_FLAG_REMOVE_PRIVATE_AS
))
8684 json_object_boolean_true_add(
8686 "privateAsNumsRemovedInUpdatesToNbr");
8688 if (p
->addpath_type
[afi
][safi
] != BGP_ADDPATH_NONE
)
8689 json_object_boolean_true_add(
8691 bgp_addpath_names(p
->addpath_type
[afi
][safi
])
8694 if (CHECK_FLAG(p
->af_flags
[afi
][safi
], PEER_FLAG_AS_OVERRIDE
))
8695 json_object_string_add(json_addr
,
8696 "overrideASNsInOutboundUpdates",
8697 "ifAspathEqualRemoteAs");
8699 if (CHECK_FLAG(p
->af_flags
[afi
][safi
], PEER_FLAG_NEXTHOP_SELF
)
8700 || CHECK_FLAG(p
->af_flags
[afi
][safi
],
8701 PEER_FLAG_FORCE_NEXTHOP_SELF
))
8702 json_object_boolean_true_add(json_addr
,
8703 "routerAlwaysNextHop");
8704 if (CHECK_FLAG(p
->af_flags
[afi
][safi
],
8705 PEER_FLAG_AS_PATH_UNCHANGED
))
8706 json_object_boolean_true_add(
8707 json_addr
, "unchangedAsPathPropogatedToNbr");
8708 if (CHECK_FLAG(p
->af_flags
[afi
][safi
],
8709 PEER_FLAG_NEXTHOP_UNCHANGED
))
8710 json_object_boolean_true_add(
8711 json_addr
, "unchangedNextHopPropogatedToNbr");
8712 if (CHECK_FLAG(p
->af_flags
[afi
][safi
], PEER_FLAG_MED_UNCHANGED
))
8713 json_object_boolean_true_add(
8714 json_addr
, "unchangedMedPropogatedToNbr");
8715 if (CHECK_FLAG(p
->af_flags
[afi
][safi
], PEER_FLAG_SEND_COMMUNITY
)
8716 || CHECK_FLAG(p
->af_flags
[afi
][safi
],
8717 PEER_FLAG_SEND_EXT_COMMUNITY
)) {
8718 if (CHECK_FLAG(p
->af_flags
[afi
][safi
],
8719 PEER_FLAG_SEND_COMMUNITY
)
8720 && CHECK_FLAG(p
->af_flags
[afi
][safi
],
8721 PEER_FLAG_SEND_EXT_COMMUNITY
))
8722 json_object_string_add(json_addr
,
8723 "commAttriSentToNbr",
8724 "extendedAndStandard");
8725 else if (CHECK_FLAG(p
->af_flags
[afi
][safi
],
8726 PEER_FLAG_SEND_EXT_COMMUNITY
))
8727 json_object_string_add(json_addr
,
8728 "commAttriSentToNbr",
8731 json_object_string_add(json_addr
,
8732 "commAttriSentToNbr",
8735 if (CHECK_FLAG(p
->af_flags
[afi
][safi
],
8736 PEER_FLAG_DEFAULT_ORIGINATE
)) {
8737 if (p
->default_rmap
[afi
][safi
].name
)
8738 json_object_string_add(
8739 json_addr
, "defaultRouteMap",
8740 p
->default_rmap
[afi
][safi
].name
);
8742 if (paf
&& PAF_SUBGRP(paf
)
8743 && CHECK_FLAG(PAF_SUBGRP(paf
)->sflags
,
8744 SUBGRP_STATUS_DEFAULT_ORIGINATE
))
8745 json_object_boolean_true_add(json_addr
,
8748 json_object_boolean_true_add(json_addr
,
8752 if (afi
== AFI_L2VPN
&& safi
== SAFI_EVPN
) {
8753 if (is_evpn_enabled())
8754 json_object_boolean_true_add(
8755 json_addr
, "advertiseAllVnis");
8758 if (filter
->plist
[FILTER_IN
].name
8759 || filter
->dlist
[FILTER_IN
].name
8760 || filter
->aslist
[FILTER_IN
].name
8761 || filter
->map
[RMAP_IN
].name
)
8762 json_object_boolean_true_add(json_addr
,
8763 "inboundPathPolicyConfig");
8764 if (filter
->plist
[FILTER_OUT
].name
8765 || filter
->dlist
[FILTER_OUT
].name
8766 || filter
->aslist
[FILTER_OUT
].name
8767 || filter
->map
[RMAP_OUT
].name
|| filter
->usmap
.name
)
8768 json_object_boolean_true_add(
8769 json_addr
, "outboundPathPolicyConfig");
8772 if (filter
->plist
[FILTER_IN
].name
)
8773 json_object_string_add(json_addr
,
8774 "incomingUpdatePrefixFilterList",
8775 filter
->plist
[FILTER_IN
].name
);
8776 if (filter
->plist
[FILTER_OUT
].name
)
8777 json_object_string_add(json_addr
,
8778 "outgoingUpdatePrefixFilterList",
8779 filter
->plist
[FILTER_OUT
].name
);
8781 /* distribute-list */
8782 if (filter
->dlist
[FILTER_IN
].name
)
8783 json_object_string_add(
8784 json_addr
, "incomingUpdateNetworkFilterList",
8785 filter
->dlist
[FILTER_IN
].name
);
8786 if (filter
->dlist
[FILTER_OUT
].name
)
8787 json_object_string_add(
8788 json_addr
, "outgoingUpdateNetworkFilterList",
8789 filter
->dlist
[FILTER_OUT
].name
);
8792 if (filter
->aslist
[FILTER_IN
].name
)
8793 json_object_string_add(json_addr
,
8794 "incomingUpdateAsPathFilterList",
8795 filter
->aslist
[FILTER_IN
].name
);
8796 if (filter
->aslist
[FILTER_OUT
].name
)
8797 json_object_string_add(json_addr
,
8798 "outgoingUpdateAsPathFilterList",
8799 filter
->aslist
[FILTER_OUT
].name
);
8802 if (filter
->map
[RMAP_IN
].name
)
8803 json_object_string_add(
8804 json_addr
, "routeMapForIncomingAdvertisements",
8805 filter
->map
[RMAP_IN
].name
);
8806 if (filter
->map
[RMAP_OUT
].name
)
8807 json_object_string_add(
8808 json_addr
, "routeMapForOutgoingAdvertisements",
8809 filter
->map
[RMAP_OUT
].name
);
8811 /* unsuppress-map */
8812 if (filter
->usmap
.name
)
8813 json_object_string_add(json_addr
,
8814 "selectiveUnsuppressRouteMap",
8815 filter
->usmap
.name
);
8817 /* Receive prefix count */
8818 json_object_int_add(json_addr
, "acceptedPrefixCounter",
8819 p
->pcount
[afi
][safi
]);
8820 if (paf
&& PAF_SUBGRP(paf
))
8821 json_object_int_add(json_addr
, "sentPrefixCounter",
8822 (PAF_SUBGRP(paf
))->scount
);
8824 /* Maximum prefix */
8825 if (CHECK_FLAG(p
->af_flags
[afi
][safi
], PEER_FLAG_MAX_PREFIX
)) {
8826 json_object_int_add(json_addr
, "prefixAllowedMax",
8827 p
->pmax
[afi
][safi
]);
8828 if (CHECK_FLAG(p
->af_flags
[afi
][safi
],
8829 PEER_FLAG_MAX_PREFIX_WARNING
))
8830 json_object_boolean_true_add(
8831 json_addr
, "prefixAllowedMaxWarning");
8832 json_object_int_add(json_addr
,
8833 "prefixAllowedWarningThresh",
8834 p
->pmax_threshold
[afi
][safi
]);
8835 if (p
->pmax_restart
[afi
][safi
])
8836 json_object_int_add(
8838 "prefixAllowedRestartIntervalMsecs",
8839 p
->pmax_restart
[afi
][safi
] * 60000);
8841 json_object_object_add(json_neigh
, afi_safi_print(afi
, safi
),
8845 filter
= &p
->filter
[afi
][safi
];
8847 vty_out(vty
, " For address family: %s\n",
8848 afi_safi_print(afi
, safi
));
8850 if (peer_group_active(p
))
8851 vty_out(vty
, " %s peer-group member\n",
8854 paf
= peer_af_find(p
, afi
, safi
);
8855 if (paf
&& PAF_SUBGRP(paf
)) {
8856 vty_out(vty
, " Update group %" PRIu64
8857 ", subgroup %" PRIu64
"\n",
8858 PAF_UPDGRP(paf
)->id
, PAF_SUBGRP(paf
)->id
);
8859 vty_out(vty
, " Packet Queue length %d\n",
8860 bpacket_queue_virtual_length(paf
));
8862 vty_out(vty
, " Not part of any update group\n");
8864 if (CHECK_FLAG(p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_ADV
)
8865 || CHECK_FLAG(p
->af_cap
[afi
][safi
],
8866 PEER_CAP_ORF_PREFIX_SM_RCV
)
8867 || CHECK_FLAG(p
->af_cap
[afi
][safi
],
8868 PEER_CAP_ORF_PREFIX_SM_OLD_RCV
)
8869 || CHECK_FLAG(p
->af_cap
[afi
][safi
],
8870 PEER_CAP_ORF_PREFIX_RM_ADV
)
8871 || CHECK_FLAG(p
->af_cap
[afi
][safi
],
8872 PEER_CAP_ORF_PREFIX_RM_RCV
)
8873 || CHECK_FLAG(p
->af_cap
[afi
][safi
],
8874 PEER_CAP_ORF_PREFIX_RM_OLD_RCV
))
8875 vty_out(vty
, " AF-dependant capabilities:\n");
8877 if (CHECK_FLAG(p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_ADV
)
8878 || CHECK_FLAG(p
->af_cap
[afi
][safi
],
8879 PEER_CAP_ORF_PREFIX_SM_RCV
)
8880 || CHECK_FLAG(p
->af_cap
[afi
][safi
],
8881 PEER_CAP_ORF_PREFIX_RM_ADV
)
8882 || CHECK_FLAG(p
->af_cap
[afi
][safi
],
8883 PEER_CAP_ORF_PREFIX_RM_RCV
)) {
8885 " Outbound Route Filter (ORF) type (%d) Prefix-list:\n",
8887 bgp_show_peer_afi_orf_cap(
8888 vty
, p
, afi
, safi
, PEER_CAP_ORF_PREFIX_SM_ADV
,
8889 PEER_CAP_ORF_PREFIX_RM_ADV
,
8890 PEER_CAP_ORF_PREFIX_SM_RCV
,
8891 PEER_CAP_ORF_PREFIX_RM_RCV
, use_json
, NULL
);
8893 if (CHECK_FLAG(p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_ADV
)
8894 || CHECK_FLAG(p
->af_cap
[afi
][safi
],
8895 PEER_CAP_ORF_PREFIX_SM_OLD_RCV
)
8896 || CHECK_FLAG(p
->af_cap
[afi
][safi
],
8897 PEER_CAP_ORF_PREFIX_RM_ADV
)
8898 || CHECK_FLAG(p
->af_cap
[afi
][safi
],
8899 PEER_CAP_ORF_PREFIX_RM_OLD_RCV
)) {
8901 " Outbound Route Filter (ORF) type (%d) Prefix-list:\n",
8902 ORF_TYPE_PREFIX_OLD
);
8903 bgp_show_peer_afi_orf_cap(
8904 vty
, p
, afi
, safi
, PEER_CAP_ORF_PREFIX_SM_ADV
,
8905 PEER_CAP_ORF_PREFIX_RM_ADV
,
8906 PEER_CAP_ORF_PREFIX_SM_OLD_RCV
,
8907 PEER_CAP_ORF_PREFIX_RM_OLD_RCV
, use_json
, NULL
);
8910 sprintf(orf_pfx_name
, "%s.%d.%d", p
->host
, afi
, safi
);
8911 orf_pfx_count
= prefix_bgp_show_prefix_list(
8912 NULL
, afi
, orf_pfx_name
, use_json
);
8914 if (CHECK_FLAG(p
->af_sflags
[afi
][safi
],
8915 PEER_STATUS_ORF_PREFIX_SEND
)
8917 vty_out(vty
, " Outbound Route Filter (ORF):");
8918 if (CHECK_FLAG(p
->af_sflags
[afi
][safi
],
8919 PEER_STATUS_ORF_PREFIX_SEND
))
8920 vty_out(vty
, " sent;");
8922 vty_out(vty
, " received (%d entries)",
8926 if (CHECK_FLAG(p
->af_sflags
[afi
][safi
],
8927 PEER_STATUS_ORF_WAIT_REFRESH
))
8929 " First update is deferred until ORF or ROUTE-REFRESH is received\n");
8931 if (CHECK_FLAG(p
->af_flags
[afi
][safi
],
8932 PEER_FLAG_REFLECTOR_CLIENT
))
8933 vty_out(vty
, " Route-Reflector Client\n");
8934 if (CHECK_FLAG(p
->af_flags
[afi
][safi
],
8935 PEER_FLAG_RSERVER_CLIENT
))
8936 vty_out(vty
, " Route-Server Client\n");
8937 if (CHECK_FLAG(p
->af_flags
[afi
][safi
], PEER_FLAG_SOFT_RECONFIG
))
8939 " Inbound soft reconfiguration allowed\n");
8941 if (CHECK_FLAG(p
->af_flags
[afi
][safi
],
8942 PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE
))
8944 " Private AS numbers (all) replaced in updates to this neighbor\n");
8945 else if (CHECK_FLAG(p
->af_flags
[afi
][safi
],
8946 PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE
))
8948 " Private AS numbers replaced in updates to this neighbor\n");
8949 else if (CHECK_FLAG(p
->af_flags
[afi
][safi
],
8950 PEER_FLAG_REMOVE_PRIVATE_AS_ALL
))
8952 " Private AS numbers (all) removed in updates to this neighbor\n");
8953 else if (CHECK_FLAG(p
->af_flags
[afi
][safi
],
8954 PEER_FLAG_REMOVE_PRIVATE_AS
))
8956 " Private AS numbers removed in updates to this neighbor\n");
8958 if (p
->addpath_type
[afi
][safi
] != BGP_ADDPATH_NONE
)
8959 vty_out(vty
, " %s\n",
8960 bgp_addpath_names(p
->addpath_type
[afi
][safi
])
8961 ->human_description
);
8963 if (CHECK_FLAG(p
->af_flags
[afi
][safi
], PEER_FLAG_AS_OVERRIDE
))
8965 " Override ASNs in outbound updates if aspath equals remote-as\n");
8967 if (CHECK_FLAG(p
->af_flags
[afi
][safi
], PEER_FLAG_NEXTHOP_SELF
)
8968 || CHECK_FLAG(p
->af_flags
[afi
][safi
],
8969 PEER_FLAG_FORCE_NEXTHOP_SELF
))
8970 vty_out(vty
, " NEXT_HOP is always this router\n");
8971 if (CHECK_FLAG(p
->af_flags
[afi
][safi
],
8972 PEER_FLAG_AS_PATH_UNCHANGED
))
8974 " AS_PATH is propagated unchanged to this neighbor\n");
8975 if (CHECK_FLAG(p
->af_flags
[afi
][safi
],
8976 PEER_FLAG_NEXTHOP_UNCHANGED
))
8978 " NEXT_HOP is propagated unchanged to this neighbor\n");
8979 if (CHECK_FLAG(p
->af_flags
[afi
][safi
], PEER_FLAG_MED_UNCHANGED
))
8981 " MED is propagated unchanged to this neighbor\n");
8982 if (CHECK_FLAG(p
->af_flags
[afi
][safi
], PEER_FLAG_SEND_COMMUNITY
)
8983 || CHECK_FLAG(p
->af_flags
[afi
][safi
],
8984 PEER_FLAG_SEND_EXT_COMMUNITY
)
8985 || CHECK_FLAG(p
->af_flags
[afi
][safi
],
8986 PEER_FLAG_SEND_LARGE_COMMUNITY
)) {
8988 " Community attribute sent to this neighbor");
8989 if (CHECK_FLAG(p
->af_flags
[afi
][safi
],
8990 PEER_FLAG_SEND_COMMUNITY
)
8991 && CHECK_FLAG(p
->af_flags
[afi
][safi
],
8992 PEER_FLAG_SEND_EXT_COMMUNITY
)
8993 && CHECK_FLAG(p
->af_flags
[afi
][safi
],
8994 PEER_FLAG_SEND_LARGE_COMMUNITY
))
8995 vty_out(vty
, "(all)\n");
8996 else if (CHECK_FLAG(p
->af_flags
[afi
][safi
],
8997 PEER_FLAG_SEND_LARGE_COMMUNITY
))
8998 vty_out(vty
, "(large)\n");
8999 else if (CHECK_FLAG(p
->af_flags
[afi
][safi
],
9000 PEER_FLAG_SEND_EXT_COMMUNITY
))
9001 vty_out(vty
, "(extended)\n");
9003 vty_out(vty
, "(standard)\n");
9005 if (CHECK_FLAG(p
->af_flags
[afi
][safi
],
9006 PEER_FLAG_DEFAULT_ORIGINATE
)) {
9007 vty_out(vty
, " Default information originate,");
9009 if (p
->default_rmap
[afi
][safi
].name
)
9010 vty_out(vty
, " default route-map %s%s,",
9011 p
->default_rmap
[afi
][safi
].map
? "*"
9013 p
->default_rmap
[afi
][safi
].name
);
9014 if (paf
&& PAF_SUBGRP(paf
)
9015 && CHECK_FLAG(PAF_SUBGRP(paf
)->sflags
,
9016 SUBGRP_STATUS_DEFAULT_ORIGINATE
))
9017 vty_out(vty
, " default sent\n");
9019 vty_out(vty
, " default not sent\n");
9022 /* advertise-vni-all */
9023 if (afi
== AFI_L2VPN
&& safi
== SAFI_EVPN
) {
9024 if (is_evpn_enabled())
9025 vty_out(vty
, " advertise-all-vni\n");
9028 if (filter
->plist
[FILTER_IN
].name
9029 || filter
->dlist
[FILTER_IN
].name
9030 || filter
->aslist
[FILTER_IN
].name
9031 || filter
->map
[RMAP_IN
].name
)
9032 vty_out(vty
, " Inbound path policy configured\n");
9033 if (filter
->plist
[FILTER_OUT
].name
9034 || filter
->dlist
[FILTER_OUT
].name
9035 || filter
->aslist
[FILTER_OUT
].name
9036 || filter
->map
[RMAP_OUT
].name
|| filter
->usmap
.name
)
9037 vty_out(vty
, " Outbound path policy configured\n");
9040 if (filter
->plist
[FILTER_IN
].name
)
9042 " Incoming update prefix filter list is %s%s\n",
9043 filter
->plist
[FILTER_IN
].plist
? "*" : "",
9044 filter
->plist
[FILTER_IN
].name
);
9045 if (filter
->plist
[FILTER_OUT
].name
)
9047 " Outgoing update prefix filter list is %s%s\n",
9048 filter
->plist
[FILTER_OUT
].plist
? "*" : "",
9049 filter
->plist
[FILTER_OUT
].name
);
9051 /* distribute-list */
9052 if (filter
->dlist
[FILTER_IN
].name
)
9054 " Incoming update network filter list is %s%s\n",
9055 filter
->dlist
[FILTER_IN
].alist
? "*" : "",
9056 filter
->dlist
[FILTER_IN
].name
);
9057 if (filter
->dlist
[FILTER_OUT
].name
)
9059 " Outgoing update network filter list is %s%s\n",
9060 filter
->dlist
[FILTER_OUT
].alist
? "*" : "",
9061 filter
->dlist
[FILTER_OUT
].name
);
9064 if (filter
->aslist
[FILTER_IN
].name
)
9066 " Incoming update AS path filter list is %s%s\n",
9067 filter
->aslist
[FILTER_IN
].aslist
? "*" : "",
9068 filter
->aslist
[FILTER_IN
].name
);
9069 if (filter
->aslist
[FILTER_OUT
].name
)
9071 " Outgoing update AS path filter list is %s%s\n",
9072 filter
->aslist
[FILTER_OUT
].aslist
? "*" : "",
9073 filter
->aslist
[FILTER_OUT
].name
);
9076 if (filter
->map
[RMAP_IN
].name
)
9078 " Route map for incoming advertisements is %s%s\n",
9079 filter
->map
[RMAP_IN
].map
? "*" : "",
9080 filter
->map
[RMAP_IN
].name
);
9081 if (filter
->map
[RMAP_OUT
].name
)
9083 " Route map for outgoing advertisements is %s%s\n",
9084 filter
->map
[RMAP_OUT
].map
? "*" : "",
9085 filter
->map
[RMAP_OUT
].name
);
9087 /* unsuppress-map */
9088 if (filter
->usmap
.name
)
9090 " Route map for selective unsuppress is %s%s\n",
9091 filter
->usmap
.map
? "*" : "",
9092 filter
->usmap
.name
);
9094 /* Receive prefix count */
9095 vty_out(vty
, " %ld accepted prefixes\n", p
->pcount
[afi
][safi
]);
9097 /* Maximum prefix */
9098 if (CHECK_FLAG(p
->af_flags
[afi
][safi
], PEER_FLAG_MAX_PREFIX
)) {
9099 vty_out(vty
, " Maximum prefixes allowed %ld%s\n",
9101 CHECK_FLAG(p
->af_flags
[afi
][safi
],
9102 PEER_FLAG_MAX_PREFIX_WARNING
)
9105 vty_out(vty
, " Threshold for warning message %d%%",
9106 p
->pmax_threshold
[afi
][safi
]);
9107 if (p
->pmax_restart
[afi
][safi
])
9108 vty_out(vty
, ", restart interval %d min",
9109 p
->pmax_restart
[afi
][safi
]);
9117 static void bgp_show_peer(struct vty
*vty
, struct peer
*p
, bool use_json
,
9121 char buf1
[PREFIX2STR_BUFFER
], buf
[SU_ADDRSTRLEN
];
9122 char timebuf
[BGP_UPTIME_LEN
];
9124 const char *subcode_str
;
9125 const char *code_str
;
9130 json_object
*json_neigh
= NULL
;
9136 json_neigh
= json_object_new_object();
9138 memset(dn_flag
, '\0', sizeof(dn_flag
));
9139 if (!p
->conf_if
&& peer_dynamic_neighbor(p
))
9143 if (p
->conf_if
) /* Configured interface name. */
9144 vty_out(vty
, "BGP neighbor on %s: %s, ", p
->conf_if
,
9145 BGP_PEER_SU_UNSPEC(p
)
9147 : sockunion2str(&p
->su
, buf
,
9149 else /* Configured IP address. */
9150 vty_out(vty
, "BGP neighbor is %s%s, ", dn_flag
,
9155 if (p
->conf_if
&& BGP_PEER_SU_UNSPEC(p
))
9156 json_object_string_add(json_neigh
, "bgpNeighborAddr",
9158 else if (p
->conf_if
&& !BGP_PEER_SU_UNSPEC(p
))
9159 json_object_string_add(
9160 json_neigh
, "bgpNeighborAddr",
9161 sockunion2str(&p
->su
, buf
, SU_ADDRSTRLEN
));
9163 json_object_int_add(json_neigh
, "remoteAs", p
->as
);
9165 if (p
->change_local_as
)
9166 json_object_int_add(json_neigh
, "localAs",
9167 p
->change_local_as
);
9169 json_object_int_add(json_neigh
, "localAs", p
->local_as
);
9171 if (CHECK_FLAG(p
->flags
, PEER_FLAG_LOCAL_AS_NO_PREPEND
))
9172 json_object_boolean_true_add(json_neigh
,
9173 "localAsNoPrepend");
9175 if (CHECK_FLAG(p
->flags
, PEER_FLAG_LOCAL_AS_REPLACE_AS
))
9176 json_object_boolean_true_add(json_neigh
,
9177 "localAsReplaceAs");
9179 if ((p
->as_type
== AS_SPECIFIED
) || (p
->as_type
== AS_EXTERNAL
)
9180 || (p
->as_type
== AS_INTERNAL
))
9181 vty_out(vty
, "remote AS %u, ", p
->as
);
9183 vty_out(vty
, "remote AS Unspecified, ");
9184 vty_out(vty
, "local AS %u%s%s, ",
9185 p
->change_local_as
? p
->change_local_as
: p
->local_as
,
9186 CHECK_FLAG(p
->flags
, PEER_FLAG_LOCAL_AS_NO_PREPEND
)
9189 CHECK_FLAG(p
->flags
, PEER_FLAG_LOCAL_AS_REPLACE_AS
)
9193 /* peer type internal, external, confed-internal or confed-external */
9194 if (p
->as
== p
->local_as
) {
9196 if (CHECK_FLAG(bgp
->config
, BGP_CONFIG_CONFEDERATION
))
9197 json_object_boolean_true_add(
9198 json_neigh
, "nbrConfedInternalLink");
9200 json_object_boolean_true_add(json_neigh
,
9203 if (CHECK_FLAG(bgp
->config
, BGP_CONFIG_CONFEDERATION
))
9204 vty_out(vty
, "confed-internal link\n");
9206 vty_out(vty
, "internal link\n");
9210 if (CHECK_FLAG(bgp
->config
, BGP_CONFIG_CONFEDERATION
))
9211 json_object_boolean_true_add(
9212 json_neigh
, "nbrConfedExternalLink");
9214 json_object_boolean_true_add(json_neigh
,
9217 if (bgp_confederation_peers_check(bgp
, p
->as
))
9218 vty_out(vty
, "confed-external link\n");
9220 vty_out(vty
, "external link\n");
9227 json_object_string_add(json_neigh
, "nbrDesc", p
->desc
);
9229 vty_out(vty
, " Description: %s\n", p
->desc
);
9235 json_object_string_add(json_neigh
, "hostname",
9239 json_object_string_add(json_neigh
, "domainname",
9242 if (p
->domainname
&& (p
->domainname
[0] != '\0'))
9243 vty_out(vty
, "Hostname: %s.%s\n", p
->hostname
,
9246 vty_out(vty
, "Hostname: %s\n", p
->hostname
);
9253 json_object_string_add(json_neigh
, "peerGroup",
9257 struct prefix prefix
, *range
= NULL
;
9259 sockunion2hostprefix(&(p
->su
), &prefix
);
9260 range
= peer_group_lookup_dynamic_neighbor_range(
9264 prefix2str(range
, buf1
, sizeof(buf1
));
9265 json_object_string_add(
9267 "peerSubnetRangeGroup", buf1
);
9272 " Member of peer-group %s for session parameters\n",
9276 struct prefix prefix
, *range
= NULL
;
9278 sockunion2hostprefix(&(p
->su
), &prefix
);
9279 range
= peer_group_lookup_dynamic_neighbor_range(
9283 prefix2str(range
, buf1
, sizeof(buf1
));
9285 " Belongs to the subnet range group: %s\n",
9293 /* Administrative shutdown. */
9294 if (CHECK_FLAG(p
->flags
, PEER_FLAG_SHUTDOWN
))
9295 json_object_boolean_true_add(json_neigh
,
9299 json_object_int_add(json_neigh
, "bgpVersion", 4);
9300 json_object_string_add(
9301 json_neigh
, "remoteRouterId",
9302 inet_ntop(AF_INET
, &p
->remote_id
, buf1
, sizeof(buf1
)));
9303 json_object_string_add(
9304 json_neigh
, "localRouterId",
9305 inet_ntop(AF_INET
, &bgp
->router_id
, buf1
,
9309 if (CHECK_FLAG(bgp
->config
, BGP_CONFIG_CONFEDERATION
)
9310 && bgp_confederation_peers_check(bgp
, p
->as
))
9311 json_object_boolean_true_add(json_neigh
,
9315 json_object_string_add(
9316 json_neigh
, "bgpState",
9317 lookup_msg(bgp_status_msg
, p
->status
, NULL
));
9319 if (p
->status
== Established
) {
9322 uptime
= bgp_clock();
9323 uptime
-= p
->uptime
;
9324 epoch_tbuf
= time(NULL
) - uptime
;
9326 #if CONFDATE > 20200101
9328 "bgpTimerUp should be deprecated and can be removed now");
9331 * bgpTimerUp was miliseconds that was accurate
9332 * up to 1 day, then the value returned
9333 * became garbage. So in order to provide
9334 * some level of backwards compatability,
9335 * we still provde the data, but now
9336 * we are returning the correct value
9337 * and also adding a new bgpTimerUpMsec
9338 * which will allow us to deprecate
9341 json_object_int_add(json_neigh
, "bgpTimerUp",
9343 json_object_int_add(json_neigh
, "bgpTimerUpMsec",
9345 json_object_string_add(json_neigh
, "bgpTimerUpString",
9346 peer_uptime(p
->uptime
, timebuf
,
9349 json_object_int_add(json_neigh
,
9350 "bgpTimerUpEstablishedEpoch",
9354 else if (p
->status
== Active
) {
9355 if (CHECK_FLAG(p
->flags
, PEER_FLAG_PASSIVE
))
9356 json_object_string_add(json_neigh
, "bgpStateIs",
9358 else if (CHECK_FLAG(p
->sflags
, PEER_STATUS_NSF_WAIT
))
9359 json_object_string_add(json_neigh
, "bgpStateIs",
9367 uptime
= bgp_clock();
9368 uptime
-= p
->readtime
;
9369 tm
= gmtime(&uptime
);
9370 json_object_int_add(json_neigh
, "bgpTimerLastRead",
9371 (tm
->tm_sec
* 1000) + (tm
->tm_min
* 60000)
9372 + (tm
->tm_hour
* 3600000));
9374 uptime
= bgp_clock();
9375 uptime
-= p
->last_write
;
9376 tm
= gmtime(&uptime
);
9377 json_object_int_add(json_neigh
, "bgpTimerLastWrite",
9378 (tm
->tm_sec
* 1000) + (tm
->tm_min
* 60000)
9379 + (tm
->tm_hour
* 3600000));
9381 uptime
= bgp_clock();
9382 uptime
-= p
->update_time
;
9383 tm
= gmtime(&uptime
);
9384 json_object_int_add(json_neigh
, "bgpInUpdateElapsedTimeMsecs",
9385 (tm
->tm_sec
* 1000) + (tm
->tm_min
* 60000)
9386 + (tm
->tm_hour
* 3600000));
9388 /* Configured timer values. */
9389 json_object_int_add(json_neigh
, "bgpTimerHoldTimeMsecs",
9390 p
->v_holdtime
* 1000);
9391 json_object_int_add(json_neigh
,
9392 "bgpTimerKeepAliveIntervalMsecs",
9393 p
->v_keepalive
* 1000);
9394 if (CHECK_FLAG(p
->flags
, PEER_FLAG_TIMER
)) {
9395 json_object_int_add(json_neigh
,
9396 "bgpTimerConfiguredHoldTimeMsecs",
9397 p
->holdtime
* 1000);
9398 json_object_int_add(
9400 "bgpTimerConfiguredKeepAliveIntervalMsecs",
9401 p
->keepalive
* 1000);
9402 } else if ((bgp
->default_holdtime
!= BGP_DEFAULT_HOLDTIME
)
9403 || (bgp
->default_keepalive
9404 != BGP_DEFAULT_KEEPALIVE
)) {
9405 json_object_int_add(json_neigh
,
9406 "bgpTimerConfiguredHoldTimeMsecs",
9407 bgp
->default_holdtime
);
9408 json_object_int_add(
9410 "bgpTimerConfiguredKeepAliveIntervalMsecs",
9411 bgp
->default_keepalive
);
9414 /* Administrative shutdown. */
9415 if (CHECK_FLAG(p
->flags
, PEER_FLAG_SHUTDOWN
))
9416 vty_out(vty
, " Administratively shut down\n");
9419 vty_out(vty
, " BGP version 4");
9420 vty_out(vty
, ", remote router ID %s",
9421 inet_ntop(AF_INET
, &p
->remote_id
, buf1
, sizeof(buf1
)));
9422 vty_out(vty
, ", local router ID %s\n",
9423 inet_ntop(AF_INET
, &bgp
->router_id
, buf1
,
9427 if (CHECK_FLAG(bgp
->config
, BGP_CONFIG_CONFEDERATION
)
9428 && bgp_confederation_peers_check(bgp
, p
->as
))
9430 " Neighbor under common administration\n");
9433 vty_out(vty
, " BGP state = %s",
9434 lookup_msg(bgp_status_msg
, p
->status
, NULL
));
9436 if (p
->status
== Established
)
9437 vty_out(vty
, ", up for %8s",
9438 peer_uptime(p
->uptime
, timebuf
, BGP_UPTIME_LEN
,
9441 else if (p
->status
== Active
) {
9442 if (CHECK_FLAG(p
->flags
, PEER_FLAG_PASSIVE
))
9443 vty_out(vty
, " (passive)");
9444 else if (CHECK_FLAG(p
->sflags
, PEER_STATUS_NSF_WAIT
))
9445 vty_out(vty
, " (NSF passive)");
9450 vty_out(vty
, " Last read %s",
9451 peer_uptime(p
->readtime
, timebuf
, BGP_UPTIME_LEN
, 0,
9453 vty_out(vty
, ", Last write %s\n",
9454 peer_uptime(p
->last_write
, timebuf
, BGP_UPTIME_LEN
, 0,
9457 /* Configured timer values. */
9459 " Hold time is %d, keepalive interval is %d seconds\n",
9460 p
->v_holdtime
, p
->v_keepalive
);
9461 if (CHECK_FLAG(p
->flags
, PEER_FLAG_TIMER
)) {
9462 vty_out(vty
, " Configured hold time is %d",
9464 vty_out(vty
, ", keepalive interval is %d seconds\n",
9466 } else if ((bgp
->default_holdtime
!= BGP_DEFAULT_HOLDTIME
)
9467 || (bgp
->default_keepalive
9468 != BGP_DEFAULT_KEEPALIVE
)) {
9469 vty_out(vty
, " Configured hold time is %d",
9470 bgp
->default_holdtime
);
9471 vty_out(vty
, ", keepalive interval is %d seconds\n",
9472 bgp
->default_keepalive
);
9476 if (p
->status
== Established
) {
9477 if (p
->cap
|| p
->afc_adv
[AFI_IP
][SAFI_UNICAST
]
9478 || p
->afc_recv
[AFI_IP
][SAFI_UNICAST
]
9479 || p
->afc_adv
[AFI_IP
][SAFI_MULTICAST
]
9480 || p
->afc_recv
[AFI_IP
][SAFI_MULTICAST
]
9481 || p
->afc_adv
[AFI_IP6
][SAFI_UNICAST
]
9482 || p
->afc_recv
[AFI_IP6
][SAFI_UNICAST
]
9483 || p
->afc_adv
[AFI_IP6
][SAFI_MULTICAST
]
9484 || p
->afc_recv
[AFI_IP6
][SAFI_MULTICAST
]
9485 || p
->afc_adv
[AFI_IP6
][SAFI_MPLS_VPN
]
9486 || p
->afc_recv
[AFI_IP6
][SAFI_MPLS_VPN
]
9487 || p
->afc_adv
[AFI_IP6
][SAFI_ENCAP
]
9488 || p
->afc_recv
[AFI_IP6
][SAFI_ENCAP
]
9489 || p
->afc_adv
[AFI_IP6
][SAFI_FLOWSPEC
]
9490 || p
->afc_recv
[AFI_IP6
][SAFI_FLOWSPEC
]
9491 || p
->afc_adv
[AFI_IP
][SAFI_ENCAP
]
9492 || p
->afc_recv
[AFI_IP
][SAFI_ENCAP
]
9493 || p
->afc_adv
[AFI_IP
][SAFI_FLOWSPEC
]
9494 || p
->afc_recv
[AFI_IP
][SAFI_FLOWSPEC
]
9495 || p
->afc_adv
[AFI_IP
][SAFI_MPLS_VPN
]
9496 || p
->afc_recv
[AFI_IP
][SAFI_MPLS_VPN
]) {
9498 json_object
*json_cap
= NULL
;
9500 json_cap
= json_object_new_object();
9503 if (CHECK_FLAG(p
->cap
, PEER_CAP_AS4_RCV
)
9504 || CHECK_FLAG(p
->cap
, PEER_CAP_AS4_ADV
)) {
9505 if (CHECK_FLAG(p
->cap
, PEER_CAP_AS4_ADV
)
9506 && CHECK_FLAG(p
->cap
,
9508 json_object_string_add(
9509 json_cap
, "4byteAs",
9510 "advertisedAndReceived");
9511 else if (CHECK_FLAG(p
->cap
,
9513 json_object_string_add(
9514 json_cap
, "4byteAs",
9516 else if (CHECK_FLAG(p
->cap
,
9518 json_object_string_add(
9519 json_cap
, "4byteAs",
9524 if (CHECK_FLAG(p
->cap
, PEER_CAP_ADDPATH_RCV
)
9525 || CHECK_FLAG(p
->cap
,
9526 PEER_CAP_ADDPATH_ADV
)) {
9527 json_object
*json_add
= NULL
;
9528 const char *print_store
;
9530 json_add
= json_object_new_object();
9532 FOREACH_AFI_SAFI (afi
, safi
) {
9533 json_object
*json_sub
= NULL
;
9535 json_object_new_object();
9536 print_store
= afi_safi_print(
9542 PEER_CAP_ADDPATH_AF_TX_ADV
)
9546 PEER_CAP_ADDPATH_AF_TX_RCV
)) {
9551 PEER_CAP_ADDPATH_AF_TX_ADV
)
9556 PEER_CAP_ADDPATH_AF_TX_RCV
))
9557 json_object_boolean_true_add(
9559 "txAdvertisedAndReceived");
9565 PEER_CAP_ADDPATH_AF_TX_ADV
))
9566 json_object_boolean_true_add(
9574 PEER_CAP_ADDPATH_AF_TX_RCV
))
9575 json_object_boolean_true_add(
9583 PEER_CAP_ADDPATH_AF_RX_ADV
)
9587 PEER_CAP_ADDPATH_AF_RX_RCV
)) {
9592 PEER_CAP_ADDPATH_AF_RX_ADV
)
9597 PEER_CAP_ADDPATH_AF_RX_RCV
))
9598 json_object_boolean_true_add(
9600 "rxAdvertisedAndReceived");
9606 PEER_CAP_ADDPATH_AF_RX_ADV
))
9607 json_object_boolean_true_add(
9615 PEER_CAP_ADDPATH_AF_RX_RCV
))
9616 json_object_boolean_true_add(
9624 PEER_CAP_ADDPATH_AF_TX_ADV
)
9628 PEER_CAP_ADDPATH_AF_TX_RCV
)
9632 PEER_CAP_ADDPATH_AF_RX_ADV
)
9636 PEER_CAP_ADDPATH_AF_RX_RCV
))
9637 json_object_object_add(
9646 json_object_object_add(
9647 json_cap
, "addPath", json_add
);
9651 if (CHECK_FLAG(p
->cap
, PEER_CAP_DYNAMIC_RCV
)
9652 || CHECK_FLAG(p
->cap
,
9653 PEER_CAP_DYNAMIC_ADV
)) {
9654 if (CHECK_FLAG(p
->cap
,
9655 PEER_CAP_DYNAMIC_ADV
)
9656 && CHECK_FLAG(p
->cap
,
9657 PEER_CAP_DYNAMIC_RCV
))
9658 json_object_string_add(
9659 json_cap
, "dynamic",
9660 "advertisedAndReceived");
9661 else if (CHECK_FLAG(
9663 PEER_CAP_DYNAMIC_ADV
))
9664 json_object_string_add(
9665 json_cap
, "dynamic",
9667 else if (CHECK_FLAG(
9669 PEER_CAP_DYNAMIC_RCV
))
9670 json_object_string_add(
9671 json_cap
, "dynamic",
9675 /* Extended nexthop */
9676 if (CHECK_FLAG(p
->cap
, PEER_CAP_ENHE_RCV
)
9677 || CHECK_FLAG(p
->cap
, PEER_CAP_ENHE_ADV
)) {
9678 json_object
*json_nxt
= NULL
;
9679 const char *print_store
;
9682 if (CHECK_FLAG(p
->cap
,
9684 && CHECK_FLAG(p
->cap
,
9686 json_object_string_add(
9689 "advertisedAndReceived");
9690 else if (CHECK_FLAG(p
->cap
,
9692 json_object_string_add(
9696 else if (CHECK_FLAG(p
->cap
,
9698 json_object_string_add(
9703 if (CHECK_FLAG(p
->cap
,
9704 PEER_CAP_ENHE_RCV
)) {
9706 json_object_new_object();
9708 for (safi
= SAFI_UNICAST
;
9709 safi
< SAFI_MAX
; safi
++) {
9714 PEER_CAP_ENHE_AF_RCV
)) {
9715 print_store
= afi_safi_print(
9718 json_object_string_add(
9724 json_object_object_add(
9726 "extendedNexthopFamililesByPeer",
9732 if (CHECK_FLAG(p
->cap
, PEER_CAP_REFRESH_ADV
)
9733 || CHECK_FLAG(p
->cap
,
9734 PEER_CAP_REFRESH_NEW_RCV
)
9735 || CHECK_FLAG(p
->cap
,
9736 PEER_CAP_REFRESH_OLD_RCV
)) {
9737 if (CHECK_FLAG(p
->cap
,
9738 PEER_CAP_REFRESH_ADV
)
9741 PEER_CAP_REFRESH_NEW_RCV
)
9744 PEER_CAP_REFRESH_OLD_RCV
))) {
9747 PEER_CAP_REFRESH_OLD_RCV
)
9750 PEER_CAP_REFRESH_NEW_RCV
))
9751 json_object_string_add(
9754 "advertisedAndReceivedOldNew");
9758 PEER_CAP_REFRESH_OLD_RCV
))
9759 json_object_string_add(
9762 "advertisedAndReceivedOld");
9764 json_object_string_add(
9767 "advertisedAndReceivedNew");
9772 PEER_CAP_REFRESH_ADV
))
9773 json_object_string_add(
9780 PEER_CAP_REFRESH_NEW_RCV
)
9783 PEER_CAP_REFRESH_OLD_RCV
))
9784 json_object_string_add(
9790 /* Multiprotocol Extensions */
9791 json_object
*json_multi
= NULL
;
9792 json_multi
= json_object_new_object();
9794 FOREACH_AFI_SAFI (afi
, safi
) {
9795 if (p
->afc_adv
[afi
][safi
]
9796 || p
->afc_recv
[afi
][safi
]) {
9797 json_object
*json_exten
= NULL
;
9799 json_object_new_object();
9801 if (p
->afc_adv
[afi
][safi
]
9802 && p
->afc_recv
[afi
][safi
])
9803 json_object_boolean_true_add(
9805 "advertisedAndReceived");
9806 else if (p
->afc_adv
[afi
][safi
])
9807 json_object_boolean_true_add(
9810 else if (p
->afc_recv
[afi
][safi
])
9811 json_object_boolean_true_add(
9815 json_object_object_add(
9822 json_object_object_add(
9823 json_cap
, "multiprotocolExtensions",
9826 /* Hostname capabilities */
9827 json_object
*json_hname
= NULL
;
9829 json_hname
= json_object_new_object();
9831 if (CHECK_FLAG(p
->cap
, PEER_CAP_HOSTNAME_ADV
)) {
9832 json_object_string_add(
9833 json_hname
, "advHostName",
9834 bgp
->peer_self
->hostname
9838 json_object_string_add(
9839 json_hname
, "advDomainName",
9840 bgp
->peer_self
->domainname
9847 if (CHECK_FLAG(p
->cap
, PEER_CAP_HOSTNAME_RCV
)) {
9848 json_object_string_add(
9849 json_hname
, "rcvHostName",
9850 p
->hostname
? p
->hostname
9852 json_object_string_add(
9853 json_hname
, "rcvDomainName",
9854 p
->domainname
? p
->domainname
9858 json_object_object_add(json_cap
, "hostName",
9861 /* Gracefull Restart */
9862 if (CHECK_FLAG(p
->cap
, PEER_CAP_RESTART_RCV
)
9863 || CHECK_FLAG(p
->cap
,
9864 PEER_CAP_RESTART_ADV
)) {
9865 if (CHECK_FLAG(p
->cap
,
9866 PEER_CAP_RESTART_ADV
)
9867 && CHECK_FLAG(p
->cap
,
9868 PEER_CAP_RESTART_RCV
))
9869 json_object_string_add(
9872 "advertisedAndReceived");
9873 else if (CHECK_FLAG(
9875 PEER_CAP_RESTART_ADV
))
9876 json_object_string_add(
9878 "gracefulRestartCapability",
9880 else if (CHECK_FLAG(
9882 PEER_CAP_RESTART_RCV
))
9883 json_object_string_add(
9885 "gracefulRestartCapability",
9888 if (CHECK_FLAG(p
->cap
,
9889 PEER_CAP_RESTART_RCV
)) {
9890 int restart_af_count
= 0;
9891 json_object
*json_restart
=
9894 json_object_new_object();
9896 json_object_int_add(
9898 "gracefulRestartRemoteTimerMsecs",
9899 p
->v_gr_restart
* 1000);
9901 FOREACH_AFI_SAFI (afi
, safi
) {
9906 PEER_CAP_RESTART_AF_RCV
)) {
9911 json_object_new_object();
9917 PEER_CAP_RESTART_AF_PRESERVE_RCV
))
9918 json_object_boolean_true_add(
9922 json_object_object_add(
9930 if (!restart_af_count
) {
9931 json_object_string_add(
9933 "addressFamiliesByPeer",
9938 json_object_object_add(
9940 "addressFamiliesByPeer",
9944 json_object_object_add(json_neigh
,
9945 "neighborCapabilities",
9948 vty_out(vty
, " Neighbor capabilities:\n");
9951 if (CHECK_FLAG(p
->cap
, PEER_CAP_AS4_RCV
)
9952 || CHECK_FLAG(p
->cap
, PEER_CAP_AS4_ADV
)) {
9953 vty_out(vty
, " 4 Byte AS:");
9954 if (CHECK_FLAG(p
->cap
,
9956 vty_out(vty
, " advertised");
9957 if (CHECK_FLAG(p
->cap
,
9959 vty_out(vty
, " %sreceived",
9969 if (CHECK_FLAG(p
->cap
, PEER_CAP_ADDPATH_RCV
)
9970 || CHECK_FLAG(p
->cap
,
9971 PEER_CAP_ADDPATH_ADV
)) {
9972 vty_out(vty
, " AddPath:\n");
9974 FOREACH_AFI_SAFI (afi
, safi
) {
9978 PEER_CAP_ADDPATH_AF_TX_ADV
)
9982 PEER_CAP_ADDPATH_AF_TX_RCV
)) {
9993 PEER_CAP_ADDPATH_AF_TX_ADV
))
10004 PEER_CAP_ADDPATH_AF_TX_RCV
))
10011 PEER_CAP_ADDPATH_AF_TX_ADV
)
10015 vty_out(vty
, "\n");
10021 PEER_CAP_ADDPATH_AF_RX_ADV
)
10025 PEER_CAP_ADDPATH_AF_RX_RCV
)) {
10036 PEER_CAP_ADDPATH_AF_RX_ADV
))
10047 PEER_CAP_ADDPATH_AF_RX_RCV
))
10054 PEER_CAP_ADDPATH_AF_RX_ADV
)
10058 vty_out(vty
, "\n");
10064 if (CHECK_FLAG(p
->cap
, PEER_CAP_DYNAMIC_RCV
)
10065 || CHECK_FLAG(p
->cap
,
10066 PEER_CAP_DYNAMIC_ADV
)) {
10067 vty_out(vty
, " Dynamic:");
10068 if (CHECK_FLAG(p
->cap
,
10069 PEER_CAP_DYNAMIC_ADV
))
10070 vty_out(vty
, " advertised");
10071 if (CHECK_FLAG(p
->cap
,
10072 PEER_CAP_DYNAMIC_RCV
))
10073 vty_out(vty
, " %sreceived",
10076 PEER_CAP_DYNAMIC_ADV
)
10079 vty_out(vty
, "\n");
10082 /* Extended nexthop */
10083 if (CHECK_FLAG(p
->cap
, PEER_CAP_ENHE_RCV
)
10084 || CHECK_FLAG(p
->cap
, PEER_CAP_ENHE_ADV
)) {
10085 vty_out(vty
, " Extended nexthop:");
10086 if (CHECK_FLAG(p
->cap
,
10087 PEER_CAP_ENHE_ADV
))
10088 vty_out(vty
, " advertised");
10089 if (CHECK_FLAG(p
->cap
,
10090 PEER_CAP_ENHE_RCV
))
10091 vty_out(vty
, " %sreceived",
10097 vty_out(vty
, "\n");
10099 if (CHECK_FLAG(p
->cap
,
10100 PEER_CAP_ENHE_RCV
)) {
10102 " Address families by peer:\n ");
10103 for (safi
= SAFI_UNICAST
;
10104 safi
< SAFI_MAX
; safi
++)
10109 PEER_CAP_ENHE_AF_RCV
))
10118 /* Route Refresh */
10119 if (CHECK_FLAG(p
->cap
, PEER_CAP_REFRESH_ADV
)
10120 || CHECK_FLAG(p
->cap
,
10121 PEER_CAP_REFRESH_NEW_RCV
)
10122 || CHECK_FLAG(p
->cap
,
10123 PEER_CAP_REFRESH_OLD_RCV
)) {
10124 vty_out(vty
, " Route refresh:");
10125 if (CHECK_FLAG(p
->cap
,
10126 PEER_CAP_REFRESH_ADV
))
10127 vty_out(vty
, " advertised");
10128 if (CHECK_FLAG(p
->cap
,
10129 PEER_CAP_REFRESH_NEW_RCV
)
10132 PEER_CAP_REFRESH_OLD_RCV
))
10133 vty_out(vty
, " %sreceived(%s)",
10136 PEER_CAP_REFRESH_ADV
)
10141 PEER_CAP_REFRESH_OLD_RCV
)
10144 PEER_CAP_REFRESH_NEW_RCV
))
10148 PEER_CAP_REFRESH_OLD_RCV
)
10152 vty_out(vty
, "\n");
10155 /* Multiprotocol Extensions */
10156 FOREACH_AFI_SAFI (afi
, safi
)
10157 if (p
->afc_adv
[afi
][safi
]
10158 || p
->afc_recv
[afi
][safi
]) {
10160 " Address Family %s:",
10161 afi_safi_print(afi
,
10163 if (p
->afc_adv
[afi
][safi
])
10166 if (p
->afc_recv
[afi
][safi
])
10173 vty_out(vty
, "\n");
10176 /* Hostname capability */
10177 vty_out(vty
, " Hostname Capability:");
10179 if (CHECK_FLAG(p
->cap
, PEER_CAP_HOSTNAME_ADV
)) {
10181 " advertised (name: %s,domain name: %s)",
10182 bgp
->peer_self
->hostname
10186 bgp
->peer_self
->domainname
10191 vty_out(vty
, " not advertised");
10194 if (CHECK_FLAG(p
->cap
, PEER_CAP_HOSTNAME_RCV
)) {
10196 " received (name: %s,domain name: %s)",
10197 p
->hostname
? p
->hostname
10199 p
->domainname
? p
->domainname
10202 vty_out(vty
, " not received");
10205 vty_out(vty
, "\n");
10207 /* Gracefull Restart */
10208 if (CHECK_FLAG(p
->cap
, PEER_CAP_RESTART_RCV
)
10209 || CHECK_FLAG(p
->cap
,
10210 PEER_CAP_RESTART_ADV
)) {
10212 " Graceful Restart Capabilty:");
10213 if (CHECK_FLAG(p
->cap
,
10214 PEER_CAP_RESTART_ADV
))
10215 vty_out(vty
, " advertised");
10216 if (CHECK_FLAG(p
->cap
,
10217 PEER_CAP_RESTART_RCV
))
10218 vty_out(vty
, " %sreceived",
10221 PEER_CAP_RESTART_ADV
)
10224 vty_out(vty
, "\n");
10226 if (CHECK_FLAG(p
->cap
,
10227 PEER_CAP_RESTART_RCV
)) {
10228 int restart_af_count
= 0;
10231 " Remote Restart timer is %d seconds\n",
10234 " Address families by peer:\n ");
10236 FOREACH_AFI_SAFI (afi
, safi
)
10241 PEER_CAP_RESTART_AF_RCV
)) {
10254 PEER_CAP_RESTART_AF_PRESERVE_RCV
)
10256 : "not preserved");
10257 restart_af_count
++;
10259 if (!restart_af_count
)
10260 vty_out(vty
, "none");
10261 vty_out(vty
, "\n");
10268 /* graceful restart information */
10269 if (CHECK_FLAG(p
->cap
, PEER_CAP_RESTART_RCV
) || p
->t_gr_restart
10270 || p
->t_gr_stale
) {
10271 json_object
*json_grace
= NULL
;
10272 json_object
*json_grace_send
= NULL
;
10273 json_object
*json_grace_recv
= NULL
;
10274 int eor_send_af_count
= 0;
10275 int eor_receive_af_count
= 0;
10278 json_grace
= json_object_new_object();
10279 json_grace_send
= json_object_new_object();
10280 json_grace_recv
= json_object_new_object();
10282 if (p
->status
== Established
) {
10283 FOREACH_AFI_SAFI (afi
, safi
) {
10284 if (CHECK_FLAG(p
->af_sflags
[afi
][safi
],
10285 PEER_STATUS_EOR_SEND
)) {
10286 json_object_boolean_true_add(
10288 afi_safi_print(afi
,
10290 eor_send_af_count
++;
10293 FOREACH_AFI_SAFI (afi
, safi
) {
10295 p
->af_sflags
[afi
][safi
],
10296 PEER_STATUS_EOR_RECEIVED
)) {
10297 json_object_boolean_true_add(
10299 afi_safi_print(afi
,
10301 eor_receive_af_count
++;
10306 json_object_object_add(json_grace
, "endOfRibSend",
10308 json_object_object_add(json_grace
, "endOfRibRecv",
10311 if (p
->t_gr_restart
)
10312 json_object_int_add(json_grace
,
10313 "gracefulRestartTimerMsecs",
10314 thread_timer_remain_second(
10319 json_object_int_add(
10321 "gracefulStalepathTimerMsecs",
10322 thread_timer_remain_second(
10326 json_object_object_add(
10327 json_neigh
, "gracefulRestartInfo", json_grace
);
10329 vty_out(vty
, " Graceful restart information:\n");
10330 if (p
->status
== Established
) {
10331 vty_out(vty
, " End-of-RIB send: ");
10332 FOREACH_AFI_SAFI (afi
, safi
) {
10333 if (CHECK_FLAG(p
->af_sflags
[afi
][safi
],
10334 PEER_STATUS_EOR_SEND
)) {
10335 vty_out(vty
, "%s%s",
10336 eor_send_af_count
? ", "
10338 afi_safi_print(afi
,
10340 eor_send_af_count
++;
10343 vty_out(vty
, "\n");
10344 vty_out(vty
, " End-of-RIB received: ");
10345 FOREACH_AFI_SAFI (afi
, safi
) {
10347 p
->af_sflags
[afi
][safi
],
10348 PEER_STATUS_EOR_RECEIVED
)) {
10349 vty_out(vty
, "%s%s",
10350 eor_receive_af_count
10353 afi_safi_print(afi
,
10355 eor_receive_af_count
++;
10358 vty_out(vty
, "\n");
10361 if (p
->t_gr_restart
)
10363 " The remaining time of restart timer is %ld\n",
10364 thread_timer_remain_second(
10369 " The remaining time of stalepath timer is %ld\n",
10370 thread_timer_remain_second(
10375 json_object
*json_stat
= NULL
;
10376 json_stat
= json_object_new_object();
10377 /* Packet counts. */
10378 json_object_int_add(json_stat
, "depthInq", 0);
10379 json_object_int_add(json_stat
, "depthOutq",
10380 (unsigned long)p
->obuf
->count
);
10381 json_object_int_add(json_stat
, "opensSent",
10382 atomic_load_explicit(&p
->open_out
,
10383 memory_order_relaxed
));
10384 json_object_int_add(json_stat
, "opensRecv",
10385 atomic_load_explicit(&p
->open_in
,
10386 memory_order_relaxed
));
10387 json_object_int_add(json_stat
, "notificationsSent",
10388 atomic_load_explicit(&p
->notify_out
,
10389 memory_order_relaxed
));
10390 json_object_int_add(json_stat
, "notificationsRecv",
10391 atomic_load_explicit(&p
->notify_in
,
10392 memory_order_relaxed
));
10393 json_object_int_add(json_stat
, "updatesSent",
10394 atomic_load_explicit(&p
->update_out
,
10395 memory_order_relaxed
));
10396 json_object_int_add(json_stat
, "updatesRecv",
10397 atomic_load_explicit(&p
->update_in
,
10398 memory_order_relaxed
));
10399 json_object_int_add(json_stat
, "keepalivesSent",
10400 atomic_load_explicit(&p
->keepalive_out
,
10401 memory_order_relaxed
));
10402 json_object_int_add(json_stat
, "keepalivesRecv",
10403 atomic_load_explicit(&p
->keepalive_in
,
10404 memory_order_relaxed
));
10405 json_object_int_add(json_stat
, "routeRefreshSent",
10406 atomic_load_explicit(&p
->refresh_out
,
10407 memory_order_relaxed
));
10408 json_object_int_add(json_stat
, "routeRefreshRecv",
10409 atomic_load_explicit(&p
->refresh_in
,
10410 memory_order_relaxed
));
10411 json_object_int_add(json_stat
, "capabilitySent",
10412 atomic_load_explicit(&p
->dynamic_cap_out
,
10413 memory_order_relaxed
));
10414 json_object_int_add(json_stat
, "capabilityRecv",
10415 atomic_load_explicit(&p
->dynamic_cap_in
,
10416 memory_order_relaxed
));
10417 json_object_int_add(json_stat
, "totalSent", PEER_TOTAL_TX(p
));
10418 json_object_int_add(json_stat
, "totalRecv", PEER_TOTAL_RX(p
));
10419 json_object_object_add(json_neigh
, "messageStats", json_stat
);
10421 /* Packet counts. */
10422 vty_out(vty
, " Message statistics:\n");
10423 vty_out(vty
, " Inq depth is 0\n");
10424 vty_out(vty
, " Outq depth is %lu\n",
10425 (unsigned long)p
->obuf
->count
);
10426 vty_out(vty
, " Sent Rcvd\n");
10427 vty_out(vty
, " Opens: %10d %10d\n",
10428 atomic_load_explicit(&p
->open_out
,
10429 memory_order_relaxed
),
10430 atomic_load_explicit(&p
->open_in
,
10431 memory_order_relaxed
));
10432 vty_out(vty
, " Notifications: %10d %10d\n",
10433 atomic_load_explicit(&p
->notify_out
,
10434 memory_order_relaxed
),
10435 atomic_load_explicit(&p
->notify_in
,
10436 memory_order_relaxed
));
10437 vty_out(vty
, " Updates: %10d %10d\n",
10438 atomic_load_explicit(&p
->update_out
,
10439 memory_order_relaxed
),
10440 atomic_load_explicit(&p
->update_in
,
10441 memory_order_relaxed
));
10442 vty_out(vty
, " Keepalives: %10d %10d\n",
10443 atomic_load_explicit(&p
->keepalive_out
,
10444 memory_order_relaxed
),
10445 atomic_load_explicit(&p
->keepalive_in
,
10446 memory_order_relaxed
));
10447 vty_out(vty
, " Route Refresh: %10d %10d\n",
10448 atomic_load_explicit(&p
->refresh_out
,
10449 memory_order_relaxed
),
10450 atomic_load_explicit(&p
->refresh_in
,
10451 memory_order_relaxed
));
10452 vty_out(vty
, " Capability: %10d %10d\n",
10453 atomic_load_explicit(&p
->dynamic_cap_out
,
10454 memory_order_relaxed
),
10455 atomic_load_explicit(&p
->dynamic_cap_in
,
10456 memory_order_relaxed
));
10457 vty_out(vty
, " Total: %10d %10d\n", PEER_TOTAL_TX(p
),
10462 /* advertisement-interval */
10463 json_object_int_add(json_neigh
,
10464 "minBtwnAdvertisementRunsTimerMsecs",
10465 p
->v_routeadv
* 1000);
10467 /* Update-source. */
10468 if (p
->update_if
|| p
->update_source
) {
10470 json_object_string_add(json_neigh
,
10473 else if (p
->update_source
)
10474 json_object_string_add(
10475 json_neigh
, "updateSource",
10476 sockunion2str(p
->update_source
, buf1
,
10480 /* advertisement-interval */
10482 " Minimum time between advertisement runs is %d seconds\n",
10485 /* Update-source. */
10486 if (p
->update_if
|| p
->update_source
) {
10487 vty_out(vty
, " Update source is ");
10489 vty_out(vty
, "%s", p
->update_if
);
10490 else if (p
->update_source
)
10492 sockunion2str(p
->update_source
, buf1
,
10494 vty_out(vty
, "\n");
10497 vty_out(vty
, "\n");
10500 /* Address Family Information */
10501 json_object
*json_hold
= NULL
;
10504 json_hold
= json_object_new_object();
10506 FOREACH_AFI_SAFI (afi
, safi
)
10507 if (p
->afc
[afi
][safi
])
10508 bgp_show_peer_afi(vty
, p
, afi
, safi
, use_json
,
10512 json_object_object_add(json_neigh
, "addressFamilyInfo",
10514 json_object_int_add(json_neigh
, "connectionsEstablished",
10516 json_object_int_add(json_neigh
, "connectionsDropped",
10519 vty_out(vty
, " Connections established %d; dropped %d\n",
10520 p
->established
, p
->dropped
);
10522 if (!p
->last_reset
) {
10524 json_object_string_add(json_neigh
, "lastReset",
10527 vty_out(vty
, " Last reset never\n");
10533 uptime
= bgp_clock();
10534 uptime
-= p
->resettime
;
10535 tm
= gmtime(&uptime
);
10536 json_object_int_add(json_neigh
, "lastResetTimerMsecs",
10537 (tm
->tm_sec
* 1000)
10538 + (tm
->tm_min
* 60000)
10539 + (tm
->tm_hour
* 3600000));
10540 json_object_string_add(
10541 json_neigh
, "lastResetDueTo",
10542 peer_down_str
[(int)p
->last_reset
]);
10543 if (p
->last_reset
== PEER_DOWN_NOTIFY_SEND
10544 || p
->last_reset
== PEER_DOWN_NOTIFY_RECEIVED
) {
10545 char errorcodesubcode_hexstr
[5];
10546 char errorcodesubcode_str
[256];
10548 code_str
= bgp_notify_code_str(p
->notify
.code
);
10549 subcode_str
= bgp_notify_subcode_str(
10550 p
->notify
.code
, p
->notify
.subcode
);
10552 sprintf(errorcodesubcode_hexstr
, "%02X%02X",
10553 p
->notify
.code
, p
->notify
.subcode
);
10554 json_object_string_add(json_neigh
,
10555 "lastErrorCodeSubcode",
10556 errorcodesubcode_hexstr
);
10557 snprintf(errorcodesubcode_str
, 255, "%s%s",
10558 code_str
, subcode_str
);
10559 json_object_string_add(json_neigh
,
10560 "lastNotificationReason",
10561 errorcodesubcode_str
);
10562 if (p
->last_reset
== PEER_DOWN_NOTIFY_RECEIVED
10563 && p
->notify
.code
== BGP_NOTIFY_CEASE
10564 && (p
->notify
.subcode
10565 == BGP_NOTIFY_CEASE_ADMIN_SHUTDOWN
10566 || p
->notify
.subcode
10567 == BGP_NOTIFY_CEASE_ADMIN_RESET
)
10568 && p
->notify
.length
) {
10570 const char *msg_str
;
10572 msg_str
= bgp_notify_admin_message(
10573 msgbuf
, sizeof(msgbuf
),
10574 (uint8_t *)p
->notify
.data
,
10577 json_object_string_add(
10579 "lastShutdownDescription",
10584 vty_out(vty
, " Last reset %s, ",
10585 peer_uptime(p
->resettime
, timebuf
,
10586 BGP_UPTIME_LEN
, 0, NULL
));
10588 if (p
->last_reset
== PEER_DOWN_NOTIFY_SEND
10589 || p
->last_reset
== PEER_DOWN_NOTIFY_RECEIVED
) {
10590 code_str
= bgp_notify_code_str(p
->notify
.code
);
10591 subcode_str
= bgp_notify_subcode_str(
10592 p
->notify
.code
, p
->notify
.subcode
);
10593 vty_out(vty
, "due to NOTIFICATION %s (%s%s)\n",
10594 p
->last_reset
== PEER_DOWN_NOTIFY_SEND
10597 code_str
, subcode_str
);
10598 if (p
->last_reset
== PEER_DOWN_NOTIFY_RECEIVED
10599 && p
->notify
.code
== BGP_NOTIFY_CEASE
10600 && (p
->notify
.subcode
10601 == BGP_NOTIFY_CEASE_ADMIN_SHUTDOWN
10602 || p
->notify
.subcode
10603 == BGP_NOTIFY_CEASE_ADMIN_RESET
)
10604 && p
->notify
.length
) {
10606 const char *msg_str
;
10608 msg_str
= bgp_notify_admin_message(
10609 msgbuf
, sizeof(msgbuf
),
10610 (uint8_t *)p
->notify
.data
,
10614 " Message: \"%s\"\n",
10618 vty_out(vty
, "due to %s\n",
10619 peer_down_str
[(int)p
->last_reset
]);
10622 if (p
->last_reset_cause_size
) {
10623 msg
= p
->last_reset_cause
;
10625 " Message received that caused BGP to send a NOTIFICATION:\n ");
10626 for (i
= 1; i
<= p
->last_reset_cause_size
;
10628 vty_out(vty
, "%02X", *msg
++);
10630 if (i
!= p
->last_reset_cause_size
) {
10632 vty_out(vty
, "\n ");
10633 } else if (i
% 4 == 0) {
10638 vty_out(vty
, "\n");
10643 if (CHECK_FLAG(p
->sflags
, PEER_STATUS_PREFIX_OVERFLOW
)) {
10645 json_object_boolean_true_add(json_neigh
,
10646 "prefixesConfigExceedMax");
10649 " Peer had exceeded the max. no. of prefixes configured.\n");
10651 if (p
->t_pmax_restart
) {
10653 json_object_boolean_true_add(
10654 json_neigh
, "reducePrefixNumFrom");
10655 json_object_int_add(json_neigh
,
10656 "restartInTimerMsec",
10657 thread_timer_remain_second(
10662 " Reduce the no. of prefix from %s, will restart in %ld seconds\n",
10663 p
->host
, thread_timer_remain_second(
10664 p
->t_pmax_restart
));
10667 json_object_boolean_true_add(
10669 "reducePrefixNumAndClearIpBgp");
10672 " Reduce the no. of prefix and clear ip bgp %s to restore peering\n",
10677 /* EBGP Multihop and GTSM */
10678 if (p
->sort
!= BGP_PEER_IBGP
) {
10680 if (p
->gtsm_hops
> 0)
10681 json_object_int_add(json_neigh
,
10682 "externalBgpNbrMaxHopsAway",
10684 else if (p
->ttl
> 1)
10685 json_object_int_add(json_neigh
,
10686 "externalBgpNbrMaxHopsAway",
10689 if (p
->gtsm_hops
> 0)
10691 " External BGP neighbor may be up to %d hops away.\n",
10693 else if (p
->ttl
> 1)
10695 " External BGP neighbor may be up to %d hops away.\n",
10699 if (p
->gtsm_hops
> 0) {
10701 json_object_int_add(json_neigh
,
10702 "internalBgpNbrMaxHopsAway",
10706 " Internal BGP neighbor may be up to %d hops away.\n",
10711 /* Local address. */
10714 json_object_string_add(json_neigh
, "hostLocal",
10715 sockunion2str(p
->su_local
, buf1
,
10717 json_object_int_add(json_neigh
, "portLocal",
10718 ntohs(p
->su_local
->sin
.sin_port
));
10720 vty_out(vty
, "Local host: %s, Local port: %d\n",
10721 sockunion2str(p
->su_local
, buf1
, SU_ADDRSTRLEN
),
10722 ntohs(p
->su_local
->sin
.sin_port
));
10725 /* Remote address. */
10726 if (p
->su_remote
) {
10728 json_object_string_add(json_neigh
, "hostForeign",
10729 sockunion2str(p
->su_remote
, buf1
,
10731 json_object_int_add(json_neigh
, "portForeign",
10732 ntohs(p
->su_remote
->sin
.sin_port
));
10734 vty_out(vty
, "Foreign host: %s, Foreign port: %d\n",
10735 sockunion2str(p
->su_remote
, buf1
,
10737 ntohs(p
->su_remote
->sin
.sin_port
));
10740 /* Nexthop display. */
10743 json_object_string_add(json_neigh
, "nexthop",
10745 &p
->nexthop
.v4
, buf1
,
10747 json_object_string_add(json_neigh
, "nexthopGlobal",
10748 inet_ntop(AF_INET6
,
10749 &p
->nexthop
.v6_global
,
10750 buf1
, sizeof(buf1
)));
10751 json_object_string_add(json_neigh
, "nexthopLocal",
10752 inet_ntop(AF_INET6
,
10753 &p
->nexthop
.v6_local
,
10754 buf1
, sizeof(buf1
)));
10755 if (p
->shared_network
)
10756 json_object_string_add(json_neigh
,
10760 json_object_string_add(json_neigh
,
10762 "nonSharedNetwork");
10764 vty_out(vty
, "Nexthop: %s\n",
10765 inet_ntop(AF_INET
, &p
->nexthop
.v4
, buf1
,
10767 vty_out(vty
, "Nexthop global: %s\n",
10768 inet_ntop(AF_INET6
, &p
->nexthop
.v6_global
, buf1
,
10770 vty_out(vty
, "Nexthop local: %s\n",
10771 inet_ntop(AF_INET6
, &p
->nexthop
.v6_local
, buf1
,
10773 vty_out(vty
, "BGP connection: %s\n",
10774 p
->shared_network
? "shared network"
10775 : "non shared network");
10779 /* Timer information. */
10781 json_object_int_add(json_neigh
, "connectRetryTimer",
10783 if (p
->status
== Established
&& p
->rtt
)
10784 json_object_int_add(json_neigh
, "estimatedRttInMsecs",
10787 json_object_int_add(
10788 json_neigh
, "nextStartTimerDueInMsecs",
10789 thread_timer_remain_second(p
->t_start
) * 1000);
10791 json_object_int_add(
10792 json_neigh
, "nextConnectTimerDueInMsecs",
10793 thread_timer_remain_second(p
->t_connect
)
10795 if (p
->t_routeadv
) {
10796 json_object_int_add(json_neigh
, "mraiInterval",
10798 json_object_int_add(
10799 json_neigh
, "mraiTimerExpireInMsecs",
10800 thread_timer_remain_second(p
->t_routeadv
)
10804 json_object_int_add(json_neigh
, "authenticationEnabled",
10808 json_object_string_add(json_neigh
, "readThread", "on");
10810 json_object_string_add(json_neigh
, "readThread", "off");
10812 if (CHECK_FLAG(p
->thread_flags
, PEER_THREAD_WRITES_ON
))
10813 json_object_string_add(json_neigh
, "writeThread", "on");
10815 json_object_string_add(json_neigh
, "writeThread",
10818 vty_out(vty
, "BGP Connect Retry Timer in Seconds: %d\n",
10820 if (p
->status
== Established
&& p
->rtt
)
10821 vty_out(vty
, "Estimated round trip time: %d ms\n",
10824 vty_out(vty
, "Next start timer due in %ld seconds\n",
10825 thread_timer_remain_second(p
->t_start
));
10827 vty_out(vty
, "Next connect timer due in %ld seconds\n",
10828 thread_timer_remain_second(p
->t_connect
));
10831 "MRAI (interval %u) timer expires in %ld seconds\n",
10833 thread_timer_remain_second(p
->t_routeadv
));
10835 vty_out(vty
, "Peer Authentication Enabled\n");
10837 vty_out(vty
, "Read thread: %s Write thread: %s\n",
10838 p
->t_read
? "on" : "off",
10839 CHECK_FLAG(p
->thread_flags
, PEER_THREAD_WRITES_ON
)
10844 if (p
->notify
.code
== BGP_NOTIFY_OPEN_ERR
10845 && p
->notify
.subcode
== BGP_NOTIFY_OPEN_UNSUP_CAPBL
)
10846 bgp_capability_vty_out(vty
, p
, use_json
, json_neigh
);
10849 vty_out(vty
, "\n");
10851 /* BFD information. */
10852 bgp_bfd_show_info(vty
, p
, use_json
, json_neigh
);
10855 if (p
->conf_if
) /* Configured interface name. */
10856 json_object_object_add(json
, p
->conf_if
, json_neigh
);
10857 else /* Configured IP address. */
10858 json_object_object_add(json
, p
->host
, json_neigh
);
10862 static int bgp_show_neighbor(struct vty
*vty
, struct bgp
*bgp
,
10863 enum show_type type
, union sockunion
*su
,
10864 const char *conf_if
, bool use_json
,
10867 struct listnode
*node
, *nnode
;
10870 bool nbr_output
= false;
10872 for (ALL_LIST_ELEMENTS(bgp
->peer
, node
, nnode
, peer
)) {
10873 if (!CHECK_FLAG(peer
->flags
, PEER_FLAG_CONFIG_NODE
))
10878 bgp_show_peer(vty
, peer
, use_json
, json
);
10884 && !strcmp(peer
->conf_if
, conf_if
))
10886 && !strcmp(peer
->hostname
, conf_if
))) {
10888 bgp_show_peer(vty
, peer
, use_json
,
10892 if (sockunion_same(&peer
->su
, su
)) {
10894 bgp_show_peer(vty
, peer
, use_json
,
10902 if (type
== show_peer
&& !find
) {
10904 json_object_boolean_true_add(json
, "bgpNoSuchNeighbor");
10906 vty_out(vty
, "%% No such neighbor in this view/vrf\n");
10909 if (type
!= show_peer
&& !nbr_output
&& !use_json
)
10910 vty_out(vty
, "%% No BGP neighbors found\n");
10913 vty_out(vty
, "%s\n", json_object_to_json_string_ext(
10914 json
, JSON_C_TO_STRING_PRETTY
));
10915 json_object_free(json
);
10917 vty_out(vty
, "\n");
10920 return CMD_SUCCESS
;
10923 static void bgp_show_all_instances_neighbors_vty(struct vty
*vty
,
10924 enum show_type type
,
10925 const char *ip_str
,
10928 struct listnode
*node
, *nnode
;
10930 union sockunion su
;
10931 json_object
*json
= NULL
;
10932 int ret
, is_first
= 1;
10933 bool nbr_output
= false;
10936 vty_out(vty
, "{\n");
10938 for (ALL_LIST_ELEMENTS(bm
->bgp
, node
, nnode
, bgp
)) {
10941 if (!(json
= json_object_new_object())) {
10943 EC_BGP_JSON_MEM_ERROR
,
10944 "Unable to allocate memory for JSON object");
10946 "{\"error\": {\"message:\": \"Unable to allocate memory for JSON object\"}}}\n");
10950 json_object_int_add(json
, "vrfId",
10951 (bgp
->vrf_id
== VRF_UNKNOWN
)
10953 : (int64_t)bgp
->vrf_id
);
10954 json_object_string_add(
10956 (bgp
->inst_type
== BGP_INSTANCE_TYPE_DEFAULT
)
10961 vty_out(vty
, ",\n");
10965 vty_out(vty
, "\"%s\":",
10966 (bgp
->inst_type
== BGP_INSTANCE_TYPE_DEFAULT
)
10970 vty_out(vty
, "\nInstance %s:\n",
10971 (bgp
->inst_type
== BGP_INSTANCE_TYPE_DEFAULT
)
10976 if (type
== show_peer
) {
10977 ret
= str2sockunion(ip_str
, &su
);
10979 bgp_show_neighbor(vty
, bgp
, type
, NULL
, ip_str
,
10982 bgp_show_neighbor(vty
, bgp
, type
, &su
, NULL
,
10985 bgp_show_neighbor(vty
, bgp
, show_all
, NULL
, NULL
,
10991 vty_out(vty
, "}\n");
10992 else if (!nbr_output
)
10993 vty_out(vty
, "%% BGP instance not found\n");
10996 static int bgp_show_neighbor_vty(struct vty
*vty
, const char *name
,
10997 enum show_type type
, const char *ip_str
,
11002 union sockunion su
;
11003 json_object
*json
= NULL
;
11006 if (strmatch(name
, "all")) {
11007 bgp_show_all_instances_neighbors_vty(vty
, type
, ip_str
,
11009 return CMD_SUCCESS
;
11011 bgp
= bgp_lookup_by_name(name
);
11014 json
= json_object_new_object();
11015 vty_out(vty
, "%s\n",
11016 json_object_to_json_string_ext(
11018 JSON_C_TO_STRING_PRETTY
));
11019 json_object_free(json
);
11022 "%% BGP instance not found\n");
11024 return CMD_WARNING
;
11028 bgp
= bgp_get_default();
11032 json
= json_object_new_object();
11034 ret
= str2sockunion(ip_str
, &su
);
11036 bgp_show_neighbor(vty
, bgp
, type
, NULL
, ip_str
,
11039 bgp_show_neighbor(vty
, bgp
, type
, &su
, NULL
,
11042 bgp_show_neighbor(vty
, bgp
, type
, NULL
, NULL
, use_json
,
11045 json_object_free(json
);
11048 vty_out(vty
, "{}\n");
11050 vty_out(vty
, "%% BGP instance not found\n");
11053 return CMD_SUCCESS
;
11056 /* "show [ip] bgp neighbors" commands. */
11057 DEFUN (show_ip_bgp_neighbors
,
11058 show_ip_bgp_neighbors_cmd
,
11059 "show [ip] bgp [<view|vrf> VIEWVRFNAME] [<ipv4|ipv6>] neighbors [<A.B.C.D|X:X::X:X|WORD>] [json]",
11063 BGP_INSTANCE_HELP_STR
11066 "Detailed information on TCP and BGP neighbor connections\n"
11067 "Neighbor to display information about\n"
11068 "Neighbor to display information about\n"
11069 "Neighbor on BGP configured interface\n"
11073 char *sh_arg
= NULL
;
11074 enum show_type sh_type
;
11076 bool uj
= use_json(argc
, argv
);
11080 /* [<vrf> VIEWVRFNAME] */
11081 if (argv_find(argv
, argc
, "vrf", &idx
)) {
11082 vrf
= argv
[idx
+ 1]->arg
;
11083 if (vrf
&& strmatch(vrf
, VRF_DEFAULT_NAME
))
11085 } else if (argv_find(argv
, argc
, "view", &idx
))
11086 /* [<view> VIEWVRFNAME] */
11087 vrf
= argv
[idx
+ 1]->arg
;
11090 if (argv_find(argv
, argc
, "A.B.C.D", &idx
)
11091 || argv_find(argv
, argc
, "X:X::X:X", &idx
)
11092 || argv_find(argv
, argc
, "WORD", &idx
)) {
11093 sh_type
= show_peer
;
11094 sh_arg
= argv
[idx
]->arg
;
11096 sh_type
= show_all
;
11098 return bgp_show_neighbor_vty(vty
, vrf
, sh_type
, sh_arg
, uj
);
11101 /* Show BGP's AS paths internal data. There are both `show [ip] bgp
11102 paths' and `show ip mbgp paths'. Those functions results are the
11104 DEFUN (show_ip_bgp_paths
,
11105 show_ip_bgp_paths_cmd
,
11106 "show [ip] bgp ["BGP_SAFI_CMD_STR
"] paths",
11111 "Path information\n")
11113 vty_out(vty
, "Address Refcnt Path\n");
11114 aspath_print_all_vty(vty
);
11115 return CMD_SUCCESS
;
11120 static void community_show_all_iterator(struct hash_backet
*backet
,
11123 struct community
*com
;
11125 com
= (struct community
*)backet
->data
;
11126 vty_out(vty
, "[%p] (%ld) %s\n", (void *)com
, com
->refcnt
,
11127 community_str(com
, false));
11130 /* Show BGP's community internal data. */
11131 DEFUN (show_ip_bgp_community_info
,
11132 show_ip_bgp_community_info_cmd
,
11133 "show [ip] bgp community-info",
11137 "List all bgp community information\n")
11139 vty_out(vty
, "Address Refcnt Community\n");
11141 hash_iterate(community_hash(),
11142 (void (*)(struct hash_backet
*,
11143 void *))community_show_all_iterator
,
11146 return CMD_SUCCESS
;
11149 static void lcommunity_show_all_iterator(struct hash_backet
*backet
,
11152 struct lcommunity
*lcom
;
11154 lcom
= (struct lcommunity
*)backet
->data
;
11155 vty_out(vty
, "[%p] (%ld) %s\n", (void *)lcom
, lcom
->refcnt
,
11156 lcommunity_str(lcom
, false));
11159 /* Show BGP's community internal data. */
11160 DEFUN (show_ip_bgp_lcommunity_info
,
11161 show_ip_bgp_lcommunity_info_cmd
,
11162 "show ip bgp large-community-info",
11166 "List all bgp large-community information\n")
11168 vty_out(vty
, "Address Refcnt Large-community\n");
11170 hash_iterate(lcommunity_hash(),
11171 (void (*)(struct hash_backet
*,
11172 void *))lcommunity_show_all_iterator
,
11175 return CMD_SUCCESS
;
11179 DEFUN (show_ip_bgp_attr_info
,
11180 show_ip_bgp_attr_info_cmd
,
11181 "show [ip] bgp attribute-info",
11185 "List all bgp attribute information\n")
11187 attr_show_all(vty
);
11188 return CMD_SUCCESS
;
11191 static int bgp_show_route_leak_vty(struct vty
*vty
, const char *name
, afi_t afi
,
11192 safi_t safi
, bool use_json
)
11195 struct listnode
*node
;
11197 char buf1
[INET6_ADDRSTRLEN
];
11199 vpn_policy_direction_t dir
;
11202 json_object
*json
= NULL
;
11203 json_object
*json_import_vrfs
= NULL
;
11204 json_object
*json_export_vrfs
= NULL
;
11206 json
= json_object_new_object();
11208 bgp
= name
? bgp_lookup_by_name(name
) : bgp_get_default();
11211 vty_out(vty
, "%s\n",
11212 json_object_to_json_string_ext(
11214 JSON_C_TO_STRING_PRETTY
));
11215 json_object_free(json
);
11217 return CMD_WARNING
;
11220 /* Provide context for the block */
11221 json_object_string_add(json
, "vrf", name
? name
: "default");
11222 json_object_string_add(json
, "afiSafi",
11223 afi_safi_print(afi
, safi
));
11225 if (!CHECK_FLAG(bgp
->af_flags
[afi
][safi
],
11226 BGP_CONFIG_VRF_TO_VRF_IMPORT
)) {
11227 json_object_string_add(json
, "importFromVrfs", "none");
11228 json_object_string_add(json
, "importRts", "none");
11230 json_import_vrfs
= json_object_new_array();
11232 for (ALL_LIST_ELEMENTS_RO(
11233 bgp
->vpn_policy
[afi
].import_vrf
,
11235 json_object_array_add(json_import_vrfs
,
11236 json_object_new_string(vname
));
11238 dir
= BGP_VPN_POLICY_DIR_FROMVPN
;
11239 ecom_str
= ecommunity_ecom2str(
11240 bgp
->vpn_policy
[afi
].rtlist
[dir
],
11241 ECOMMUNITY_FORMAT_ROUTE_MAP
, 0);
11242 json_object_object_add(json
, "importFromVrfs",
11244 json_object_string_add(json
, "importRts", ecom_str
);
11246 XFREE(MTYPE_ECOMMUNITY_STR
, ecom_str
);
11249 if (!CHECK_FLAG(bgp
->af_flags
[afi
][safi
],
11250 BGP_CONFIG_VRF_TO_VRF_EXPORT
)) {
11251 json_object_string_add(json
, "exportToVrfs", "none");
11252 json_object_string_add(json
, "routeDistinguisher",
11254 json_object_string_add(json
, "exportRts", "none");
11256 json_export_vrfs
= json_object_new_array();
11258 for (ALL_LIST_ELEMENTS_RO(
11259 bgp
->vpn_policy
[afi
].export_vrf
,
11261 json_object_array_add(json_export_vrfs
,
11262 json_object_new_string(vname
));
11263 json_object_object_add(json
, "exportToVrfs",
11265 json_object_string_add(json
, "routeDistinguisher",
11266 prefix_rd2str(&bgp
->vpn_policy
[afi
].tovpn_rd
,
11267 buf1
, RD_ADDRSTRLEN
));
11269 dir
= BGP_VPN_POLICY_DIR_TOVPN
;
11270 ecom_str
= ecommunity_ecom2str(
11271 bgp
->vpn_policy
[afi
].rtlist
[dir
],
11272 ECOMMUNITY_FORMAT_ROUTE_MAP
, 0);
11273 json_object_string_add(json
, "exportRts", ecom_str
);
11275 XFREE(MTYPE_ECOMMUNITY_STR
, ecom_str
);
11278 vty_out(vty
, "%s\n",
11279 json_object_to_json_string_ext(json
,
11280 JSON_C_TO_STRING_PRETTY
));
11281 json_object_free(json
);
11284 bgp
= name
? bgp_lookup_by_name(name
) : bgp_get_default();
11287 vty_out(vty
, "%% No such BGP instance exist\n");
11288 return CMD_WARNING
;
11291 if (!CHECK_FLAG(bgp
->af_flags
[afi
][safi
],
11292 BGP_CONFIG_VRF_TO_VRF_IMPORT
))
11294 "This VRF is not importing %s routes from any other VRF\n",
11295 afi_safi_print(afi
, safi
));
11298 "This VRF is importing %s routes from the following VRFs:\n",
11299 afi_safi_print(afi
, safi
));
11301 for (ALL_LIST_ELEMENTS_RO(
11302 bgp
->vpn_policy
[afi
].import_vrf
,
11304 vty_out(vty
, " %s\n", vname
);
11306 dir
= BGP_VPN_POLICY_DIR_FROMVPN
;
11307 ecom_str
= ecommunity_ecom2str(
11308 bgp
->vpn_policy
[afi
].rtlist
[dir
],
11309 ECOMMUNITY_FORMAT_ROUTE_MAP
, 0);
11310 vty_out(vty
, "Import RT(s): %s\n", ecom_str
);
11312 XFREE(MTYPE_ECOMMUNITY_STR
, ecom_str
);
11315 if (!CHECK_FLAG(bgp
->af_flags
[afi
][safi
],
11316 BGP_CONFIG_VRF_TO_VRF_EXPORT
))
11318 "This VRF is not exporting %s routes to any other VRF\n",
11319 afi_safi_print(afi
, safi
));
11322 "This VRF is exporting %s routes to the following VRFs:\n",
11323 afi_safi_print(afi
, safi
));
11325 for (ALL_LIST_ELEMENTS_RO(
11326 bgp
->vpn_policy
[afi
].export_vrf
,
11328 vty_out(vty
, " %s\n", vname
);
11330 vty_out(vty
, "RD: %s\n",
11331 prefix_rd2str(&bgp
->vpn_policy
[afi
].tovpn_rd
,
11332 buf1
, RD_ADDRSTRLEN
));
11334 dir
= BGP_VPN_POLICY_DIR_TOVPN
;
11335 ecom_str
= ecommunity_ecom2str(
11336 bgp
->vpn_policy
[afi
].rtlist
[dir
],
11337 ECOMMUNITY_FORMAT_ROUTE_MAP
, 0);
11338 vty_out(vty
, "Export RT: %s\n", ecom_str
);
11339 XFREE(MTYPE_ECOMMUNITY_STR
, ecom_str
);
11343 return CMD_SUCCESS
;
11346 /* "show [ip] bgp route-leak" command. */
11347 DEFUN (show_ip_bgp_route_leak
,
11348 show_ip_bgp_route_leak_cmd
,
11349 "show [ip] bgp [<view|vrf> VIEWVRFNAME] ["BGP_AFI_CMD_STR
" ["BGP_SAFI_CMD_STR
"]] route-leak [json]",
11353 BGP_INSTANCE_HELP_STR
11356 "Route leaking information\n"
11360 afi_t afi
= AFI_MAX
;
11361 safi_t safi
= SAFI_MAX
;
11363 bool uj
= use_json(argc
, argv
);
11366 /* show [ip] bgp */
11367 if (argv_find(argv
, argc
, "ip", &idx
)) {
11369 safi
= SAFI_UNICAST
;
11371 /* [vrf VIEWVRFNAME] */
11372 if (argv_find(argv
, argc
, "view", &idx
)) {
11374 "%% This command is not applicable to BGP views\n");
11375 return CMD_WARNING
;
11378 if (argv_find(argv
, argc
, "vrf", &idx
)) {
11379 vrf
= argv
[idx
+ 1]->arg
;
11380 if (vrf
&& strmatch(vrf
, VRF_DEFAULT_NAME
))
11383 /* ["BGP_AFI_CMD_STR" ["BGP_SAFI_CMD_STR"]] */
11384 if (argv_find_and_parse_afi(argv
, argc
, &idx
, &afi
)) {
11385 argv_find_and_parse_safi(argv
, argc
, &idx
, &safi
);
11388 if (!((afi
== AFI_IP
|| afi
== AFI_IP6
) && safi
== SAFI_UNICAST
)) {
11390 "%% This command is applicable only for unicast ipv4|ipv6\n");
11391 return CMD_WARNING
;
11394 return bgp_show_route_leak_vty(vty
, vrf
, afi
, safi
, uj
);
11397 static void bgp_show_all_instances_updgrps_vty(struct vty
*vty
, afi_t afi
,
11400 struct listnode
*node
, *nnode
;
11403 for (ALL_LIST_ELEMENTS(bm
->bgp
, node
, nnode
, bgp
)) {
11404 vty_out(vty
, "\nInstance %s:\n",
11405 (bgp
->inst_type
== BGP_INSTANCE_TYPE_DEFAULT
)
11408 update_group_show(bgp
, afi
, safi
, vty
, 0);
11412 static int bgp_show_update_groups(struct vty
*vty
, const char *name
, int afi
,
11413 int safi
, uint64_t subgrp_id
)
11418 if (strmatch(name
, "all")) {
11419 bgp_show_all_instances_updgrps_vty(vty
, afi
, safi
);
11420 return CMD_SUCCESS
;
11422 bgp
= bgp_lookup_by_name(name
);
11425 bgp
= bgp_get_default();
11429 update_group_show(bgp
, afi
, safi
, vty
, subgrp_id
);
11430 return CMD_SUCCESS
;
11433 DEFUN (show_ip_bgp_updgrps
,
11434 show_ip_bgp_updgrps_cmd
,
11435 "show [ip] bgp [<view|vrf> VIEWVRFNAME] ["BGP_AFI_CMD_STR
" ["BGP_SAFI_WITH_LABEL_CMD_STR
"]] update-groups [SUBGROUP-ID]",
11439 BGP_INSTANCE_HELP_STR
11441 BGP_SAFI_WITH_LABEL_HELP_STR
11442 "Detailed info about dynamic update groups\n"
11443 "Specific subgroup to display detailed info for\n")
11446 afi_t afi
= AFI_IP6
;
11447 safi_t safi
= SAFI_UNICAST
;
11448 uint64_t subgrp_id
= 0;
11452 /* show [ip] bgp */
11453 if (argv_find(argv
, argc
, "ip", &idx
))
11455 /* [<vrf> VIEWVRFNAME] */
11456 if (argv_find(argv
, argc
, "vrf", &idx
)) {
11457 vrf
= argv
[idx
+ 1]->arg
;
11458 if (vrf
&& strmatch(vrf
, VRF_DEFAULT_NAME
))
11460 } else if (argv_find(argv
, argc
, "view", &idx
))
11461 /* [<view> VIEWVRFNAME] */
11462 vrf
= argv
[idx
+ 1]->arg
;
11463 /* ["BGP_AFI_CMD_STR" ["BGP_SAFI_CMD_STR"]] */
11464 if (argv_find_and_parse_afi(argv
, argc
, &idx
, &afi
)) {
11465 argv_find_and_parse_safi(argv
, argc
, &idx
, &safi
);
11468 /* get subgroup id, if provided */
11470 if (argv
[idx
]->type
== VARIABLE_TKN
)
11471 subgrp_id
= strtoull(argv
[idx
]->arg
, NULL
, 10);
11473 return (bgp_show_update_groups(vty
, vrf
, afi
, safi
, subgrp_id
));
11476 DEFUN (show_bgp_instance_all_ipv6_updgrps
,
11477 show_bgp_instance_all_ipv6_updgrps_cmd
,
11478 "show [ip] bgp <view|vrf> all update-groups",
11482 BGP_INSTANCE_ALL_HELP_STR
11483 "Detailed info about dynamic update groups\n")
11485 bgp_show_all_instances_updgrps_vty(vty
, AFI_IP6
, SAFI_UNICAST
);
11486 return CMD_SUCCESS
;
11489 DEFUN (show_bgp_l2vpn_evpn_updgrps
,
11490 show_bgp_l2vpn_evpn_updgrps_cmd
,
11491 "show [ip] bgp l2vpn evpn update-groups",
11495 "l2vpn address family\n"
11496 "evpn sub-address family\n"
11497 "Detailed info about dynamic update groups\n")
11500 uint64_t subgrp_id
= 0;
11502 bgp_show_update_groups(vty
, vrf
, AFI_L2VPN
, SAFI_EVPN
, subgrp_id
);
11503 return CMD_SUCCESS
;
11506 DEFUN (show_bgp_updgrps_stats
,
11507 show_bgp_updgrps_stats_cmd
,
11508 "show [ip] bgp update-groups statistics",
11512 "Detailed info about dynamic update groups\n"
11517 bgp
= bgp_get_default();
11519 update_group_show_stats(bgp
, vty
);
11521 return CMD_SUCCESS
;
11524 DEFUN (show_bgp_instance_updgrps_stats
,
11525 show_bgp_instance_updgrps_stats_cmd
,
11526 "show [ip] bgp <view|vrf> VIEWVRFNAME update-groups statistics",
11530 BGP_INSTANCE_HELP_STR
11531 "Detailed info about dynamic update groups\n"
11537 bgp
= bgp_lookup_by_name(argv
[idx_word
]->arg
);
11539 update_group_show_stats(bgp
, vty
);
11541 return CMD_SUCCESS
;
11544 static void show_bgp_updgrps_adj_info_aux(struct vty
*vty
, const char *name
,
11545 afi_t afi
, safi_t safi
,
11546 const char *what
, uint64_t subgrp_id
)
11551 bgp
= bgp_lookup_by_name(name
);
11553 bgp
= bgp_get_default();
11556 if (!strcmp(what
, "advertise-queue"))
11557 update_group_show_adj_queue(bgp
, afi
, safi
, vty
,
11559 else if (!strcmp(what
, "advertised-routes"))
11560 update_group_show_advertised(bgp
, afi
, safi
, vty
,
11562 else if (!strcmp(what
, "packet-queue"))
11563 update_group_show_packet_queue(bgp
, afi
, safi
, vty
,
11568 DEFPY(show_ip_bgp_instance_updgrps_adj_s
,
11569 show_ip_bgp_instance_updgrps_adj_s_cmd
,
11570 "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",
11571 SHOW_STR IP_STR BGP_STR BGP_INSTANCE_HELP_STR BGP_AFI_HELP_STR
11573 "Detailed info about dynamic update groups\n"
11574 "Specific subgroup to display info for\n"
11575 "Advertisement queue\n"
11576 "Announced routes\n"
11579 uint64_t subgrp_id
= 0;
11583 subgrp_id
= strtoull(sgid
, NULL
, 10);
11588 afiz
= bgp_vty_afi_from_str(afi
);
11592 afiz
= bgp_vty_afi_from_str(afi
);
11593 if (afiz
!= AFI_IP
)
11595 "%% Cannot specify both 'ip' and 'ipv6'\n");
11596 return CMD_WARNING
;
11599 safiz
= safi
? bgp_vty_safi_from_str(safi
) : SAFI_UNICAST
;
11601 show_bgp_updgrps_adj_info_aux(vty
, vrf
, afiz
, safiz
, rtq
, subgrp_id
);
11602 return CMD_SUCCESS
;
11605 static int bgp_show_one_peer_group(struct vty
*vty
, struct peer_group
*group
)
11607 struct listnode
*node
, *nnode
;
11608 struct prefix
*range
;
11611 char buf
[PREFIX2STR_BUFFER
];
11614 const char *peer_status
;
11615 const char *af_str
;
11620 conf
= group
->conf
;
11622 if (conf
->as_type
== AS_SPECIFIED
|| conf
->as_type
== AS_EXTERNAL
) {
11623 vty_out(vty
, "\nBGP peer-group %s, remote AS %d\n", group
->name
,
11625 } else if (conf
->as_type
== AS_INTERNAL
) {
11626 vty_out(vty
, "\nBGP peer-group %s, remote AS %d\n", group
->name
,
11629 vty_out(vty
, "\nBGP peer-group %s\n", group
->name
);
11632 if ((group
->bgp
->as
== conf
->as
) || (conf
->as_type
== AS_INTERNAL
))
11633 vty_out(vty
, " Peer-group type is internal\n");
11635 vty_out(vty
, " Peer-group type is external\n");
11637 /* Display AFs configured. */
11638 vty_out(vty
, " Configured address-families:");
11639 FOREACH_AFI_SAFI (afi
, safi
) {
11640 if (conf
->afc
[afi
][safi
]) {
11642 vty_out(vty
, " %s;", afi_safi_print(afi
, safi
));
11646 vty_out(vty
, " none\n");
11648 vty_out(vty
, "\n");
11650 /* Display listen ranges (for dynamic neighbors), if any */
11651 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++) {
11654 else if (afi
== AFI_IP6
)
11658 lr_count
= listcount(group
->listen_range
[afi
]);
11660 vty_out(vty
, " %d %s listen range(s)\n", lr_count
,
11664 for (ALL_LIST_ELEMENTS(group
->listen_range
[afi
], node
,
11666 prefix2str(range
, buf
, sizeof(buf
));
11667 vty_out(vty
, " %s\n", buf
);
11672 /* Display group members and their status */
11673 if (listcount(group
->peer
)) {
11674 vty_out(vty
, " Peer-group members:\n");
11675 for (ALL_LIST_ELEMENTS(group
->peer
, node
, nnode
, peer
)) {
11676 if (CHECK_FLAG(peer
->flags
, PEER_FLAG_SHUTDOWN
))
11677 peer_status
= "Idle (Admin)";
11678 else if (CHECK_FLAG(peer
->sflags
,
11679 PEER_STATUS_PREFIX_OVERFLOW
))
11680 peer_status
= "Idle (PfxCt)";
11682 peer_status
= lookup_msg(bgp_status_msg
,
11683 peer
->status
, NULL
);
11685 dynamic
= peer_dynamic_neighbor(peer
);
11686 vty_out(vty
, " %s %s %s \n", peer
->host
,
11687 dynamic
? "(dynamic)" : "", peer_status
);
11691 return CMD_SUCCESS
;
11694 static int bgp_show_peer_group_vty(struct vty
*vty
, const char *name
,
11695 const char *group_name
)
11698 struct listnode
*node
, *nnode
;
11699 struct peer_group
*group
;
11700 bool found
= false;
11702 bgp
= name
? bgp_lookup_by_name(name
) : bgp_get_default();
11705 vty_out(vty
, "%% BGP instance not found\n");
11706 return CMD_WARNING
;
11709 for (ALL_LIST_ELEMENTS(bgp
->group
, node
, nnode
, group
)) {
11711 if (strmatch(group
->name
, group_name
)) {
11712 bgp_show_one_peer_group(vty
, group
);
11717 bgp_show_one_peer_group(vty
, group
);
11721 if (group_name
&& !found
)
11722 vty_out(vty
, "%% No such peer-group\n");
11724 return CMD_SUCCESS
;
11727 DEFUN (show_ip_bgp_peer_groups
,
11728 show_ip_bgp_peer_groups_cmd
,
11729 "show [ip] bgp [<view|vrf> VIEWVRFNAME] peer-group [PGNAME]",
11733 BGP_INSTANCE_HELP_STR
11734 "Detailed information on BGP peer groups\n"
11735 "Peer group name\n")
11740 vrf
= argv_find(argv
, argc
, "VIEWVRFNAME", &idx
) ? argv
[idx
]->arg
11742 pg
= argv_find(argv
, argc
, "PGNAME", &idx
) ? argv
[idx
]->arg
: NULL
;
11744 return bgp_show_peer_group_vty(vty
, vrf
, pg
);
11748 /* Redistribute VTY commands. */
11750 DEFUN (bgp_redistribute_ipv4
,
11751 bgp_redistribute_ipv4_cmd
,
11752 "redistribute " FRR_IP_REDIST_STR_BGPD
,
11753 "Redistribute information from another routing protocol\n"
11754 FRR_IP_REDIST_HELP_STR_BGPD
)
11756 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
11757 int idx_protocol
= 1;
11760 type
= proto_redistnum(AFI_IP
, argv
[idx_protocol
]->text
);
11762 vty_out(vty
, "%% Invalid route type\n");
11763 return CMD_WARNING_CONFIG_FAILED
;
11766 bgp_redist_add(bgp
, AFI_IP
, type
, 0);
11767 return bgp_redistribute_set(bgp
, AFI_IP
, type
, 0, false);
11771 bgp_redistribute_ipv4
, bgp_redistribute_ipv4_hidden_cmd
,
11772 "redistribute " FRR_IP_REDIST_STR_BGPD
,
11773 "Redistribute information from another routing protocol\n" FRR_IP_REDIST_HELP_STR_BGPD
)
11775 DEFUN (bgp_redistribute_ipv4_rmap
,
11776 bgp_redistribute_ipv4_rmap_cmd
,
11777 "redistribute " FRR_IP_REDIST_STR_BGPD
" route-map WORD",
11778 "Redistribute information from another routing protocol\n"
11779 FRR_IP_REDIST_HELP_STR_BGPD
11780 "Route map reference\n"
11781 "Pointer to route-map entries\n")
11783 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
11784 int idx_protocol
= 1;
11787 struct bgp_redist
*red
;
11789 struct route_map
*route_map
= route_map_lookup_warn_noexist(
11790 vty
, argv
[idx_word
]->arg
);
11792 type
= proto_redistnum(AFI_IP
, argv
[idx_protocol
]->text
);
11794 vty_out(vty
, "%% Invalid route type\n");
11795 return CMD_WARNING_CONFIG_FAILED
;
11798 red
= bgp_redist_add(bgp
, AFI_IP
, type
, 0);
11800 bgp_redistribute_rmap_set(red
, argv
[idx_word
]->arg
, route_map
);
11801 return bgp_redistribute_set(bgp
, AFI_IP
, type
, 0, changed
);
11805 bgp_redistribute_ipv4_rmap
, bgp_redistribute_ipv4_rmap_hidden_cmd
,
11806 "redistribute " FRR_IP_REDIST_STR_BGPD
" route-map WORD",
11807 "Redistribute information from another routing protocol\n" FRR_IP_REDIST_HELP_STR_BGPD
11808 "Route map reference\n"
11809 "Pointer to route-map entries\n")
11811 DEFUN (bgp_redistribute_ipv4_metric
,
11812 bgp_redistribute_ipv4_metric_cmd
,
11813 "redistribute " FRR_IP_REDIST_STR_BGPD
" metric (0-4294967295)",
11814 "Redistribute information from another routing protocol\n"
11815 FRR_IP_REDIST_HELP_STR_BGPD
11816 "Metric for redistributed routes\n"
11817 "Default metric\n")
11819 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
11820 int idx_protocol
= 1;
11821 int idx_number
= 3;
11824 struct bgp_redist
*red
;
11827 type
= proto_redistnum(AFI_IP
, argv
[idx_protocol
]->text
);
11829 vty_out(vty
, "%% Invalid route type\n");
11830 return CMD_WARNING_CONFIG_FAILED
;
11832 metric
= strtoul(argv
[idx_number
]->arg
, NULL
, 10);
11834 red
= bgp_redist_add(bgp
, AFI_IP
, type
, 0);
11835 changed
= bgp_redistribute_metric_set(bgp
, red
, AFI_IP
, type
, metric
);
11836 return bgp_redistribute_set(bgp
, AFI_IP
, type
, 0, changed
);
11840 bgp_redistribute_ipv4_metric
, bgp_redistribute_ipv4_metric_hidden_cmd
,
11841 "redistribute " FRR_IP_REDIST_STR_BGPD
" metric (0-4294967295)",
11842 "Redistribute information from another routing protocol\n" FRR_IP_REDIST_HELP_STR_BGPD
11843 "Metric for redistributed routes\n"
11844 "Default metric\n")
11846 DEFUN (bgp_redistribute_ipv4_rmap_metric
,
11847 bgp_redistribute_ipv4_rmap_metric_cmd
,
11848 "redistribute " FRR_IP_REDIST_STR_BGPD
" route-map WORD metric (0-4294967295)",
11849 "Redistribute information from another routing protocol\n"
11850 FRR_IP_REDIST_HELP_STR_BGPD
11851 "Route map reference\n"
11852 "Pointer to route-map entries\n"
11853 "Metric for redistributed routes\n"
11854 "Default metric\n")
11856 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
11857 int idx_protocol
= 1;
11859 int idx_number
= 5;
11862 struct bgp_redist
*red
;
11864 struct route_map
*route_map
=
11865 route_map_lookup_warn_noexist(vty
, argv
[idx_word
]->arg
);
11867 type
= proto_redistnum(AFI_IP
, argv
[idx_protocol
]->text
);
11869 vty_out(vty
, "%% Invalid route type\n");
11870 return CMD_WARNING_CONFIG_FAILED
;
11872 metric
= strtoul(argv
[idx_number
]->arg
, NULL
, 10);
11874 red
= bgp_redist_add(bgp
, AFI_IP
, type
, 0);
11876 bgp_redistribute_rmap_set(red
, argv
[idx_word
]->arg
, route_map
);
11877 changed
|= bgp_redistribute_metric_set(bgp
, red
, AFI_IP
, type
, metric
);
11878 return bgp_redistribute_set(bgp
, AFI_IP
, type
, 0, changed
);
11882 bgp_redistribute_ipv4_rmap_metric
,
11883 bgp_redistribute_ipv4_rmap_metric_hidden_cmd
,
11884 "redistribute " FRR_IP_REDIST_STR_BGPD
11885 " route-map WORD metric (0-4294967295)",
11886 "Redistribute information from another routing protocol\n" FRR_IP_REDIST_HELP_STR_BGPD
11887 "Route map reference\n"
11888 "Pointer to route-map entries\n"
11889 "Metric for redistributed routes\n"
11890 "Default metric\n")
11892 DEFUN (bgp_redistribute_ipv4_metric_rmap
,
11893 bgp_redistribute_ipv4_metric_rmap_cmd
,
11894 "redistribute " FRR_IP_REDIST_STR_BGPD
" metric (0-4294967295) route-map WORD",
11895 "Redistribute information from another routing protocol\n"
11896 FRR_IP_REDIST_HELP_STR_BGPD
11897 "Metric for redistributed routes\n"
11899 "Route map reference\n"
11900 "Pointer to route-map entries\n")
11902 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
11903 int idx_protocol
= 1;
11904 int idx_number
= 3;
11908 struct bgp_redist
*red
;
11910 struct route_map
*route_map
=
11911 route_map_lookup_warn_noexist(vty
, argv
[idx_word
]->arg
);
11913 type
= proto_redistnum(AFI_IP
, argv
[idx_protocol
]->text
);
11915 vty_out(vty
, "%% Invalid route type\n");
11916 return CMD_WARNING_CONFIG_FAILED
;
11918 metric
= strtoul(argv
[idx_number
]->arg
, NULL
, 10);
11920 red
= bgp_redist_add(bgp
, AFI_IP
, type
, 0);
11921 changed
= bgp_redistribute_metric_set(bgp
, red
, AFI_IP
, type
, metric
);
11923 bgp_redistribute_rmap_set(red
, argv
[idx_word
]->arg
, route_map
);
11924 return bgp_redistribute_set(bgp
, AFI_IP
, type
, 0, changed
);
11928 bgp_redistribute_ipv4_metric_rmap
,
11929 bgp_redistribute_ipv4_metric_rmap_hidden_cmd
,
11930 "redistribute " FRR_IP_REDIST_STR_BGPD
11931 " metric (0-4294967295) route-map WORD",
11932 "Redistribute information from another routing protocol\n" FRR_IP_REDIST_HELP_STR_BGPD
11933 "Metric for redistributed routes\n"
11935 "Route map reference\n"
11936 "Pointer to route-map entries\n")
11938 DEFUN (bgp_redistribute_ipv4_ospf
,
11939 bgp_redistribute_ipv4_ospf_cmd
,
11940 "redistribute <ospf|table> (1-65535)",
11941 "Redistribute information from another routing protocol\n"
11942 "Open Shortest Path First (OSPFv2)\n"
11943 "Non-main Kernel Routing Table\n"
11944 "Instance ID/Table ID\n")
11946 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
11947 int idx_ospf_table
= 1;
11948 int idx_number
= 2;
11949 unsigned short instance
;
11950 unsigned short protocol
;
11952 instance
= strtoul(argv
[idx_number
]->arg
, NULL
, 10);
11954 if (strncmp(argv
[idx_ospf_table
]->arg
, "o", 1) == 0)
11955 protocol
= ZEBRA_ROUTE_OSPF
;
11957 protocol
= ZEBRA_ROUTE_TABLE
;
11959 bgp_redist_add(bgp
, AFI_IP
, protocol
, instance
);
11960 return bgp_redistribute_set(bgp
, AFI_IP
, protocol
, instance
, false);
11963 ALIAS_HIDDEN(bgp_redistribute_ipv4_ospf
, bgp_redistribute_ipv4_ospf_hidden_cmd
,
11964 "redistribute <ospf|table> (1-65535)",
11965 "Redistribute information from another routing protocol\n"
11966 "Open Shortest Path First (OSPFv2)\n"
11967 "Non-main Kernel Routing Table\n"
11968 "Instance ID/Table ID\n")
11970 DEFUN (bgp_redistribute_ipv4_ospf_rmap
,
11971 bgp_redistribute_ipv4_ospf_rmap_cmd
,
11972 "redistribute <ospf|table> (1-65535) route-map WORD",
11973 "Redistribute information from another routing protocol\n"
11974 "Open Shortest Path First (OSPFv2)\n"
11975 "Non-main Kernel Routing Table\n"
11976 "Instance ID/Table ID\n"
11977 "Route map reference\n"
11978 "Pointer to route-map entries\n")
11980 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
11981 int idx_ospf_table
= 1;
11982 int idx_number
= 2;
11984 struct bgp_redist
*red
;
11985 unsigned short instance
;
11988 struct route_map
*route_map
=
11989 route_map_lookup_warn_noexist(vty
, argv
[idx_word
]->arg
);
11991 if (strncmp(argv
[idx_ospf_table
]->arg
, "o", 1) == 0)
11992 protocol
= ZEBRA_ROUTE_OSPF
;
11994 protocol
= ZEBRA_ROUTE_TABLE
;
11996 instance
= strtoul(argv
[idx_number
]->arg
, NULL
, 10);
11997 red
= bgp_redist_add(bgp
, AFI_IP
, protocol
, instance
);
11999 bgp_redistribute_rmap_set(red
, argv
[idx_word
]->arg
, route_map
);
12000 return bgp_redistribute_set(bgp
, AFI_IP
, protocol
, instance
, changed
);
12003 ALIAS_HIDDEN(bgp_redistribute_ipv4_ospf_rmap
,
12004 bgp_redistribute_ipv4_ospf_rmap_hidden_cmd
,
12005 "redistribute <ospf|table> (1-65535) route-map WORD",
12006 "Redistribute information from another routing protocol\n"
12007 "Open Shortest Path First (OSPFv2)\n"
12008 "Non-main Kernel Routing Table\n"
12009 "Instance ID/Table ID\n"
12010 "Route map reference\n"
12011 "Pointer to route-map entries\n")
12013 DEFUN (bgp_redistribute_ipv4_ospf_metric
,
12014 bgp_redistribute_ipv4_ospf_metric_cmd
,
12015 "redistribute <ospf|table> (1-65535) metric (0-4294967295)",
12016 "Redistribute information from another routing protocol\n"
12017 "Open Shortest Path First (OSPFv2)\n"
12018 "Non-main Kernel Routing Table\n"
12019 "Instance ID/Table ID\n"
12020 "Metric for redistributed routes\n"
12021 "Default metric\n")
12023 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
12024 int idx_ospf_table
= 1;
12025 int idx_number
= 2;
12026 int idx_number_2
= 4;
12028 struct bgp_redist
*red
;
12029 unsigned short instance
;
12033 if (strncmp(argv
[idx_ospf_table
]->arg
, "o", 1) == 0)
12034 protocol
= ZEBRA_ROUTE_OSPF
;
12036 protocol
= ZEBRA_ROUTE_TABLE
;
12038 instance
= strtoul(argv
[idx_number
]->arg
, NULL
, 10);
12039 metric
= strtoul(argv
[idx_number_2
]->arg
, NULL
, 10);
12041 red
= bgp_redist_add(bgp
, AFI_IP
, protocol
, instance
);
12042 changed
= bgp_redistribute_metric_set(bgp
, red
, AFI_IP
, protocol
,
12044 return bgp_redistribute_set(bgp
, AFI_IP
, protocol
, instance
, changed
);
12047 ALIAS_HIDDEN(bgp_redistribute_ipv4_ospf_metric
,
12048 bgp_redistribute_ipv4_ospf_metric_hidden_cmd
,
12049 "redistribute <ospf|table> (1-65535) metric (0-4294967295)",
12050 "Redistribute information from another routing protocol\n"
12051 "Open Shortest Path First (OSPFv2)\n"
12052 "Non-main Kernel Routing Table\n"
12053 "Instance ID/Table ID\n"
12054 "Metric for redistributed routes\n"
12055 "Default metric\n")
12057 DEFUN (bgp_redistribute_ipv4_ospf_rmap_metric
,
12058 bgp_redistribute_ipv4_ospf_rmap_metric_cmd
,
12059 "redistribute <ospf|table> (1-65535) route-map WORD metric (0-4294967295)",
12060 "Redistribute information from another routing protocol\n"
12061 "Open Shortest Path First (OSPFv2)\n"
12062 "Non-main Kernel Routing Table\n"
12063 "Instance ID/Table ID\n"
12064 "Route map reference\n"
12065 "Pointer to route-map entries\n"
12066 "Metric for redistributed routes\n"
12067 "Default metric\n")
12069 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
12070 int idx_ospf_table
= 1;
12071 int idx_number
= 2;
12073 int idx_number_2
= 6;
12075 struct bgp_redist
*red
;
12076 unsigned short instance
;
12079 struct route_map
*route_map
=
12080 route_map_lookup_warn_noexist(vty
, argv
[idx_word
]->arg
);
12082 if (strncmp(argv
[idx_ospf_table
]->arg
, "o", 1) == 0)
12083 protocol
= ZEBRA_ROUTE_OSPF
;
12085 protocol
= ZEBRA_ROUTE_TABLE
;
12087 instance
= strtoul(argv
[idx_number
]->arg
, NULL
, 10);
12088 metric
= strtoul(argv
[idx_number_2
]->arg
, NULL
, 10);
12090 red
= bgp_redist_add(bgp
, AFI_IP
, protocol
, instance
);
12092 bgp_redistribute_rmap_set(red
, argv
[idx_word
]->arg
, route_map
);
12093 changed
|= bgp_redistribute_metric_set(bgp
, red
, AFI_IP
, protocol
,
12095 return bgp_redistribute_set(bgp
, AFI_IP
, protocol
, instance
, changed
);
12099 bgp_redistribute_ipv4_ospf_rmap_metric
,
12100 bgp_redistribute_ipv4_ospf_rmap_metric_hidden_cmd
,
12101 "redistribute <ospf|table> (1-65535) route-map WORD metric (0-4294967295)",
12102 "Redistribute information from another routing protocol\n"
12103 "Open Shortest Path First (OSPFv2)\n"
12104 "Non-main Kernel Routing Table\n"
12105 "Instance ID/Table ID\n"
12106 "Route map reference\n"
12107 "Pointer to route-map entries\n"
12108 "Metric for redistributed routes\n"
12109 "Default metric\n")
12111 DEFUN (bgp_redistribute_ipv4_ospf_metric_rmap
,
12112 bgp_redistribute_ipv4_ospf_metric_rmap_cmd
,
12113 "redistribute <ospf|table> (1-65535) metric (0-4294967295) route-map WORD",
12114 "Redistribute information from another routing protocol\n"
12115 "Open Shortest Path First (OSPFv2)\n"
12116 "Non-main Kernel Routing Table\n"
12117 "Instance ID/Table ID\n"
12118 "Metric for redistributed routes\n"
12120 "Route map reference\n"
12121 "Pointer to route-map entries\n")
12123 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
12124 int idx_ospf_table
= 1;
12125 int idx_number
= 2;
12126 int idx_number_2
= 4;
12129 struct bgp_redist
*red
;
12130 unsigned short instance
;
12133 struct route_map
*route_map
=
12134 route_map_lookup_warn_noexist(vty
, argv
[idx_word
]->arg
);
12136 if (strncmp(argv
[idx_ospf_table
]->arg
, "o", 1) == 0)
12137 protocol
= ZEBRA_ROUTE_OSPF
;
12139 protocol
= ZEBRA_ROUTE_TABLE
;
12141 instance
= strtoul(argv
[idx_number
]->arg
, NULL
, 10);
12142 metric
= strtoul(argv
[idx_number_2
]->arg
, NULL
, 10);
12144 red
= bgp_redist_add(bgp
, AFI_IP
, protocol
, instance
);
12145 changed
= bgp_redistribute_metric_set(bgp
, red
, AFI_IP
, protocol
,
12148 bgp_redistribute_rmap_set(red
, argv
[idx_word
]->arg
, route_map
);
12149 return bgp_redistribute_set(bgp
, AFI_IP
, protocol
, instance
, changed
);
12153 bgp_redistribute_ipv4_ospf_metric_rmap
,
12154 bgp_redistribute_ipv4_ospf_metric_rmap_hidden_cmd
,
12155 "redistribute <ospf|table> (1-65535) metric (0-4294967295) route-map WORD",
12156 "Redistribute information from another routing protocol\n"
12157 "Open Shortest Path First (OSPFv2)\n"
12158 "Non-main Kernel Routing Table\n"
12159 "Instance ID/Table ID\n"
12160 "Metric for redistributed routes\n"
12162 "Route map reference\n"
12163 "Pointer to route-map entries\n")
12165 DEFUN (no_bgp_redistribute_ipv4_ospf
,
12166 no_bgp_redistribute_ipv4_ospf_cmd
,
12167 "no redistribute <ospf|table> (1-65535) [metric (0-4294967295)] [route-map WORD]",
12169 "Redistribute information from another routing protocol\n"
12170 "Open Shortest Path First (OSPFv2)\n"
12171 "Non-main Kernel Routing Table\n"
12172 "Instance ID/Table ID\n"
12173 "Metric for redistributed routes\n"
12175 "Route map reference\n"
12176 "Pointer to route-map entries\n")
12178 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
12179 int idx_ospf_table
= 2;
12180 int idx_number
= 3;
12181 unsigned short instance
;
12184 if (strncmp(argv
[idx_ospf_table
]->arg
, "o", 1) == 0)
12185 protocol
= ZEBRA_ROUTE_OSPF
;
12187 protocol
= ZEBRA_ROUTE_TABLE
;
12189 instance
= strtoul(argv
[idx_number
]->arg
, NULL
, 10);
12190 return bgp_redistribute_unset(bgp
, AFI_IP
, protocol
, instance
);
12194 no_bgp_redistribute_ipv4_ospf
, no_bgp_redistribute_ipv4_ospf_hidden_cmd
,
12195 "no redistribute <ospf|table> (1-65535) [metric (0-4294967295)] [route-map WORD]",
12197 "Redistribute information from another routing protocol\n"
12198 "Open Shortest Path First (OSPFv2)\n"
12199 "Non-main Kernel Routing Table\n"
12200 "Instance ID/Table ID\n"
12201 "Metric for redistributed routes\n"
12203 "Route map reference\n"
12204 "Pointer to route-map entries\n")
12206 DEFUN (no_bgp_redistribute_ipv4
,
12207 no_bgp_redistribute_ipv4_cmd
,
12208 "no redistribute " FRR_IP_REDIST_STR_BGPD
" [metric (0-4294967295)] [route-map WORD]",
12210 "Redistribute information from another routing protocol\n"
12211 FRR_IP_REDIST_HELP_STR_BGPD
12212 "Metric for redistributed routes\n"
12214 "Route map reference\n"
12215 "Pointer to route-map entries\n")
12217 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
12218 int idx_protocol
= 2;
12221 type
= proto_redistnum(AFI_IP
, argv
[idx_protocol
]->text
);
12223 vty_out(vty
, "%% Invalid route type\n");
12224 return CMD_WARNING_CONFIG_FAILED
;
12226 return bgp_redistribute_unset(bgp
, AFI_IP
, type
, 0);
12230 no_bgp_redistribute_ipv4
, no_bgp_redistribute_ipv4_hidden_cmd
,
12231 "no redistribute " FRR_IP_REDIST_STR_BGPD
12232 " [metric (0-4294967295)] [route-map WORD]",
12234 "Redistribute information from another routing protocol\n" FRR_IP_REDIST_HELP_STR_BGPD
12235 "Metric for redistributed routes\n"
12237 "Route map reference\n"
12238 "Pointer to route-map entries\n")
12240 DEFUN (bgp_redistribute_ipv6
,
12241 bgp_redistribute_ipv6_cmd
,
12242 "redistribute " FRR_IP6_REDIST_STR_BGPD
,
12243 "Redistribute information from another routing protocol\n"
12244 FRR_IP6_REDIST_HELP_STR_BGPD
)
12246 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
12247 int idx_protocol
= 1;
12250 type
= proto_redistnum(AFI_IP6
, argv
[idx_protocol
]->text
);
12252 vty_out(vty
, "%% Invalid route type\n");
12253 return CMD_WARNING_CONFIG_FAILED
;
12256 bgp_redist_add(bgp
, AFI_IP6
, type
, 0);
12257 return bgp_redistribute_set(bgp
, AFI_IP6
, type
, 0, false);
12260 DEFUN (bgp_redistribute_ipv6_rmap
,
12261 bgp_redistribute_ipv6_rmap_cmd
,
12262 "redistribute " FRR_IP6_REDIST_STR_BGPD
" route-map WORD",
12263 "Redistribute information from another routing protocol\n"
12264 FRR_IP6_REDIST_HELP_STR_BGPD
12265 "Route map reference\n"
12266 "Pointer to route-map entries\n")
12268 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
12269 int idx_protocol
= 1;
12272 struct bgp_redist
*red
;
12274 struct route_map
*route_map
=
12275 route_map_lookup_warn_noexist(vty
, argv
[idx_word
]->arg
);
12277 type
= proto_redistnum(AFI_IP6
, argv
[idx_protocol
]->text
);
12279 vty_out(vty
, "%% Invalid route type\n");
12280 return CMD_WARNING_CONFIG_FAILED
;
12283 red
= bgp_redist_add(bgp
, AFI_IP6
, type
, 0);
12285 bgp_redistribute_rmap_set(red
, argv
[idx_word
]->arg
, route_map
);
12286 return bgp_redistribute_set(bgp
, AFI_IP6
, type
, 0, changed
);
12289 DEFUN (bgp_redistribute_ipv6_metric
,
12290 bgp_redistribute_ipv6_metric_cmd
,
12291 "redistribute " FRR_IP6_REDIST_STR_BGPD
" metric (0-4294967295)",
12292 "Redistribute information from another routing protocol\n"
12293 FRR_IP6_REDIST_HELP_STR_BGPD
12294 "Metric for redistributed routes\n"
12295 "Default metric\n")
12297 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
12298 int idx_protocol
= 1;
12299 int idx_number
= 3;
12302 struct bgp_redist
*red
;
12305 type
= proto_redistnum(AFI_IP6
, argv
[idx_protocol
]->text
);
12307 vty_out(vty
, "%% Invalid route type\n");
12308 return CMD_WARNING_CONFIG_FAILED
;
12310 metric
= strtoul(argv
[idx_number
]->arg
, NULL
, 10);
12312 red
= bgp_redist_add(bgp
, AFI_IP6
, type
, 0);
12313 changed
= bgp_redistribute_metric_set(bgp
, red
, AFI_IP6
, type
, metric
);
12314 return bgp_redistribute_set(bgp
, AFI_IP6
, type
, 0, changed
);
12317 DEFUN (bgp_redistribute_ipv6_rmap_metric
,
12318 bgp_redistribute_ipv6_rmap_metric_cmd
,
12319 "redistribute " FRR_IP6_REDIST_STR_BGPD
" route-map WORD metric (0-4294967295)",
12320 "Redistribute information from another routing protocol\n"
12321 FRR_IP6_REDIST_HELP_STR_BGPD
12322 "Route map reference\n"
12323 "Pointer to route-map entries\n"
12324 "Metric for redistributed routes\n"
12325 "Default metric\n")
12327 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
12328 int idx_protocol
= 1;
12330 int idx_number
= 5;
12333 struct bgp_redist
*red
;
12335 struct route_map
*route_map
=
12336 route_map_lookup_warn_noexist(vty
, argv
[idx_word
]->arg
);
12338 type
= proto_redistnum(AFI_IP6
, argv
[idx_protocol
]->text
);
12340 vty_out(vty
, "%% Invalid route type\n");
12341 return CMD_WARNING_CONFIG_FAILED
;
12343 metric
= strtoul(argv
[idx_number
]->arg
, NULL
, 10);
12345 red
= bgp_redist_add(bgp
, AFI_IP6
, type
, 0);
12347 bgp_redistribute_rmap_set(red
, argv
[idx_word
]->arg
, route_map
);
12348 changed
|= bgp_redistribute_metric_set(bgp
, red
, AFI_IP6
, type
,
12350 return bgp_redistribute_set(bgp
, AFI_IP6
, type
, 0, changed
);
12353 DEFUN (bgp_redistribute_ipv6_metric_rmap
,
12354 bgp_redistribute_ipv6_metric_rmap_cmd
,
12355 "redistribute " FRR_IP6_REDIST_STR_BGPD
" metric (0-4294967295) route-map WORD",
12356 "Redistribute information from another routing protocol\n"
12357 FRR_IP6_REDIST_HELP_STR_BGPD
12358 "Metric for redistributed routes\n"
12360 "Route map reference\n"
12361 "Pointer to route-map entries\n")
12363 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
12364 int idx_protocol
= 1;
12365 int idx_number
= 3;
12369 struct bgp_redist
*red
;
12371 struct route_map
*route_map
=
12372 route_map_lookup_warn_noexist(vty
, argv
[idx_word
]->arg
);
12374 type
= proto_redistnum(AFI_IP6
, argv
[idx_protocol
]->text
);
12376 vty_out(vty
, "%% Invalid route type\n");
12377 return CMD_WARNING_CONFIG_FAILED
;
12379 metric
= strtoul(argv
[idx_number
]->arg
, NULL
, 10);
12381 red
= bgp_redist_add(bgp
, AFI_IP6
, type
, 0);
12382 changed
= bgp_redistribute_metric_set(bgp
, red
, AFI_IP6
, SAFI_UNICAST
,
12385 bgp_redistribute_rmap_set(red
, argv
[idx_word
]->arg
, route_map
);
12386 return bgp_redistribute_set(bgp
, AFI_IP6
, type
, 0, changed
);
12389 DEFUN (no_bgp_redistribute_ipv6
,
12390 no_bgp_redistribute_ipv6_cmd
,
12391 "no redistribute " FRR_IP6_REDIST_STR_BGPD
" [metric (0-4294967295)] [route-map WORD]",
12393 "Redistribute information from another routing protocol\n"
12394 FRR_IP6_REDIST_HELP_STR_BGPD
12395 "Metric for redistributed routes\n"
12397 "Route map reference\n"
12398 "Pointer to route-map entries\n")
12400 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
12401 int idx_protocol
= 2;
12404 type
= proto_redistnum(AFI_IP6
, argv
[idx_protocol
]->text
);
12406 vty_out(vty
, "%% Invalid route type\n");
12407 return CMD_WARNING_CONFIG_FAILED
;
12410 return bgp_redistribute_unset(bgp
, AFI_IP6
, type
, 0);
12413 void bgp_config_write_redistribute(struct vty
*vty
, struct bgp
*bgp
, afi_t afi
,
12418 /* Unicast redistribution only. */
12419 if (safi
!= SAFI_UNICAST
)
12422 for (i
= 0; i
< ZEBRA_ROUTE_MAX
; i
++) {
12423 /* Redistribute BGP does not make sense. */
12424 if (i
!= ZEBRA_ROUTE_BGP
) {
12425 struct list
*red_list
;
12426 struct listnode
*node
;
12427 struct bgp_redist
*red
;
12429 red_list
= bgp
->redist
[afi
][i
];
12433 for (ALL_LIST_ELEMENTS_RO(red_list
, node
, red
)) {
12434 /* "redistribute" configuration. */
12435 vty_out(vty
, " redistribute %s",
12436 zebra_route_string(i
));
12438 vty_out(vty
, " %d", red
->instance
);
12439 if (red
->redist_metric_flag
)
12440 vty_out(vty
, " metric %u",
12441 red
->redist_metric
);
12442 if (red
->rmap
.name
)
12443 vty_out(vty
, " route-map %s",
12445 vty_out(vty
, "\n");
12451 /* This is part of the address-family block (unicast only) */
12452 void bgp_vpn_policy_config_write_afi(struct vty
*vty
, struct bgp
*bgp
,
12457 if (bgp
->vpn_policy
[afi
].rmap_name
[BGP_VPN_POLICY_DIR_FROMVPN
]) {
12458 if (listcount(bgp
->vpn_policy
[afi
].import_vrf
))
12459 vty_out(vty
, "%*simport vrf route-map %s\n", indent
, "",
12460 bgp
->vpn_policy
[afi
]
12461 .rmap_name
[BGP_VPN_POLICY_DIR_FROMVPN
]);
12463 vty_out(vty
, "%*sroute-map vpn import %s\n", indent
, "",
12464 bgp
->vpn_policy
[afi
]
12465 .rmap_name
[BGP_VPN_POLICY_DIR_FROMVPN
]);
12467 if (CHECK_FLAG(bgp
->af_flags
[afi
][SAFI_UNICAST
],
12468 BGP_CONFIG_VRF_TO_VRF_IMPORT
)
12469 || CHECK_FLAG(bgp
->af_flags
[afi
][SAFI_UNICAST
],
12470 BGP_CONFIG_VRF_TO_VRF_EXPORT
))
12473 if (CHECK_FLAG(bgp
->vpn_policy
[afi
].flags
,
12474 BGP_VPN_POLICY_TOVPN_LABEL_AUTO
)) {
12476 vty_out(vty
, "%*slabel vpn export %s\n", indent
, "", "auto");
12479 if (bgp
->vpn_policy
[afi
].tovpn_label
!= MPLS_LABEL_NONE
) {
12480 vty_out(vty
, "%*slabel vpn export %u\n", indent
, "",
12481 bgp
->vpn_policy
[afi
].tovpn_label
);
12484 if (CHECK_FLAG(bgp
->vpn_policy
[afi
].flags
,
12485 BGP_VPN_POLICY_TOVPN_RD_SET
)) {
12486 char buf
[RD_ADDRSTRLEN
];
12487 vty_out(vty
, "%*srd vpn export %s\n", indent
, "",
12488 prefix_rd2str(&bgp
->vpn_policy
[afi
].tovpn_rd
, buf
,
12491 if (CHECK_FLAG(bgp
->vpn_policy
[afi
].flags
,
12492 BGP_VPN_POLICY_TOVPN_NEXTHOP_SET
)) {
12494 char buf
[PREFIX_STRLEN
];
12495 if (inet_ntop(bgp
->vpn_policy
[afi
].tovpn_nexthop
.family
,
12496 &bgp
->vpn_policy
[afi
].tovpn_nexthop
.u
.prefix
, buf
,
12499 vty_out(vty
, "%*snexthop vpn export %s\n",
12503 if (bgp
->vpn_policy
[afi
].rtlist
[BGP_VPN_POLICY_DIR_FROMVPN
]
12504 && bgp
->vpn_policy
[afi
].rtlist
[BGP_VPN_POLICY_DIR_TOVPN
]
12506 bgp
->vpn_policy
[afi
].rtlist
[BGP_VPN_POLICY_DIR_FROMVPN
],
12507 bgp
->vpn_policy
[afi
].rtlist
[BGP_VPN_POLICY_DIR_TOVPN
])) {
12509 char *b
= ecommunity_ecom2str(
12510 bgp
->vpn_policy
[afi
].rtlist
[BGP_VPN_POLICY_DIR_TOVPN
],
12511 ECOMMUNITY_FORMAT_ROUTE_MAP
, ECOMMUNITY_ROUTE_TARGET
);
12512 vty_out(vty
, "%*srt vpn both %s\n", indent
, "", b
);
12513 XFREE(MTYPE_ECOMMUNITY_STR
, b
);
12515 if (bgp
->vpn_policy
[afi
].rtlist
[BGP_VPN_POLICY_DIR_FROMVPN
]) {
12516 char *b
= ecommunity_ecom2str(
12517 bgp
->vpn_policy
[afi
]
12518 .rtlist
[BGP_VPN_POLICY_DIR_FROMVPN
],
12519 ECOMMUNITY_FORMAT_ROUTE_MAP
,
12520 ECOMMUNITY_ROUTE_TARGET
);
12521 vty_out(vty
, "%*srt vpn import %s\n", indent
, "", b
);
12522 XFREE(MTYPE_ECOMMUNITY_STR
, b
);
12524 if (bgp
->vpn_policy
[afi
].rtlist
[BGP_VPN_POLICY_DIR_TOVPN
]) {
12525 char *b
= ecommunity_ecom2str(
12526 bgp
->vpn_policy
[afi
]
12527 .rtlist
[BGP_VPN_POLICY_DIR_TOVPN
],
12528 ECOMMUNITY_FORMAT_ROUTE_MAP
,
12529 ECOMMUNITY_ROUTE_TARGET
);
12530 vty_out(vty
, "%*srt vpn export %s\n", indent
, "", b
);
12531 XFREE(MTYPE_ECOMMUNITY_STR
, b
);
12535 if (bgp
->vpn_policy
[afi
].rmap_name
[BGP_VPN_POLICY_DIR_TOVPN
])
12536 vty_out(vty
, "%*sroute-map vpn export %s\n", indent
, "",
12537 bgp
->vpn_policy
[afi
]
12538 .rmap_name
[BGP_VPN_POLICY_DIR_TOVPN
]);
12540 if (bgp
->vpn_policy
[afi
].import_redirect_rtlist
) {
12541 char *b
= ecommunity_ecom2str(
12542 bgp
->vpn_policy
[afi
]
12543 .import_redirect_rtlist
,
12544 ECOMMUNITY_FORMAT_ROUTE_MAP
,
12545 ECOMMUNITY_ROUTE_TARGET
);
12547 vty_out(vty
, "%*srt redirect import %s\n", indent
, "", b
);
12548 XFREE(MTYPE_ECOMMUNITY_STR
, b
);
12553 /* BGP node structure. */
12554 static struct cmd_node bgp_node
= {
12555 BGP_NODE
, "%s(config-router)# ", 1,
12558 static struct cmd_node bgp_ipv4_unicast_node
= {
12559 BGP_IPV4_NODE
, "%s(config-router-af)# ", 1,
12562 static struct cmd_node bgp_ipv4_multicast_node
= {
12563 BGP_IPV4M_NODE
, "%s(config-router-af)# ", 1,
12566 static struct cmd_node bgp_ipv4_labeled_unicast_node
= {
12567 BGP_IPV4L_NODE
, "%s(config-router-af)# ", 1,
12570 static struct cmd_node bgp_ipv6_unicast_node
= {
12571 BGP_IPV6_NODE
, "%s(config-router-af)# ", 1,
12574 static struct cmd_node bgp_ipv6_multicast_node
= {
12575 BGP_IPV6M_NODE
, "%s(config-router-af)# ", 1,
12578 static struct cmd_node bgp_ipv6_labeled_unicast_node
= {
12579 BGP_IPV6L_NODE
, "%s(config-router-af)# ", 1,
12582 static struct cmd_node bgp_vpnv4_node
= {BGP_VPNV4_NODE
,
12583 "%s(config-router-af)# ", 1};
12585 static struct cmd_node bgp_vpnv6_node
= {BGP_VPNV6_NODE
,
12586 "%s(config-router-af-vpnv6)# ", 1};
12588 static struct cmd_node bgp_evpn_node
= {BGP_EVPN_NODE
,
12589 "%s(config-router-evpn)# ", 1};
12591 static struct cmd_node bgp_evpn_vni_node
= {BGP_EVPN_VNI_NODE
,
12592 "%s(config-router-af-vni)# ", 1};
12594 static struct cmd_node bgp_flowspecv4_node
= {BGP_FLOWSPECV4_NODE
,
12595 "%s(config-router-af)# ", 1};
12597 static struct cmd_node bgp_flowspecv6_node
= {BGP_FLOWSPECV6_NODE
,
12598 "%s(config-router-af-vpnv6)# ", 1};
12600 static void community_list_vty(void);
12602 static void bgp_ac_neighbor(vector comps
, struct cmd_token
*token
)
12606 struct listnode
*lnbgp
, *lnpeer
;
12608 for (ALL_LIST_ELEMENTS_RO(bm
->bgp
, lnbgp
, bgp
)) {
12609 for (ALL_LIST_ELEMENTS_RO(bgp
->peer
, lnpeer
, peer
)) {
12610 /* only provide suggestions on the appropriate input
12612 * they'll otherwise show up multiple times */
12613 enum cmd_token_type match_type
;
12614 char *name
= peer
->host
;
12616 if (peer
->conf_if
) {
12617 match_type
= VARIABLE_TKN
;
12618 name
= peer
->conf_if
;
12619 } else if (strchr(peer
->host
, ':'))
12620 match_type
= IPV6_TKN
;
12622 match_type
= IPV4_TKN
;
12624 if (token
->type
!= match_type
)
12627 vector_set(comps
, XSTRDUP(MTYPE_COMPLETION
, name
));
12632 static const struct cmd_variable_handler bgp_var_neighbor
[] = {
12633 {.varname
= "neighbor", .completions
= bgp_ac_neighbor
},
12634 {.varname
= "neighbors", .completions
= bgp_ac_neighbor
},
12635 {.varname
= "peer", .completions
= bgp_ac_neighbor
},
12636 {.completions
= NULL
}};
12638 static void bgp_ac_peergroup(vector comps
, struct cmd_token
*token
)
12641 struct peer_group
*group
;
12642 struct listnode
*lnbgp
, *lnpeer
;
12644 for (ALL_LIST_ELEMENTS_RO(bm
->bgp
, lnbgp
, bgp
)) {
12645 for (ALL_LIST_ELEMENTS_RO(bgp
->group
, lnpeer
, group
))
12646 vector_set(comps
, XSTRDUP(MTYPE_COMPLETION
,
12651 static const struct cmd_variable_handler bgp_var_peergroup
[] = {
12652 {.tokenname
= "PGNAME", .completions
= bgp_ac_peergroup
},
12653 {.completions
= NULL
} };
12655 void bgp_vty_init(void)
12657 cmd_variable_handler_register(bgp_var_neighbor
);
12658 cmd_variable_handler_register(bgp_var_peergroup
);
12660 /* Install bgp top node. */
12661 install_node(&bgp_node
, bgp_config_write
);
12662 install_node(&bgp_ipv4_unicast_node
, NULL
);
12663 install_node(&bgp_ipv4_multicast_node
, NULL
);
12664 install_node(&bgp_ipv4_labeled_unicast_node
, NULL
);
12665 install_node(&bgp_ipv6_unicast_node
, NULL
);
12666 install_node(&bgp_ipv6_multicast_node
, NULL
);
12667 install_node(&bgp_ipv6_labeled_unicast_node
, NULL
);
12668 install_node(&bgp_vpnv4_node
, NULL
);
12669 install_node(&bgp_vpnv6_node
, NULL
);
12670 install_node(&bgp_evpn_node
, NULL
);
12671 install_node(&bgp_evpn_vni_node
, NULL
);
12672 install_node(&bgp_flowspecv4_node
, NULL
);
12673 install_node(&bgp_flowspecv6_node
, NULL
);
12675 /* Install default VTY commands to new nodes. */
12676 install_default(BGP_NODE
);
12677 install_default(BGP_IPV4_NODE
);
12678 install_default(BGP_IPV4M_NODE
);
12679 install_default(BGP_IPV4L_NODE
);
12680 install_default(BGP_IPV6_NODE
);
12681 install_default(BGP_IPV6M_NODE
);
12682 install_default(BGP_IPV6L_NODE
);
12683 install_default(BGP_VPNV4_NODE
);
12684 install_default(BGP_VPNV6_NODE
);
12685 install_default(BGP_FLOWSPECV4_NODE
);
12686 install_default(BGP_FLOWSPECV6_NODE
);
12687 install_default(BGP_EVPN_NODE
);
12688 install_default(BGP_EVPN_VNI_NODE
);
12690 /* "bgp multiple-instance" commands. */
12691 install_element(CONFIG_NODE
, &bgp_multiple_instance_cmd
);
12692 install_element(CONFIG_NODE
, &no_bgp_multiple_instance_cmd
);
12694 /* "bgp config-type" commands. */
12695 install_element(CONFIG_NODE
, &bgp_config_type_cmd
);
12696 install_element(CONFIG_NODE
, &no_bgp_config_type_cmd
);
12698 /* "bgp local-mac" hidden commands. */
12699 install_element(CONFIG_NODE
, &bgp_local_mac_cmd
);
12700 install_element(CONFIG_NODE
, &no_bgp_local_mac_cmd
);
12702 /* bgp route-map delay-timer commands. */
12703 install_element(CONFIG_NODE
, &bgp_set_route_map_delay_timer_cmd
);
12704 install_element(CONFIG_NODE
, &no_bgp_set_route_map_delay_timer_cmd
);
12706 /* Dummy commands (Currently not supported) */
12707 install_element(BGP_NODE
, &no_synchronization_cmd
);
12708 install_element(BGP_NODE
, &no_auto_summary_cmd
);
12710 /* "router bgp" commands. */
12711 install_element(CONFIG_NODE
, &router_bgp_cmd
);
12713 /* "no router bgp" commands. */
12714 install_element(CONFIG_NODE
, &no_router_bgp_cmd
);
12716 /* "bgp router-id" commands. */
12717 install_element(BGP_NODE
, &bgp_router_id_cmd
);
12718 install_element(BGP_NODE
, &no_bgp_router_id_cmd
);
12720 /* "bgp cluster-id" commands. */
12721 install_element(BGP_NODE
, &bgp_cluster_id_cmd
);
12722 install_element(BGP_NODE
, &no_bgp_cluster_id_cmd
);
12724 /* "bgp confederation" commands. */
12725 install_element(BGP_NODE
, &bgp_confederation_identifier_cmd
);
12726 install_element(BGP_NODE
, &no_bgp_confederation_identifier_cmd
);
12728 /* "bgp confederation peers" commands. */
12729 install_element(BGP_NODE
, &bgp_confederation_peers_cmd
);
12730 install_element(BGP_NODE
, &no_bgp_confederation_peers_cmd
);
12732 /* bgp max-med command */
12733 install_element(BGP_NODE
, &bgp_maxmed_admin_cmd
);
12734 install_element(BGP_NODE
, &no_bgp_maxmed_admin_cmd
);
12735 install_element(BGP_NODE
, &bgp_maxmed_admin_medv_cmd
);
12736 install_element(BGP_NODE
, &bgp_maxmed_onstartup_cmd
);
12737 install_element(BGP_NODE
, &no_bgp_maxmed_onstartup_cmd
);
12739 /* bgp disable-ebgp-connected-nh-check */
12740 install_element(BGP_NODE
, &bgp_disable_connected_route_check_cmd
);
12741 install_element(BGP_NODE
, &no_bgp_disable_connected_route_check_cmd
);
12743 /* bgp update-delay command */
12744 install_element(BGP_NODE
, &bgp_update_delay_cmd
);
12745 install_element(BGP_NODE
, &no_bgp_update_delay_cmd
);
12746 install_element(BGP_NODE
, &bgp_update_delay_establish_wait_cmd
);
12748 install_element(BGP_NODE
, &bgp_wpkt_quanta_cmd
);
12749 install_element(BGP_NODE
, &no_bgp_wpkt_quanta_cmd
);
12750 install_element(BGP_NODE
, &bgp_rpkt_quanta_cmd
);
12751 install_element(BGP_NODE
, &no_bgp_rpkt_quanta_cmd
);
12753 install_element(BGP_NODE
, &bgp_coalesce_time_cmd
);
12754 install_element(BGP_NODE
, &no_bgp_coalesce_time_cmd
);
12756 /* "maximum-paths" commands. */
12757 install_element(BGP_NODE
, &bgp_maxpaths_hidden_cmd
);
12758 install_element(BGP_NODE
, &no_bgp_maxpaths_hidden_cmd
);
12759 install_element(BGP_IPV4_NODE
, &bgp_maxpaths_cmd
);
12760 install_element(BGP_IPV4_NODE
, &no_bgp_maxpaths_cmd
);
12761 install_element(BGP_IPV6_NODE
, &bgp_maxpaths_cmd
);
12762 install_element(BGP_IPV6_NODE
, &no_bgp_maxpaths_cmd
);
12763 install_element(BGP_NODE
, &bgp_maxpaths_ibgp_hidden_cmd
);
12764 install_element(BGP_NODE
, &bgp_maxpaths_ibgp_cluster_hidden_cmd
);
12765 install_element(BGP_NODE
, &no_bgp_maxpaths_ibgp_hidden_cmd
);
12766 install_element(BGP_IPV4_NODE
, &bgp_maxpaths_ibgp_cmd
);
12767 install_element(BGP_IPV4_NODE
, &bgp_maxpaths_ibgp_cluster_cmd
);
12768 install_element(BGP_IPV4_NODE
, &no_bgp_maxpaths_ibgp_cmd
);
12769 install_element(BGP_IPV6_NODE
, &bgp_maxpaths_ibgp_cmd
);
12770 install_element(BGP_IPV6_NODE
, &bgp_maxpaths_ibgp_cluster_cmd
);
12771 install_element(BGP_IPV6_NODE
, &no_bgp_maxpaths_ibgp_cmd
);
12773 install_element(BGP_IPV6L_NODE
, &bgp_maxpaths_cmd
);
12774 install_element(BGP_IPV6L_NODE
, &no_bgp_maxpaths_cmd
);
12775 install_element(BGP_IPV6L_NODE
, &bgp_maxpaths_ibgp_cmd
);
12776 install_element(BGP_IPV6L_NODE
, &bgp_maxpaths_ibgp_cluster_cmd
);
12777 install_element(BGP_IPV6L_NODE
, &no_bgp_maxpaths_ibgp_cmd
);
12779 /* "timers bgp" commands. */
12780 install_element(BGP_NODE
, &bgp_timers_cmd
);
12781 install_element(BGP_NODE
, &no_bgp_timers_cmd
);
12783 /* route-map delay-timer commands - per instance for backwards compat.
12785 install_element(BGP_NODE
, &bgp_set_route_map_delay_timer_cmd
);
12786 install_element(BGP_NODE
, &no_bgp_set_route_map_delay_timer_cmd
);
12788 /* "bgp client-to-client reflection" commands */
12789 install_element(BGP_NODE
, &no_bgp_client_to_client_reflection_cmd
);
12790 install_element(BGP_NODE
, &bgp_client_to_client_reflection_cmd
);
12792 /* "bgp always-compare-med" commands */
12793 install_element(BGP_NODE
, &bgp_always_compare_med_cmd
);
12794 install_element(BGP_NODE
, &no_bgp_always_compare_med_cmd
);
12796 /* "bgp deterministic-med" commands */
12797 install_element(BGP_NODE
, &bgp_deterministic_med_cmd
);
12798 install_element(BGP_NODE
, &no_bgp_deterministic_med_cmd
);
12800 /* "bgp graceful-restart" commands */
12801 install_element(BGP_NODE
, &bgp_graceful_restart_cmd
);
12802 install_element(BGP_NODE
, &no_bgp_graceful_restart_cmd
);
12803 install_element(BGP_NODE
, &bgp_graceful_restart_stalepath_time_cmd
);
12804 install_element(BGP_NODE
, &no_bgp_graceful_restart_stalepath_time_cmd
);
12805 install_element(BGP_NODE
, &bgp_graceful_restart_restart_time_cmd
);
12806 install_element(BGP_NODE
, &no_bgp_graceful_restart_restart_time_cmd
);
12808 install_element(BGP_NODE
, &bgp_graceful_restart_preserve_fw_cmd
);
12809 install_element(BGP_NODE
, &no_bgp_graceful_restart_preserve_fw_cmd
);
12811 /* "bgp graceful-shutdown" commands */
12812 install_element(BGP_NODE
, &bgp_graceful_shutdown_cmd
);
12813 install_element(BGP_NODE
, &no_bgp_graceful_shutdown_cmd
);
12815 /* "bgp fast-external-failover" commands */
12816 install_element(BGP_NODE
, &bgp_fast_external_failover_cmd
);
12817 install_element(BGP_NODE
, &no_bgp_fast_external_failover_cmd
);
12819 /* "bgp enforce-first-as" commands */
12820 install_element(BGP_NODE
, &bgp_enforce_first_as_cmd
);
12822 /* "bgp bestpath compare-routerid" commands */
12823 install_element(BGP_NODE
, &bgp_bestpath_compare_router_id_cmd
);
12824 install_element(BGP_NODE
, &no_bgp_bestpath_compare_router_id_cmd
);
12826 /* "bgp bestpath as-path ignore" commands */
12827 install_element(BGP_NODE
, &bgp_bestpath_aspath_ignore_cmd
);
12828 install_element(BGP_NODE
, &no_bgp_bestpath_aspath_ignore_cmd
);
12830 /* "bgp bestpath as-path confed" commands */
12831 install_element(BGP_NODE
, &bgp_bestpath_aspath_confed_cmd
);
12832 install_element(BGP_NODE
, &no_bgp_bestpath_aspath_confed_cmd
);
12834 /* "bgp bestpath as-path multipath-relax" commands */
12835 install_element(BGP_NODE
, &bgp_bestpath_aspath_multipath_relax_cmd
);
12836 install_element(BGP_NODE
, &no_bgp_bestpath_aspath_multipath_relax_cmd
);
12838 /* "bgp log-neighbor-changes" commands */
12839 install_element(BGP_NODE
, &bgp_log_neighbor_changes_cmd
);
12840 install_element(BGP_NODE
, &no_bgp_log_neighbor_changes_cmd
);
12842 /* "bgp bestpath med" commands */
12843 install_element(BGP_NODE
, &bgp_bestpath_med_cmd
);
12844 install_element(BGP_NODE
, &no_bgp_bestpath_med_cmd
);
12846 /* "no bgp default ipv4-unicast" commands. */
12847 install_element(BGP_NODE
, &no_bgp_default_ipv4_unicast_cmd
);
12848 install_element(BGP_NODE
, &bgp_default_ipv4_unicast_cmd
);
12850 /* "bgp network import-check" commands. */
12851 install_element(BGP_NODE
, &bgp_network_import_check_cmd
);
12852 install_element(BGP_NODE
, &bgp_network_import_check_exact_cmd
);
12853 install_element(BGP_NODE
, &no_bgp_network_import_check_cmd
);
12855 /* "bgp default local-preference" commands. */
12856 install_element(BGP_NODE
, &bgp_default_local_preference_cmd
);
12857 install_element(BGP_NODE
, &no_bgp_default_local_preference_cmd
);
12859 /* bgp default show-hostname */
12860 install_element(BGP_NODE
, &bgp_default_show_hostname_cmd
);
12861 install_element(BGP_NODE
, &no_bgp_default_show_hostname_cmd
);
12863 /* "bgp default subgroup-pkt-queue-max" commands. */
12864 install_element(BGP_NODE
, &bgp_default_subgroup_pkt_queue_max_cmd
);
12865 install_element(BGP_NODE
, &no_bgp_default_subgroup_pkt_queue_max_cmd
);
12867 /* bgp ibgp-allow-policy-mods command */
12868 install_element(BGP_NODE
, &bgp_rr_allow_outbound_policy_cmd
);
12869 install_element(BGP_NODE
, &no_bgp_rr_allow_outbound_policy_cmd
);
12871 /* "bgp listen limit" commands. */
12872 install_element(BGP_NODE
, &bgp_listen_limit_cmd
);
12873 install_element(BGP_NODE
, &no_bgp_listen_limit_cmd
);
12875 /* "bgp listen range" commands. */
12876 install_element(BGP_NODE
, &bgp_listen_range_cmd
);
12877 install_element(BGP_NODE
, &no_bgp_listen_range_cmd
);
12879 /* "bgp default shutdown" command */
12880 install_element(BGP_NODE
, &bgp_default_shutdown_cmd
);
12882 /* "neighbor remote-as" commands. */
12883 install_element(BGP_NODE
, &neighbor_remote_as_cmd
);
12884 install_element(BGP_NODE
, &neighbor_interface_config_cmd
);
12885 install_element(BGP_NODE
, &neighbor_interface_config_v6only_cmd
);
12886 install_element(BGP_NODE
, &neighbor_interface_config_remote_as_cmd
);
12887 install_element(BGP_NODE
,
12888 &neighbor_interface_v6only_config_remote_as_cmd
);
12889 install_element(BGP_NODE
, &no_neighbor_cmd
);
12890 install_element(BGP_NODE
, &no_neighbor_interface_config_cmd
);
12892 /* "neighbor peer-group" commands. */
12893 install_element(BGP_NODE
, &neighbor_peer_group_cmd
);
12894 install_element(BGP_NODE
, &no_neighbor_peer_group_cmd
);
12895 install_element(BGP_NODE
,
12896 &no_neighbor_interface_peer_group_remote_as_cmd
);
12898 /* "neighbor local-as" commands. */
12899 install_element(BGP_NODE
, &neighbor_local_as_cmd
);
12900 install_element(BGP_NODE
, &neighbor_local_as_no_prepend_cmd
);
12901 install_element(BGP_NODE
, &neighbor_local_as_no_prepend_replace_as_cmd
);
12902 install_element(BGP_NODE
, &no_neighbor_local_as_cmd
);
12904 /* "neighbor solo" commands. */
12905 install_element(BGP_NODE
, &neighbor_solo_cmd
);
12906 install_element(BGP_NODE
, &no_neighbor_solo_cmd
);
12908 /* "neighbor password" commands. */
12909 install_element(BGP_NODE
, &neighbor_password_cmd
);
12910 install_element(BGP_NODE
, &no_neighbor_password_cmd
);
12912 /* "neighbor activate" commands. */
12913 install_element(BGP_NODE
, &neighbor_activate_hidden_cmd
);
12914 install_element(BGP_IPV4_NODE
, &neighbor_activate_cmd
);
12915 install_element(BGP_IPV4M_NODE
, &neighbor_activate_cmd
);
12916 install_element(BGP_IPV4L_NODE
, &neighbor_activate_cmd
);
12917 install_element(BGP_IPV6_NODE
, &neighbor_activate_cmd
);
12918 install_element(BGP_IPV6M_NODE
, &neighbor_activate_cmd
);
12919 install_element(BGP_IPV6L_NODE
, &neighbor_activate_cmd
);
12920 install_element(BGP_VPNV4_NODE
, &neighbor_activate_cmd
);
12921 install_element(BGP_VPNV6_NODE
, &neighbor_activate_cmd
);
12922 install_element(BGP_FLOWSPECV4_NODE
, &neighbor_activate_cmd
);
12923 install_element(BGP_FLOWSPECV6_NODE
, &neighbor_activate_cmd
);
12924 install_element(BGP_EVPN_NODE
, &neighbor_activate_cmd
);
12926 /* "no neighbor activate" commands. */
12927 install_element(BGP_NODE
, &no_neighbor_activate_hidden_cmd
);
12928 install_element(BGP_IPV4_NODE
, &no_neighbor_activate_cmd
);
12929 install_element(BGP_IPV4M_NODE
, &no_neighbor_activate_cmd
);
12930 install_element(BGP_IPV4L_NODE
, &no_neighbor_activate_cmd
);
12931 install_element(BGP_IPV6_NODE
, &no_neighbor_activate_cmd
);
12932 install_element(BGP_IPV6M_NODE
, &no_neighbor_activate_cmd
);
12933 install_element(BGP_IPV6L_NODE
, &no_neighbor_activate_cmd
);
12934 install_element(BGP_VPNV4_NODE
, &no_neighbor_activate_cmd
);
12935 install_element(BGP_VPNV6_NODE
, &no_neighbor_activate_cmd
);
12936 install_element(BGP_FLOWSPECV4_NODE
, &no_neighbor_activate_cmd
);
12937 install_element(BGP_FLOWSPECV6_NODE
, &no_neighbor_activate_cmd
);
12938 install_element(BGP_EVPN_NODE
, &no_neighbor_activate_cmd
);
12940 /* "neighbor peer-group" set commands. */
12941 install_element(BGP_NODE
, &neighbor_set_peer_group_cmd
);
12942 install_element(BGP_IPV4_NODE
, &neighbor_set_peer_group_hidden_cmd
);
12943 install_element(BGP_IPV4M_NODE
, &neighbor_set_peer_group_hidden_cmd
);
12944 install_element(BGP_IPV6_NODE
, &neighbor_set_peer_group_hidden_cmd
);
12945 install_element(BGP_IPV6M_NODE
, &neighbor_set_peer_group_hidden_cmd
);
12946 install_element(BGP_IPV6L_NODE
, &neighbor_set_peer_group_hidden_cmd
);
12947 install_element(BGP_VPNV4_NODE
, &neighbor_set_peer_group_hidden_cmd
);
12948 install_element(BGP_VPNV6_NODE
, &neighbor_set_peer_group_hidden_cmd
);
12949 install_element(BGP_FLOWSPECV4_NODE
,
12950 &neighbor_set_peer_group_hidden_cmd
);
12951 install_element(BGP_FLOWSPECV6_NODE
,
12952 &neighbor_set_peer_group_hidden_cmd
);
12954 /* "no neighbor peer-group unset" commands. */
12955 install_element(BGP_NODE
, &no_neighbor_set_peer_group_cmd
);
12956 install_element(BGP_IPV4_NODE
, &no_neighbor_set_peer_group_hidden_cmd
);
12957 install_element(BGP_IPV4M_NODE
, &no_neighbor_set_peer_group_hidden_cmd
);
12958 install_element(BGP_IPV6_NODE
, &no_neighbor_set_peer_group_hidden_cmd
);
12959 install_element(BGP_IPV6M_NODE
, &no_neighbor_set_peer_group_hidden_cmd
);
12960 install_element(BGP_IPV6L_NODE
, &no_neighbor_set_peer_group_hidden_cmd
);
12961 install_element(BGP_VPNV4_NODE
, &no_neighbor_set_peer_group_hidden_cmd
);
12962 install_element(BGP_VPNV6_NODE
, &no_neighbor_set_peer_group_hidden_cmd
);
12963 install_element(BGP_FLOWSPECV4_NODE
,
12964 &no_neighbor_set_peer_group_hidden_cmd
);
12965 install_element(BGP_FLOWSPECV6_NODE
,
12966 &no_neighbor_set_peer_group_hidden_cmd
);
12968 /* "neighbor softreconfiguration inbound" commands.*/
12969 install_element(BGP_NODE
, &neighbor_soft_reconfiguration_hidden_cmd
);
12970 install_element(BGP_NODE
, &no_neighbor_soft_reconfiguration_hidden_cmd
);
12971 install_element(BGP_IPV4_NODE
, &neighbor_soft_reconfiguration_cmd
);
12972 install_element(BGP_IPV4_NODE
, &no_neighbor_soft_reconfiguration_cmd
);
12973 install_element(BGP_IPV4L_NODE
, &neighbor_soft_reconfiguration_cmd
);
12974 install_element(BGP_IPV4L_NODE
, &no_neighbor_soft_reconfiguration_cmd
);
12975 install_element(BGP_IPV4M_NODE
, &neighbor_soft_reconfiguration_cmd
);
12976 install_element(BGP_IPV4M_NODE
, &no_neighbor_soft_reconfiguration_cmd
);
12977 install_element(BGP_IPV6_NODE
, &neighbor_soft_reconfiguration_cmd
);
12978 install_element(BGP_IPV6_NODE
, &no_neighbor_soft_reconfiguration_cmd
);
12979 install_element(BGP_IPV6M_NODE
, &neighbor_soft_reconfiguration_cmd
);
12980 install_element(BGP_IPV6M_NODE
, &no_neighbor_soft_reconfiguration_cmd
);
12981 install_element(BGP_IPV6L_NODE
, &neighbor_soft_reconfiguration_cmd
);
12982 install_element(BGP_IPV6L_NODE
, &no_neighbor_soft_reconfiguration_cmd
);
12983 install_element(BGP_VPNV4_NODE
, &neighbor_soft_reconfiguration_cmd
);
12984 install_element(BGP_VPNV4_NODE
, &no_neighbor_soft_reconfiguration_cmd
);
12985 install_element(BGP_VPNV6_NODE
, &neighbor_soft_reconfiguration_cmd
);
12986 install_element(BGP_VPNV6_NODE
, &no_neighbor_soft_reconfiguration_cmd
);
12987 install_element(BGP_FLOWSPECV4_NODE
,
12988 &neighbor_soft_reconfiguration_cmd
);
12989 install_element(BGP_FLOWSPECV4_NODE
,
12990 &no_neighbor_soft_reconfiguration_cmd
);
12991 install_element(BGP_FLOWSPECV6_NODE
,
12992 &neighbor_soft_reconfiguration_cmd
);
12993 install_element(BGP_FLOWSPECV6_NODE
,
12994 &no_neighbor_soft_reconfiguration_cmd
);
12996 /* "neighbor attribute-unchanged" commands. */
12997 install_element(BGP_NODE
, &neighbor_attr_unchanged_hidden_cmd
);
12998 install_element(BGP_NODE
, &no_neighbor_attr_unchanged_hidden_cmd
);
12999 install_element(BGP_IPV4_NODE
, &neighbor_attr_unchanged_cmd
);
13000 install_element(BGP_IPV4_NODE
, &no_neighbor_attr_unchanged_cmd
);
13001 install_element(BGP_IPV4M_NODE
, &neighbor_attr_unchanged_cmd
);
13002 install_element(BGP_IPV4M_NODE
, &no_neighbor_attr_unchanged_cmd
);
13003 install_element(BGP_IPV4L_NODE
, &neighbor_attr_unchanged_cmd
);
13004 install_element(BGP_IPV4L_NODE
, &no_neighbor_attr_unchanged_cmd
);
13005 install_element(BGP_IPV6_NODE
, &neighbor_attr_unchanged_cmd
);
13006 install_element(BGP_IPV6_NODE
, &no_neighbor_attr_unchanged_cmd
);
13007 install_element(BGP_IPV6M_NODE
, &neighbor_attr_unchanged_cmd
);
13008 install_element(BGP_IPV6M_NODE
, &no_neighbor_attr_unchanged_cmd
);
13009 install_element(BGP_IPV6L_NODE
, &neighbor_attr_unchanged_cmd
);
13010 install_element(BGP_IPV6L_NODE
, &no_neighbor_attr_unchanged_cmd
);
13011 install_element(BGP_VPNV4_NODE
, &neighbor_attr_unchanged_cmd
);
13012 install_element(BGP_VPNV4_NODE
, &no_neighbor_attr_unchanged_cmd
);
13013 install_element(BGP_VPNV6_NODE
, &neighbor_attr_unchanged_cmd
);
13014 install_element(BGP_VPNV6_NODE
, &no_neighbor_attr_unchanged_cmd
);
13016 install_element(BGP_EVPN_NODE
, &neighbor_attr_unchanged_cmd
);
13017 install_element(BGP_EVPN_NODE
, &no_neighbor_attr_unchanged_cmd
);
13019 /* "nexthop-local unchanged" commands */
13020 install_element(BGP_IPV6_NODE
, &neighbor_nexthop_local_unchanged_cmd
);
13021 install_element(BGP_IPV6_NODE
,
13022 &no_neighbor_nexthop_local_unchanged_cmd
);
13024 /* "neighbor next-hop-self" commands. */
13025 install_element(BGP_NODE
, &neighbor_nexthop_self_hidden_cmd
);
13026 install_element(BGP_NODE
, &no_neighbor_nexthop_self_hidden_cmd
);
13027 install_element(BGP_IPV4_NODE
, &neighbor_nexthop_self_cmd
);
13028 install_element(BGP_IPV4_NODE
, &no_neighbor_nexthop_self_cmd
);
13029 install_element(BGP_IPV4M_NODE
, &neighbor_nexthop_self_cmd
);
13030 install_element(BGP_IPV4M_NODE
, &no_neighbor_nexthop_self_cmd
);
13031 install_element(BGP_IPV4L_NODE
, &neighbor_nexthop_self_cmd
);
13032 install_element(BGP_IPV4L_NODE
, &no_neighbor_nexthop_self_cmd
);
13033 install_element(BGP_IPV6_NODE
, &neighbor_nexthop_self_cmd
);
13034 install_element(BGP_IPV6_NODE
, &no_neighbor_nexthop_self_cmd
);
13035 install_element(BGP_IPV6M_NODE
, &neighbor_nexthop_self_cmd
);
13036 install_element(BGP_IPV6M_NODE
, &no_neighbor_nexthop_self_cmd
);
13037 install_element(BGP_IPV6L_NODE
, &neighbor_nexthop_self_cmd
);
13038 install_element(BGP_IPV6L_NODE
, &no_neighbor_nexthop_self_cmd
);
13039 install_element(BGP_VPNV4_NODE
, &neighbor_nexthop_self_cmd
);
13040 install_element(BGP_VPNV4_NODE
, &no_neighbor_nexthop_self_cmd
);
13041 install_element(BGP_VPNV6_NODE
, &neighbor_nexthop_self_cmd
);
13042 install_element(BGP_VPNV6_NODE
, &no_neighbor_nexthop_self_cmd
);
13043 install_element(BGP_EVPN_NODE
, &neighbor_nexthop_self_cmd
);
13044 install_element(BGP_EVPN_NODE
, &no_neighbor_nexthop_self_cmd
);
13046 /* "neighbor next-hop-self force" commands. */
13047 install_element(BGP_NODE
, &neighbor_nexthop_self_force_hidden_cmd
);
13048 install_element(BGP_NODE
, &no_neighbor_nexthop_self_force_hidden_cmd
);
13049 install_element(BGP_IPV4_NODE
, &neighbor_nexthop_self_force_cmd
);
13050 install_element(BGP_IPV4_NODE
, &no_neighbor_nexthop_self_force_cmd
);
13051 install_element(BGP_IPV4M_NODE
, &neighbor_nexthop_self_force_cmd
);
13052 install_element(BGP_IPV4M_NODE
, &no_neighbor_nexthop_self_force_cmd
);
13053 install_element(BGP_IPV4L_NODE
, &neighbor_nexthop_self_force_cmd
);
13054 install_element(BGP_IPV4L_NODE
, &no_neighbor_nexthop_self_force_cmd
);
13055 install_element(BGP_IPV6_NODE
, &neighbor_nexthop_self_force_cmd
);
13056 install_element(BGP_IPV6_NODE
, &no_neighbor_nexthop_self_force_cmd
);
13057 install_element(BGP_IPV6M_NODE
, &neighbor_nexthop_self_force_cmd
);
13058 install_element(BGP_IPV6M_NODE
, &no_neighbor_nexthop_self_force_cmd
);
13059 install_element(BGP_IPV6L_NODE
, &neighbor_nexthop_self_force_cmd
);
13060 install_element(BGP_IPV6L_NODE
, &no_neighbor_nexthop_self_force_cmd
);
13061 install_element(BGP_VPNV4_NODE
, &neighbor_nexthop_self_force_cmd
);
13062 install_element(BGP_VPNV4_NODE
, &no_neighbor_nexthop_self_force_cmd
);
13063 install_element(BGP_VPNV6_NODE
, &neighbor_nexthop_self_force_cmd
);
13064 install_element(BGP_VPNV6_NODE
, &no_neighbor_nexthop_self_force_cmd
);
13066 /* "neighbor as-override" commands. */
13067 install_element(BGP_NODE
, &neighbor_as_override_hidden_cmd
);
13068 install_element(BGP_NODE
, &no_neighbor_as_override_hidden_cmd
);
13069 install_element(BGP_IPV4_NODE
, &neighbor_as_override_cmd
);
13070 install_element(BGP_IPV4_NODE
, &no_neighbor_as_override_cmd
);
13071 install_element(BGP_IPV4M_NODE
, &neighbor_as_override_cmd
);
13072 install_element(BGP_IPV4M_NODE
, &no_neighbor_as_override_cmd
);
13073 install_element(BGP_IPV4L_NODE
, &neighbor_as_override_cmd
);
13074 install_element(BGP_IPV4L_NODE
, &no_neighbor_as_override_cmd
);
13075 install_element(BGP_IPV6_NODE
, &neighbor_as_override_cmd
);
13076 install_element(BGP_IPV6_NODE
, &no_neighbor_as_override_cmd
);
13077 install_element(BGP_IPV6M_NODE
, &neighbor_as_override_cmd
);
13078 install_element(BGP_IPV6M_NODE
, &no_neighbor_as_override_cmd
);
13079 install_element(BGP_IPV6L_NODE
, &neighbor_as_override_cmd
);
13080 install_element(BGP_IPV6L_NODE
, &no_neighbor_as_override_cmd
);
13081 install_element(BGP_VPNV4_NODE
, &neighbor_as_override_cmd
);
13082 install_element(BGP_VPNV4_NODE
, &no_neighbor_as_override_cmd
);
13083 install_element(BGP_VPNV6_NODE
, &neighbor_as_override_cmd
);
13084 install_element(BGP_VPNV6_NODE
, &no_neighbor_as_override_cmd
);
13086 /* "neighbor remove-private-AS" commands. */
13087 install_element(BGP_NODE
, &neighbor_remove_private_as_hidden_cmd
);
13088 install_element(BGP_NODE
, &no_neighbor_remove_private_as_hidden_cmd
);
13089 install_element(BGP_NODE
, &neighbor_remove_private_as_all_hidden_cmd
);
13090 install_element(BGP_NODE
,
13091 &no_neighbor_remove_private_as_all_hidden_cmd
);
13092 install_element(BGP_NODE
,
13093 &neighbor_remove_private_as_replace_as_hidden_cmd
);
13094 install_element(BGP_NODE
,
13095 &no_neighbor_remove_private_as_replace_as_hidden_cmd
);
13096 install_element(BGP_NODE
,
13097 &neighbor_remove_private_as_all_replace_as_hidden_cmd
);
13100 &no_neighbor_remove_private_as_all_replace_as_hidden_cmd
);
13101 install_element(BGP_IPV4_NODE
, &neighbor_remove_private_as_cmd
);
13102 install_element(BGP_IPV4_NODE
, &no_neighbor_remove_private_as_cmd
);
13103 install_element(BGP_IPV4_NODE
, &neighbor_remove_private_as_all_cmd
);
13104 install_element(BGP_IPV4_NODE
, &no_neighbor_remove_private_as_all_cmd
);
13105 install_element(BGP_IPV4_NODE
,
13106 &neighbor_remove_private_as_replace_as_cmd
);
13107 install_element(BGP_IPV4_NODE
,
13108 &no_neighbor_remove_private_as_replace_as_cmd
);
13109 install_element(BGP_IPV4_NODE
,
13110 &neighbor_remove_private_as_all_replace_as_cmd
);
13111 install_element(BGP_IPV4_NODE
,
13112 &no_neighbor_remove_private_as_all_replace_as_cmd
);
13113 install_element(BGP_IPV4M_NODE
, &neighbor_remove_private_as_cmd
);
13114 install_element(BGP_IPV4M_NODE
, &no_neighbor_remove_private_as_cmd
);
13115 install_element(BGP_IPV4M_NODE
, &neighbor_remove_private_as_all_cmd
);
13116 install_element(BGP_IPV4M_NODE
, &no_neighbor_remove_private_as_all_cmd
);
13117 install_element(BGP_IPV4M_NODE
,
13118 &neighbor_remove_private_as_replace_as_cmd
);
13119 install_element(BGP_IPV4M_NODE
,
13120 &no_neighbor_remove_private_as_replace_as_cmd
);
13121 install_element(BGP_IPV4M_NODE
,
13122 &neighbor_remove_private_as_all_replace_as_cmd
);
13123 install_element(BGP_IPV4M_NODE
,
13124 &no_neighbor_remove_private_as_all_replace_as_cmd
);
13125 install_element(BGP_IPV4L_NODE
, &neighbor_remove_private_as_cmd
);
13126 install_element(BGP_IPV4L_NODE
, &no_neighbor_remove_private_as_cmd
);
13127 install_element(BGP_IPV4L_NODE
, &neighbor_remove_private_as_all_cmd
);
13128 install_element(BGP_IPV4L_NODE
, &no_neighbor_remove_private_as_all_cmd
);
13129 install_element(BGP_IPV4L_NODE
,
13130 &neighbor_remove_private_as_replace_as_cmd
);
13131 install_element(BGP_IPV4L_NODE
,
13132 &no_neighbor_remove_private_as_replace_as_cmd
);
13133 install_element(BGP_IPV4L_NODE
,
13134 &neighbor_remove_private_as_all_replace_as_cmd
);
13135 install_element(BGP_IPV4L_NODE
,
13136 &no_neighbor_remove_private_as_all_replace_as_cmd
);
13137 install_element(BGP_IPV6_NODE
, &neighbor_remove_private_as_cmd
);
13138 install_element(BGP_IPV6_NODE
, &no_neighbor_remove_private_as_cmd
);
13139 install_element(BGP_IPV6_NODE
, &neighbor_remove_private_as_all_cmd
);
13140 install_element(BGP_IPV6_NODE
, &no_neighbor_remove_private_as_all_cmd
);
13141 install_element(BGP_IPV6_NODE
,
13142 &neighbor_remove_private_as_replace_as_cmd
);
13143 install_element(BGP_IPV6_NODE
,
13144 &no_neighbor_remove_private_as_replace_as_cmd
);
13145 install_element(BGP_IPV6_NODE
,
13146 &neighbor_remove_private_as_all_replace_as_cmd
);
13147 install_element(BGP_IPV6_NODE
,
13148 &no_neighbor_remove_private_as_all_replace_as_cmd
);
13149 install_element(BGP_IPV6M_NODE
, &neighbor_remove_private_as_cmd
);
13150 install_element(BGP_IPV6M_NODE
, &no_neighbor_remove_private_as_cmd
);
13151 install_element(BGP_IPV6M_NODE
, &neighbor_remove_private_as_all_cmd
);
13152 install_element(BGP_IPV6M_NODE
, &no_neighbor_remove_private_as_all_cmd
);
13153 install_element(BGP_IPV6M_NODE
,
13154 &neighbor_remove_private_as_replace_as_cmd
);
13155 install_element(BGP_IPV6M_NODE
,
13156 &no_neighbor_remove_private_as_replace_as_cmd
);
13157 install_element(BGP_IPV6M_NODE
,
13158 &neighbor_remove_private_as_all_replace_as_cmd
);
13159 install_element(BGP_IPV6M_NODE
,
13160 &no_neighbor_remove_private_as_all_replace_as_cmd
);
13161 install_element(BGP_IPV6L_NODE
, &neighbor_remove_private_as_cmd
);
13162 install_element(BGP_IPV6L_NODE
, &no_neighbor_remove_private_as_cmd
);
13163 install_element(BGP_IPV6L_NODE
, &neighbor_remove_private_as_all_cmd
);
13164 install_element(BGP_IPV6L_NODE
, &no_neighbor_remove_private_as_all_cmd
);
13165 install_element(BGP_IPV6L_NODE
,
13166 &neighbor_remove_private_as_replace_as_cmd
);
13167 install_element(BGP_IPV6L_NODE
,
13168 &no_neighbor_remove_private_as_replace_as_cmd
);
13169 install_element(BGP_IPV6L_NODE
,
13170 &neighbor_remove_private_as_all_replace_as_cmd
);
13171 install_element(BGP_IPV6L_NODE
,
13172 &no_neighbor_remove_private_as_all_replace_as_cmd
);
13173 install_element(BGP_VPNV4_NODE
, &neighbor_remove_private_as_cmd
);
13174 install_element(BGP_VPNV4_NODE
, &no_neighbor_remove_private_as_cmd
);
13175 install_element(BGP_VPNV4_NODE
, &neighbor_remove_private_as_all_cmd
);
13176 install_element(BGP_VPNV4_NODE
, &no_neighbor_remove_private_as_all_cmd
);
13177 install_element(BGP_VPNV4_NODE
,
13178 &neighbor_remove_private_as_replace_as_cmd
);
13179 install_element(BGP_VPNV4_NODE
,
13180 &no_neighbor_remove_private_as_replace_as_cmd
);
13181 install_element(BGP_VPNV4_NODE
,
13182 &neighbor_remove_private_as_all_replace_as_cmd
);
13183 install_element(BGP_VPNV4_NODE
,
13184 &no_neighbor_remove_private_as_all_replace_as_cmd
);
13185 install_element(BGP_VPNV6_NODE
, &neighbor_remove_private_as_cmd
);
13186 install_element(BGP_VPNV6_NODE
, &no_neighbor_remove_private_as_cmd
);
13187 install_element(BGP_VPNV6_NODE
, &neighbor_remove_private_as_all_cmd
);
13188 install_element(BGP_VPNV6_NODE
, &no_neighbor_remove_private_as_all_cmd
);
13189 install_element(BGP_VPNV6_NODE
,
13190 &neighbor_remove_private_as_replace_as_cmd
);
13191 install_element(BGP_VPNV6_NODE
,
13192 &no_neighbor_remove_private_as_replace_as_cmd
);
13193 install_element(BGP_VPNV6_NODE
,
13194 &neighbor_remove_private_as_all_replace_as_cmd
);
13195 install_element(BGP_VPNV6_NODE
,
13196 &no_neighbor_remove_private_as_all_replace_as_cmd
);
13198 /* "neighbor send-community" commands.*/
13199 install_element(BGP_NODE
, &neighbor_send_community_hidden_cmd
);
13200 install_element(BGP_NODE
, &neighbor_send_community_type_hidden_cmd
);
13201 install_element(BGP_NODE
, &no_neighbor_send_community_hidden_cmd
);
13202 install_element(BGP_NODE
, &no_neighbor_send_community_type_hidden_cmd
);
13203 install_element(BGP_IPV4_NODE
, &neighbor_send_community_cmd
);
13204 install_element(BGP_IPV4_NODE
, &neighbor_send_community_type_cmd
);
13205 install_element(BGP_IPV4_NODE
, &no_neighbor_send_community_cmd
);
13206 install_element(BGP_IPV4_NODE
, &no_neighbor_send_community_type_cmd
);
13207 install_element(BGP_IPV4M_NODE
, &neighbor_send_community_cmd
);
13208 install_element(BGP_IPV4M_NODE
, &neighbor_send_community_type_cmd
);
13209 install_element(BGP_IPV4M_NODE
, &no_neighbor_send_community_cmd
);
13210 install_element(BGP_IPV4M_NODE
, &no_neighbor_send_community_type_cmd
);
13211 install_element(BGP_IPV4L_NODE
, &neighbor_send_community_cmd
);
13212 install_element(BGP_IPV4L_NODE
, &neighbor_send_community_type_cmd
);
13213 install_element(BGP_IPV4L_NODE
, &no_neighbor_send_community_cmd
);
13214 install_element(BGP_IPV4L_NODE
, &no_neighbor_send_community_type_cmd
);
13215 install_element(BGP_IPV6_NODE
, &neighbor_send_community_cmd
);
13216 install_element(BGP_IPV6_NODE
, &neighbor_send_community_type_cmd
);
13217 install_element(BGP_IPV6_NODE
, &no_neighbor_send_community_cmd
);
13218 install_element(BGP_IPV6_NODE
, &no_neighbor_send_community_type_cmd
);
13219 install_element(BGP_IPV6M_NODE
, &neighbor_send_community_cmd
);
13220 install_element(BGP_IPV6M_NODE
, &neighbor_send_community_type_cmd
);
13221 install_element(BGP_IPV6M_NODE
, &no_neighbor_send_community_cmd
);
13222 install_element(BGP_IPV6M_NODE
, &no_neighbor_send_community_type_cmd
);
13223 install_element(BGP_IPV6L_NODE
, &neighbor_send_community_cmd
);
13224 install_element(BGP_IPV6L_NODE
, &neighbor_send_community_type_cmd
);
13225 install_element(BGP_IPV6L_NODE
, &no_neighbor_send_community_cmd
);
13226 install_element(BGP_IPV6L_NODE
, &no_neighbor_send_community_type_cmd
);
13227 install_element(BGP_VPNV4_NODE
, &neighbor_send_community_cmd
);
13228 install_element(BGP_VPNV4_NODE
, &neighbor_send_community_type_cmd
);
13229 install_element(BGP_VPNV4_NODE
, &no_neighbor_send_community_cmd
);
13230 install_element(BGP_VPNV4_NODE
, &no_neighbor_send_community_type_cmd
);
13231 install_element(BGP_VPNV6_NODE
, &neighbor_send_community_cmd
);
13232 install_element(BGP_VPNV6_NODE
, &neighbor_send_community_type_cmd
);
13233 install_element(BGP_VPNV6_NODE
, &no_neighbor_send_community_cmd
);
13234 install_element(BGP_VPNV6_NODE
, &no_neighbor_send_community_type_cmd
);
13236 /* "neighbor route-reflector" commands.*/
13237 install_element(BGP_NODE
, &neighbor_route_reflector_client_hidden_cmd
);
13238 install_element(BGP_NODE
,
13239 &no_neighbor_route_reflector_client_hidden_cmd
);
13240 install_element(BGP_IPV4_NODE
, &neighbor_route_reflector_client_cmd
);
13241 install_element(BGP_IPV4_NODE
, &no_neighbor_route_reflector_client_cmd
);
13242 install_element(BGP_IPV4M_NODE
, &neighbor_route_reflector_client_cmd
);
13243 install_element(BGP_IPV4M_NODE
,
13244 &no_neighbor_route_reflector_client_cmd
);
13245 install_element(BGP_IPV4L_NODE
, &neighbor_route_reflector_client_cmd
);
13246 install_element(BGP_IPV4L_NODE
,
13247 &no_neighbor_route_reflector_client_cmd
);
13248 install_element(BGP_IPV6_NODE
, &neighbor_route_reflector_client_cmd
);
13249 install_element(BGP_IPV6_NODE
, &no_neighbor_route_reflector_client_cmd
);
13250 install_element(BGP_IPV6M_NODE
, &neighbor_route_reflector_client_cmd
);
13251 install_element(BGP_IPV6M_NODE
,
13252 &no_neighbor_route_reflector_client_cmd
);
13253 install_element(BGP_IPV6L_NODE
, &neighbor_route_reflector_client_cmd
);
13254 install_element(BGP_IPV6L_NODE
,
13255 &no_neighbor_route_reflector_client_cmd
);
13256 install_element(BGP_VPNV4_NODE
, &neighbor_route_reflector_client_cmd
);
13257 install_element(BGP_VPNV4_NODE
,
13258 &no_neighbor_route_reflector_client_cmd
);
13259 install_element(BGP_VPNV6_NODE
, &neighbor_route_reflector_client_cmd
);
13260 install_element(BGP_VPNV6_NODE
,
13261 &no_neighbor_route_reflector_client_cmd
);
13262 install_element(BGP_FLOWSPECV4_NODE
,
13263 &neighbor_route_reflector_client_cmd
);
13264 install_element(BGP_FLOWSPECV4_NODE
,
13265 &no_neighbor_route_reflector_client_cmd
);
13266 install_element(BGP_FLOWSPECV6_NODE
,
13267 &neighbor_route_reflector_client_cmd
);
13268 install_element(BGP_FLOWSPECV6_NODE
,
13269 &no_neighbor_route_reflector_client_cmd
);
13270 install_element(BGP_EVPN_NODE
, &neighbor_route_reflector_client_cmd
);
13271 install_element(BGP_EVPN_NODE
, &no_neighbor_route_reflector_client_cmd
);
13273 /* "neighbor route-server" commands.*/
13274 install_element(BGP_NODE
, &neighbor_route_server_client_hidden_cmd
);
13275 install_element(BGP_NODE
, &no_neighbor_route_server_client_hidden_cmd
);
13276 install_element(BGP_IPV4_NODE
, &neighbor_route_server_client_cmd
);
13277 install_element(BGP_IPV4_NODE
, &no_neighbor_route_server_client_cmd
);
13278 install_element(BGP_IPV4M_NODE
, &neighbor_route_server_client_cmd
);
13279 install_element(BGP_IPV4M_NODE
, &no_neighbor_route_server_client_cmd
);
13280 install_element(BGP_IPV4L_NODE
, &neighbor_route_server_client_cmd
);
13281 install_element(BGP_IPV4L_NODE
, &no_neighbor_route_server_client_cmd
);
13282 install_element(BGP_IPV6_NODE
, &neighbor_route_server_client_cmd
);
13283 install_element(BGP_IPV6_NODE
, &no_neighbor_route_server_client_cmd
);
13284 install_element(BGP_IPV6M_NODE
, &neighbor_route_server_client_cmd
);
13285 install_element(BGP_IPV6M_NODE
, &no_neighbor_route_server_client_cmd
);
13286 install_element(BGP_IPV6L_NODE
, &neighbor_route_server_client_cmd
);
13287 install_element(BGP_IPV6L_NODE
, &no_neighbor_route_server_client_cmd
);
13288 install_element(BGP_VPNV4_NODE
, &neighbor_route_server_client_cmd
);
13289 install_element(BGP_VPNV4_NODE
, &no_neighbor_route_server_client_cmd
);
13290 install_element(BGP_VPNV6_NODE
, &neighbor_route_server_client_cmd
);
13291 install_element(BGP_VPNV6_NODE
, &no_neighbor_route_server_client_cmd
);
13292 install_element(BGP_EVPN_NODE
, &neighbor_route_server_client_cmd
);
13293 install_element(BGP_EVPN_NODE
, &no_neighbor_route_server_client_cmd
);
13294 install_element(BGP_FLOWSPECV4_NODE
, &neighbor_route_server_client_cmd
);
13295 install_element(BGP_FLOWSPECV4_NODE
,
13296 &no_neighbor_route_server_client_cmd
);
13297 install_element(BGP_FLOWSPECV6_NODE
, &neighbor_route_server_client_cmd
);
13298 install_element(BGP_FLOWSPECV6_NODE
,
13299 &no_neighbor_route_server_client_cmd
);
13301 /* "neighbor addpath-tx-all-paths" commands.*/
13302 install_element(BGP_NODE
, &neighbor_addpath_tx_all_paths_hidden_cmd
);
13303 install_element(BGP_NODE
, &no_neighbor_addpath_tx_all_paths_hidden_cmd
);
13304 install_element(BGP_IPV4_NODE
, &neighbor_addpath_tx_all_paths_cmd
);
13305 install_element(BGP_IPV4_NODE
, &no_neighbor_addpath_tx_all_paths_cmd
);
13306 install_element(BGP_IPV4M_NODE
, &neighbor_addpath_tx_all_paths_cmd
);
13307 install_element(BGP_IPV4M_NODE
, &no_neighbor_addpath_tx_all_paths_cmd
);
13308 install_element(BGP_IPV4L_NODE
, &neighbor_addpath_tx_all_paths_cmd
);
13309 install_element(BGP_IPV4L_NODE
, &no_neighbor_addpath_tx_all_paths_cmd
);
13310 install_element(BGP_IPV6_NODE
, &neighbor_addpath_tx_all_paths_cmd
);
13311 install_element(BGP_IPV6_NODE
, &no_neighbor_addpath_tx_all_paths_cmd
);
13312 install_element(BGP_IPV6M_NODE
, &neighbor_addpath_tx_all_paths_cmd
);
13313 install_element(BGP_IPV6M_NODE
, &no_neighbor_addpath_tx_all_paths_cmd
);
13314 install_element(BGP_IPV6L_NODE
, &neighbor_addpath_tx_all_paths_cmd
);
13315 install_element(BGP_IPV6L_NODE
, &no_neighbor_addpath_tx_all_paths_cmd
);
13316 install_element(BGP_VPNV4_NODE
, &neighbor_addpath_tx_all_paths_cmd
);
13317 install_element(BGP_VPNV4_NODE
, &no_neighbor_addpath_tx_all_paths_cmd
);
13318 install_element(BGP_VPNV6_NODE
, &neighbor_addpath_tx_all_paths_cmd
);
13319 install_element(BGP_VPNV6_NODE
, &no_neighbor_addpath_tx_all_paths_cmd
);
13321 /* "neighbor addpath-tx-bestpath-per-AS" commands.*/
13322 install_element(BGP_NODE
,
13323 &neighbor_addpath_tx_bestpath_per_as_hidden_cmd
);
13324 install_element(BGP_NODE
,
13325 &no_neighbor_addpath_tx_bestpath_per_as_hidden_cmd
);
13326 install_element(BGP_IPV4_NODE
,
13327 &neighbor_addpath_tx_bestpath_per_as_cmd
);
13328 install_element(BGP_IPV4_NODE
,
13329 &no_neighbor_addpath_tx_bestpath_per_as_cmd
);
13330 install_element(BGP_IPV4M_NODE
,
13331 &neighbor_addpath_tx_bestpath_per_as_cmd
);
13332 install_element(BGP_IPV4M_NODE
,
13333 &no_neighbor_addpath_tx_bestpath_per_as_cmd
);
13334 install_element(BGP_IPV4L_NODE
,
13335 &neighbor_addpath_tx_bestpath_per_as_cmd
);
13336 install_element(BGP_IPV4L_NODE
,
13337 &no_neighbor_addpath_tx_bestpath_per_as_cmd
);
13338 install_element(BGP_IPV6_NODE
,
13339 &neighbor_addpath_tx_bestpath_per_as_cmd
);
13340 install_element(BGP_IPV6_NODE
,
13341 &no_neighbor_addpath_tx_bestpath_per_as_cmd
);
13342 install_element(BGP_IPV6M_NODE
,
13343 &neighbor_addpath_tx_bestpath_per_as_cmd
);
13344 install_element(BGP_IPV6M_NODE
,
13345 &no_neighbor_addpath_tx_bestpath_per_as_cmd
);
13346 install_element(BGP_IPV6L_NODE
,
13347 &neighbor_addpath_tx_bestpath_per_as_cmd
);
13348 install_element(BGP_IPV6L_NODE
,
13349 &no_neighbor_addpath_tx_bestpath_per_as_cmd
);
13350 install_element(BGP_VPNV4_NODE
,
13351 &neighbor_addpath_tx_bestpath_per_as_cmd
);
13352 install_element(BGP_VPNV4_NODE
,
13353 &no_neighbor_addpath_tx_bestpath_per_as_cmd
);
13354 install_element(BGP_VPNV6_NODE
,
13355 &neighbor_addpath_tx_bestpath_per_as_cmd
);
13356 install_element(BGP_VPNV6_NODE
,
13357 &no_neighbor_addpath_tx_bestpath_per_as_cmd
);
13359 /* "neighbor passive" commands. */
13360 install_element(BGP_NODE
, &neighbor_passive_cmd
);
13361 install_element(BGP_NODE
, &no_neighbor_passive_cmd
);
13364 /* "neighbor shutdown" commands. */
13365 install_element(BGP_NODE
, &neighbor_shutdown_cmd
);
13366 install_element(BGP_NODE
, &no_neighbor_shutdown_cmd
);
13367 install_element(BGP_NODE
, &neighbor_shutdown_msg_cmd
);
13368 install_element(BGP_NODE
, &no_neighbor_shutdown_msg_cmd
);
13370 /* "neighbor capability extended-nexthop" commands.*/
13371 install_element(BGP_NODE
, &neighbor_capability_enhe_cmd
);
13372 install_element(BGP_NODE
, &no_neighbor_capability_enhe_cmd
);
13374 /* "neighbor capability orf prefix-list" commands.*/
13375 install_element(BGP_NODE
, &neighbor_capability_orf_prefix_hidden_cmd
);
13376 install_element(BGP_NODE
,
13377 &no_neighbor_capability_orf_prefix_hidden_cmd
);
13378 install_element(BGP_IPV4_NODE
, &neighbor_capability_orf_prefix_cmd
);
13379 install_element(BGP_IPV4_NODE
, &no_neighbor_capability_orf_prefix_cmd
);
13380 install_element(BGP_IPV4M_NODE
, &neighbor_capability_orf_prefix_cmd
);
13381 install_element(BGP_IPV4M_NODE
, &no_neighbor_capability_orf_prefix_cmd
);
13382 install_element(BGP_IPV4L_NODE
, &neighbor_capability_orf_prefix_cmd
);
13383 install_element(BGP_IPV4L_NODE
, &no_neighbor_capability_orf_prefix_cmd
);
13384 install_element(BGP_IPV6_NODE
, &neighbor_capability_orf_prefix_cmd
);
13385 install_element(BGP_IPV6_NODE
, &no_neighbor_capability_orf_prefix_cmd
);
13386 install_element(BGP_IPV6M_NODE
, &neighbor_capability_orf_prefix_cmd
);
13387 install_element(BGP_IPV6M_NODE
, &no_neighbor_capability_orf_prefix_cmd
);
13388 install_element(BGP_IPV6L_NODE
, &neighbor_capability_orf_prefix_cmd
);
13389 install_element(BGP_IPV6L_NODE
, &no_neighbor_capability_orf_prefix_cmd
);
13391 /* "neighbor capability dynamic" commands.*/
13392 install_element(BGP_NODE
, &neighbor_capability_dynamic_cmd
);
13393 install_element(BGP_NODE
, &no_neighbor_capability_dynamic_cmd
);
13395 /* "neighbor dont-capability-negotiate" commands. */
13396 install_element(BGP_NODE
, &neighbor_dont_capability_negotiate_cmd
);
13397 install_element(BGP_NODE
, &no_neighbor_dont_capability_negotiate_cmd
);
13399 /* "neighbor ebgp-multihop" commands. */
13400 install_element(BGP_NODE
, &neighbor_ebgp_multihop_cmd
);
13401 install_element(BGP_NODE
, &neighbor_ebgp_multihop_ttl_cmd
);
13402 install_element(BGP_NODE
, &no_neighbor_ebgp_multihop_cmd
);
13404 /* "neighbor disable-connected-check" commands. */
13405 install_element(BGP_NODE
, &neighbor_disable_connected_check_cmd
);
13406 install_element(BGP_NODE
, &no_neighbor_disable_connected_check_cmd
);
13408 /* "neighbor enforce-first-as" commands. */
13409 install_element(BGP_NODE
, &neighbor_enforce_first_as_cmd
);
13410 install_element(BGP_NODE
, &no_neighbor_enforce_first_as_cmd
);
13412 /* "neighbor description" commands. */
13413 install_element(BGP_NODE
, &neighbor_description_cmd
);
13414 install_element(BGP_NODE
, &no_neighbor_description_cmd
);
13415 install_element(BGP_NODE
, &no_neighbor_description_comment_cmd
);
13417 /* "neighbor update-source" commands. "*/
13418 install_element(BGP_NODE
, &neighbor_update_source_cmd
);
13419 install_element(BGP_NODE
, &no_neighbor_update_source_cmd
);
13421 /* "neighbor default-originate" commands. */
13422 install_element(BGP_NODE
, &neighbor_default_originate_hidden_cmd
);
13423 install_element(BGP_NODE
, &neighbor_default_originate_rmap_hidden_cmd
);
13424 install_element(BGP_NODE
, &no_neighbor_default_originate_hidden_cmd
);
13425 install_element(BGP_IPV4_NODE
, &neighbor_default_originate_cmd
);
13426 install_element(BGP_IPV4_NODE
, &neighbor_default_originate_rmap_cmd
);
13427 install_element(BGP_IPV4_NODE
, &no_neighbor_default_originate_cmd
);
13428 install_element(BGP_IPV4M_NODE
, &neighbor_default_originate_cmd
);
13429 install_element(BGP_IPV4M_NODE
, &neighbor_default_originate_rmap_cmd
);
13430 install_element(BGP_IPV4M_NODE
, &no_neighbor_default_originate_cmd
);
13431 install_element(BGP_IPV4L_NODE
, &neighbor_default_originate_cmd
);
13432 install_element(BGP_IPV4L_NODE
, &neighbor_default_originate_rmap_cmd
);
13433 install_element(BGP_IPV4L_NODE
, &no_neighbor_default_originate_cmd
);
13434 install_element(BGP_IPV6_NODE
, &neighbor_default_originate_cmd
);
13435 install_element(BGP_IPV6_NODE
, &neighbor_default_originate_rmap_cmd
);
13436 install_element(BGP_IPV6_NODE
, &no_neighbor_default_originate_cmd
);
13437 install_element(BGP_IPV6M_NODE
, &neighbor_default_originate_cmd
);
13438 install_element(BGP_IPV6M_NODE
, &neighbor_default_originate_rmap_cmd
);
13439 install_element(BGP_IPV6M_NODE
, &no_neighbor_default_originate_cmd
);
13440 install_element(BGP_IPV6L_NODE
, &neighbor_default_originate_cmd
);
13441 install_element(BGP_IPV6L_NODE
, &neighbor_default_originate_rmap_cmd
);
13442 install_element(BGP_IPV6L_NODE
, &no_neighbor_default_originate_cmd
);
13444 /* "neighbor port" commands. */
13445 install_element(BGP_NODE
, &neighbor_port_cmd
);
13446 install_element(BGP_NODE
, &no_neighbor_port_cmd
);
13448 /* "neighbor weight" commands. */
13449 install_element(BGP_NODE
, &neighbor_weight_hidden_cmd
);
13450 install_element(BGP_NODE
, &no_neighbor_weight_hidden_cmd
);
13452 install_element(BGP_IPV4_NODE
, &neighbor_weight_cmd
);
13453 install_element(BGP_IPV4_NODE
, &no_neighbor_weight_cmd
);
13454 install_element(BGP_IPV4M_NODE
, &neighbor_weight_cmd
);
13455 install_element(BGP_IPV4M_NODE
, &no_neighbor_weight_cmd
);
13456 install_element(BGP_IPV4L_NODE
, &neighbor_weight_cmd
);
13457 install_element(BGP_IPV4L_NODE
, &no_neighbor_weight_cmd
);
13458 install_element(BGP_IPV6_NODE
, &neighbor_weight_cmd
);
13459 install_element(BGP_IPV6_NODE
, &no_neighbor_weight_cmd
);
13460 install_element(BGP_IPV6M_NODE
, &neighbor_weight_cmd
);
13461 install_element(BGP_IPV6M_NODE
, &no_neighbor_weight_cmd
);
13462 install_element(BGP_IPV6L_NODE
, &neighbor_weight_cmd
);
13463 install_element(BGP_IPV6L_NODE
, &no_neighbor_weight_cmd
);
13464 install_element(BGP_VPNV4_NODE
, &neighbor_weight_cmd
);
13465 install_element(BGP_VPNV4_NODE
, &no_neighbor_weight_cmd
);
13466 install_element(BGP_VPNV6_NODE
, &neighbor_weight_cmd
);
13467 install_element(BGP_VPNV6_NODE
, &no_neighbor_weight_cmd
);
13469 /* "neighbor override-capability" commands. */
13470 install_element(BGP_NODE
, &neighbor_override_capability_cmd
);
13471 install_element(BGP_NODE
, &no_neighbor_override_capability_cmd
);
13473 /* "neighbor strict-capability-match" commands. */
13474 install_element(BGP_NODE
, &neighbor_strict_capability_cmd
);
13475 install_element(BGP_NODE
, &no_neighbor_strict_capability_cmd
);
13477 /* "neighbor timers" commands. */
13478 install_element(BGP_NODE
, &neighbor_timers_cmd
);
13479 install_element(BGP_NODE
, &no_neighbor_timers_cmd
);
13481 /* "neighbor timers connect" commands. */
13482 install_element(BGP_NODE
, &neighbor_timers_connect_cmd
);
13483 install_element(BGP_NODE
, &no_neighbor_timers_connect_cmd
);
13485 /* "neighbor advertisement-interval" commands. */
13486 install_element(BGP_NODE
, &neighbor_advertise_interval_cmd
);
13487 install_element(BGP_NODE
, &no_neighbor_advertise_interval_cmd
);
13489 /* "neighbor interface" commands. */
13490 install_element(BGP_NODE
, &neighbor_interface_cmd
);
13491 install_element(BGP_NODE
, &no_neighbor_interface_cmd
);
13493 /* "neighbor distribute" commands. */
13494 install_element(BGP_NODE
, &neighbor_distribute_list_hidden_cmd
);
13495 install_element(BGP_NODE
, &no_neighbor_distribute_list_hidden_cmd
);
13496 install_element(BGP_IPV4_NODE
, &neighbor_distribute_list_cmd
);
13497 install_element(BGP_IPV4_NODE
, &no_neighbor_distribute_list_cmd
);
13498 install_element(BGP_IPV4M_NODE
, &neighbor_distribute_list_cmd
);
13499 install_element(BGP_IPV4M_NODE
, &no_neighbor_distribute_list_cmd
);
13500 install_element(BGP_IPV4L_NODE
, &neighbor_distribute_list_cmd
);
13501 install_element(BGP_IPV4L_NODE
, &no_neighbor_distribute_list_cmd
);
13502 install_element(BGP_IPV6_NODE
, &neighbor_distribute_list_cmd
);
13503 install_element(BGP_IPV6_NODE
, &no_neighbor_distribute_list_cmd
);
13504 install_element(BGP_IPV6M_NODE
, &neighbor_distribute_list_cmd
);
13505 install_element(BGP_IPV6M_NODE
, &no_neighbor_distribute_list_cmd
);
13506 install_element(BGP_IPV6L_NODE
, &neighbor_distribute_list_cmd
);
13507 install_element(BGP_IPV6L_NODE
, &no_neighbor_distribute_list_cmd
);
13508 install_element(BGP_VPNV4_NODE
, &neighbor_distribute_list_cmd
);
13509 install_element(BGP_VPNV4_NODE
, &no_neighbor_distribute_list_cmd
);
13510 install_element(BGP_VPNV6_NODE
, &neighbor_distribute_list_cmd
);
13511 install_element(BGP_VPNV6_NODE
, &no_neighbor_distribute_list_cmd
);
13513 /* "neighbor prefix-list" commands. */
13514 install_element(BGP_NODE
, &neighbor_prefix_list_hidden_cmd
);
13515 install_element(BGP_NODE
, &no_neighbor_prefix_list_hidden_cmd
);
13516 install_element(BGP_IPV4_NODE
, &neighbor_prefix_list_cmd
);
13517 install_element(BGP_IPV4_NODE
, &no_neighbor_prefix_list_cmd
);
13518 install_element(BGP_IPV4M_NODE
, &neighbor_prefix_list_cmd
);
13519 install_element(BGP_IPV4M_NODE
, &no_neighbor_prefix_list_cmd
);
13520 install_element(BGP_IPV4L_NODE
, &neighbor_prefix_list_cmd
);
13521 install_element(BGP_IPV4L_NODE
, &no_neighbor_prefix_list_cmd
);
13522 install_element(BGP_IPV6_NODE
, &neighbor_prefix_list_cmd
);
13523 install_element(BGP_IPV6_NODE
, &no_neighbor_prefix_list_cmd
);
13524 install_element(BGP_IPV6M_NODE
, &neighbor_prefix_list_cmd
);
13525 install_element(BGP_IPV6M_NODE
, &no_neighbor_prefix_list_cmd
);
13526 install_element(BGP_IPV6L_NODE
, &neighbor_prefix_list_cmd
);
13527 install_element(BGP_IPV6L_NODE
, &no_neighbor_prefix_list_cmd
);
13528 install_element(BGP_VPNV4_NODE
, &neighbor_prefix_list_cmd
);
13529 install_element(BGP_VPNV4_NODE
, &no_neighbor_prefix_list_cmd
);
13530 install_element(BGP_VPNV6_NODE
, &neighbor_prefix_list_cmd
);
13531 install_element(BGP_VPNV6_NODE
, &no_neighbor_prefix_list_cmd
);
13532 install_element(BGP_FLOWSPECV4_NODE
, &neighbor_prefix_list_cmd
);
13533 install_element(BGP_FLOWSPECV4_NODE
, &no_neighbor_prefix_list_cmd
);
13534 install_element(BGP_FLOWSPECV6_NODE
, &neighbor_prefix_list_cmd
);
13535 install_element(BGP_FLOWSPECV6_NODE
, &no_neighbor_prefix_list_cmd
);
13537 /* "neighbor filter-list" commands. */
13538 install_element(BGP_NODE
, &neighbor_filter_list_hidden_cmd
);
13539 install_element(BGP_NODE
, &no_neighbor_filter_list_hidden_cmd
);
13540 install_element(BGP_IPV4_NODE
, &neighbor_filter_list_cmd
);
13541 install_element(BGP_IPV4_NODE
, &no_neighbor_filter_list_cmd
);
13542 install_element(BGP_IPV4M_NODE
, &neighbor_filter_list_cmd
);
13543 install_element(BGP_IPV4M_NODE
, &no_neighbor_filter_list_cmd
);
13544 install_element(BGP_IPV4L_NODE
, &neighbor_filter_list_cmd
);
13545 install_element(BGP_IPV4L_NODE
, &no_neighbor_filter_list_cmd
);
13546 install_element(BGP_IPV6_NODE
, &neighbor_filter_list_cmd
);
13547 install_element(BGP_IPV6_NODE
, &no_neighbor_filter_list_cmd
);
13548 install_element(BGP_IPV6M_NODE
, &neighbor_filter_list_cmd
);
13549 install_element(BGP_IPV6M_NODE
, &no_neighbor_filter_list_cmd
);
13550 install_element(BGP_IPV6L_NODE
, &neighbor_filter_list_cmd
);
13551 install_element(BGP_IPV6L_NODE
, &no_neighbor_filter_list_cmd
);
13552 install_element(BGP_VPNV4_NODE
, &neighbor_filter_list_cmd
);
13553 install_element(BGP_VPNV4_NODE
, &no_neighbor_filter_list_cmd
);
13554 install_element(BGP_VPNV6_NODE
, &neighbor_filter_list_cmd
);
13555 install_element(BGP_VPNV6_NODE
, &no_neighbor_filter_list_cmd
);
13556 install_element(BGP_FLOWSPECV4_NODE
, &neighbor_filter_list_cmd
);
13557 install_element(BGP_FLOWSPECV4_NODE
, &no_neighbor_filter_list_cmd
);
13558 install_element(BGP_FLOWSPECV6_NODE
, &neighbor_filter_list_cmd
);
13559 install_element(BGP_FLOWSPECV6_NODE
, &no_neighbor_filter_list_cmd
);
13561 /* "neighbor route-map" commands. */
13562 install_element(BGP_NODE
, &neighbor_route_map_hidden_cmd
);
13563 install_element(BGP_NODE
, &no_neighbor_route_map_hidden_cmd
);
13564 install_element(BGP_IPV4_NODE
, &neighbor_route_map_cmd
);
13565 install_element(BGP_IPV4_NODE
, &no_neighbor_route_map_cmd
);
13566 install_element(BGP_IPV4M_NODE
, &neighbor_route_map_cmd
);
13567 install_element(BGP_IPV4M_NODE
, &no_neighbor_route_map_cmd
);
13568 install_element(BGP_IPV4L_NODE
, &neighbor_route_map_cmd
);
13569 install_element(BGP_IPV4L_NODE
, &no_neighbor_route_map_cmd
);
13570 install_element(BGP_IPV6_NODE
, &neighbor_route_map_cmd
);
13571 install_element(BGP_IPV6_NODE
, &no_neighbor_route_map_cmd
);
13572 install_element(BGP_IPV6M_NODE
, &neighbor_route_map_cmd
);
13573 install_element(BGP_IPV6M_NODE
, &no_neighbor_route_map_cmd
);
13574 install_element(BGP_IPV6L_NODE
, &neighbor_route_map_cmd
);
13575 install_element(BGP_IPV6L_NODE
, &no_neighbor_route_map_cmd
);
13576 install_element(BGP_VPNV4_NODE
, &neighbor_route_map_cmd
);
13577 install_element(BGP_VPNV4_NODE
, &no_neighbor_route_map_cmd
);
13578 install_element(BGP_VPNV6_NODE
, &neighbor_route_map_cmd
);
13579 install_element(BGP_VPNV6_NODE
, &no_neighbor_route_map_cmd
);
13580 install_element(BGP_FLOWSPECV4_NODE
, &neighbor_route_map_cmd
);
13581 install_element(BGP_FLOWSPECV4_NODE
, &no_neighbor_route_map_cmd
);
13582 install_element(BGP_FLOWSPECV6_NODE
, &neighbor_route_map_cmd
);
13583 install_element(BGP_FLOWSPECV6_NODE
, &no_neighbor_route_map_cmd
);
13584 install_element(BGP_EVPN_NODE
, &neighbor_route_map_cmd
);
13585 install_element(BGP_EVPN_NODE
, &no_neighbor_route_map_cmd
);
13587 /* "neighbor unsuppress-map" commands. */
13588 install_element(BGP_NODE
, &neighbor_unsuppress_map_hidden_cmd
);
13589 install_element(BGP_NODE
, &no_neighbor_unsuppress_map_hidden_cmd
);
13590 install_element(BGP_IPV4_NODE
, &neighbor_unsuppress_map_cmd
);
13591 install_element(BGP_IPV4_NODE
, &no_neighbor_unsuppress_map_cmd
);
13592 install_element(BGP_IPV4M_NODE
, &neighbor_unsuppress_map_cmd
);
13593 install_element(BGP_IPV4M_NODE
, &no_neighbor_unsuppress_map_cmd
);
13594 install_element(BGP_IPV4L_NODE
, &neighbor_unsuppress_map_cmd
);
13595 install_element(BGP_IPV4L_NODE
, &no_neighbor_unsuppress_map_cmd
);
13596 install_element(BGP_IPV6_NODE
, &neighbor_unsuppress_map_cmd
);
13597 install_element(BGP_IPV6_NODE
, &no_neighbor_unsuppress_map_cmd
);
13598 install_element(BGP_IPV6M_NODE
, &neighbor_unsuppress_map_cmd
);
13599 install_element(BGP_IPV6M_NODE
, &no_neighbor_unsuppress_map_cmd
);
13600 install_element(BGP_IPV6L_NODE
, &neighbor_unsuppress_map_cmd
);
13601 install_element(BGP_IPV6L_NODE
, &no_neighbor_unsuppress_map_cmd
);
13602 install_element(BGP_VPNV4_NODE
, &neighbor_unsuppress_map_cmd
);
13603 install_element(BGP_VPNV4_NODE
, &no_neighbor_unsuppress_map_cmd
);
13604 install_element(BGP_VPNV6_NODE
, &neighbor_unsuppress_map_cmd
);
13605 install_element(BGP_VPNV6_NODE
, &no_neighbor_unsuppress_map_cmd
);
13607 /* "neighbor maximum-prefix" commands. */
13608 install_element(BGP_NODE
, &neighbor_maximum_prefix_hidden_cmd
);
13609 install_element(BGP_NODE
,
13610 &neighbor_maximum_prefix_threshold_hidden_cmd
);
13611 install_element(BGP_NODE
, &neighbor_maximum_prefix_warning_hidden_cmd
);
13612 install_element(BGP_NODE
,
13613 &neighbor_maximum_prefix_threshold_warning_hidden_cmd
);
13614 install_element(BGP_NODE
, &neighbor_maximum_prefix_restart_hidden_cmd
);
13615 install_element(BGP_NODE
,
13616 &neighbor_maximum_prefix_threshold_restart_hidden_cmd
);
13617 install_element(BGP_NODE
, &no_neighbor_maximum_prefix_hidden_cmd
);
13618 install_element(BGP_IPV4_NODE
, &neighbor_maximum_prefix_cmd
);
13619 install_element(BGP_IPV4_NODE
, &neighbor_maximum_prefix_threshold_cmd
);
13620 install_element(BGP_IPV4_NODE
, &neighbor_maximum_prefix_warning_cmd
);
13621 install_element(BGP_IPV4_NODE
,
13622 &neighbor_maximum_prefix_threshold_warning_cmd
);
13623 install_element(BGP_IPV4_NODE
, &neighbor_maximum_prefix_restart_cmd
);
13624 install_element(BGP_IPV4_NODE
,
13625 &neighbor_maximum_prefix_threshold_restart_cmd
);
13626 install_element(BGP_IPV4_NODE
, &no_neighbor_maximum_prefix_cmd
);
13627 install_element(BGP_IPV4M_NODE
, &neighbor_maximum_prefix_cmd
);
13628 install_element(BGP_IPV4M_NODE
, &neighbor_maximum_prefix_threshold_cmd
);
13629 install_element(BGP_IPV4M_NODE
, &neighbor_maximum_prefix_warning_cmd
);
13630 install_element(BGP_IPV4M_NODE
,
13631 &neighbor_maximum_prefix_threshold_warning_cmd
);
13632 install_element(BGP_IPV4M_NODE
, &neighbor_maximum_prefix_restart_cmd
);
13633 install_element(BGP_IPV4M_NODE
,
13634 &neighbor_maximum_prefix_threshold_restart_cmd
);
13635 install_element(BGP_IPV4M_NODE
, &no_neighbor_maximum_prefix_cmd
);
13636 install_element(BGP_IPV4L_NODE
, &neighbor_maximum_prefix_cmd
);
13637 install_element(BGP_IPV4L_NODE
, &neighbor_maximum_prefix_threshold_cmd
);
13638 install_element(BGP_IPV4L_NODE
, &neighbor_maximum_prefix_warning_cmd
);
13639 install_element(BGP_IPV4L_NODE
,
13640 &neighbor_maximum_prefix_threshold_warning_cmd
);
13641 install_element(BGP_IPV4L_NODE
, &neighbor_maximum_prefix_restart_cmd
);
13642 install_element(BGP_IPV4L_NODE
,
13643 &neighbor_maximum_prefix_threshold_restart_cmd
);
13644 install_element(BGP_IPV4L_NODE
, &no_neighbor_maximum_prefix_cmd
);
13645 install_element(BGP_IPV6_NODE
, &neighbor_maximum_prefix_cmd
);
13646 install_element(BGP_IPV6_NODE
, &neighbor_maximum_prefix_threshold_cmd
);
13647 install_element(BGP_IPV6_NODE
, &neighbor_maximum_prefix_warning_cmd
);
13648 install_element(BGP_IPV6_NODE
,
13649 &neighbor_maximum_prefix_threshold_warning_cmd
);
13650 install_element(BGP_IPV6_NODE
, &neighbor_maximum_prefix_restart_cmd
);
13651 install_element(BGP_IPV6_NODE
,
13652 &neighbor_maximum_prefix_threshold_restart_cmd
);
13653 install_element(BGP_IPV6_NODE
, &no_neighbor_maximum_prefix_cmd
);
13654 install_element(BGP_IPV6M_NODE
, &neighbor_maximum_prefix_cmd
);
13655 install_element(BGP_IPV6M_NODE
, &neighbor_maximum_prefix_threshold_cmd
);
13656 install_element(BGP_IPV6M_NODE
, &neighbor_maximum_prefix_warning_cmd
);
13657 install_element(BGP_IPV6M_NODE
,
13658 &neighbor_maximum_prefix_threshold_warning_cmd
);
13659 install_element(BGP_IPV6M_NODE
, &neighbor_maximum_prefix_restart_cmd
);
13660 install_element(BGP_IPV6M_NODE
,
13661 &neighbor_maximum_prefix_threshold_restart_cmd
);
13662 install_element(BGP_IPV6M_NODE
, &no_neighbor_maximum_prefix_cmd
);
13663 install_element(BGP_IPV6L_NODE
, &neighbor_maximum_prefix_cmd
);
13664 install_element(BGP_IPV6L_NODE
, &neighbor_maximum_prefix_threshold_cmd
);
13665 install_element(BGP_IPV6L_NODE
, &neighbor_maximum_prefix_warning_cmd
);
13666 install_element(BGP_IPV6L_NODE
,
13667 &neighbor_maximum_prefix_threshold_warning_cmd
);
13668 install_element(BGP_IPV6L_NODE
, &neighbor_maximum_prefix_restart_cmd
);
13669 install_element(BGP_IPV6L_NODE
,
13670 &neighbor_maximum_prefix_threshold_restart_cmd
);
13671 install_element(BGP_IPV6L_NODE
, &no_neighbor_maximum_prefix_cmd
);
13672 install_element(BGP_VPNV4_NODE
, &neighbor_maximum_prefix_cmd
);
13673 install_element(BGP_VPNV4_NODE
, &neighbor_maximum_prefix_threshold_cmd
);
13674 install_element(BGP_VPNV4_NODE
, &neighbor_maximum_prefix_warning_cmd
);
13675 install_element(BGP_VPNV4_NODE
,
13676 &neighbor_maximum_prefix_threshold_warning_cmd
);
13677 install_element(BGP_VPNV4_NODE
, &neighbor_maximum_prefix_restart_cmd
);
13678 install_element(BGP_VPNV4_NODE
,
13679 &neighbor_maximum_prefix_threshold_restart_cmd
);
13680 install_element(BGP_VPNV4_NODE
, &no_neighbor_maximum_prefix_cmd
);
13681 install_element(BGP_VPNV6_NODE
, &neighbor_maximum_prefix_cmd
);
13682 install_element(BGP_VPNV6_NODE
, &neighbor_maximum_prefix_threshold_cmd
);
13683 install_element(BGP_VPNV6_NODE
, &neighbor_maximum_prefix_warning_cmd
);
13684 install_element(BGP_VPNV6_NODE
,
13685 &neighbor_maximum_prefix_threshold_warning_cmd
);
13686 install_element(BGP_VPNV6_NODE
, &neighbor_maximum_prefix_restart_cmd
);
13687 install_element(BGP_VPNV6_NODE
,
13688 &neighbor_maximum_prefix_threshold_restart_cmd
);
13689 install_element(BGP_VPNV6_NODE
, &no_neighbor_maximum_prefix_cmd
);
13691 /* "neighbor allowas-in" */
13692 install_element(BGP_NODE
, &neighbor_allowas_in_hidden_cmd
);
13693 install_element(BGP_NODE
, &no_neighbor_allowas_in_hidden_cmd
);
13694 install_element(BGP_IPV4_NODE
, &neighbor_allowas_in_cmd
);
13695 install_element(BGP_IPV4_NODE
, &no_neighbor_allowas_in_cmd
);
13696 install_element(BGP_IPV4M_NODE
, &neighbor_allowas_in_cmd
);
13697 install_element(BGP_IPV4M_NODE
, &no_neighbor_allowas_in_cmd
);
13698 install_element(BGP_IPV4L_NODE
, &neighbor_allowas_in_cmd
);
13699 install_element(BGP_IPV4L_NODE
, &no_neighbor_allowas_in_cmd
);
13700 install_element(BGP_IPV6_NODE
, &neighbor_allowas_in_cmd
);
13701 install_element(BGP_IPV6_NODE
, &no_neighbor_allowas_in_cmd
);
13702 install_element(BGP_IPV6M_NODE
, &neighbor_allowas_in_cmd
);
13703 install_element(BGP_IPV6M_NODE
, &no_neighbor_allowas_in_cmd
);
13704 install_element(BGP_IPV6L_NODE
, &neighbor_allowas_in_cmd
);
13705 install_element(BGP_IPV6L_NODE
, &no_neighbor_allowas_in_cmd
);
13706 install_element(BGP_VPNV4_NODE
, &neighbor_allowas_in_cmd
);
13707 install_element(BGP_VPNV4_NODE
, &no_neighbor_allowas_in_cmd
);
13708 install_element(BGP_VPNV6_NODE
, &neighbor_allowas_in_cmd
);
13709 install_element(BGP_VPNV6_NODE
, &no_neighbor_allowas_in_cmd
);
13710 install_element(BGP_EVPN_NODE
, &neighbor_allowas_in_cmd
);
13711 install_element(BGP_EVPN_NODE
, &no_neighbor_allowas_in_cmd
);
13713 /* address-family commands. */
13714 install_element(BGP_NODE
, &address_family_ipv4_safi_cmd
);
13715 install_element(BGP_NODE
, &address_family_ipv6_safi_cmd
);
13716 #ifdef KEEP_OLD_VPN_COMMANDS
13717 install_element(BGP_NODE
, &address_family_vpnv4_cmd
);
13718 install_element(BGP_NODE
, &address_family_vpnv6_cmd
);
13719 #endif /* KEEP_OLD_VPN_COMMANDS */
13721 install_element(BGP_NODE
, &address_family_evpn_cmd
);
13723 /* "exit-address-family" command. */
13724 install_element(BGP_IPV4_NODE
, &exit_address_family_cmd
);
13725 install_element(BGP_IPV4M_NODE
, &exit_address_family_cmd
);
13726 install_element(BGP_IPV4L_NODE
, &exit_address_family_cmd
);
13727 install_element(BGP_IPV6_NODE
, &exit_address_family_cmd
);
13728 install_element(BGP_IPV6M_NODE
, &exit_address_family_cmd
);
13729 install_element(BGP_IPV6L_NODE
, &exit_address_family_cmd
);
13730 install_element(BGP_VPNV4_NODE
, &exit_address_family_cmd
);
13731 install_element(BGP_VPNV6_NODE
, &exit_address_family_cmd
);
13732 install_element(BGP_FLOWSPECV4_NODE
, &exit_address_family_cmd
);
13733 install_element(BGP_FLOWSPECV6_NODE
, &exit_address_family_cmd
);
13734 install_element(BGP_EVPN_NODE
, &exit_address_family_cmd
);
13736 /* "clear ip bgp commands" */
13737 install_element(ENABLE_NODE
, &clear_ip_bgp_all_cmd
);
13739 /* clear ip bgp prefix */
13740 install_element(ENABLE_NODE
, &clear_ip_bgp_prefix_cmd
);
13741 install_element(ENABLE_NODE
, &clear_bgp_ipv6_safi_prefix_cmd
);
13742 install_element(ENABLE_NODE
, &clear_bgp_instance_ipv6_safi_prefix_cmd
);
13744 /* "show [ip] bgp summary" commands. */
13745 install_element(VIEW_NODE
, &show_bgp_instance_all_ipv6_updgrps_cmd
);
13746 install_element(VIEW_NODE
, &show_bgp_l2vpn_evpn_updgrps_cmd
);
13747 install_element(VIEW_NODE
, &show_bgp_instance_updgrps_stats_cmd
);
13748 install_element(VIEW_NODE
, &show_bgp_updgrps_stats_cmd
);
13749 install_element(VIEW_NODE
, &show_ip_bgp_instance_updgrps_adj_s_cmd
);
13750 install_element(VIEW_NODE
, &show_ip_bgp_summary_cmd
);
13751 install_element(VIEW_NODE
, &show_ip_bgp_updgrps_cmd
);
13753 /* "show [ip] bgp neighbors" commands. */
13754 install_element(VIEW_NODE
, &show_ip_bgp_neighbors_cmd
);
13756 /* "show [ip] bgp peer-group" commands. */
13757 install_element(VIEW_NODE
, &show_ip_bgp_peer_groups_cmd
);
13759 /* "show [ip] bgp paths" commands. */
13760 install_element(VIEW_NODE
, &show_ip_bgp_paths_cmd
);
13762 /* "show [ip] bgp community" commands. */
13763 install_element(VIEW_NODE
, &show_ip_bgp_community_info_cmd
);
13765 /* "show ip bgp large-community" commands. */
13766 install_element(VIEW_NODE
, &show_ip_bgp_lcommunity_info_cmd
);
13767 /* "show [ip] bgp attribute-info" commands. */
13768 install_element(VIEW_NODE
, &show_ip_bgp_attr_info_cmd
);
13769 /* "show [ip] bgp route-leak" command */
13770 install_element(VIEW_NODE
, &show_ip_bgp_route_leak_cmd
);
13772 /* "redistribute" commands. */
13773 install_element(BGP_NODE
, &bgp_redistribute_ipv4_hidden_cmd
);
13774 install_element(BGP_NODE
, &no_bgp_redistribute_ipv4_hidden_cmd
);
13775 install_element(BGP_NODE
, &bgp_redistribute_ipv4_rmap_hidden_cmd
);
13776 install_element(BGP_NODE
, &bgp_redistribute_ipv4_metric_hidden_cmd
);
13777 install_element(BGP_NODE
,
13778 &bgp_redistribute_ipv4_rmap_metric_hidden_cmd
);
13779 install_element(BGP_NODE
,
13780 &bgp_redistribute_ipv4_metric_rmap_hidden_cmd
);
13781 install_element(BGP_NODE
, &bgp_redistribute_ipv4_ospf_hidden_cmd
);
13782 install_element(BGP_NODE
, &no_bgp_redistribute_ipv4_ospf_hidden_cmd
);
13783 install_element(BGP_NODE
, &bgp_redistribute_ipv4_ospf_rmap_hidden_cmd
);
13784 install_element(BGP_NODE
,
13785 &bgp_redistribute_ipv4_ospf_metric_hidden_cmd
);
13786 install_element(BGP_NODE
,
13787 &bgp_redistribute_ipv4_ospf_rmap_metric_hidden_cmd
);
13788 install_element(BGP_NODE
,
13789 &bgp_redistribute_ipv4_ospf_metric_rmap_hidden_cmd
);
13790 install_element(BGP_IPV4_NODE
, &bgp_redistribute_ipv4_cmd
);
13791 install_element(BGP_IPV4_NODE
, &no_bgp_redistribute_ipv4_cmd
);
13792 install_element(BGP_IPV4_NODE
, &bgp_redistribute_ipv4_rmap_cmd
);
13793 install_element(BGP_IPV4_NODE
, &bgp_redistribute_ipv4_metric_cmd
);
13794 install_element(BGP_IPV4_NODE
, &bgp_redistribute_ipv4_rmap_metric_cmd
);
13795 install_element(BGP_IPV4_NODE
, &bgp_redistribute_ipv4_metric_rmap_cmd
);
13796 install_element(BGP_IPV4_NODE
, &bgp_redistribute_ipv4_ospf_cmd
);
13797 install_element(BGP_IPV4_NODE
, &no_bgp_redistribute_ipv4_ospf_cmd
);
13798 install_element(BGP_IPV4_NODE
, &bgp_redistribute_ipv4_ospf_rmap_cmd
);
13799 install_element(BGP_IPV4_NODE
, &bgp_redistribute_ipv4_ospf_metric_cmd
);
13800 install_element(BGP_IPV4_NODE
,
13801 &bgp_redistribute_ipv4_ospf_rmap_metric_cmd
);
13802 install_element(BGP_IPV4_NODE
,
13803 &bgp_redistribute_ipv4_ospf_metric_rmap_cmd
);
13804 install_element(BGP_IPV6_NODE
, &bgp_redistribute_ipv6_cmd
);
13805 install_element(BGP_IPV6_NODE
, &no_bgp_redistribute_ipv6_cmd
);
13806 install_element(BGP_IPV6_NODE
, &bgp_redistribute_ipv6_rmap_cmd
);
13807 install_element(BGP_IPV6_NODE
, &bgp_redistribute_ipv6_metric_cmd
);
13808 install_element(BGP_IPV6_NODE
, &bgp_redistribute_ipv6_rmap_metric_cmd
);
13809 install_element(BGP_IPV6_NODE
, &bgp_redistribute_ipv6_metric_rmap_cmd
);
13811 /* import|export vpn [route-map WORD] */
13812 install_element(BGP_IPV4_NODE
, &bgp_imexport_vpn_cmd
);
13813 install_element(BGP_IPV6_NODE
, &bgp_imexport_vpn_cmd
);
13815 install_element(BGP_IPV4_NODE
, &bgp_imexport_vrf_cmd
);
13816 install_element(BGP_IPV6_NODE
, &bgp_imexport_vrf_cmd
);
13818 /* ttl_security commands */
13819 install_element(BGP_NODE
, &neighbor_ttl_security_cmd
);
13820 install_element(BGP_NODE
, &no_neighbor_ttl_security_cmd
);
13822 /* "show [ip] bgp memory" commands. */
13823 install_element(VIEW_NODE
, &show_bgp_memory_cmd
);
13825 /* "show bgp martian next-hop" */
13826 install_element(VIEW_NODE
, &show_bgp_martian_nexthop_db_cmd
);
13828 /* "show [ip] bgp views" commands. */
13829 install_element(VIEW_NODE
, &show_bgp_views_cmd
);
13831 /* "show [ip] bgp vrfs" commands. */
13832 install_element(VIEW_NODE
, &show_bgp_vrfs_cmd
);
13834 /* Community-list. */
13835 community_list_vty();
13837 /* vpn-policy commands */
13838 install_element(BGP_IPV4_NODE
, &af_rd_vpn_export_cmd
);
13839 install_element(BGP_IPV6_NODE
, &af_rd_vpn_export_cmd
);
13840 install_element(BGP_IPV4_NODE
, &af_label_vpn_export_cmd
);
13841 install_element(BGP_IPV6_NODE
, &af_label_vpn_export_cmd
);
13842 install_element(BGP_IPV4_NODE
, &af_nexthop_vpn_export_cmd
);
13843 install_element(BGP_IPV6_NODE
, &af_nexthop_vpn_export_cmd
);
13844 install_element(BGP_IPV4_NODE
, &af_rt_vpn_imexport_cmd
);
13845 install_element(BGP_IPV6_NODE
, &af_rt_vpn_imexport_cmd
);
13846 install_element(BGP_IPV4_NODE
, &af_route_map_vpn_imexport_cmd
);
13847 install_element(BGP_IPV6_NODE
, &af_route_map_vpn_imexport_cmd
);
13848 install_element(BGP_IPV4_NODE
, &af_import_vrf_route_map_cmd
);
13849 install_element(BGP_IPV6_NODE
, &af_import_vrf_route_map_cmd
);
13851 install_element(BGP_IPV4_NODE
, &af_routetarget_import_cmd
);
13852 install_element(BGP_IPV6_NODE
, &af_routetarget_import_cmd
);
13854 install_element(BGP_IPV4_NODE
, &af_no_rd_vpn_export_cmd
);
13855 install_element(BGP_IPV6_NODE
, &af_no_rd_vpn_export_cmd
);
13856 install_element(BGP_IPV4_NODE
, &af_no_label_vpn_export_cmd
);
13857 install_element(BGP_IPV6_NODE
, &af_no_label_vpn_export_cmd
);
13858 install_element(BGP_IPV4_NODE
, &af_no_nexthop_vpn_export_cmd
);
13859 install_element(BGP_IPV6_NODE
, &af_no_nexthop_vpn_export_cmd
);
13860 install_element(BGP_IPV4_NODE
, &af_no_rt_vpn_imexport_cmd
);
13861 install_element(BGP_IPV6_NODE
, &af_no_rt_vpn_imexport_cmd
);
13862 install_element(BGP_IPV4_NODE
, &af_no_route_map_vpn_imexport_cmd
);
13863 install_element(BGP_IPV6_NODE
, &af_no_route_map_vpn_imexport_cmd
);
13864 install_element(BGP_IPV4_NODE
, &af_no_import_vrf_route_map_cmd
);
13865 install_element(BGP_IPV6_NODE
, &af_no_import_vrf_route_map_cmd
);
13868 #include "memory.h"
13869 #include "bgp_regex.h"
13870 #include "bgp_clist.h"
13871 #include "bgp_ecommunity.h"
13873 /* VTY functions. */
13875 /* Direction value to string conversion. */
13876 static const char *community_direct_str(int direct
)
13879 case COMMUNITY_DENY
:
13881 case COMMUNITY_PERMIT
:
13888 /* Display error string. */
13889 static void community_list_perror(struct vty
*vty
, int ret
)
13892 case COMMUNITY_LIST_ERR_CANT_FIND_LIST
:
13893 vty_out(vty
, "%% Can't find community-list\n");
13895 case COMMUNITY_LIST_ERR_MALFORMED_VAL
:
13896 vty_out(vty
, "%% Malformed community-list value\n");
13898 case COMMUNITY_LIST_ERR_STANDARD_CONFLICT
:
13900 "%% Community name conflict, previously defined as standard community\n");
13902 case COMMUNITY_LIST_ERR_EXPANDED_CONFLICT
:
13904 "%% Community name conflict, previously defined as expanded community\n");
13909 /* "community-list" keyword help string. */
13910 #define COMMUNITY_LIST_STR "Add a community list entry\n"
13912 /*community-list standard */
13913 DEFUN (community_list_standard
,
13914 bgp_community_list_standard_cmd
,
13915 "bgp community-list <(1-99)|standard WORD> <deny|permit> AA:NN...",
13918 "Community list number (standard)\n"
13919 "Add an standard community-list entry\n"
13920 "Community list name\n"
13921 "Specify community to reject\n"
13922 "Specify community to accept\n"
13925 char *cl_name_or_number
= NULL
;
13927 int style
= COMMUNITY_LIST_STANDARD
;
13931 if (argv_find(argv
, argc
, "ip", &idx
)) {
13932 vty_out(vty
, "This config option is deprecated, and is scheduled for removal.\n");
13933 vty_out(vty
, "if you are using this please migrate to the below command.\n");
13934 vty_out(vty
, "'bgp community-list <(1-99)|(100-500)|standard|expanded> <deny|permit> AA:NN'\n");
13935 zlog_warn("Deprecated option: 'ip community-list <(1-99)|(100-500)|standard|expanded> <deny|permit> AA:NN' being used");
13938 argv_find(argv
, argc
, "(1-99)", &idx
);
13939 argv_find(argv
, argc
, "WORD", &idx
);
13940 cl_name_or_number
= argv
[idx
]->arg
;
13941 direct
= argv_find(argv
, argc
, "permit", &idx
) ? COMMUNITY_PERMIT
13943 argv_find(argv
, argc
, "AA:NN", &idx
);
13944 char *str
= argv_concat(argv
, argc
, idx
);
13946 int ret
= community_list_set(bgp_clist
, cl_name_or_number
, str
, direct
,
13949 XFREE(MTYPE_TMP
, str
);
13952 /* Display error string. */
13953 community_list_perror(vty
, ret
);
13954 return CMD_WARNING_CONFIG_FAILED
;
13957 return CMD_SUCCESS
;
13960 #if CONFDATE > 20191005
13961 CPP_NOTICE("bgpd: remove deprecated 'ip community-list <(1-99)|(100-500)|standard|expanded> <deny|permit> AA:NN' command")
13963 ALIAS (community_list_standard
,
13964 ip_community_list_standard_cmd
,
13965 "ip community-list <(1-99)|standard WORD> <deny|permit> AA:NN...",
13968 "Community list number (standard)\n"
13969 "Add an standard community-list entry\n"
13970 "Community list name\n"
13971 "Specify community to reject\n"
13972 "Specify community to accept\n"
13975 DEFUN (no_community_list_standard_all
,
13976 no_bgp_community_list_standard_all_cmd
,
13977 "no bgp community-list <(1-99)|standard WORD> <deny|permit> AA:NN...",
13981 "Community list number (standard)\n"
13982 "Add an standard community-list entry\n"
13983 "Community list name\n"
13984 "Specify community to reject\n"
13985 "Specify community to accept\n"
13988 char *cl_name_or_number
= NULL
;
13991 int style
= COMMUNITY_LIST_STANDARD
;
13995 if (argv_find(argv
, argc
, "ip", &idx
)) {
13996 vty_out(vty
, "This config option is deprecated, and is scheduled for removal\n");
13997 vty_out(vty
, "if you are using this please migrate to the below command.\n");
13998 vty_out(vty
, "'no bgp community-list <(1-99)|(100-500)|standard|expanded> <deny|permit> AA:NN'\n");
13999 zlog_warn("Deprecated option: 'no ip community-list <(1-99)|(100-500)|standard|expanded> <deny|permit> |AA:NN' being used");
14002 argv_find(argv
, argc
, "permit", &idx
);
14003 argv_find(argv
, argc
, "deny", &idx
);
14006 direct
= argv_find(argv
, argc
, "permit", &idx
)
14011 argv_find(argv
, argc
, "AA:NN", &idx
);
14012 str
= argv_concat(argv
, argc
, idx
);
14016 argv_find(argv
, argc
, "(1-99)", &idx
);
14017 argv_find(argv
, argc
, "WORD", &idx
);
14018 cl_name_or_number
= argv
[idx
]->arg
;
14020 int ret
= community_list_unset(bgp_clist
, cl_name_or_number
, str
,
14023 XFREE(MTYPE_TMP
, str
);
14026 community_list_perror(vty
, ret
);
14027 return CMD_WARNING_CONFIG_FAILED
;
14030 return CMD_SUCCESS
;
14032 ALIAS (no_community_list_standard_all
,
14033 no_ip_community_list_standard_all_cmd
,
14034 "no ip community-list <(1-99)|standard WORD> <deny|permit> AA:NN...",
14038 "Community list number (standard)\n"
14039 "Add an standard community-list entry\n"
14040 "Community list name\n"
14041 "Specify community to reject\n"
14042 "Specify community to accept\n"
14045 ALIAS(no_community_list_standard_all
, no_bgp_community_list_standard_all_list_cmd
,
14046 "no bgp community-list <(1-99)|standard WORD>",
14047 NO_STR BGP_STR COMMUNITY_LIST_STR
14048 "Community list number (standard)\n"
14049 "Add an standard community-list entry\n"
14050 "Community list name\n")
14052 ALIAS(no_community_list_standard_all
, no_ip_community_list_standard_all_list_cmd
,
14053 "no ip 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 /*community-list expanded */
14060 DEFUN (community_list_expanded_all
,
14061 bgp_community_list_expanded_all_cmd
,
14062 "bgp community-list <(100-500)|expanded WORD> <deny|permit> AA:NN...",
14065 "Community list number (expanded)\n"
14066 "Add an expanded community-list entry\n"
14067 "Community list name\n"
14068 "Specify community to reject\n"
14069 "Specify community to accept\n"
14072 char *cl_name_or_number
= NULL
;
14074 int style
= COMMUNITY_LIST_EXPANDED
;
14077 if (argv_find(argv
, argc
, "ip", &idx
)) {
14078 vty_out(vty
, "This config option is deprecated, and is scheduled for removal.\n");
14079 vty_out(vty
, "if you are using this please migrate to the below command.\n");
14080 vty_out(vty
, "'bgp community-list <(1-99)|(100-500)|standard|expanded> <deny|permit> AA:NN'\n");
14081 zlog_warn("Deprecated option: 'ip community-list <(1-99)|(100-500)|standard|expanded> <deny|permit> AA:NN' being used");
14083 argv_find(argv
, argc
, "(100-500)", &idx
);
14084 argv_find(argv
, argc
, "WORD", &idx
);
14085 cl_name_or_number
= argv
[idx
]->arg
;
14086 direct
= argv_find(argv
, argc
, "permit", &idx
) ? COMMUNITY_PERMIT
14088 argv_find(argv
, argc
, "AA:NN", &idx
);
14089 char *str
= argv_concat(argv
, argc
, idx
);
14091 int ret
= community_list_set(bgp_clist
, cl_name_or_number
, str
, direct
,
14094 XFREE(MTYPE_TMP
, str
);
14097 /* Display error string. */
14098 community_list_perror(vty
, ret
);
14099 return CMD_WARNING_CONFIG_FAILED
;
14102 return CMD_SUCCESS
;
14105 ALIAS (community_list_expanded_all
,
14106 ip_community_list_expanded_all_cmd
,
14107 "ip community-list <(100-500)|expanded WORD> <deny|permit> AA:NN...",
14110 "Community list number (expanded)\n"
14111 "Add an expanded community-list entry\n"
14112 "Community list name\n"
14113 "Specify community to reject\n"
14114 "Specify community to accept\n"
14117 DEFUN (no_community_list_expanded_all
,
14118 no_bgp_community_list_expanded_all_cmd
,
14119 "no bgp community-list <(100-500)|expanded WORD> <deny|permit> AA:NN...",
14123 "Community list number (expanded)\n"
14124 "Add an expanded community-list entry\n"
14125 "Community list name\n"
14126 "Specify community to reject\n"
14127 "Specify community to accept\n"
14130 char *cl_name_or_number
= NULL
;
14133 int style
= COMMUNITY_LIST_EXPANDED
;
14136 if (argv_find(argv
, argc
, "ip", &idx
)) {
14137 vty_out(vty
, "This config option is deprecated, and is scheduled for removal.\n");
14138 vty_out(vty
, "if you are using this please migrate to the below command.\n");
14139 vty_out(vty
, "'no bgp community-list <(1-99)|(100-500)|standard|expanded> <deny|permit> AA:NN'\n");
14140 zlog_warn("Deprecated option: 'no ip community-list <(1-99)|(100-500)|standard|expanded> <deny|permit> AA:NN' being used");
14143 argv_find(argv
, argc
, "permit", &idx
);
14144 argv_find(argv
, argc
, "deny", &idx
);
14147 direct
= argv_find(argv
, argc
, "permit", &idx
)
14152 argv_find(argv
, argc
, "AA:NN", &idx
);
14153 str
= argv_concat(argv
, argc
, idx
);
14157 argv_find(argv
, argc
, "(100-500)", &idx
);
14158 argv_find(argv
, argc
, "WORD", &idx
);
14159 cl_name_or_number
= argv
[idx
]->arg
;
14161 int ret
= community_list_unset(bgp_clist
, cl_name_or_number
, str
,
14164 XFREE(MTYPE_TMP
, str
);
14167 community_list_perror(vty
, ret
);
14168 return CMD_WARNING_CONFIG_FAILED
;
14171 return CMD_SUCCESS
;
14174 ALIAS (no_community_list_expanded_all
,
14175 no_ip_community_list_expanded_all_cmd
,
14176 "no ip community-list <(100-500)|expanded WORD> <deny|permit> AA:NN...",
14180 "Community list number (expanded)\n"
14181 "Add an expanded community-list entry\n"
14182 "Community list name\n"
14183 "Specify community to reject\n"
14184 "Specify community to accept\n"
14187 ALIAS(no_community_list_expanded_all
, no_bgp_community_list_expanded_all_list_cmd
,
14188 "no bgp community-list <(100-500)|expanded WORD>",
14189 NO_STR IP_STR COMMUNITY_LIST_STR
14190 "Community list number (expanded)\n"
14191 "Add an expanded community-list entry\n"
14192 "Community list name\n")
14194 ALIAS(no_community_list_expanded_all
, no_ip_community_list_expanded_all_list_cmd
,
14195 "no ip community-list <(100-500)|expanded WORD>",
14196 NO_STR IP_STR COMMUNITY_LIST_STR
14197 "Community list number (expanded)\n"
14198 "Add an expanded community-list entry\n"
14199 "Community list name\n")
14201 /* Return configuration string of community-list entry. */
14202 static const char *community_list_config_str(struct community_entry
*entry
)
14209 if (entry
->style
== COMMUNITY_LIST_STANDARD
)
14210 str
= community_str(entry
->u
.com
, false);
14211 else if (entry
->style
== LARGE_COMMUNITY_LIST_STANDARD
)
14212 str
= lcommunity_str(entry
->u
.lcom
, false);
14214 str
= entry
->config
;
14219 static void community_list_show(struct vty
*vty
, struct community_list
*list
)
14221 struct community_entry
*entry
;
14223 for (entry
= list
->head
; entry
; entry
= entry
->next
) {
14224 if (entry
== list
->head
) {
14225 if (all_digit(list
->name
))
14226 vty_out(vty
, "Community %s list %s\n",
14227 entry
->style
== COMMUNITY_LIST_STANDARD
14229 : "(expanded) access",
14232 vty_out(vty
, "Named Community %s list %s\n",
14233 entry
->style
== COMMUNITY_LIST_STANDARD
14239 vty_out(vty
, " %s\n",
14240 community_direct_str(entry
->direct
));
14242 vty_out(vty
, " %s %s\n",
14243 community_direct_str(entry
->direct
),
14244 community_list_config_str(entry
));
14248 DEFUN (show_community_list
,
14249 show_bgp_community_list_cmd
,
14250 "show bgp community-list",
14253 "List community-list\n")
14255 struct community_list
*list
;
14256 struct community_list_master
*cm
;
14259 if (argv_find(argv
, argc
, "ip", &idx
)) {
14260 vty_out(vty
, "This config option is deprecated, and is scheduled for removal.\n");
14261 vty_out(vty
, "if you are using this please migrate to the below command.\n");
14262 vty_out(vty
, "'show bgp community-list <(1-500)|WORD>'\n");
14263 zlog_warn("Deprecated option: 'ip show community-list <(1-500)|WORD>' being used");
14265 cm
= community_list_master_lookup(bgp_clist
, COMMUNITY_LIST_MASTER
);
14267 return CMD_SUCCESS
;
14269 for (list
= cm
->num
.head
; list
; list
= list
->next
)
14270 community_list_show(vty
, list
);
14272 for (list
= cm
->str
.head
; list
; list
= list
->next
)
14273 community_list_show(vty
, list
);
14275 return CMD_SUCCESS
;
14278 ALIAS (show_community_list
,
14279 show_ip_community_list_cmd
,
14280 "show ip community-list",
14283 "List community-list\n")
14285 DEFUN (show_community_list_arg
,
14286 show_bgp_community_list_arg_cmd
,
14287 "show bgp community-list <(1-500)|WORD>",
14290 "List community-list\n"
14291 "Community-list number\n"
14292 "Community-list name\n")
14294 int idx_comm_list
= 3;
14295 struct community_list
*list
;
14298 if (argv_find(argv
, argc
, "ip", &idx
)) {
14299 vty_out(vty
, "This config option is deprecated, and is scheduled for removal.\n");
14300 vty_out(vty
, "if you are using this please migrate to the below command.\n");
14301 vty_out(vty
, "'show bgp community-list <(1-500)|WORD>'\n");
14302 zlog_warn("Deprecated option: 'ip show community-list <(1-500)|WORD>' being used");
14304 list
= community_list_lookup(bgp_clist
, argv
[idx_comm_list
]->arg
,
14305 COMMUNITY_LIST_MASTER
);
14307 vty_out(vty
, "%% Can't find community-list\n");
14308 return CMD_WARNING
;
14311 community_list_show(vty
, list
);
14313 return CMD_SUCCESS
;
14316 ALIAS (show_community_list_arg
,
14317 show_ip_community_list_arg_cmd
,
14318 "show ip community-list <(1-500)|WORD>",
14321 "List community-list\n"
14322 "Community-list number\n"
14323 "Community-list name\n")
14326 * Large Community code.
14328 static int lcommunity_list_set_vty(struct vty
*vty
, int argc
,
14329 struct cmd_token
**argv
, int style
,
14330 int reject_all_digit_name
)
14338 if (argv_find(argv
, argc
, "ip", &idx
)) {
14339 vty_out(vty
, "This config option is deprecated, and is scheduled for removal.\n");
14340 vty_out(vty
, "if you are using this please migrate to the below command.\n");
14341 vty_out(vty
, "'bgp large-community-list <(1-99)|(100-500)|standard|expanded> <deny|permit> <LINE|AA:BB:CC>'\n");
14342 zlog_warn("Deprecated option: 'large-community-list <(1-99)|(100-500)|standard|expanded> <deny|permit> <LINE|AA:BB:CC>' being used");
14344 direct
= argv_find(argv
, argc
, "permit", &idx
) ? COMMUNITY_PERMIT
14347 /* All digit name check. */
14349 argv_find(argv
, argc
, "WORD", &idx
);
14350 argv_find(argv
, argc
, "(1-99)", &idx
);
14351 argv_find(argv
, argc
, "(100-500)", &idx
);
14352 cl_name
= argv
[idx
]->arg
;
14353 if (reject_all_digit_name
&& all_digit(cl_name
)) {
14354 vty_out(vty
, "%% Community name cannot have all digits\n");
14355 return CMD_WARNING_CONFIG_FAILED
;
14359 argv_find(argv
, argc
, "AA:BB:CC", &idx
);
14360 argv_find(argv
, argc
, "LINE", &idx
);
14361 /* Concat community string argument. */
14363 str
= argv_concat(argv
, argc
, idx
);
14367 ret
= lcommunity_list_set(bgp_clist
, cl_name
, str
, direct
, style
);
14369 /* Free temporary community list string allocated by
14372 XFREE(MTYPE_TMP
, str
);
14375 community_list_perror(vty
, ret
);
14376 return CMD_WARNING_CONFIG_FAILED
;
14378 return CMD_SUCCESS
;
14381 static int lcommunity_list_unset_vty(struct vty
*vty
, int argc
,
14382 struct cmd_token
**argv
, int style
)
14389 if (argv_find(argv
, argc
, "ip", &idx
)) {
14390 vty_out(vty
, "This config option is deprecated, and is scheduled for removal.\n");
14391 vty_out(vty
, "if you are using this please migrate to the below command.\n");
14392 vty_out(vty
, "'no bgp large-community-list <(1-99)|(100-500)|standard|expanded> <deny|permit> <LINE|AA:BB:CC>'\n");
14393 zlog_warn("Deprecated option: 'no ip large-community-list <(1-99)|(100-500)|standard|expanded> <deny|permit> <LINE|AA:BB:CC>' being used");
14395 argv_find(argv
, argc
, "permit", &idx
);
14396 argv_find(argv
, argc
, "deny", &idx
);
14399 /* Check the list direct. */
14400 if (strncmp(argv
[idx
]->arg
, "p", 1) == 0)
14401 direct
= COMMUNITY_PERMIT
;
14403 direct
= COMMUNITY_DENY
;
14406 argv_find(argv
, argc
, "LINE", &idx
);
14407 argv_find(argv
, argc
, "AA:AA:NN", &idx
);
14408 /* Concat community string argument. */
14409 str
= argv_concat(argv
, argc
, idx
);
14413 argv_find(argv
, argc
, "(1-99)", &idx
);
14414 argv_find(argv
, argc
, "(100-500)", &idx
);
14415 argv_find(argv
, argc
, "WORD", &idx
);
14417 /* Unset community list. */
14418 ret
= lcommunity_list_unset(bgp_clist
, argv
[idx
]->arg
, str
, direct
,
14421 /* Free temporary community list string allocated by
14424 XFREE(MTYPE_TMP
, str
);
14427 community_list_perror(vty
, ret
);
14428 return CMD_WARNING_CONFIG_FAILED
;
14431 return CMD_SUCCESS
;
14434 /* "large-community-list" keyword help string. */
14435 #define LCOMMUNITY_LIST_STR "Add a large community list entry\n"
14436 #define LCOMMUNITY_VAL_STR "large community in 'aa:bb:cc' format\n"
14438 #if CONFDATE > 20191005
14439 CPP_NOTICE("bgpd: remove deprecated 'ip large-community-list <(1-99)|(100-500)|standard|expanded> <deny|permit> <LINE|AA:BB:CC>' command")
14441 DEFUN (lcommunity_list_standard
,
14442 bgp_lcommunity_list_standard_cmd
,
14443 "bgp large-community-list (1-99) <deny|permit>",
14445 LCOMMUNITY_LIST_STR
14446 "Large Community list number (standard)\n"
14447 "Specify large community to reject\n"
14448 "Specify large community to accept\n")
14450 return lcommunity_list_set_vty(vty
, argc
, argv
,
14451 LARGE_COMMUNITY_LIST_STANDARD
, 0);
14454 ALIAS (lcommunity_list_standard
,
14455 ip_lcommunity_list_standard_cmd
,
14456 "ip large-community-list (1-99) <deny|permit>",
14458 LCOMMUNITY_LIST_STR
14459 "Large Community list number (standard)\n"
14460 "Specify large community to reject\n"
14461 "Specify large community to accept\n")
14463 DEFUN (lcommunity_list_standard1
,
14464 bgp_lcommunity_list_standard1_cmd
,
14465 "bgp large-community-list (1-99) <deny|permit> AA:BB:CC...",
14467 LCOMMUNITY_LIST_STR
14468 "Large Community list number (standard)\n"
14469 "Specify large community to reject\n"
14470 "Specify large community to accept\n"
14471 LCOMMUNITY_VAL_STR
)
14473 return lcommunity_list_set_vty(vty
, argc
, argv
,
14474 LARGE_COMMUNITY_LIST_STANDARD
, 0);
14477 ALIAS (lcommunity_list_standard1
,
14478 ip_lcommunity_list_standard1_cmd
,
14479 "ip large-community-list (1-99) <deny|permit> AA:BB:CC...",
14481 LCOMMUNITY_LIST_STR
14482 "Large Community list number (standard)\n"
14483 "Specify large community to reject\n"
14484 "Specify large community to accept\n"
14485 LCOMMUNITY_VAL_STR
)
14487 DEFUN (lcommunity_list_expanded
,
14488 bgp_lcommunity_list_expanded_cmd
,
14489 "bgp large-community-list (100-500) <deny|permit> LINE...",
14491 LCOMMUNITY_LIST_STR
14492 "Large Community list number (expanded)\n"
14493 "Specify large community to reject\n"
14494 "Specify large community to accept\n"
14495 "An ordered list as a regular-expression\n")
14497 return lcommunity_list_set_vty(vty
, argc
, argv
,
14498 LARGE_COMMUNITY_LIST_EXPANDED
, 0);
14501 ALIAS (lcommunity_list_expanded
,
14502 ip_lcommunity_list_expanded_cmd
,
14503 "ip large-community-list (100-500) <deny|permit> LINE...",
14505 LCOMMUNITY_LIST_STR
14506 "Large Community list number (expanded)\n"
14507 "Specify large community to reject\n"
14508 "Specify large community to accept\n"
14509 "An ordered list as a regular-expression\n")
14511 DEFUN (lcommunity_list_name_standard
,
14512 bgp_lcommunity_list_name_standard_cmd
,
14513 "bgp large-community-list standard WORD <deny|permit>",
14515 LCOMMUNITY_LIST_STR
14516 "Specify standard large-community-list\n"
14517 "Large Community list name\n"
14518 "Specify large community to reject\n"
14519 "Specify large community to accept\n")
14521 return lcommunity_list_set_vty(vty
, argc
, argv
,
14522 LARGE_COMMUNITY_LIST_STANDARD
, 1);
14525 ALIAS (lcommunity_list_name_standard
,
14526 ip_lcommunity_list_name_standard_cmd
,
14527 "ip large-community-list standard WORD <deny|permit>",
14529 LCOMMUNITY_LIST_STR
14530 "Specify standard large-community-list\n"
14531 "Large Community list name\n"
14532 "Specify large community to reject\n"
14533 "Specify large community to accept\n")
14535 DEFUN (lcommunity_list_name_standard1
,
14536 bgp_lcommunity_list_name_standard1_cmd
,
14537 "bgp large-community-list standard WORD <deny|permit> AA:BB:CC...",
14539 LCOMMUNITY_LIST_STR
14540 "Specify standard large-community-list\n"
14541 "Large Community list name\n"
14542 "Specify large community to reject\n"
14543 "Specify large community to accept\n"
14544 LCOMMUNITY_VAL_STR
)
14546 return lcommunity_list_set_vty(vty
, argc
, argv
,
14547 LARGE_COMMUNITY_LIST_STANDARD
, 1);
14550 ALIAS (lcommunity_list_name_standard1
,
14551 ip_lcommunity_list_name_standard1_cmd
,
14552 "ip large-community-list standard WORD <deny|permit> AA:BB:CC...",
14554 LCOMMUNITY_LIST_STR
14555 "Specify standard large-community-list\n"
14556 "Large Community list name\n"
14557 "Specify large community to reject\n"
14558 "Specify large community to accept\n"
14559 LCOMMUNITY_VAL_STR
)
14561 DEFUN (lcommunity_list_name_expanded
,
14562 bgp_lcommunity_list_name_expanded_cmd
,
14563 "bgp large-community-list expanded WORD <deny|permit> LINE...",
14565 LCOMMUNITY_LIST_STR
14566 "Specify expanded large-community-list\n"
14567 "Large Community list name\n"
14568 "Specify large community to reject\n"
14569 "Specify large community to accept\n"
14570 "An ordered list as a regular-expression\n")
14572 return lcommunity_list_set_vty(vty
, argc
, argv
,
14573 LARGE_COMMUNITY_LIST_EXPANDED
, 1);
14576 ALIAS (lcommunity_list_name_expanded
,
14577 ip_lcommunity_list_name_expanded_cmd
,
14578 "ip large-community-list expanded WORD <deny|permit> LINE...",
14580 LCOMMUNITY_LIST_STR
14581 "Specify expanded large-community-list\n"
14582 "Large Community list name\n"
14583 "Specify large community to reject\n"
14584 "Specify large community to accept\n"
14585 "An ordered list as a regular-expression\n")
14587 DEFUN (no_lcommunity_list_standard_all
,
14588 no_bgp_lcommunity_list_standard_all_cmd
,
14589 "no bgp large-community-list <(1-99)|(100-500)|WORD>",
14592 LCOMMUNITY_LIST_STR
14593 "Large Community list number (standard)\n"
14594 "Large Community list number (expanded)\n"
14595 "Large Community list name\n")
14597 return lcommunity_list_unset_vty(vty
, argc
, argv
,
14598 LARGE_COMMUNITY_LIST_STANDARD
);
14601 ALIAS (no_lcommunity_list_standard_all
,
14602 no_ip_lcommunity_list_standard_all_cmd
,
14603 "no ip large-community-list <(1-99)|(100-500)|WORD>",
14606 LCOMMUNITY_LIST_STR
14607 "Large Community list number (standard)\n"
14608 "Large Community list number (expanded)\n"
14609 "Large Community list name\n")
14611 DEFUN (no_lcommunity_list_name_expanded_all
,
14612 no_bgp_lcommunity_list_name_expanded_all_cmd
,
14613 "no bgp large-community-list expanded WORD",
14616 LCOMMUNITY_LIST_STR
14617 "Specify expanded large-community-list\n"
14618 "Large Community list name\n")
14620 return lcommunity_list_unset_vty(vty
, argc
, argv
,
14621 LARGE_COMMUNITY_LIST_EXPANDED
);
14624 ALIAS (no_lcommunity_list_name_expanded_all
,
14625 no_ip_lcommunity_list_name_expanded_all_cmd
,
14626 "no ip large-community-list expanded WORD",
14629 LCOMMUNITY_LIST_STR
14630 "Specify expanded large-community-list\n"
14631 "Large Community list name\n")
14633 DEFUN (no_lcommunity_list_standard
,
14634 no_bgp_lcommunity_list_standard_cmd
,
14635 "no bgp large-community-list (1-99) <deny|permit> AA:AA:NN...",
14638 LCOMMUNITY_LIST_STR
14639 "Large Community list number (standard)\n"
14640 "Specify large community to reject\n"
14641 "Specify large community to accept\n"
14642 LCOMMUNITY_VAL_STR
)
14644 return lcommunity_list_unset_vty(vty
, argc
, argv
,
14645 LARGE_COMMUNITY_LIST_STANDARD
);
14648 ALIAS (no_lcommunity_list_standard
,
14649 no_ip_lcommunity_list_standard_cmd
,
14650 "no ip large-community-list (1-99) <deny|permit> AA:AA:NN...",
14653 LCOMMUNITY_LIST_STR
14654 "Large Community list number (standard)\n"
14655 "Specify large community to reject\n"
14656 "Specify large community to accept\n"
14657 LCOMMUNITY_VAL_STR
)
14659 DEFUN (no_lcommunity_list_expanded
,
14660 no_bgp_lcommunity_list_expanded_cmd
,
14661 "no bgp large-community-list (100-500) <deny|permit> LINE...",
14664 LCOMMUNITY_LIST_STR
14665 "Large Community list number (expanded)\n"
14666 "Specify large community to reject\n"
14667 "Specify large community to accept\n"
14668 "An ordered list as a regular-expression\n")
14670 return lcommunity_list_unset_vty(vty
, argc
, argv
,
14671 LARGE_COMMUNITY_LIST_EXPANDED
);
14674 ALIAS (no_lcommunity_list_expanded
,
14675 no_ip_lcommunity_list_expanded_cmd
,
14676 "no ip large-community-list (100-500) <deny|permit> LINE...",
14679 LCOMMUNITY_LIST_STR
14680 "Large Community list number (expanded)\n"
14681 "Specify large community to reject\n"
14682 "Specify large community to accept\n"
14683 "An ordered list as a regular-expression\n")
14685 DEFUN (no_lcommunity_list_name_standard
,
14686 no_bgp_lcommunity_list_name_standard_cmd
,
14687 "no bgp large-community-list standard WORD <deny|permit> AA:AA:NN...",
14690 LCOMMUNITY_LIST_STR
14691 "Specify standard large-community-list\n"
14692 "Large Community list name\n"
14693 "Specify large community to reject\n"
14694 "Specify large community to accept\n"
14695 LCOMMUNITY_VAL_STR
)
14697 return lcommunity_list_unset_vty(vty
, argc
, argv
,
14698 LARGE_COMMUNITY_LIST_STANDARD
);
14701 ALIAS (no_lcommunity_list_name_standard
,
14702 no_ip_lcommunity_list_name_standard_cmd
,
14703 "no ip large-community-list standard WORD <deny|permit> AA:AA:NN...",
14706 LCOMMUNITY_LIST_STR
14707 "Specify standard large-community-list\n"
14708 "Large Community list name\n"
14709 "Specify large community to reject\n"
14710 "Specify large community to accept\n"
14711 LCOMMUNITY_VAL_STR
)
14713 DEFUN (no_lcommunity_list_name_expanded
,
14714 no_bgp_lcommunity_list_name_expanded_cmd
,
14715 "no bgp large-community-list expanded WORD <deny|permit> LINE...",
14718 LCOMMUNITY_LIST_STR
14719 "Specify expanded large-community-list\n"
14720 "Large community list name\n"
14721 "Specify large community to reject\n"
14722 "Specify large community to accept\n"
14723 "An ordered list as a regular-expression\n")
14725 return lcommunity_list_unset_vty(vty
, argc
, argv
,
14726 LARGE_COMMUNITY_LIST_EXPANDED
);
14729 ALIAS (no_lcommunity_list_name_expanded
,
14730 no_ip_lcommunity_list_name_expanded_cmd
,
14731 "no ip large-community-list expanded WORD <deny|permit> LINE...",
14734 LCOMMUNITY_LIST_STR
14735 "Specify expanded large-community-list\n"
14736 "Large community list name\n"
14737 "Specify large community to reject\n"
14738 "Specify large community to accept\n"
14739 "An ordered list as a regular-expression\n")
14741 static void lcommunity_list_show(struct vty
*vty
, struct community_list
*list
)
14743 struct community_entry
*entry
;
14745 for (entry
= list
->head
; entry
; entry
= entry
->next
) {
14746 if (entry
== list
->head
) {
14747 if (all_digit(list
->name
))
14748 vty_out(vty
, "Large community %s list %s\n",
14749 entry
->style
== EXTCOMMUNITY_LIST_STANDARD
14751 : "(expanded) access",
14755 "Named large community %s list %s\n",
14756 entry
->style
== EXTCOMMUNITY_LIST_STANDARD
14762 vty_out(vty
, " %s\n",
14763 community_direct_str(entry
->direct
));
14765 vty_out(vty
, " %s %s\n",
14766 community_direct_str(entry
->direct
),
14767 community_list_config_str(entry
));
14771 DEFUN (show_lcommunity_list
,
14772 show_bgp_lcommunity_list_cmd
,
14773 "show bgp large-community-list",
14776 "List large-community list\n")
14778 struct community_list
*list
;
14779 struct community_list_master
*cm
;
14782 if (argv_find(argv
, argc
, "ip", &idx
)) {
14783 vty_out(vty
, "This config option is deprecated, and is scheduled for removal.\n");
14784 vty_out(vty
, "if you are using this please migrate to the below command.\n");
14785 vty_out(vty
, "'show bgp large-community-list <(1-500)|WORD>'\n");
14786 zlog_warn("Deprecated option: 'ip show large-community-list <(1-500)|WORD>' being used");
14789 cm
= community_list_master_lookup(bgp_clist
,
14790 LARGE_COMMUNITY_LIST_MASTER
);
14792 return CMD_SUCCESS
;
14794 for (list
= cm
->num
.head
; list
; list
= list
->next
)
14795 lcommunity_list_show(vty
, list
);
14797 for (list
= cm
->str
.head
; list
; list
= list
->next
)
14798 lcommunity_list_show(vty
, list
);
14800 return CMD_SUCCESS
;
14803 ALIAS (show_lcommunity_list
,
14804 show_ip_lcommunity_list_cmd
,
14805 "show ip large-community-list",
14808 "List large-community list\n")
14810 DEFUN (show_lcommunity_list_arg
,
14811 show_bgp_lcommunity_list_arg_cmd
,
14812 "show bgp large-community-list <(1-500)|WORD>",
14815 "List large-community list\n"
14816 "large-community-list number\n"
14817 "large-community-list name\n")
14819 struct community_list
*list
;
14822 if (argv_find(argv
, argc
, "ip", &idx
)) {
14823 vty_out(vty
, "This config option is deprecated, and is scheduled for removal.\n");
14824 vty_out(vty
, "if you are using this please migrate to the below command.\n");
14825 vty_out(vty
, "'show bgp large-community-list <(1-500)|WORD>'\n");
14826 zlog_warn("Deprecated option: 'ip show large-community-list <(1-500)|WORD>' being used");
14829 list
= community_list_lookup(bgp_clist
, argv
[3]->arg
,
14830 LARGE_COMMUNITY_LIST_MASTER
);
14832 vty_out(vty
, "%% Can't find extcommunity-list\n");
14833 return CMD_WARNING
;
14836 lcommunity_list_show(vty
, list
);
14838 return CMD_SUCCESS
;
14841 ALIAS (show_lcommunity_list_arg
,
14842 show_ip_lcommunity_list_arg_cmd
,
14843 "show ip large-community-list <(1-500)|WORD>",
14846 "List large-community list\n"
14847 "large-community-list number\n"
14848 "large-community-list name\n")
14850 /* "extcommunity-list" keyword help string. */
14851 #define EXTCOMMUNITY_LIST_STR "Add a extended community list entry\n"
14852 #define EXTCOMMUNITY_VAL_STR "Extended community attribute in 'rt aa:nn_or_IPaddr:nn' OR 'soo aa:nn_or_IPaddr:nn' format\n"
14854 DEFUN (extcommunity_list_standard
,
14855 bgp_extcommunity_list_standard_cmd
,
14856 "bgp extcommunity-list <(1-99)|standard WORD> <deny|permit> AA:NN...",
14858 EXTCOMMUNITY_LIST_STR
14859 "Extended Community list number (standard)\n"
14860 "Specify standard extcommunity-list\n"
14861 "Community list name\n"
14862 "Specify community to reject\n"
14863 "Specify community to accept\n"
14864 EXTCOMMUNITY_VAL_STR
)
14866 int style
= EXTCOMMUNITY_LIST_STANDARD
;
14868 char *cl_number_or_name
= NULL
;
14871 if (argv_find(argv
, argc
, "ip", &idx
)) {
14872 vty_out(vty
, "This config option is deprecated, and is scheduled for removal.\n");
14873 vty_out(vty
, "if you are using this please migrate to the below command.\n");
14874 vty_out(vty
, "'bgp extcommunity-list <(1-99)|(100-500)|standard|expanded> <deny|permit> <LINE|AA:NN>'\n");
14875 zlog_warn("Deprecated option: 'ip extcommunity-list <(1-99)|(100-500)|standard|expanded> <deny|permit> <LINE|AA:NN>' being used");
14877 argv_find(argv
, argc
, "(1-99)", &idx
);
14878 argv_find(argv
, argc
, "WORD", &idx
);
14879 cl_number_or_name
= argv
[idx
]->arg
;
14880 direct
= argv_find(argv
, argc
, "permit", &idx
) ? COMMUNITY_PERMIT
14882 argv_find(argv
, argc
, "AA:NN", &idx
);
14883 char *str
= argv_concat(argv
, argc
, idx
);
14885 int ret
= extcommunity_list_set(bgp_clist
, cl_number_or_name
, str
,
14888 XFREE(MTYPE_TMP
, str
);
14891 community_list_perror(vty
, ret
);
14892 return CMD_WARNING_CONFIG_FAILED
;
14895 return CMD_SUCCESS
;
14898 #if CONFDATE > 20191005
14899 CPP_NOTICE("bgpd: remove deprecated 'ip extcommunity-list <(1-99)|(100-500)|standard|expanded> <deny|permit> <LINE|AA:NN>' command")
14901 ALIAS (extcommunity_list_standard
,
14902 ip_extcommunity_list_standard_cmd
,
14903 "ip extcommunity-list <(1-99)|standard WORD> <deny|permit> AA:NN...",
14905 EXTCOMMUNITY_LIST_STR
14906 "Extended Community list number (standard)\n"
14907 "Specify standard extcommunity-list\n"
14908 "Community list name\n"
14909 "Specify community to reject\n"
14910 "Specify community to accept\n"
14911 EXTCOMMUNITY_VAL_STR
)
14913 DEFUN (extcommunity_list_name_expanded
,
14914 bgp_extcommunity_list_name_expanded_cmd
,
14915 "bgp extcommunity-list <(100-500)|expanded WORD> <deny|permit> LINE...",
14917 EXTCOMMUNITY_LIST_STR
14918 "Extended Community list number (expanded)\n"
14919 "Specify expanded extcommunity-list\n"
14920 "Extended Community list name\n"
14921 "Specify community to reject\n"
14922 "Specify community to accept\n"
14923 "An ordered list as a regular-expression\n")
14925 int style
= EXTCOMMUNITY_LIST_EXPANDED
;
14927 char *cl_number_or_name
= NULL
;
14930 if (argv_find(argv
, argc
, "ip", &idx
)) {
14931 vty_out(vty
, "This config option is deprecated, and is scheduled for removal.\n");
14932 vty_out(vty
, "if you are using this please migrate to the below command.\n");
14933 vty_out(vty
, "'extcommunity-list <(1-99)|(100-500)|standard|expanded> <deny|permit> <LINE|AA:NN>'\n");
14934 zlog_warn("Deprecated option: ‘ip extcommunity-list <(1-99)|(100-500)|standard|expanded> <deny|permit> <LINE|AA:NN>' being used");
14937 argv_find(argv
, argc
, "(100-500)", &idx
);
14938 argv_find(argv
, argc
, "WORD", &idx
);
14939 cl_number_or_name
= argv
[idx
]->arg
;
14940 direct
= argv_find(argv
, argc
, "permit", &idx
) ? COMMUNITY_PERMIT
14942 argv_find(argv
, argc
, "LINE", &idx
);
14943 char *str
= argv_concat(argv
, argc
, idx
);
14945 int ret
= extcommunity_list_set(bgp_clist
, cl_number_or_name
, str
,
14948 XFREE(MTYPE_TMP
, str
);
14951 community_list_perror(vty
, ret
);
14952 return CMD_WARNING_CONFIG_FAILED
;
14955 return CMD_SUCCESS
;
14958 ALIAS (extcommunity_list_name_expanded
,
14959 ip_extcommunity_list_name_expanded_cmd
,
14960 "ip extcommunity-list <(100-500)|expanded WORD> <deny|permit> LINE...",
14962 EXTCOMMUNITY_LIST_STR
14963 "Extended Community list number (expanded)\n"
14964 "Specify expanded extcommunity-list\n"
14965 "Extended Community list name\n"
14966 "Specify community to reject\n"
14967 "Specify community to accept\n"
14968 "An ordered list as a regular-expression\n")
14970 DEFUN (no_extcommunity_list_standard_all
,
14971 no_bgp_extcommunity_list_standard_all_cmd
,
14972 "no bgp extcommunity-list <(1-99)|standard WORD> <deny|permit> AA:NN...",
14975 EXTCOMMUNITY_LIST_STR
14976 "Extended Community list number (standard)\n"
14977 "Specify standard extcommunity-list\n"
14978 "Community list name\n"
14979 "Specify community to reject\n"
14980 "Specify community to accept\n"
14981 EXTCOMMUNITY_VAL_STR
)
14983 int style
= EXTCOMMUNITY_LIST_STANDARD
;
14985 char *cl_number_or_name
= NULL
;
14988 if (argv_find(argv
, argc
, "ip", &idx
)) {
14989 vty_out(vty
, "This config option is deprecated, and is scheduled for removal\n");
14990 vty_out(vty
, "if you are using this please migrate to the below command.\n");
14991 vty_out(vty
, "'no bgp extcommunity-list <(1-99)|(100-500)|standard|expanded> <deny|permit> <LINE|AA:NN>'\n");
14992 zlog_warn("Deprecated option: ‘no ip extcommunity-list <(1-99)|(100-500)|standard|expanded> <deny|permit> <LINE|AA:NN>' being used");
14994 argv_find(argv
, argc
, "(1-99)", &idx
);
14995 argv_find(argv
, argc
, "WORD", &idx
);
14996 cl_number_or_name
= argv
[idx
]->arg
;
14997 direct
= argv_find(argv
, argc
, "permit", &idx
) ? COMMUNITY_PERMIT
14999 argv_find(argv
, argc
, "AA:NN", &idx
);
15000 char *str
= argv_concat(argv
, argc
, idx
);
15002 int ret
= extcommunity_list_unset(bgp_clist
, cl_number_or_name
, str
,
15005 XFREE(MTYPE_TMP
, str
);
15008 community_list_perror(vty
, ret
);
15009 return CMD_WARNING_CONFIG_FAILED
;
15012 return CMD_SUCCESS
;
15015 ALIAS (no_extcommunity_list_standard_all
,
15016 no_ip_extcommunity_list_standard_all_cmd
,
15017 "no ip extcommunity-list <(1-99)|standard WORD> <deny|permit> AA:NN...",
15020 EXTCOMMUNITY_LIST_STR
15021 "Extended Community list number (standard)\n"
15022 "Specify standard extcommunity-list\n"
15023 "Community list name\n"
15024 "Specify community to reject\n"
15025 "Specify community to accept\n"
15026 EXTCOMMUNITY_VAL_STR
)
15028 DEFUN (no_extcommunity_list_expanded_all
,
15029 no_bgp_extcommunity_list_expanded_all_cmd
,
15030 "no bgp extcommunity-list <(100-500)|expanded WORD> <deny|permit> LINE...",
15033 EXTCOMMUNITY_LIST_STR
15034 "Extended Community list number (expanded)\n"
15035 "Specify expanded extcommunity-list\n"
15036 "Extended Community list name\n"
15037 "Specify community to reject\n"
15038 "Specify community to accept\n"
15039 "An ordered list as a regular-expression\n")
15041 int style
= EXTCOMMUNITY_LIST_EXPANDED
;
15043 char *cl_number_or_name
= NULL
;
15046 if (argv_find(argv
, argc
, "ip", &idx
)) {
15047 vty_out(vty
, "This config option is deprecated, and is scheduled for removal.\n");
15048 vty_out(vty
, "if you are using this please migrate to the below command.\n");
15049 vty_out(vty
, "'no bgp extcommunity-list <(1-99)|(100-500)|standard|expanded> <deny|permit> <LINE|AA:NN>'\n");
15050 zlog_warn("Deprecated option: ‘no ip extcommunity-list <(1-99)|(100-500)|standard|expanded> <deny|permit> <LINE|AA:NN>' being used");
15052 argv_find(argv
, argc
, "(100-500)", &idx
);
15053 argv_find(argv
, argc
, "WORD", &idx
);
15054 cl_number_or_name
= argv
[idx
]->arg
;
15055 direct
= argv_find(argv
, argc
, "permit", &idx
) ? COMMUNITY_PERMIT
15057 argv_find(argv
, argc
, "LINE", &idx
);
15058 char *str
= argv_concat(argv
, argc
, idx
);
15060 int ret
= extcommunity_list_unset(bgp_clist
, cl_number_or_name
, str
,
15063 XFREE(MTYPE_TMP
, str
);
15066 community_list_perror(vty
, ret
);
15067 return CMD_WARNING_CONFIG_FAILED
;
15070 return CMD_SUCCESS
;
15073 ALIAS (no_extcommunity_list_expanded_all
,
15074 no_ip_extcommunity_list_expanded_all_cmd
,
15075 "no ip extcommunity-list <(100-500)|expanded WORD> <deny|permit> LINE...",
15078 EXTCOMMUNITY_LIST_STR
15079 "Extended Community list number (expanded)\n"
15080 "Specify expanded extcommunity-list\n"
15081 "Extended Community list name\n"
15082 "Specify community to reject\n"
15083 "Specify community to accept\n"
15084 "An ordered list as a regular-expression\n")
15086 static void extcommunity_list_show(struct vty
*vty
, struct community_list
*list
)
15088 struct community_entry
*entry
;
15090 for (entry
= list
->head
; entry
; entry
= entry
->next
) {
15091 if (entry
== list
->head
) {
15092 if (all_digit(list
->name
))
15093 vty_out(vty
, "Extended community %s list %s\n",
15094 entry
->style
== EXTCOMMUNITY_LIST_STANDARD
15096 : "(expanded) access",
15100 "Named extended community %s list %s\n",
15101 entry
->style
== EXTCOMMUNITY_LIST_STANDARD
15107 vty_out(vty
, " %s\n",
15108 community_direct_str(entry
->direct
));
15110 vty_out(vty
, " %s %s\n",
15111 community_direct_str(entry
->direct
),
15112 community_list_config_str(entry
));
15116 DEFUN (show_extcommunity_list
,
15117 show_bgp_extcommunity_list_cmd
,
15118 "show bgp extcommunity-list",
15121 "List extended-community list\n")
15123 struct community_list
*list
;
15124 struct community_list_master
*cm
;
15127 if (argv_find(argv
, argc
, "ip", &idx
)) {
15128 vty_out(vty
, "This config option is deprecated, and is scheduled for removal\n");
15129 vty_out(vty
, "if you are using this please migrate to the below command.\n");
15130 vty_out(vty
, "'show bgp extcommunity-list <(1-500)|WORD>'\n");
15131 zlog_warn("Deprecated option: 'ip show extcommunity-list <(1-500)|WORD>' being used");
15133 cm
= community_list_master_lookup(bgp_clist
, EXTCOMMUNITY_LIST_MASTER
);
15135 return CMD_SUCCESS
;
15137 for (list
= cm
->num
.head
; list
; list
= list
->next
)
15138 extcommunity_list_show(vty
, list
);
15140 for (list
= cm
->str
.head
; list
; list
= list
->next
)
15141 extcommunity_list_show(vty
, list
);
15143 return CMD_SUCCESS
;
15146 ALIAS (show_extcommunity_list
,
15147 show_ip_extcommunity_list_cmd
,
15148 "show ip extcommunity-list",
15151 "List extended-community list\n")
15153 DEFUN (show_extcommunity_list_arg
,
15154 show_bgp_extcommunity_list_arg_cmd
,
15155 "show bgp extcommunity-list <(1-500)|WORD>",
15158 "List extended-community list\n"
15159 "Extcommunity-list number\n"
15160 "Extcommunity-list name\n")
15162 int idx_comm_list
= 3;
15163 struct community_list
*list
;
15166 if (argv_find(argv
, argc
, "ip", &idx
)) {
15167 vty_out(vty
, "This config option is deprecated, and is scheduled for removal.\n");
15168 vty_out(vty
, "if you are using this please migrate to the below command.\n");
15169 vty_out(vty
, "'show bgp extcommunity-list <(1-500)|WORD>'\n");
15170 zlog_warn("Deprecated option: 'ip show extcommunity-list <(1-500)|WORD>' being used");
15172 list
= community_list_lookup(bgp_clist
, argv
[idx_comm_list
]->arg
,
15173 EXTCOMMUNITY_LIST_MASTER
);
15175 vty_out(vty
, "%% Can't find extcommunity-list\n");
15176 return CMD_WARNING
;
15179 extcommunity_list_show(vty
, list
);
15181 return CMD_SUCCESS
;
15184 ALIAS (show_extcommunity_list_arg
,
15185 show_ip_extcommunity_list_arg_cmd
,
15186 "show ip extcommunity-list <(1-500)|WORD>",
15189 "List extended-community list\n"
15190 "Extcommunity-list number\n"
15191 "Extcommunity-list name\n")
15193 /* Display community-list and extcommunity-list configuration. */
15194 static int community_list_config_write(struct vty
*vty
)
15196 struct community_list
*list
;
15197 struct community_entry
*entry
;
15198 struct community_list_master
*cm
;
15201 /* Community-list. */
15202 cm
= community_list_master_lookup(bgp_clist
, COMMUNITY_LIST_MASTER
);
15204 for (list
= cm
->num
.head
; list
; list
= list
->next
)
15205 for (entry
= list
->head
; entry
; entry
= entry
->next
) {
15206 vty_out(vty
, "bgp community-list %s %s %s\n", list
->name
,
15207 community_direct_str(entry
->direct
),
15208 community_list_config_str(entry
));
15211 for (list
= cm
->str
.head
; list
; list
= list
->next
)
15212 for (entry
= list
->head
; entry
; entry
= entry
->next
) {
15213 vty_out(vty
, "bgp community-list %s %s %s %s\n",
15214 entry
->style
== COMMUNITY_LIST_STANDARD
15217 list
->name
, community_direct_str(entry
->direct
),
15218 community_list_config_str(entry
));
15222 /* Extcommunity-list. */
15223 cm
= community_list_master_lookup(bgp_clist
, EXTCOMMUNITY_LIST_MASTER
);
15225 for (list
= cm
->num
.head
; list
; list
= list
->next
)
15226 for (entry
= list
->head
; entry
; entry
= entry
->next
) {
15227 vty_out(vty
, "bgp extcommunity-list %s %s %s\n",
15228 list
->name
, community_direct_str(entry
->direct
),
15229 community_list_config_str(entry
));
15232 for (list
= cm
->str
.head
; list
; list
= list
->next
)
15233 for (entry
= list
->head
; entry
; entry
= entry
->next
) {
15234 vty_out(vty
, "bgp extcommunity-list %s %s %s %s\n",
15235 entry
->style
== EXTCOMMUNITY_LIST_STANDARD
15238 list
->name
, community_direct_str(entry
->direct
),
15239 community_list_config_str(entry
));
15244 /* lcommunity-list. */
15245 cm
= community_list_master_lookup(bgp_clist
,
15246 LARGE_COMMUNITY_LIST_MASTER
);
15248 for (list
= cm
->num
.head
; list
; list
= list
->next
)
15249 for (entry
= list
->head
; entry
; entry
= entry
->next
) {
15250 vty_out(vty
, "bgp large-community-list %s %s %s\n",
15251 list
->name
, community_direct_str(entry
->direct
),
15252 community_list_config_str(entry
));
15255 for (list
= cm
->str
.head
; list
; list
= list
->next
)
15256 for (entry
= list
->head
; entry
; entry
= entry
->next
) {
15257 vty_out(vty
, "bgp large-community-list %s %s %s %s\n",
15258 entry
->style
== LARGE_COMMUNITY_LIST_STANDARD
15261 list
->name
, community_direct_str(entry
->direct
),
15262 community_list_config_str(entry
));
15269 static struct cmd_node community_list_node
= {
15270 COMMUNITY_LIST_NODE
, "", 1 /* Export to vtysh. */
15273 static void community_list_vty(void)
15275 install_node(&community_list_node
, community_list_config_write
);
15277 /* Community-list. */
15278 install_element(CONFIG_NODE
, &bgp_community_list_standard_cmd
);
15279 install_element(CONFIG_NODE
, &bgp_community_list_expanded_all_cmd
);
15280 install_element(CONFIG_NODE
, &no_bgp_community_list_standard_all_cmd
);
15281 install_element(CONFIG_NODE
, &no_bgp_community_list_standard_all_list_cmd
);
15282 install_element(CONFIG_NODE
, &no_bgp_community_list_expanded_all_cmd
);
15283 install_element(CONFIG_NODE
, &no_bgp_community_list_expanded_all_list_cmd
);
15284 install_element(VIEW_NODE
, &show_bgp_community_list_cmd
);
15285 install_element(VIEW_NODE
, &show_bgp_community_list_arg_cmd
);
15286 install_element(CONFIG_NODE
, &ip_community_list_standard_cmd
);
15287 install_element(CONFIG_NODE
, &ip_community_list_expanded_all_cmd
);
15288 install_element(CONFIG_NODE
, &no_ip_community_list_standard_all_cmd
);
15289 install_element(CONFIG_NODE
, &no_ip_community_list_standard_all_list_cmd
);
15290 install_element(CONFIG_NODE
, &no_ip_community_list_expanded_all_cmd
);
15291 install_element(CONFIG_NODE
, &no_ip_community_list_expanded_all_list_cmd
);
15292 install_element(VIEW_NODE
, &show_ip_community_list_cmd
);
15293 install_element(VIEW_NODE
, &show_ip_community_list_arg_cmd
);
15295 /* Extcommunity-list. */
15296 install_element(CONFIG_NODE
, &bgp_extcommunity_list_standard_cmd
);
15297 install_element(CONFIG_NODE
, &bgp_extcommunity_list_name_expanded_cmd
);
15298 install_element(CONFIG_NODE
, &no_bgp_extcommunity_list_standard_all_cmd
);
15299 install_element(CONFIG_NODE
, &no_bgp_extcommunity_list_expanded_all_cmd
);
15300 install_element(VIEW_NODE
, &show_bgp_extcommunity_list_cmd
);
15301 install_element(VIEW_NODE
, &show_bgp_extcommunity_list_arg_cmd
);
15302 install_element(CONFIG_NODE
, &ip_extcommunity_list_standard_cmd
);
15303 install_element(CONFIG_NODE
, &ip_extcommunity_list_name_expanded_cmd
);
15304 install_element(CONFIG_NODE
, &no_ip_extcommunity_list_standard_all_cmd
);
15305 install_element(CONFIG_NODE
, &no_ip_extcommunity_list_expanded_all_cmd
);
15306 install_element(VIEW_NODE
, &show_ip_extcommunity_list_cmd
);
15307 install_element(VIEW_NODE
, &show_ip_extcommunity_list_arg_cmd
);
15309 /* Large Community List */
15310 install_element(CONFIG_NODE
, &bgp_lcommunity_list_standard_cmd
);
15311 install_element(CONFIG_NODE
, &bgp_lcommunity_list_standard1_cmd
);
15312 install_element(CONFIG_NODE
, &bgp_lcommunity_list_expanded_cmd
);
15313 install_element(CONFIG_NODE
, &bgp_lcommunity_list_name_standard_cmd
);
15314 install_element(CONFIG_NODE
, &bgp_lcommunity_list_name_standard1_cmd
);
15315 install_element(CONFIG_NODE
, &bgp_lcommunity_list_name_expanded_cmd
);
15316 install_element(CONFIG_NODE
, &no_bgp_lcommunity_list_standard_all_cmd
);
15317 install_element(CONFIG_NODE
,
15318 &no_bgp_lcommunity_list_name_expanded_all_cmd
);
15319 install_element(CONFIG_NODE
, &no_bgp_lcommunity_list_standard_cmd
);
15320 install_element(CONFIG_NODE
, &no_bgp_lcommunity_list_expanded_cmd
);
15321 install_element(CONFIG_NODE
, &no_bgp_lcommunity_list_name_standard_cmd
);
15322 install_element(CONFIG_NODE
, &no_bgp_lcommunity_list_name_expanded_cmd
);
15323 install_element(VIEW_NODE
, &show_bgp_lcommunity_list_cmd
);
15324 install_element(VIEW_NODE
, &show_bgp_lcommunity_list_arg_cmd
);
15325 install_element(CONFIG_NODE
, &ip_lcommunity_list_standard_cmd
);
15326 install_element(CONFIG_NODE
, &ip_lcommunity_list_standard1_cmd
);
15327 install_element(CONFIG_NODE
, &ip_lcommunity_list_expanded_cmd
);
15328 install_element(CONFIG_NODE
, &ip_lcommunity_list_name_standard_cmd
);
15329 install_element(CONFIG_NODE
, &ip_lcommunity_list_name_standard1_cmd
);
15330 install_element(CONFIG_NODE
, &ip_lcommunity_list_name_expanded_cmd
);
15331 install_element(CONFIG_NODE
, &no_ip_lcommunity_list_standard_all_cmd
);
15332 install_element(CONFIG_NODE
,
15333 &no_ip_lcommunity_list_name_expanded_all_cmd
);
15334 install_element(CONFIG_NODE
, &no_ip_lcommunity_list_standard_cmd
);
15335 install_element(CONFIG_NODE
, &no_ip_lcommunity_list_expanded_cmd
);
15336 install_element(CONFIG_NODE
, &no_ip_lcommunity_list_name_standard_cmd
);
15337 install_element(CONFIG_NODE
, &no_ip_lcommunity_list_name_expanded_cmd
);
15338 install_element(VIEW_NODE
, &show_ip_lcommunity_list_cmd
);
15339 install_element(VIEW_NODE
, &show_ip_lcommunity_list_arg_cmd
);