2 * Copyright (C) 1996, 97, 98, 99, 2000 Kunihiro Ishiguro
4 * This file is part of GNU Zebra.
6 * GNU Zebra is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2, or (at your option) any
11 * GNU Zebra is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
16 * You should have received a copy of the GNU General Public License along
17 * with this program; see the file COPYING; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
33 #include "memory_vty.h"
38 #include "bgpd/bgpd.h"
39 #include "bgpd/bgp_advertise.h"
40 #include "bgpd/bgp_attr.h"
41 #include "bgpd/bgp_aspath.h"
42 #include "bgpd/bgp_community.h"
43 #include "bgpd/bgp_ecommunity.h"
44 #include "bgpd/bgp_lcommunity.h"
45 #include "bgpd/bgp_damp.h"
46 #include "bgpd/bgp_debug.h"
47 #include "bgpd/bgp_fsm.h"
48 #include "bgpd/bgp_nexthop.h"
49 #include "bgpd/bgp_open.h"
50 #include "bgpd/bgp_regex.h"
51 #include "bgpd/bgp_route.h"
52 #include "bgpd/bgp_mplsvpn.h"
53 #include "bgpd/bgp_zebra.h"
54 #include "bgpd/bgp_table.h"
55 #include "bgpd/bgp_vty.h"
56 #include "bgpd/bgp_mpath.h"
57 #include "bgpd/bgp_packet.h"
58 #include "bgpd/bgp_updgrp.h"
59 #include "bgpd/bgp_bfd.h"
61 static struct peer_group
*
62 listen_range_exists (struct bgp
*bgp
, struct prefix
*range
, int exact
);
65 bgp_node_type (afi_t afi
, safi_t safi
)
76 return BGP_IPV4M_NODE
;
78 case SAFI_LABELED_UNICAST
:
79 return BGP_IPV4L_NODE
;
82 return BGP_VPNV4_NODE
;
93 return BGP_IPV6M_NODE
;
95 case SAFI_LABELED_UNICAST
:
96 return BGP_IPV6L_NODE
;
99 return BGP_VPNV6_NODE
;
104 return BGP_EVPN_NODE
;
107 // We should never be here but to clarify the switch statement..
108 return BGP_IPV4_NODE
;
112 // Impossible to happen
113 return BGP_IPV4_NODE
;
116 /* Utility function to get address family from current node. */
118 bgp_node_afi (struct vty
*vty
)
139 /* Utility function to get subsequent address family from current
142 bgp_node_safi (struct vty
*vty
)
149 safi
= SAFI_MPLS_VPN
;
153 safi
= SAFI_MULTICAST
;
160 safi
= SAFI_LABELED_UNICAST
;
169 /* supports <ipv4|ipv6> */
171 bgp_vty_afi_from_arg(const char *afi_str
)
173 afi_t afi
= AFI_MAX
; /* unknown */
174 if (!strcmp(afi_str
, "ipv4")) {
177 else if (!strcmp(afi_str
, "ipv6")) {
180 else if (!strcmp(afi_str
, "l2vpn")) {
187 bgp_parse_afi(const char *str
, afi_t
*afi
)
189 *afi
= bgp_vty_afi_from_arg(str
);
197 argv_find_and_parse_afi(struct cmd_token
**argv
, int argc
, int *index
, afi_t
*afi
)
200 if (argv_find (argv
, argc
, "ipv4", index
))
206 else if (argv_find (argv
, argc
, "ipv6", index
))
215 /* supports <unicast|multicast|vpn|labeled-unicast> */
217 bgp_vty_safi_from_arg(const char *safi_str
)
219 safi_t safi
= SAFI_MAX
; /* unknown */
220 if (strncmp (safi_str
, "m", 1) == 0)
221 safi
= SAFI_MULTICAST
;
222 else if (strncmp (safi_str
, "u", 1) == 0)
224 else if (strncmp (safi_str
, "v", 1) == 0)
225 safi
= SAFI_MPLS_VPN
;
226 else if (strncmp (safi_str
, "l", 1) == 0)
227 safi
= SAFI_LABELED_UNICAST
;
232 argv_find_and_parse_safi (struct cmd_token
**argv
, int argc
, int *index
, safi_t
*safi
)
235 if (argv_find (argv
, argc
, "unicast", index
))
239 *safi
= SAFI_UNICAST
;
241 else if (argv_find (argv
, argc
, "multicast", index
))
245 *safi
= SAFI_MULTICAST
;
247 else if (argv_find (argv
, argc
, "labeled-unicast", index
))
251 *safi
= SAFI_LABELED_UNICAST
;
253 else if (argv_find (argv
, argc
, "vpn", index
))
257 *safi
= SAFI_MPLS_VPN
;
259 else if (argv_find (argv
, argc
, "evpn", index
))
269 * bgp_vty_find_and_parse_afi_safi_bgp
271 * For a given 'show ...' command, correctly parse the afi/safi/bgp out from it
272 * This function *assumes* that the calling function pre-sets the afi/safi/bgp
273 * to appropriate values for the calling function. This is to allow the
274 * calling function to make decisions appropriate for the show command
275 * that is being parsed.
277 * The show commands are generally of the form:
278 * "show [ip] bgp [<view|vrf> VIEWVRFNAME] [<ipv4|ipv6> [<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 function
291 * afi -> The parsed afi if it was included in the show command, returned here
292 * safi -> The parsed safi if it was included in the show command, returned here
293 * bgp -> Pointer to the bgp data structure we need to fill in.
295 * The function returns the correct location in the parse tree for the
298 * Returns 0 for failure to parse correctly, else the idx position of where
299 * it found the last token.
302 bgp_vty_find_and_parse_afi_safi_bgp (struct vty
*vty
, struct cmd_token
**argv
, int argc
, int *idx
,
303 afi_t
*afi
, safi_t
*safi
, struct bgp
**bgp
)
305 char *vrf_name
= NULL
;
311 if (argv_find (argv
, argc
, "ip", idx
))
314 if (argv_find (argv
, argc
, "view", idx
) || argv_find (argv
, argc
, "vrf", idx
))
316 vrf_name
= argv
[*idx
+ 1]->arg
;
318 if (strmatch (vrf_name
, "all"))
322 *bgp
= bgp_lookup_by_name (vrf_name
);
325 vty_out (vty
, "View/Vrf specified is unknown: %s%s", vrf_name
, VTY_NEWLINE
);
333 *bgp
= bgp_get_default ();
336 vty_out (vty
, "Unable to find default BGP instance%s", VTY_NEWLINE
);
342 if (argv_find_and_parse_afi (argv
, argc
, idx
, afi
))
343 argv_find_and_parse_safi (argv
, argc
, idx
, safi
);
350 peer_address_self_check (struct bgp
*bgp
, union sockunion
*su
)
352 struct interface
*ifp
= NULL
;
354 if (su
->sa
.sa_family
== AF_INET
)
355 ifp
= if_lookup_by_ipv4_exact (&su
->sin
.sin_addr
, bgp
->vrf_id
);
356 else if (su
->sa
.sa_family
== AF_INET6
)
357 ifp
= if_lookup_by_ipv6_exact (&su
->sin6
.sin6_addr
,
358 su
->sin6
.sin6_scope_id
, bgp
->vrf_id
);
366 /* Utility function for looking up peer from VTY. */
367 /* This is used only for configuration, so disallow if attempted on
368 * a dynamic neighbor.
371 peer_lookup_vty (struct vty
*vty
, const char *ip_str
)
373 struct bgp
*bgp
= VTY_GET_CONTEXT(bgp
);
382 ret
= str2sockunion (ip_str
, &su
);
385 peer
= peer_lookup_by_conf_if (bgp
, ip_str
);
388 if ((peer
= peer_lookup_by_hostname(bgp
, ip_str
)) == NULL
)
390 vty_out (vty
, "%% Malformed address or name: %s%s", ip_str
, VTY_NEWLINE
);
397 peer
= peer_lookup (bgp
, &su
);
400 vty_out (vty
, "%% Specify remote-as or peer-group commands first%s",
404 if (peer_dynamic_neighbor (peer
))
406 vty_out (vty
, "%% Operation not allowed on a dynamic neighbor%s",
415 /* Utility function for looking up peer or peer group. */
416 /* This is used only for configuration, so disallow if attempted on
417 * a dynamic neighbor.
420 peer_and_group_lookup_vty (struct vty
*vty
, const char *peer_str
)
422 struct bgp
*bgp
= VTY_GET_CONTEXT(bgp
);
425 struct peer
*peer
= NULL
;
426 struct peer_group
*group
= NULL
;
432 ret
= str2sockunion (peer_str
, &su
);
435 /* IP address, locate peer. */
436 peer
= peer_lookup (bgp
, &su
);
440 /* Not IP, could match either peer configured on interface or a group. */
441 peer
= peer_lookup_by_conf_if (bgp
, peer_str
);
443 group
= peer_group_lookup (bgp
, peer_str
);
448 if (peer_dynamic_neighbor (peer
))
450 vty_out (vty
, "%% Operation not allowed on a dynamic neighbor%s",
461 vty_out (vty
, "%% Specify remote-as or peer-group commands first%s",
468 bgp_vty_return (struct vty
*vty
, int ret
)
470 const char *str
= NULL
;
474 case BGP_ERR_INVALID_VALUE
:
475 str
= "Invalid value";
477 case BGP_ERR_INVALID_FLAG
:
478 str
= "Invalid flag";
480 case BGP_ERR_PEER_GROUP_SHUTDOWN
:
481 str
= "Peer-group has been shutdown. Activate the peer-group first";
483 case BGP_ERR_PEER_FLAG_CONFLICT
:
484 str
= "Can't set override-capability and strict-capability-match at the same time";
486 case BGP_ERR_PEER_GROUP_NO_REMOTE_AS
:
487 str
= "Specify remote-as or peer-group remote AS first";
489 case BGP_ERR_PEER_GROUP_CANT_CHANGE
:
490 str
= "Cannot change the peer-group. Deconfigure first";
492 case BGP_ERR_PEER_GROUP_MISMATCH
:
493 str
= "Peer is not a member of this peer-group";
495 case BGP_ERR_PEER_FILTER_CONFLICT
:
496 str
= "Prefix/distribute list can not co-exist";
498 case BGP_ERR_NOT_INTERNAL_PEER
:
499 str
= "Invalid command. Not an internal neighbor";
501 case BGP_ERR_REMOVE_PRIVATE_AS
:
502 str
= "remove-private-AS cannot be configured for IBGP peers";
504 case BGP_ERR_LOCAL_AS_ALLOWED_ONLY_FOR_EBGP
:
505 str
= "Local-AS allowed only for EBGP peers";
507 case BGP_ERR_CANNOT_HAVE_LOCAL_AS_SAME_AS
:
508 str
= "Cannot have local-as same as BGP AS number";
510 case BGP_ERR_TCPSIG_FAILED
:
511 str
= "Error while applying TCP-Sig to session(s)";
513 case BGP_ERR_NO_EBGP_MULTIHOP_WITH_TTLHACK
:
514 str
= "ebgp-multihop and ttl-security cannot be configured together";
516 case BGP_ERR_NO_IBGP_WITH_TTLHACK
:
517 str
= "ttl-security only allowed for EBGP peers";
519 case BGP_ERR_AS_OVERRIDE
:
520 str
= "as-override cannot be configured for IBGP peers";
522 case BGP_ERR_INVALID_DYNAMIC_NEIGHBORS_LIMIT
:
523 str
= "Invalid limit for number of dynamic neighbors";
525 case BGP_ERR_DYNAMIC_NEIGHBORS_RANGE_EXISTS
:
526 str
= "Dynamic neighbor listen range already exists";
528 case BGP_ERR_INVALID_FOR_DYNAMIC_PEER
:
529 str
= "Operation not allowed on a dynamic neighbor";
531 case BGP_ERR_INVALID_FOR_DIRECT_PEER
:
532 str
= "Operation not allowed on a directly connected neighbor";
537 vty_out (vty
, "%% %s%s", str
, VTY_NEWLINE
);
543 /* BGP clear sort. */
554 bgp_clear_vty_error (struct vty
*vty
, struct peer
*peer
, afi_t afi
,
555 safi_t safi
, int error
)
559 case BGP_ERR_AF_UNCONFIGURED
:
561 "%%BGP: Enable %s address family for the neighbor %s%s",
562 afi_safi_print(afi
, safi
), peer
->host
, VTY_NEWLINE
);
564 case BGP_ERR_SOFT_RECONFIG_UNCONFIGURED
:
565 vty_out (vty
, "%%BGP: Inbound soft reconfig for %s not possible as it%s has neither refresh capability, nor inbound soft reconfig%s", peer
->host
, VTY_NEWLINE
, VTY_NEWLINE
);
572 /* `clear ip bgp' functions. */
574 bgp_clear (struct vty
*vty
, struct bgp
*bgp
, afi_t afi
, safi_t safi
,
575 enum clear_sort sort
,enum bgp_clear_type stype
, const char *arg
)
579 struct listnode
*node
, *nnode
;
581 /* Clear all neighbors. */
583 * Pass along pointer to next node to peer_clear() when walking all nodes
584 * on the BGP instance as that may get freed if it is a doppelganger
586 if (sort
== clear_all
)
588 for (ALL_LIST_ELEMENTS (bgp
->peer
, node
, nnode
, peer
))
590 if (stype
== BGP_CLEAR_SOFT_NONE
)
591 ret
= peer_clear (peer
, &nnode
);
592 else if (peer
->afc
[afi
][safi
])
593 ret
= peer_clear_soft (peer
, afi
, safi
, stype
);
598 bgp_clear_vty_error (vty
, peer
, afi
, safi
, ret
);
601 /* This is to apply read-only mode on this clear. */
602 if (stype
== BGP_CLEAR_SOFT_NONE
)
603 bgp
->update_delay_over
= 0;
608 /* Clear specified neighbors. */
609 if (sort
== clear_peer
)
614 /* Make sockunion for lookup. */
615 ret
= str2sockunion (arg
, &su
);
618 peer
= peer_lookup_by_conf_if (bgp
, arg
);
621 peer
= peer_lookup_by_hostname(bgp
, arg
);
624 vty_out (vty
, "Malformed address or name: %s%s", arg
, VTY_NEWLINE
);
631 peer
= peer_lookup (bgp
, &su
);
634 vty_out (vty
, "%%BGP: Unknown neighbor - \"%s\"%s", arg
, VTY_NEWLINE
);
639 if (stype
== BGP_CLEAR_SOFT_NONE
)
640 ret
= peer_clear (peer
, NULL
);
642 ret
= peer_clear_soft (peer
, afi
, safi
, stype
);
645 bgp_clear_vty_error (vty
, peer
, afi
, safi
, ret
);
650 /* Clear all peer-group members. */
651 if (sort
== clear_group
)
653 struct peer_group
*group
;
655 group
= peer_group_lookup (bgp
, arg
);
658 vty_out (vty
, "%%BGP: No such peer-group %s%s", arg
, VTY_NEWLINE
);
662 for (ALL_LIST_ELEMENTS (group
->peer
, node
, nnode
, peer
))
664 if (stype
== BGP_CLEAR_SOFT_NONE
)
666 peer_clear (peer
, NULL
);
670 if (! peer
->afc
[afi
][safi
])
673 ret
= peer_clear_soft (peer
, afi
, safi
, stype
);
676 bgp_clear_vty_error (vty
, peer
, afi
, safi
, ret
);
681 if (sort
== clear_external
)
683 for (ALL_LIST_ELEMENTS (bgp
->peer
, node
, nnode
, peer
))
685 if (peer
->sort
== BGP_PEER_IBGP
)
688 if (stype
== BGP_CLEAR_SOFT_NONE
)
689 ret
= peer_clear (peer
, &nnode
);
691 ret
= peer_clear_soft (peer
, afi
, safi
, stype
);
694 bgp_clear_vty_error (vty
, peer
, afi
, safi
, ret
);
699 if (sort
== clear_as
)
704 VTY_GET_INTEGER_RANGE ("AS", as
, arg
, 1, BGP_AS4_MAX
);
706 for (ALL_LIST_ELEMENTS (bgp
->peer
, node
, nnode
, peer
))
712 if (stype
== BGP_CLEAR_SOFT_NONE
)
713 ret
= peer_clear (peer
, &nnode
);
715 ret
= peer_clear_soft (peer
, afi
, safi
, stype
);
718 bgp_clear_vty_error (vty
, peer
, afi
, safi
, ret
);
721 vty_out (vty
, "%%BGP: No peer is configured with AS %s%s", arg
,
730 bgp_clear_vty (struct vty
*vty
, const char *name
, afi_t afi
, safi_t safi
,
731 enum clear_sort sort
, enum bgp_clear_type stype
,
736 /* BGP structure lookup. */
739 bgp
= bgp_lookup_by_name (name
);
742 vty_out (vty
, "Can't find BGP instance %s%s", name
, VTY_NEWLINE
);
748 bgp
= bgp_get_default ();
751 vty_out (vty
, "No BGP process is configured%s", VTY_NEWLINE
);
756 return bgp_clear (vty
, bgp
, afi
, safi
, sort
, stype
, arg
);
759 /* clear soft inbound */
761 bgp_clear_star_soft_in (struct vty
*vty
, const char *name
)
763 bgp_clear_vty (vty
, name
, AFI_IP
, SAFI_UNICAST
, clear_all
,
764 BGP_CLEAR_SOFT_IN
, NULL
);
765 bgp_clear_vty (vty
, name
, AFI_IP6
, SAFI_UNICAST
, clear_all
,
766 BGP_CLEAR_SOFT_IN
, NULL
);
769 /* clear soft outbound */
771 bgp_clear_star_soft_out (struct vty
*vty
, const char *name
)
773 bgp_clear_vty (vty
, name
, AFI_IP
, SAFI_UNICAST
, clear_all
,
774 BGP_CLEAR_SOFT_OUT
, NULL
);
775 bgp_clear_vty (vty
, name
, AFI_IP6
, SAFI_UNICAST
, clear_all
,
776 BGP_CLEAR_SOFT_OUT
, NULL
);
780 #ifndef VTYSH_EXTRACT_PL
781 #include "bgp_vty_clippy.c"
784 /* BGP global configuration. */
786 DEFUN (bgp_multiple_instance_func
,
787 bgp_multiple_instance_cmd
,
788 "bgp multiple-instance",
790 "Enable bgp multiple instance\n")
792 bgp_option_set (BGP_OPT_MULTIPLE_INSTANCE
);
796 DEFUN (no_bgp_multiple_instance
,
797 no_bgp_multiple_instance_cmd
,
798 "no bgp multiple-instance",
801 "BGP multiple instance\n")
805 ret
= bgp_option_unset (BGP_OPT_MULTIPLE_INSTANCE
);
808 vty_out (vty
, "%% There are more than two BGP instances%s", VTY_NEWLINE
);
814 DEFUN (bgp_config_type
,
816 "bgp config-type <cisco|zebra>",
818 "Configuration type\n"
823 if (strncmp (argv
[idx_vendor
]->arg
, "c", 1) == 0)
824 bgp_option_set (BGP_OPT_CONFIG_CISCO
);
826 bgp_option_unset (BGP_OPT_CONFIG_CISCO
);
831 DEFUN (no_bgp_config_type
,
832 no_bgp_config_type_cmd
,
833 "no bgp config-type [<cisco|zebra>]",
836 "Display configuration type\n"
840 bgp_option_unset (BGP_OPT_CONFIG_CISCO
);
845 DEFUN (no_synchronization
,
846 no_synchronization_cmd
,
847 "no synchronization",
849 "Perform IGP synchronization\n")
854 DEFUN (no_auto_summary
,
858 "Enable automatic network number summarization\n")
863 /* "router bgp" commands. */
864 DEFUN_NOSH (router_bgp
,
866 "router bgp [(1-4294967295) [<view|vrf> VIEWVRFNAME]]",
870 BGP_INSTANCE_HELP_STR
)
873 int idx_view_vrf
= 3;
878 const char *name
= NULL
;
879 enum bgp_instance_type inst_type
;
881 // "router bgp" without an ASN
884 //Pending: Make VRF option available for ASN less config
885 bgp
= bgp_get_default();
889 vty_out (vty
, "%% No BGP process is configured%s", VTY_NEWLINE
);
893 if (listcount(bm
->bgp
) > 1)
895 vty_out (vty
, "%% Multiple BGP processes are configured%s", VTY_NEWLINE
);
903 VTY_GET_INTEGER_RANGE ("AS", as
, argv
[idx_asn
]->arg
, 1, BGP_AS4_MAX
);
905 inst_type
= BGP_INSTANCE_TYPE_DEFAULT
;
908 name
= argv
[idx_vrf
]->arg
;
910 if (!strcmp(argv
[idx_view_vrf
]->text
, "vrf"))
911 inst_type
= BGP_INSTANCE_TYPE_VRF
;
912 else if (!strcmp(argv
[idx_view_vrf
]->text
, "view"))
913 inst_type
= BGP_INSTANCE_TYPE_VIEW
;
916 ret
= bgp_get (&bgp
, &as
, name
, inst_type
);
919 case BGP_ERR_MULTIPLE_INSTANCE_NOT_SET
:
920 vty_out (vty
, "Please specify 'bgp multiple-instance' first%s",
923 case BGP_ERR_AS_MISMATCH
:
924 vty_out (vty
, "BGP is already running; AS is %u%s", as
, VTY_NEWLINE
);
926 case BGP_ERR_INSTANCE_MISMATCH
:
927 vty_out (vty
, "BGP instance name and AS number mismatch%s", VTY_NEWLINE
);
928 vty_out (vty
, "BGP instance is already running; AS is %u%s",
933 /* Pending: handle when user tries to change a view to vrf n vv. */
936 VTY_PUSH_CONTEXT(BGP_NODE
, bgp
);
941 /* "no router bgp" commands. */
942 DEFUN (no_router_bgp
,
944 "no router bgp [(1-4294967295) [<view|vrf> VIEWVRFNAME]]",
949 BGP_INSTANCE_HELP_STR
)
955 const char *name
= NULL
;
957 // "no router bgp" without an ASN
960 //Pending: Make VRF option available for ASN less config
961 bgp
= bgp_get_default();
965 vty_out (vty
, "%% No BGP process is configured%s", VTY_NEWLINE
);
969 if (listcount(bm
->bgp
) > 1)
971 vty_out (vty
, "%% Multiple BGP processes are configured%s", VTY_NEWLINE
);
977 VTY_GET_INTEGER_RANGE ("AS", as
, argv
[idx_asn
]->arg
, 1, BGP_AS4_MAX
);
980 name
= argv
[idx_vrf
]->arg
;
982 /* Lookup bgp structure. */
983 bgp
= bgp_lookup (as
, name
);
986 vty_out (vty
, "%% Can't find BGP instance%s", VTY_NEWLINE
);
1000 DEFPY (bgp_router_id
,
1002 "bgp router-id A.B.C.D",
1004 "Override configured router identifier\n"
1005 "Manually configured router identifier\n")
1007 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1008 bgp_router_id_static_set (bgp
, router_id
);
1012 DEFPY (no_bgp_router_id
,
1013 no_bgp_router_id_cmd
,
1014 "no bgp router-id [A.B.C.D]",
1017 "Override configured router identifier\n"
1018 "Manually configured router identifier\n")
1020 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1024 if (! IPV4_ADDR_SAME (&bgp
->router_id_static
, &router_id
))
1026 vty_out (vty
, "%% BGP router-id doesn't match%s", VTY_NEWLINE
);
1031 router_id
.s_addr
= 0;
1032 bgp_router_id_static_set (bgp
, router_id
);
1038 /* BGP Cluster ID. */
1039 DEFUN (bgp_cluster_id
,
1041 "bgp cluster-id <A.B.C.D|(1-4294967295)>",
1043 "Configure Route-Reflector Cluster-id\n"
1044 "Route-Reflector Cluster-id in IP address format\n"
1045 "Route-Reflector Cluster-id as 32 bit quantity\n")
1047 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1050 struct in_addr cluster
;
1052 ret
= inet_aton (argv
[idx_ipv4
]->arg
, &cluster
);
1055 vty_out (vty
, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE
);
1059 bgp_cluster_id_set (bgp
, &cluster
);
1060 bgp_clear_star_soft_out (vty
, bgp
->name
);
1065 DEFUN (no_bgp_cluster_id
,
1066 no_bgp_cluster_id_cmd
,
1067 "no bgp cluster-id [<A.B.C.D|(1-4294967295)>]",
1070 "Configure Route-Reflector Cluster-id\n"
1071 "Route-Reflector Cluster-id in IP address format\n"
1072 "Route-Reflector Cluster-id as 32 bit quantity\n")
1074 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1075 bgp_cluster_id_unset (bgp
);
1076 bgp_clear_star_soft_out (vty
, bgp
->name
);
1081 DEFUN (bgp_confederation_identifier
,
1082 bgp_confederation_identifier_cmd
,
1083 "bgp confederation identifier (1-4294967295)",
1084 "BGP specific commands\n"
1085 "AS confederation parameters\n"
1087 "Set routing domain confederation AS\n")
1089 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1093 VTY_GET_INTEGER_RANGE ("AS", as
, argv
[idx_number
]->arg
, 1, BGP_AS4_MAX
);
1095 bgp_confederation_id_set (bgp
, as
);
1100 DEFUN (no_bgp_confederation_identifier
,
1101 no_bgp_confederation_identifier_cmd
,
1102 "no bgp confederation identifier [(1-4294967295)]",
1104 "BGP specific commands\n"
1105 "AS confederation parameters\n"
1107 "Set routing domain confederation AS\n")
1109 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1110 bgp_confederation_id_unset (bgp
);
1115 DEFUN (bgp_confederation_peers
,
1116 bgp_confederation_peers_cmd
,
1117 "bgp confederation peers (1-4294967295)...",
1118 "BGP specific commands\n"
1119 "AS confederation parameters\n"
1120 "Peer ASs in BGP confederation\n"
1123 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1128 for (i
= idx_asn
; i
< argc
; i
++)
1130 VTY_GET_INTEGER_RANGE ("AS", as
, argv
[i
]->arg
, 1, BGP_AS4_MAX
);
1134 vty_out (vty
, "%% Local member-AS not allowed in confed peer list%s",
1139 bgp_confederation_peers_add (bgp
, as
);
1144 DEFUN (no_bgp_confederation_peers
,
1145 no_bgp_confederation_peers_cmd
,
1146 "no bgp confederation peers (1-4294967295)...",
1148 "BGP specific commands\n"
1149 "AS confederation parameters\n"
1150 "Peer ASs in BGP confederation\n"
1153 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1158 for (i
= idx_asn
; i
< argc
; i
++)
1160 VTY_GET_INTEGER_RANGE ("AS", as
, argv
[i
]->arg
, 1, BGP_AS4_MAX
);
1162 bgp_confederation_peers_remove (bgp
, as
);
1168 * Central routine for maximum-paths configuration.
1169 * @peer_type: BGP_PEER_EBGP or BGP_PEER_IBGP
1170 * @set: 1 for setting values, 0 for removing the max-paths config.
1173 bgp_maxpaths_config_vty (struct vty
*vty
, int peer_type
, const char *mpaths
,
1174 u_int16_t options
, int set
)
1176 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1177 u_int16_t maxpaths
= 0;
1182 afi
= bgp_node_afi (vty
);
1183 safi
= bgp_node_safi (vty
);
1187 maxpaths
= strtol(mpaths
, NULL
, 10);
1188 if (maxpaths
> multipath_num
)
1191 "%% Maxpaths Specified: %d is > than multipath num specified on bgp command line %d",
1192 maxpaths
, multipath_num
);
1195 ret
= bgp_maximum_paths_set (bgp
, afi
, safi
, peer_type
, maxpaths
, options
);
1198 ret
= bgp_maximum_paths_unset (bgp
, afi
, safi
, peer_type
);
1203 "%% Failed to %sset maximum-paths %s %u for afi %u, safi %u%s",
1204 (set
== 1) ? "" : "un",
1205 (peer_type
== BGP_PEER_EBGP
) ? "ebgp" : "ibgp",
1206 maxpaths
, afi
, safi
, VTY_NEWLINE
);
1210 bgp_recalculate_all_bestpaths (bgp
);
1215 DEFUN (bgp_maxmed_admin
,
1216 bgp_maxmed_admin_cmd
,
1217 "bgp max-med administrative ",
1219 "Advertise routes with max-med\n"
1220 "Administratively applied, for an indefinite period\n")
1222 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1224 bgp
->v_maxmed_admin
= 1;
1225 bgp
->maxmed_admin_value
= BGP_MAXMED_VALUE_DEFAULT
;
1227 bgp_maxmed_update(bgp
);
1232 DEFUN (bgp_maxmed_admin_medv
,
1233 bgp_maxmed_admin_medv_cmd
,
1234 "bgp max-med administrative (0-4294967295)",
1236 "Advertise routes with max-med\n"
1237 "Administratively applied, for an indefinite period\n"
1238 "Max MED value to be used\n")
1240 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1243 bgp
->v_maxmed_admin
= 1;
1244 bgp
->maxmed_admin_value
= strtoul (argv
[idx_number
]->arg
, NULL
, 10);
1246 bgp_maxmed_update(bgp
);
1251 DEFUN (no_bgp_maxmed_admin
,
1252 no_bgp_maxmed_admin_cmd
,
1253 "no bgp max-med administrative [(0-4294967295)]",
1256 "Advertise routes with max-med\n"
1257 "Administratively applied, for an indefinite period\n"
1258 "Max MED value to be used\n")
1260 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1261 bgp
->v_maxmed_admin
= BGP_MAXMED_ADMIN_UNCONFIGURED
;
1262 bgp
->maxmed_admin_value
= BGP_MAXMED_VALUE_DEFAULT
;
1263 bgp_maxmed_update(bgp
);
1268 DEFUN (bgp_maxmed_onstartup
,
1269 bgp_maxmed_onstartup_cmd
,
1270 "bgp max-med on-startup (5-86400) [(0-4294967295)]",
1272 "Advertise routes with max-med\n"
1273 "Effective on a startup\n"
1274 "Time (seconds) period for max-med\n"
1275 "Max MED value to be used\n")
1277 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1280 argv_find (argv
, argc
, "(5-86400)", &idx
);
1281 bgp
->v_maxmed_onstartup
= strtoul (argv
[idx
]->arg
, NULL
, 10);
1282 if (argv_find (argv
, argc
, "(0-4294967295)", &idx
))
1283 bgp
->maxmed_onstartup_value
= strtoul (argv
[idx
]->arg
, NULL
, 10);
1285 bgp
->maxmed_onstartup_value
= BGP_MAXMED_VALUE_DEFAULT
;
1287 bgp_maxmed_update(bgp
);
1292 DEFUN (no_bgp_maxmed_onstartup
,
1293 no_bgp_maxmed_onstartup_cmd
,
1294 "no bgp max-med on-startup [(5-86400) [(0-4294967295)]]",
1297 "Advertise routes with max-med\n"
1298 "Effective on a startup\n"
1299 "Time (seconds) period for max-med\n"
1300 "Max MED value to be used\n")
1302 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1304 /* Cancel max-med onstartup if its on */
1305 if (bgp
->t_maxmed_onstartup
)
1307 THREAD_TIMER_OFF (bgp
->t_maxmed_onstartup
);
1308 bgp
->maxmed_onstartup_over
= 1;
1311 bgp
->v_maxmed_onstartup
= BGP_MAXMED_ONSTARTUP_UNCONFIGURED
;
1312 bgp
->maxmed_onstartup_value
= BGP_MAXMED_VALUE_DEFAULT
;
1314 bgp_maxmed_update(bgp
);
1320 bgp_update_delay_config_vty (struct vty
*vty
, const char *delay
,
1323 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1324 u_int16_t update_delay
;
1325 u_int16_t establish_wait
;
1327 VTY_GET_INTEGER_RANGE ("update-delay", update_delay
, delay
,
1328 BGP_UPDATE_DELAY_MIN
, BGP_UPDATE_DELAY_MAX
);
1330 if (!wait
) /* update-delay <delay> */
1332 bgp
->v_update_delay
= update_delay
;
1333 bgp
->v_establish_wait
= bgp
->v_update_delay
;
1337 /* update-delay <delay> <establish-wait> */
1338 establish_wait
= atoi (wait
);
1339 if (update_delay
< establish_wait
)
1341 vty_out (vty
, "%%Failed: update-delay less than the establish-wait!%s",
1346 bgp
->v_update_delay
= update_delay
;
1347 bgp
->v_establish_wait
= establish_wait
;
1353 bgp_update_delay_deconfig_vty (struct vty
*vty
)
1355 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1357 bgp
->v_update_delay
= BGP_UPDATE_DELAY_DEF
;
1358 bgp
->v_establish_wait
= bgp
->v_update_delay
;
1364 bgp_config_write_update_delay (struct vty
*vty
, struct bgp
*bgp
)
1366 if (bgp
->v_update_delay
!= BGP_UPDATE_DELAY_DEF
)
1368 vty_out (vty
, " update-delay %d", bgp
->v_update_delay
);
1369 if (bgp
->v_update_delay
!= bgp
->v_establish_wait
)
1370 vty_out (vty
, " %d", bgp
->v_establish_wait
);
1371 vty_out (vty
, "%s", VTY_NEWLINE
);
1378 /* Update-delay configuration */
1379 DEFUN (bgp_update_delay
,
1380 bgp_update_delay_cmd
,
1381 "update-delay (0-3600)",
1382 "Force initial delay for best-path and updates\n"
1386 return bgp_update_delay_config_vty(vty
, argv
[idx_number
]->arg
, NULL
);
1389 DEFUN (bgp_update_delay_establish_wait
,
1390 bgp_update_delay_establish_wait_cmd
,
1391 "update-delay (0-3600) (1-3600)",
1392 "Force initial delay for best-path and updates\n"
1394 "Wait for peers to be established\n"
1398 int idx_number_2
= 2;
1399 return bgp_update_delay_config_vty(vty
, argv
[idx_number
]->arg
, argv
[idx_number_2
]->arg
);
1402 /* Update-delay deconfiguration */
1403 DEFUN (no_bgp_update_delay
,
1404 no_bgp_update_delay_cmd
,
1405 "no update-delay [(0-3600) [(1-3600)]]",
1407 "Force initial delay for best-path and updates\n"
1409 "Wait for peers to be established\n")
1411 return bgp_update_delay_deconfig_vty(vty
);
1416 bgp_wpkt_quanta_config_vty (struct vty
*vty
, const char *num
, char set
)
1418 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1421 VTY_GET_INTEGER_RANGE ("write-quanta", bgp
->wpkt_quanta
, num
,
1424 bgp
->wpkt_quanta
= BGP_WRITE_PACKET_MAX
;
1430 bgp_config_write_wpkt_quanta (struct vty
*vty
, struct bgp
*bgp
)
1432 if (bgp
->wpkt_quanta
!= BGP_WRITE_PACKET_MAX
)
1433 vty_out (vty
, " write-quanta %d%s",
1434 bgp
->wpkt_quanta
, VTY_NEWLINE
);
1440 /* Update-delay configuration */
1441 DEFUN (bgp_wpkt_quanta
,
1442 bgp_wpkt_quanta_cmd
,
1443 "write-quanta (1-10000)",
1444 "How many packets to write to peer socket per run\n"
1445 "Number of packets\n")
1448 return bgp_wpkt_quanta_config_vty(vty
, argv
[idx_number
]->arg
, 1);
1451 /* Update-delay deconfiguration */
1452 DEFUN (no_bgp_wpkt_quanta
,
1453 no_bgp_wpkt_quanta_cmd
,
1454 "no write-quanta (1-10000)",
1456 "How many packets to write to peer socket per run\n"
1457 "Number of packets\n")
1460 return bgp_wpkt_quanta_config_vty(vty
, argv
[idx_number
]->arg
, 0);
1464 bgp_config_write_coalesce_time (struct vty
*vty
, struct bgp
*bgp
)
1466 if (bgp
->coalesce_time
!= BGP_DEFAULT_SUBGROUP_COALESCE_TIME
)
1467 vty_out (vty
, " coalesce-time %u%s",
1468 bgp
->coalesce_time
, VTY_NEWLINE
);
1474 DEFUN (bgp_coalesce_time
,
1475 bgp_coalesce_time_cmd
,
1476 "coalesce-time (0-4294967295)",
1477 "Subgroup coalesce timer\n"
1478 "Subgroup coalesce timer value (in ms)\n")
1480 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1483 argv_find (argv
, argc
, "(0-4294967295)", &idx
);
1484 bgp
->coalesce_time
= strtoul (argv
[idx
]->arg
, NULL
, 10);
1488 DEFUN (no_bgp_coalesce_time
,
1489 no_bgp_coalesce_time_cmd
,
1490 "no coalesce-time (0-4294967295)",
1492 "Subgroup coalesce timer\n"
1493 "Subgroup coalesce timer value (in ms)\n")
1495 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1497 bgp
->coalesce_time
= BGP_DEFAULT_SUBGROUP_COALESCE_TIME
;
1501 /* Maximum-paths configuration */
1502 DEFUN (bgp_maxpaths
,
1504 "maximum-paths (1-255)",
1505 "Forward packets over multiple paths\n"
1506 "Number of paths\n")
1509 return bgp_maxpaths_config_vty(vty
, BGP_PEER_EBGP
, argv
[idx_number
]->arg
, 0, 1);
1512 ALIAS_HIDDEN (bgp_maxpaths
,
1513 bgp_maxpaths_hidden_cmd
,
1514 "maximum-paths (1-255)",
1515 "Forward packets over multiple paths\n"
1516 "Number of paths\n")
1518 DEFUN (bgp_maxpaths_ibgp
,
1519 bgp_maxpaths_ibgp_cmd
,
1520 "maximum-paths ibgp (1-255)",
1521 "Forward packets over multiple paths\n"
1523 "Number of paths\n")
1526 return bgp_maxpaths_config_vty(vty
, BGP_PEER_IBGP
, argv
[idx_number
]->arg
, 0, 1);
1529 ALIAS_HIDDEN (bgp_maxpaths_ibgp
,
1530 bgp_maxpaths_ibgp_hidden_cmd
,
1531 "maximum-paths ibgp (1-255)",
1532 "Forward packets over multiple paths\n"
1534 "Number of paths\n")
1536 DEFUN (bgp_maxpaths_ibgp_cluster
,
1537 bgp_maxpaths_ibgp_cluster_cmd
,
1538 "maximum-paths ibgp (1-255) equal-cluster-length",
1539 "Forward packets over multiple paths\n"
1542 "Match the cluster length\n")
1545 return bgp_maxpaths_config_vty(vty
, BGP_PEER_IBGP
, argv
[idx_number
]->arg
,
1546 BGP_FLAG_IBGP_MULTIPATH_SAME_CLUSTERLEN
, 1);
1549 ALIAS_HIDDEN (bgp_maxpaths_ibgp_cluster
,
1550 bgp_maxpaths_ibgp_cluster_hidden_cmd
,
1551 "maximum-paths ibgp (1-255) equal-cluster-length",
1552 "Forward packets over multiple paths\n"
1555 "Match the cluster length\n")
1557 DEFUN (no_bgp_maxpaths
,
1558 no_bgp_maxpaths_cmd
,
1559 "no maximum-paths [(1-255)]",
1561 "Forward packets over multiple paths\n"
1562 "Number of paths\n")
1564 return bgp_maxpaths_config_vty(vty
, BGP_PEER_EBGP
, NULL
, 0, 0);
1567 ALIAS_HIDDEN (no_bgp_maxpaths
,
1568 no_bgp_maxpaths_hidden_cmd
,
1569 "no maximum-paths [(1-255)]",
1571 "Forward packets over multiple paths\n"
1572 "Number of paths\n")
1574 DEFUN (no_bgp_maxpaths_ibgp
,
1575 no_bgp_maxpaths_ibgp_cmd
,
1576 "no maximum-paths ibgp [(1-255) [equal-cluster-length]]",
1578 "Forward packets over multiple paths\n"
1581 "Match the cluster length\n")
1583 return bgp_maxpaths_config_vty(vty
, BGP_PEER_IBGP
, NULL
, 0, 0);
1586 ALIAS_HIDDEN (no_bgp_maxpaths_ibgp
,
1587 no_bgp_maxpaths_ibgp_hidden_cmd
,
1588 "no maximum-paths ibgp [(1-255) [equal-cluster-length]]",
1590 "Forward packets over multiple paths\n"
1593 "Match the cluster length\n")
1596 bgp_config_write_maxpaths (struct vty
*vty
, struct bgp
*bgp
, afi_t afi
,
1597 safi_t safi
, int *write
)
1599 if (bgp
->maxpaths
[afi
][safi
].maxpaths_ebgp
!= MULTIPATH_NUM
)
1601 bgp_config_write_family_header (vty
, afi
, safi
, write
);
1602 vty_out (vty
, " maximum-paths %d%s",
1603 bgp
->maxpaths
[afi
][safi
].maxpaths_ebgp
, VTY_NEWLINE
);
1606 if (bgp
->maxpaths
[afi
][safi
].maxpaths_ibgp
!= MULTIPATH_NUM
)
1608 bgp_config_write_family_header (vty
, afi
, safi
, write
);
1609 vty_out (vty
, " maximum-paths ibgp %d",
1610 bgp
->maxpaths
[afi
][safi
].maxpaths_ibgp
);
1611 if (CHECK_FLAG (bgp
->maxpaths
[afi
][safi
].ibgp_flags
,
1612 BGP_FLAG_IBGP_MULTIPATH_SAME_CLUSTERLEN
))
1613 vty_out (vty
, " equal-cluster-length");
1614 vty_out (vty
, "%s", VTY_NEWLINE
);
1624 "timers bgp (0-65535) (0-65535)",
1625 "Adjust routing timers\n"
1627 "Keepalive interval\n"
1630 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1632 int idx_number_2
= 3;
1633 unsigned long keepalive
= 0;
1634 unsigned long holdtime
= 0;
1636 VTY_GET_INTEGER ("keepalive", keepalive
, argv
[idx_number
]->arg
);
1637 VTY_GET_INTEGER ("holdtime", holdtime
, argv
[idx_number_2
]->arg
);
1639 /* Holdtime value check. */
1640 if (holdtime
< 3 && holdtime
!= 0)
1642 vty_out (vty
, "%% hold time value must be either 0 or greater than 3%s",
1647 bgp_timers_set (bgp
, keepalive
, holdtime
);
1652 DEFUN (no_bgp_timers
,
1654 "no timers bgp [(0-65535) (0-65535)]",
1656 "Adjust routing timers\n"
1658 "Keepalive interval\n"
1661 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1662 bgp_timers_unset (bgp
);
1668 DEFUN (bgp_client_to_client_reflection
,
1669 bgp_client_to_client_reflection_cmd
,
1670 "bgp client-to-client reflection",
1671 "BGP specific commands\n"
1672 "Configure client to client route reflection\n"
1673 "reflection of routes allowed\n")
1675 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1676 bgp_flag_unset (bgp
, BGP_FLAG_NO_CLIENT_TO_CLIENT
);
1677 bgp_clear_star_soft_out (vty
, bgp
->name
);
1682 DEFUN (no_bgp_client_to_client_reflection
,
1683 no_bgp_client_to_client_reflection_cmd
,
1684 "no bgp client-to-client reflection",
1686 "BGP specific commands\n"
1687 "Configure client to client route reflection\n"
1688 "reflection of routes allowed\n")
1690 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1691 bgp_flag_set (bgp
, BGP_FLAG_NO_CLIENT_TO_CLIENT
);
1692 bgp_clear_star_soft_out (vty
, bgp
->name
);
1697 /* "bgp always-compare-med" configuration. */
1698 DEFUN (bgp_always_compare_med
,
1699 bgp_always_compare_med_cmd
,
1700 "bgp always-compare-med",
1701 "BGP specific commands\n"
1702 "Allow comparing MED from different neighbors\n")
1704 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1705 bgp_flag_set (bgp
, BGP_FLAG_ALWAYS_COMPARE_MED
);
1706 bgp_recalculate_all_bestpaths (bgp
);
1711 DEFUN (no_bgp_always_compare_med
,
1712 no_bgp_always_compare_med_cmd
,
1713 "no bgp always-compare-med",
1715 "BGP specific commands\n"
1716 "Allow comparing MED from different neighbors\n")
1718 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1719 bgp_flag_unset (bgp
, BGP_FLAG_ALWAYS_COMPARE_MED
);
1720 bgp_recalculate_all_bestpaths (bgp
);
1725 /* "bgp deterministic-med" configuration. */
1726 DEFUN (bgp_deterministic_med
,
1727 bgp_deterministic_med_cmd
,
1728 "bgp deterministic-med",
1729 "BGP specific commands\n"
1730 "Pick the best-MED path among paths advertised from the neighboring AS\n")
1732 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1734 if (!bgp_flag_check(bgp
, BGP_FLAG_DETERMINISTIC_MED
))
1736 bgp_flag_set (bgp
, BGP_FLAG_DETERMINISTIC_MED
);
1737 bgp_recalculate_all_bestpaths (bgp
);
1743 DEFUN (no_bgp_deterministic_med
,
1744 no_bgp_deterministic_med_cmd
,
1745 "no bgp deterministic-med",
1747 "BGP specific commands\n"
1748 "Pick the best-MED path among paths advertised from the neighboring AS\n")
1750 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1751 int bestpath_per_as_used
;
1755 struct listnode
*node
, *nnode
;
1757 if (bgp_flag_check(bgp
, BGP_FLAG_DETERMINISTIC_MED
))
1759 bestpath_per_as_used
= 0;
1761 for (ALL_LIST_ELEMENTS (bgp
->peer
, node
, nnode
, peer
))
1763 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
1764 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
1765 if (CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_ADDPATH_TX_BESTPATH_PER_AS
))
1767 bestpath_per_as_used
= 1;
1771 if (bestpath_per_as_used
)
1775 if (bestpath_per_as_used
)
1777 vty_out (vty
, "bgp deterministic-med cannot be disabled while addpath-tx-bestpath-per-AS is in use%s",
1783 bgp_flag_unset (bgp
, BGP_FLAG_DETERMINISTIC_MED
);
1784 bgp_recalculate_all_bestpaths (bgp
);
1791 /* "bgp graceful-restart" configuration. */
1792 DEFUN (bgp_graceful_restart
,
1793 bgp_graceful_restart_cmd
,
1794 "bgp graceful-restart",
1795 "BGP specific commands\n"
1796 "Graceful restart capability parameters\n")
1798 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1799 bgp_flag_set (bgp
, BGP_FLAG_GRACEFUL_RESTART
);
1803 DEFUN (no_bgp_graceful_restart
,
1804 no_bgp_graceful_restart_cmd
,
1805 "no bgp graceful-restart",
1807 "BGP specific commands\n"
1808 "Graceful restart capability parameters\n")
1810 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1811 bgp_flag_unset (bgp
, BGP_FLAG_GRACEFUL_RESTART
);
1815 DEFUN (bgp_graceful_restart_stalepath_time
,
1816 bgp_graceful_restart_stalepath_time_cmd
,
1817 "bgp graceful-restart stalepath-time (1-3600)",
1818 "BGP specific commands\n"
1819 "Graceful restart capability parameters\n"
1820 "Set the max time to hold onto restarting peer's stale paths\n"
1821 "Delay value (seconds)\n")
1823 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1825 u_int32_t stalepath
;
1827 VTY_GET_INTEGER_RANGE ("stalepath-time", stalepath
, argv
[idx_number
]->arg
, 1, 3600);
1828 bgp
->stalepath_time
= stalepath
;
1832 DEFUN (bgp_graceful_restart_restart_time
,
1833 bgp_graceful_restart_restart_time_cmd
,
1834 "bgp graceful-restart restart-time (1-3600)",
1835 "BGP specific commands\n"
1836 "Graceful restart capability parameters\n"
1837 "Set the time to wait to delete stale routes before a BGP open message is received\n"
1838 "Delay value (seconds)\n")
1840 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1844 VTY_GET_INTEGER_RANGE ("restart-time", restart
, argv
[idx_number
]->arg
, 1, 3600);
1845 bgp
->restart_time
= restart
;
1849 DEFUN (no_bgp_graceful_restart_stalepath_time
,
1850 no_bgp_graceful_restart_stalepath_time_cmd
,
1851 "no bgp graceful-restart stalepath-time [(1-3600)]",
1853 "BGP specific commands\n"
1854 "Graceful restart capability parameters\n"
1855 "Set the max time to hold onto restarting peer's stale paths\n"
1856 "Delay value (seconds)\n")
1858 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1860 bgp
->stalepath_time
= BGP_DEFAULT_STALEPATH_TIME
;
1864 DEFUN (no_bgp_graceful_restart_restart_time
,
1865 no_bgp_graceful_restart_restart_time_cmd
,
1866 "no bgp graceful-restart restart-time [(1-3600)]",
1868 "BGP specific commands\n"
1869 "Graceful restart capability parameters\n"
1870 "Set the time to wait to delete stale routes before a BGP open message is received\n"
1871 "Delay value (seconds)\n")
1873 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1875 bgp
->restart_time
= BGP_DEFAULT_RESTART_TIME
;
1879 DEFUN (bgp_graceful_restart_preserve_fw
,
1880 bgp_graceful_restart_preserve_fw_cmd
,
1881 "bgp graceful-restart preserve-fw-state",
1882 "BGP specific commands\n"
1883 "Graceful restart capability parameters\n"
1884 "Sets F-bit indication that fib is preserved while doing Graceful Restart\n")
1886 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1887 bgp_flag_set(bgp
, BGP_FLAG_GR_PRESERVE_FWD
);
1891 DEFUN (no_bgp_graceful_restart_preserve_fw
,
1892 no_bgp_graceful_restart_preserve_fw_cmd
,
1893 "no bgp graceful-restart preserve-fw-state",
1895 "BGP specific commands\n"
1896 "Graceful restart capability parameters\n"
1897 "Unsets F-bit indication that fib is preserved while doing Graceful Restart\n")
1899 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1900 bgp_flag_unset(bgp
, BGP_FLAG_GR_PRESERVE_FWD
);
1904 /* "bgp fast-external-failover" configuration. */
1905 DEFUN (bgp_fast_external_failover
,
1906 bgp_fast_external_failover_cmd
,
1907 "bgp fast-external-failover",
1909 "Immediately reset session if a link to a directly connected external peer goes down\n")
1911 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1912 bgp_flag_unset (bgp
, BGP_FLAG_NO_FAST_EXT_FAILOVER
);
1916 DEFUN (no_bgp_fast_external_failover
,
1917 no_bgp_fast_external_failover_cmd
,
1918 "no bgp fast-external-failover",
1921 "Immediately reset session if a link to a directly connected external peer goes down\n")
1923 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1924 bgp_flag_set (bgp
, BGP_FLAG_NO_FAST_EXT_FAILOVER
);
1928 /* "bgp enforce-first-as" configuration. */
1929 DEFUN (bgp_enforce_first_as
,
1930 bgp_enforce_first_as_cmd
,
1931 "bgp enforce-first-as",
1933 "Enforce the first AS for EBGP routes\n")
1935 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1936 bgp_flag_set (bgp
, BGP_FLAG_ENFORCE_FIRST_AS
);
1937 bgp_clear_star_soft_in (vty
, bgp
->name
);
1942 DEFUN (no_bgp_enforce_first_as
,
1943 no_bgp_enforce_first_as_cmd
,
1944 "no bgp enforce-first-as",
1947 "Enforce the first AS for EBGP routes\n")
1949 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1950 bgp_flag_unset (bgp
, BGP_FLAG_ENFORCE_FIRST_AS
);
1951 bgp_clear_star_soft_in (vty
, bgp
->name
);
1956 /* "bgp bestpath compare-routerid" configuration. */
1957 DEFUN (bgp_bestpath_compare_router_id
,
1958 bgp_bestpath_compare_router_id_cmd
,
1959 "bgp bestpath compare-routerid",
1960 "BGP specific commands\n"
1961 "Change the default bestpath selection\n"
1962 "Compare router-id for identical EBGP paths\n")
1964 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1965 bgp_flag_set (bgp
, BGP_FLAG_COMPARE_ROUTER_ID
);
1966 bgp_recalculate_all_bestpaths (bgp
);
1971 DEFUN (no_bgp_bestpath_compare_router_id
,
1972 no_bgp_bestpath_compare_router_id_cmd
,
1973 "no bgp bestpath compare-routerid",
1975 "BGP specific commands\n"
1976 "Change the default bestpath selection\n"
1977 "Compare router-id for identical EBGP paths\n")
1979 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1980 bgp_flag_unset (bgp
, BGP_FLAG_COMPARE_ROUTER_ID
);
1981 bgp_recalculate_all_bestpaths (bgp
);
1986 /* "bgp bestpath as-path ignore" configuration. */
1987 DEFUN (bgp_bestpath_aspath_ignore
,
1988 bgp_bestpath_aspath_ignore_cmd
,
1989 "bgp bestpath as-path ignore",
1990 "BGP specific commands\n"
1991 "Change the default bestpath selection\n"
1992 "AS-path attribute\n"
1993 "Ignore as-path length in selecting a route\n")
1995 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1996 bgp_flag_set (bgp
, BGP_FLAG_ASPATH_IGNORE
);
1997 bgp_recalculate_all_bestpaths (bgp
);
2002 DEFUN (no_bgp_bestpath_aspath_ignore
,
2003 no_bgp_bestpath_aspath_ignore_cmd
,
2004 "no bgp bestpath as-path ignore",
2006 "BGP specific commands\n"
2007 "Change the default bestpath selection\n"
2008 "AS-path attribute\n"
2009 "Ignore as-path length in selecting a route\n")
2011 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2012 bgp_flag_unset (bgp
, BGP_FLAG_ASPATH_IGNORE
);
2013 bgp_recalculate_all_bestpaths (bgp
);
2018 /* "bgp bestpath as-path confed" configuration. */
2019 DEFUN (bgp_bestpath_aspath_confed
,
2020 bgp_bestpath_aspath_confed_cmd
,
2021 "bgp bestpath as-path confed",
2022 "BGP specific commands\n"
2023 "Change the default bestpath selection\n"
2024 "AS-path attribute\n"
2025 "Compare path lengths including confederation sets & sequences in selecting a route\n")
2027 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2028 bgp_flag_set (bgp
, BGP_FLAG_ASPATH_CONFED
);
2029 bgp_recalculate_all_bestpaths (bgp
);
2034 DEFUN (no_bgp_bestpath_aspath_confed
,
2035 no_bgp_bestpath_aspath_confed_cmd
,
2036 "no bgp bestpath as-path confed",
2038 "BGP specific commands\n"
2039 "Change the default bestpath selection\n"
2040 "AS-path attribute\n"
2041 "Compare path lengths including confederation sets & sequences in selecting a route\n")
2043 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2044 bgp_flag_unset (bgp
, BGP_FLAG_ASPATH_CONFED
);
2045 bgp_recalculate_all_bestpaths (bgp
);
2050 /* "bgp bestpath as-path multipath-relax" configuration. */
2051 DEFUN (bgp_bestpath_aspath_multipath_relax
,
2052 bgp_bestpath_aspath_multipath_relax_cmd
,
2053 "bgp bestpath as-path multipath-relax [<as-set|no-as-set>]",
2054 "BGP specific commands\n"
2055 "Change the default bestpath selection\n"
2056 "AS-path attribute\n"
2057 "Allow load sharing across routes that have different AS paths (but same length)\n"
2058 "Generate an AS_SET\n"
2059 "Do not generate an AS_SET\n")
2061 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2063 bgp_flag_set (bgp
, BGP_FLAG_ASPATH_MULTIPATH_RELAX
);
2065 /* no-as-set is now the default behavior so we can silently
2067 if (argv_find (argv
, argc
, "as-set", &idx
))
2068 bgp_flag_set (bgp
, BGP_FLAG_MULTIPATH_RELAX_AS_SET
);
2070 bgp_flag_unset (bgp
, BGP_FLAG_MULTIPATH_RELAX_AS_SET
) ;
2072 bgp_recalculate_all_bestpaths (bgp
);
2077 DEFUN (no_bgp_bestpath_aspath_multipath_relax
,
2078 no_bgp_bestpath_aspath_multipath_relax_cmd
,
2079 "no bgp bestpath as-path multipath-relax [<as-set|no-as-set>]",
2081 "BGP specific commands\n"
2082 "Change the default bestpath selection\n"
2083 "AS-path attribute\n"
2084 "Allow load sharing across routes that have different AS paths (but same length)\n"
2085 "Generate an AS_SET\n"
2086 "Do not generate an AS_SET\n")
2088 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2089 bgp_flag_unset (bgp
, BGP_FLAG_ASPATH_MULTIPATH_RELAX
);
2090 bgp_flag_unset (bgp
, BGP_FLAG_MULTIPATH_RELAX_AS_SET
);
2091 bgp_recalculate_all_bestpaths (bgp
);
2096 /* "bgp log-neighbor-changes" configuration. */
2097 DEFUN (bgp_log_neighbor_changes
,
2098 bgp_log_neighbor_changes_cmd
,
2099 "bgp log-neighbor-changes",
2100 "BGP specific commands\n"
2101 "Log neighbor up/down and reset reason\n")
2103 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2104 bgp_flag_set (bgp
, BGP_FLAG_LOG_NEIGHBOR_CHANGES
);
2108 DEFUN (no_bgp_log_neighbor_changes
,
2109 no_bgp_log_neighbor_changes_cmd
,
2110 "no bgp log-neighbor-changes",
2112 "BGP specific commands\n"
2113 "Log neighbor up/down and reset reason\n")
2115 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2116 bgp_flag_unset (bgp
, BGP_FLAG_LOG_NEIGHBOR_CHANGES
);
2120 /* "bgp bestpath med" configuration. */
2121 DEFUN (bgp_bestpath_med
,
2122 bgp_bestpath_med_cmd
,
2123 "bgp bestpath med <confed [missing-as-worst]|missing-as-worst [confed]>",
2124 "BGP specific commands\n"
2125 "Change the default bestpath selection\n"
2127 "Compare MED among confederation paths\n"
2128 "Treat missing MED as the least preferred one\n"
2129 "Treat missing MED as the least preferred one\n"
2130 "Compare MED among confederation paths\n")
2132 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2135 if (argv_find (argv
, argc
, "confed", &idx
))
2136 bgp_flag_set (bgp
, BGP_FLAG_MED_CONFED
);
2138 if (argv_find (argv
, argc
, "missing-as-worst", &idx
))
2139 bgp_flag_set (bgp
, BGP_FLAG_MED_MISSING_AS_WORST
);
2141 bgp_recalculate_all_bestpaths (bgp
);
2146 DEFUN (no_bgp_bestpath_med
,
2147 no_bgp_bestpath_med_cmd
,
2148 "no bgp bestpath med <confed [missing-as-worst]|missing-as-worst [confed]>",
2150 "BGP specific commands\n"
2151 "Change the default bestpath selection\n"
2153 "Compare MED among confederation paths\n"
2154 "Treat missing MED as the least preferred one\n"
2155 "Treat missing MED as the least preferred one\n"
2156 "Compare MED among confederation paths\n")
2158 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2161 if (argv_find (argv
, argc
, "confed", &idx
))
2162 bgp_flag_unset (bgp
, BGP_FLAG_MED_CONFED
);
2164 if (argv_find (argv
, argc
, "missing-as-worst", &idx
))
2165 bgp_flag_unset (bgp
, BGP_FLAG_MED_MISSING_AS_WORST
);
2167 bgp_recalculate_all_bestpaths (bgp
);
2172 /* "no bgp default ipv4-unicast". */
2173 DEFUN (no_bgp_default_ipv4_unicast
,
2174 no_bgp_default_ipv4_unicast_cmd
,
2175 "no bgp default ipv4-unicast",
2177 "BGP specific commands\n"
2178 "Configure BGP defaults\n"
2179 "Activate ipv4-unicast for a peer by default\n")
2181 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2182 bgp_flag_set (bgp
, BGP_FLAG_NO_DEFAULT_IPV4
);
2186 DEFUN (bgp_default_ipv4_unicast
,
2187 bgp_default_ipv4_unicast_cmd
,
2188 "bgp default ipv4-unicast",
2189 "BGP specific commands\n"
2190 "Configure BGP defaults\n"
2191 "Activate ipv4-unicast for a peer by default\n")
2193 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2194 bgp_flag_unset (bgp
, BGP_FLAG_NO_DEFAULT_IPV4
);
2198 /* Display hostname in certain command outputs */
2199 DEFUN (bgp_default_show_hostname
,
2200 bgp_default_show_hostname_cmd
,
2201 "bgp default show-hostname",
2202 "BGP specific commands\n"
2203 "Configure BGP defaults\n"
2204 "Show hostname in certain command ouputs\n")
2206 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2207 bgp_flag_set (bgp
, BGP_FLAG_SHOW_HOSTNAME
);
2211 DEFUN (no_bgp_default_show_hostname
,
2212 no_bgp_default_show_hostname_cmd
,
2213 "no bgp default show-hostname",
2215 "BGP specific commands\n"
2216 "Configure BGP defaults\n"
2217 "Show hostname in certain command ouputs\n")
2219 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2220 bgp_flag_unset (bgp
, BGP_FLAG_SHOW_HOSTNAME
);
2224 /* "bgp network import-check" configuration. */
2225 DEFUN (bgp_network_import_check
,
2226 bgp_network_import_check_cmd
,
2227 "bgp network import-check",
2228 "BGP specific commands\n"
2229 "BGP network command\n"
2230 "Check BGP network route exists in IGP\n")
2232 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2233 if (!bgp_flag_check(bgp
, BGP_FLAG_IMPORT_CHECK
))
2235 bgp_flag_set (bgp
, BGP_FLAG_IMPORT_CHECK
);
2236 bgp_static_redo_import_check(bgp
);
2242 ALIAS_HIDDEN (bgp_network_import_check
,
2243 bgp_network_import_check_exact_cmd
,
2244 "bgp network import-check exact",
2245 "BGP specific commands\n"
2246 "BGP network command\n"
2247 "Check BGP network route exists in IGP\n"
2248 "Match route precisely\n")
2250 DEFUN (no_bgp_network_import_check
,
2251 no_bgp_network_import_check_cmd
,
2252 "no bgp network import-check",
2254 "BGP specific commands\n"
2255 "BGP network command\n"
2256 "Check BGP network route exists in IGP\n")
2258 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2259 if (bgp_flag_check(bgp
, BGP_FLAG_IMPORT_CHECK
))
2261 bgp_flag_unset (bgp
, BGP_FLAG_IMPORT_CHECK
);
2262 bgp_static_redo_import_check(bgp
);
2268 DEFUN (bgp_default_local_preference
,
2269 bgp_default_local_preference_cmd
,
2270 "bgp default local-preference (0-4294967295)",
2271 "BGP specific commands\n"
2272 "Configure BGP defaults\n"
2273 "local preference (higher=more preferred)\n"
2274 "Configure default local preference value\n")
2276 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2278 u_int32_t local_pref
;
2280 VTY_GET_INTEGER ("local preference", local_pref
, argv
[idx_number
]->arg
);
2282 bgp_default_local_preference_set (bgp
, local_pref
);
2283 bgp_clear_star_soft_in (vty
, bgp
->name
);
2288 DEFUN (no_bgp_default_local_preference
,
2289 no_bgp_default_local_preference_cmd
,
2290 "no bgp default local-preference [(0-4294967295)]",
2292 "BGP specific commands\n"
2293 "Configure BGP defaults\n"
2294 "local preference (higher=more preferred)\n"
2295 "Configure default local preference value\n")
2297 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2298 bgp_default_local_preference_unset (bgp
);
2299 bgp_clear_star_soft_in (vty
, bgp
->name
);
2305 DEFUN (bgp_default_subgroup_pkt_queue_max
,
2306 bgp_default_subgroup_pkt_queue_max_cmd
,
2307 "bgp default subgroup-pkt-queue-max (20-100)",
2308 "BGP specific commands\n"
2309 "Configure BGP defaults\n"
2310 "subgroup-pkt-queue-max\n"
2311 "Configure subgroup packet queue max\n")
2313 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2317 VTY_GET_INTEGER ("subgroup packet queue max", max_size
, argv
[idx_number
]->arg
);
2319 bgp_default_subgroup_pkt_queue_max_set (bgp
, max_size
);
2324 DEFUN (no_bgp_default_subgroup_pkt_queue_max
,
2325 no_bgp_default_subgroup_pkt_queue_max_cmd
,
2326 "no bgp default subgroup-pkt-queue-max [(20-100)]",
2328 "BGP specific commands\n"
2329 "Configure BGP defaults\n"
2330 "subgroup-pkt-queue-max\n"
2331 "Configure subgroup packet queue max\n")
2333 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2334 bgp_default_subgroup_pkt_queue_max_unset (bgp
);
2339 DEFUN (bgp_rr_allow_outbound_policy
,
2340 bgp_rr_allow_outbound_policy_cmd
,
2341 "bgp route-reflector allow-outbound-policy",
2342 "BGP specific commands\n"
2343 "Allow modifications made by out route-map\n"
2344 "on ibgp neighbors\n")
2346 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2348 if (!bgp_flag_check(bgp
, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY
))
2350 bgp_flag_set(bgp
, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY
);
2351 update_group_announce_rrclients(bgp
);
2352 bgp_clear_star_soft_out (vty
, bgp
->name
);
2358 DEFUN (no_bgp_rr_allow_outbound_policy
,
2359 no_bgp_rr_allow_outbound_policy_cmd
,
2360 "no bgp route-reflector allow-outbound-policy",
2362 "BGP specific commands\n"
2363 "Allow modifications made by out route-map\n"
2364 "on ibgp neighbors\n")
2366 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2368 if (bgp_flag_check(bgp
, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY
))
2370 bgp_flag_unset(bgp
, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY
);
2371 update_group_announce_rrclients(bgp
);
2372 bgp_clear_star_soft_out (vty
, bgp
->name
);
2378 DEFUN (bgp_listen_limit
,
2379 bgp_listen_limit_cmd
,
2380 "bgp listen limit (1-5000)",
2381 "BGP specific commands\n"
2382 "Configure BGP defaults\n"
2383 "maximum number of BGP Dynamic Neighbors that can be created\n"
2384 "Configure Dynamic Neighbors listen limit value\n")
2386 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2390 VTY_GET_INTEGER_RANGE ("listen limit", listen_limit
, argv
[idx_number
]->arg
,
2391 BGP_DYNAMIC_NEIGHBORS_LIMIT_MIN
,
2392 BGP_DYNAMIC_NEIGHBORS_LIMIT_MAX
);
2394 bgp_listen_limit_set (bgp
, listen_limit
);
2399 DEFUN (no_bgp_listen_limit
,
2400 no_bgp_listen_limit_cmd
,
2401 "no bgp listen limit [(1-5000)]",
2402 "BGP specific commands\n"
2403 "Configure BGP defaults\n"
2404 "unset maximum number of BGP Dynamic Neighbors that can be created\n"
2405 "Configure Dynamic Neighbors listen limit value to default\n"
2406 "Configure Dynamic Neighbors listen limit value\n")
2408 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2409 bgp_listen_limit_unset (bgp
);
2415 * Check if this listen range is already configured. Check for exact
2416 * match or overlap based on input.
2418 static struct peer_group
*
2419 listen_range_exists (struct bgp
*bgp
, struct prefix
*range
, int exact
)
2421 struct listnode
*node
, *nnode
;
2422 struct listnode
*node1
, *nnode1
;
2423 struct peer_group
*group
;
2428 afi
= family2afi(range
->family
);
2429 for (ALL_LIST_ELEMENTS (bgp
->group
, node
, nnode
, group
))
2431 for (ALL_LIST_ELEMENTS (group
->listen_range
[afi
], node1
,
2435 match
= prefix_same (range
, lr
);
2437 match
= (prefix_match (range
, lr
) || prefix_match (lr
, range
));
2446 DEFUN (bgp_listen_range
,
2447 bgp_listen_range_cmd
,
2448 "bgp listen range <A.B.C.D/M|X:X::X:X/M> peer-group WORD",
2449 "BGP specific commands\n"
2450 "Configure BGP dynamic neighbors listen range\n"
2451 "Configure BGP dynamic neighbors listen range\n"
2453 "Member of the peer-group\n"
2454 "Peer-group name\n")
2456 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2457 struct prefix range
;
2458 struct peer_group
*group
, *existing_group
;
2463 argv_find (argv
, argc
, "A.B.C.D/M", &idx
);
2464 argv_find (argv
, argc
, "X:X::X:X/M", &idx
);
2465 char *prefix
= argv
[idx
]->arg
;
2466 argv_find (argv
, argc
, "WORD", &idx
);
2467 char *peergroup
= argv
[idx
]->arg
;
2469 /* Convert IP prefix string to struct prefix. */
2470 ret
= str2prefix (prefix
, &range
);
2473 vty_out (vty
, "%% Malformed listen range%s", VTY_NEWLINE
);
2477 afi
= family2afi(range
.family
);
2479 if (afi
== AFI_IP6
&& IN6_IS_ADDR_LINKLOCAL (&range
.u
.prefix6
))
2481 vty_out (vty
, "%% Malformed listen range (link-local address)%s",
2486 apply_mask (&range
);
2488 /* Check if same listen range is already configured. */
2489 existing_group
= listen_range_exists (bgp
, &range
, 1);
2492 if (strcmp (existing_group
->name
, peergroup
) == 0)
2496 vty_out (vty
, "%% Same listen range is attached to peer-group %s%s",
2497 existing_group
->name
, VTY_NEWLINE
);
2502 /* Check if an overlapping listen range exists. */
2503 if (listen_range_exists (bgp
, &range
, 0))
2505 vty_out (vty
, "%% Listen range overlaps with existing listen range%s",
2510 group
= peer_group_lookup (bgp
, peergroup
);
2513 vty_out (vty
, "%% Configure the peer-group first%s", VTY_NEWLINE
);
2517 ret
= peer_group_listen_range_add(group
, &range
);
2518 return bgp_vty_return (vty
, ret
);
2521 DEFUN (no_bgp_listen_range
,
2522 no_bgp_listen_range_cmd
,
2523 "no bgp listen range <A.B.C.D/M|X:X::X:X/M> peer-group WORD",
2525 "BGP specific commands\n"
2526 "Unconfigure BGP dynamic neighbors listen range\n"
2527 "Unconfigure BGP dynamic neighbors listen range\n"
2529 "Member of the peer-group\n"
2530 "Peer-group name\n")
2532 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2533 struct prefix range
;
2534 struct peer_group
*group
;
2539 argv_find (argv
, argc
, "A.B.C.D/M", &idx
);
2540 argv_find (argv
, argc
, "X:X::X:X/M", &idx
);
2541 char *prefix
= argv
[idx
]->arg
;
2542 argv_find (argv
, argc
, "WORD", &idx
);
2543 char *peergroup
= argv
[idx
]->arg
;
2545 // VTY_GET_IPV4_PREFIX ("listen range", range, argv[idx_ipv4_prefixlen]->arg);
2547 /* Convert IP prefix string to struct prefix. */
2548 ret
= str2prefix (prefix
, &range
);
2551 vty_out (vty
, "%% Malformed listen range%s", VTY_NEWLINE
);
2555 afi
= family2afi(range
.family
);
2557 if (afi
== AFI_IP6
&& IN6_IS_ADDR_LINKLOCAL (&range
.u
.prefix6
))
2559 vty_out (vty
, "%% Malformed listen range (link-local address)%s",
2564 apply_mask (&range
);
2566 group
= peer_group_lookup (bgp
, peergroup
);
2569 vty_out (vty
, "%% Peer-group does not exist%s", VTY_NEWLINE
);
2573 ret
= peer_group_listen_range_del(group
, &range
);
2574 return bgp_vty_return (vty
, ret
);
2578 bgp_config_write_listen (struct vty
*vty
, struct bgp
*bgp
)
2580 struct peer_group
*group
;
2581 struct listnode
*node
, *nnode
, *rnode
, *nrnode
;
2582 struct prefix
*range
;
2584 char buf
[PREFIX2STR_BUFFER
];
2586 if (bgp
->dynamic_neighbors_limit
!= BGP_DYNAMIC_NEIGHBORS_LIMIT_DEFAULT
)
2587 vty_out (vty
, " bgp listen limit %d%s",
2588 bgp
->dynamic_neighbors_limit
, VTY_NEWLINE
);
2590 for (ALL_LIST_ELEMENTS (bgp
->group
, node
, nnode
, group
))
2592 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
2594 for (ALL_LIST_ELEMENTS (group
->listen_range
[afi
], rnode
, nrnode
, range
))
2596 prefix2str(range
, buf
, sizeof(buf
));
2597 vty_out(vty
, " bgp listen range %s peer-group %s%s",
2598 buf
, group
->name
, VTY_NEWLINE
);
2607 DEFUN (bgp_disable_connected_route_check
,
2608 bgp_disable_connected_route_check_cmd
,
2609 "bgp disable-ebgp-connected-route-check",
2610 "BGP specific commands\n"
2611 "Disable checking if nexthop is connected on ebgp sessions\n")
2613 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2614 bgp_flag_set (bgp
, BGP_FLAG_DISABLE_NH_CONNECTED_CHK
);
2615 bgp_clear_star_soft_in (vty
, bgp
->name
);
2620 DEFUN (no_bgp_disable_connected_route_check
,
2621 no_bgp_disable_connected_route_check_cmd
,
2622 "no bgp disable-ebgp-connected-route-check",
2624 "BGP specific commands\n"
2625 "Disable checking if nexthop is connected on ebgp sessions\n")
2627 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2628 bgp_flag_unset (bgp
, BGP_FLAG_DISABLE_NH_CONNECTED_CHK
);
2629 bgp_clear_star_soft_in (vty
, bgp
->name
);
2636 peer_remote_as_vty (struct vty
*vty
, const char *peer_str
,
2637 const char *as_str
, afi_t afi
, safi_t safi
)
2639 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2642 int as_type
= AS_SPECIFIED
;
2645 if (as_str
[0] == 'i')
2648 as_type
= AS_INTERNAL
;
2650 else if (as_str
[0] == 'e')
2653 as_type
= AS_EXTERNAL
;
2657 /* Get AS number. */
2658 VTY_GET_INTEGER_RANGE ("AS", as
, as_str
, 1, BGP_AS4_MAX
);
2661 /* If peer is peer group, call proper function. */
2662 ret
= str2sockunion (peer_str
, &su
);
2665 /* Check for peer by interface */
2666 ret
= peer_remote_as (bgp
, NULL
, peer_str
, &as
, as_type
, afi
, safi
);
2669 ret
= peer_group_remote_as (bgp
, peer_str
, &as
, as_type
);
2672 vty_out (vty
, "%% Create the peer-group or interface first%s",
2681 if (peer_address_self_check (bgp
, &su
))
2683 vty_out (vty
, "%% Can not configure the local system as neighbor%s",
2687 ret
= peer_remote_as (bgp
, &su
, NULL
, &as
, as_type
, afi
, safi
);
2690 /* This peer belongs to peer group. */
2693 case BGP_ERR_PEER_GROUP_MEMBER
:
2694 vty_out (vty
, "%% Peer-group AS %u. Cannot configure remote-as for member%s", as
, VTY_NEWLINE
);
2696 case BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT
:
2697 vty_out (vty
, "%% The AS# can not be changed from %u to %s, peer-group members must be all internal or all external%s", as
, as_str
, VTY_NEWLINE
);
2700 return bgp_vty_return (vty
, ret
);
2703 DEFUN (neighbor_remote_as
,
2704 neighbor_remote_as_cmd
,
2705 "neighbor <A.B.C.D|X:X::X:X|WORD> remote-as <(1-4294967295)|internal|external>",
2708 "Specify a BGP neighbor\n"
2710 "Internal BGP peer\n"
2711 "External BGP peer\n")
2714 int idx_remote_as
= 3;
2715 return peer_remote_as_vty (vty
, argv
[idx_peer
]->arg
, argv
[idx_remote_as
]->arg
, AFI_IP
, SAFI_UNICAST
);
2719 peer_conf_interface_get (struct vty
*vty
, const char *conf_if
, afi_t afi
,
2720 safi_t safi
, int v6only
, const char *peer_group_name
,
2723 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2725 int as_type
= AS_UNSPECIFIED
;
2727 struct peer_group
*group
;
2731 group
= peer_group_lookup (bgp
, conf_if
);
2735 vty_out (vty
, "%% Name conflict with peer-group %s", VTY_NEWLINE
);
2741 if (as_str
[0] == 'i')
2743 as_type
= AS_INTERNAL
;
2745 else if (as_str
[0] == 'e')
2747 as_type
= AS_EXTERNAL
;
2751 /* Get AS number. */
2752 VTY_GET_INTEGER_RANGE ("AS", as
, as_str
, 1, BGP_AS4_MAX
);
2753 as_type
= AS_SPECIFIED
;
2757 peer
= peer_lookup_by_conf_if (bgp
, conf_if
);
2761 ret
= peer_remote_as (bgp
, &su
, conf_if
, &as
, as_type
, afi
, safi
);
2765 if (bgp_flag_check (bgp
, BGP_FLAG_NO_DEFAULT_IPV4
)
2766 && afi
== AFI_IP
&& safi
== SAFI_UNICAST
)
2767 peer
= peer_create (NULL
, conf_if
, bgp
, bgp
->as
, as
, as_type
, 0, 0,
2770 peer
= peer_create (NULL
, conf_if
, bgp
, bgp
->as
, as
, as_type
, afi
, safi
,
2777 SET_FLAG(peer
->flags
, PEER_FLAG_IFPEER_V6ONLY
);
2779 /* Request zebra to initiate IPv6 RAs on this interface. We do this
2780 * any unnumbered peer in order to not worry about run-time transitions
2781 * (e.g., peering is initially IPv4, but the IPv4 /30 or /31 address
2782 * gets deleted later etc.)
2785 bgp_zebra_initiate_radv (bgp
, peer
);
2788 if ((v6only
&& !CHECK_FLAG(peer
->flags
, PEER_FLAG_IFPEER_V6ONLY
)) ||
2789 (!v6only
&& CHECK_FLAG(peer
->flags
, PEER_FLAG_IFPEER_V6ONLY
)))
2792 SET_FLAG(peer
->flags
, PEER_FLAG_IFPEER_V6ONLY
);
2794 UNSET_FLAG(peer
->flags
, PEER_FLAG_IFPEER_V6ONLY
);
2796 /* v6only flag changed. Reset bgp seesion */
2797 if (BGP_IS_VALID_STATE_FOR_NOTIF(peer
->status
))
2799 peer
->last_reset
= PEER_DOWN_V6ONLY_CHANGE
;
2800 bgp_notify_send (peer
, BGP_NOTIFY_CEASE
,
2801 BGP_NOTIFY_CEASE_CONFIG_CHANGE
);
2804 bgp_session_reset(peer
);
2807 if (!CHECK_FLAG (peer
->flags
, PEER_FLAG_CAPABILITY_ENHE
))
2808 peer_flag_set (peer
, PEER_FLAG_CAPABILITY_ENHE
);
2810 if (peer_group_name
)
2812 group
= peer_group_lookup (bgp
, peer_group_name
);
2815 vty_out (vty
, "%% Configure the peer-group first%s", VTY_NEWLINE
);
2819 ret
= peer_group_bind (bgp
, &su
, peer
, group
, &as
);
2822 return bgp_vty_return (vty
, ret
);
2825 DEFUN (neighbor_interface_config
,
2826 neighbor_interface_config_cmd
,
2827 "neighbor WORD interface [peer-group WORD]",
2829 "Interface name or neighbor tag\n"
2830 "Enable BGP on interface\n"
2831 "Member of the peer-group\n"
2832 "Peer-group name\n")
2835 int idx_peer_group_word
= 4;
2837 if (argc
> idx_peer_group_word
)
2838 return peer_conf_interface_get (vty
, argv
[idx_word
]->arg
, AFI_IP
, SAFI_UNICAST
, 0,
2839 argv
[idx_peer_group_word
]->arg
, NULL
);
2841 return peer_conf_interface_get (vty
, argv
[idx_word
]->arg
, AFI_IP
, SAFI_UNICAST
, 0,
2845 DEFUN (neighbor_interface_config_v6only
,
2846 neighbor_interface_config_v6only_cmd
,
2847 "neighbor WORD interface v6only [peer-group WORD]",
2849 "Interface name or neighbor tag\n"
2850 "Enable BGP on interface\n"
2851 "Enable BGP with v6 link-local only\n"
2852 "Member of the peer-group\n"
2853 "Peer-group name\n")
2856 int idx_peer_group_word
= 5;
2858 if (argc
> idx_peer_group_word
)
2859 return peer_conf_interface_get (vty
, argv
[idx_word
]->arg
, AFI_IP
, SAFI_UNICAST
, 1,
2860 argv
[idx_peer_group_word
]->arg
, NULL
);
2862 return peer_conf_interface_get (vty
, argv
[idx_word
]->arg
, AFI_IP
, SAFI_UNICAST
, 1,
2867 DEFUN (neighbor_interface_config_remote_as
,
2868 neighbor_interface_config_remote_as_cmd
,
2869 "neighbor WORD interface remote-as <(1-4294967295)|internal|external>",
2871 "Interface name or neighbor tag\n"
2872 "Enable BGP on interface\n"
2873 "Specify a BGP neighbor\n"
2875 "Internal BGP peer\n"
2876 "External BGP peer\n")
2879 int idx_remote_as
= 4;
2880 return peer_conf_interface_get (vty
, argv
[idx_word
]->arg
, AFI_IP
, SAFI_UNICAST
, 0,
2881 NULL
, argv
[idx_remote_as
]->arg
);
2884 DEFUN (neighbor_interface_v6only_config_remote_as
,
2885 neighbor_interface_v6only_config_remote_as_cmd
,
2886 "neighbor WORD interface v6only remote-as <(1-4294967295)|internal|external>",
2888 "Interface name or neighbor tag\n"
2889 "Enable BGP with v6 link-local only\n"
2890 "Enable BGP on interface\n"
2891 "Specify a BGP neighbor\n"
2893 "Internal BGP peer\n"
2894 "External BGP peer\n")
2897 int idx_remote_as
= 5;
2898 return peer_conf_interface_get (vty
, argv
[idx_word
]->arg
, AFI_IP
, SAFI_UNICAST
, 1,
2899 NULL
, argv
[idx_remote_as
]->arg
);
2902 DEFUN (neighbor_peer_group
,
2903 neighbor_peer_group_cmd
,
2904 "neighbor WORD peer-group",
2906 "Interface name or neighbor tag\n"
2907 "Configure peer-group\n")
2909 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2912 struct peer_group
*group
;
2914 peer
= peer_lookup_by_conf_if (bgp
, argv
[idx_word
]->arg
);
2917 vty_out (vty
, "%% Name conflict with interface: %s", VTY_NEWLINE
);
2921 group
= peer_group_get (bgp
, argv
[idx_word
]->arg
);
2930 "no neighbor <WORD|<A.B.C.D|X:X::X:X> [remote-as <(1-4294967295)|internal|external>]>",
2934 "Specify a BGP neighbor\n"
2936 "Internal BGP peer\n"
2937 "External BGP peer\n")
2939 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2943 struct peer_group
*group
;
2947 ret
= str2sockunion (argv
[idx_peer
]->arg
, &su
);
2950 /* look up for neighbor by interface name config. */
2951 peer
= peer_lookup_by_conf_if (bgp
, argv
[idx_peer
]->arg
);
2954 /* Request zebra to terminate IPv6 RAs on this interface. */
2956 bgp_zebra_terminate_radv (peer
->bgp
, peer
);
2961 group
= peer_group_lookup (bgp
, argv
[idx_peer
]->arg
);
2963 peer_group_delete (group
);
2966 vty_out (vty
, "%% Create the peer-group first%s", VTY_NEWLINE
);
2972 peer
= peer_lookup (bgp
, &su
);
2975 if (peer_dynamic_neighbor (peer
))
2977 vty_out (vty
, "%% Operation not allowed on a dynamic neighbor%s",
2982 other
= peer
->doppelganger
;
2984 if (other
&& other
->status
!= Deleted
)
2992 DEFUN (no_neighbor_interface_config
,
2993 no_neighbor_interface_config_cmd
,
2994 "no neighbor WORD interface [v6only] [peer-group WORD] [remote-as <(1-4294967295)|internal|external>]",
2998 "Configure BGP on interface\n"
2999 "Enable BGP with v6 link-local only\n"
3000 "Member of the peer-group\n"
3002 "Specify a BGP neighbor\n"
3004 "Internal BGP peer\n"
3005 "External BGP peer\n")
3007 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
3011 /* look up for neighbor by interface name config. */
3012 peer
= peer_lookup_by_conf_if (bgp
, argv
[idx_word
]->arg
);
3015 /* Request zebra to terminate IPv6 RAs on this interface. */
3017 bgp_zebra_terminate_radv (peer
->bgp
, peer
);
3022 vty_out (vty
, "%% Create the bgp interface first%s", VTY_NEWLINE
);
3028 DEFUN (no_neighbor_peer_group
,
3029 no_neighbor_peer_group_cmd
,
3030 "no neighbor WORD peer-group",
3034 "Configure peer-group\n")
3036 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
3038 struct peer_group
*group
;
3040 group
= peer_group_lookup (bgp
, argv
[idx_word
]->arg
);
3042 peer_group_delete (group
);
3045 vty_out (vty
, "%% Create the peer-group first%s", VTY_NEWLINE
);
3051 DEFUN (no_neighbor_interface_peer_group_remote_as
,
3052 no_neighbor_interface_peer_group_remote_as_cmd
,
3053 "no neighbor WORD remote-as <(1-4294967295)|internal|external>",
3056 "Interface name or neighbor tag\n"
3057 "Specify a BGP neighbor\n"
3059 "Internal BGP peer\n"
3060 "External BGP peer\n")
3062 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
3064 struct peer_group
*group
;
3067 /* look up for neighbor by interface name config. */
3068 peer
= peer_lookup_by_conf_if (bgp
, argv
[idx_word
]->arg
);
3071 peer_as_change (peer
, 0, AS_SPECIFIED
);
3075 group
= peer_group_lookup (bgp
, argv
[idx_word
]->arg
);
3077 peer_group_remote_as_delete (group
);
3080 vty_out (vty
, "%% Create the peer-group or interface first%s", VTY_NEWLINE
);
3086 DEFUN (neighbor_local_as
,
3087 neighbor_local_as_cmd
,
3088 "neighbor <A.B.C.D|X:X::X:X|WORD> local-as (1-4294967295)",
3091 "Specify a local-as number\n"
3092 "AS number used as local AS\n")
3100 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
3104 VTY_GET_INTEGER_RANGE ("Local AS", as
, argv
[idx_number
]->arg
, 1, BGP_AS4_MAX
);
3105 ret
= peer_local_as_set (peer
, as
, 0, 0);
3106 return bgp_vty_return (vty
, ret
);
3109 DEFUN (neighbor_local_as_no_prepend
,
3110 neighbor_local_as_no_prepend_cmd
,
3111 "neighbor <A.B.C.D|X:X::X:X|WORD> local-as (1-4294967295) no-prepend",
3114 "Specify a local-as number\n"
3115 "AS number used as local AS\n"
3116 "Do not prepend local-as to updates from ebgp peers\n")
3124 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
3128 VTY_GET_INTEGER_RANGE ("Local AS", as
, argv
[idx_number
]->arg
, 1, BGP_AS4_MAX
);
3129 ret
= peer_local_as_set (peer
, as
, 1, 0);
3130 return bgp_vty_return (vty
, ret
);
3133 DEFUN (neighbor_local_as_no_prepend_replace_as
,
3134 neighbor_local_as_no_prepend_replace_as_cmd
,
3135 "neighbor <A.B.C.D|X:X::X:X|WORD> local-as (1-4294967295) no-prepend replace-as",
3138 "Specify a local-as number\n"
3139 "AS number used as local AS\n"
3140 "Do not prepend local-as to updates from ebgp peers\n"
3141 "Do not prepend local-as to updates from ibgp peers\n")
3149 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
3153 VTY_GET_INTEGER_RANGE ("Local AS", as
, argv
[idx_number
]->arg
, 1, BGP_AS4_MAX
);
3154 ret
= peer_local_as_set (peer
, as
, 1, 1);
3155 return bgp_vty_return (vty
, ret
);
3158 DEFUN (no_neighbor_local_as
,
3159 no_neighbor_local_as_cmd
,
3160 "no neighbor <A.B.C.D|X:X::X:X|WORD> local-as [(1-4294967295) [no-prepend [replace-as]]]",
3164 "Specify a local-as number\n"
3165 "AS number used as local AS\n"
3166 "Do not prepend local-as to updates from ebgp peers\n"
3167 "Do not prepend local-as to updates from ibgp peers\n")
3173 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
3177 ret
= peer_local_as_unset (peer
);
3178 return bgp_vty_return (vty
, ret
);
3184 DEFUN (neighbor_solo
,
3186 "neighbor <A.B.C.D|X:X::X:X|WORD> solo",
3189 "Solo peer - part of its own update group\n")
3195 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
3199 ret
= update_group_adjust_soloness(peer
, 1);
3200 return bgp_vty_return (vty
, ret
);
3203 DEFUN (no_neighbor_solo
,
3204 no_neighbor_solo_cmd
,
3205 "no neighbor <A.B.C.D|X:X::X:X|WORD> solo",
3209 "Solo peer - part of its own update group\n")
3215 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
3219 ret
= update_group_adjust_soloness(peer
, 0);
3220 return bgp_vty_return (vty
, ret
);
3223 DEFUN (neighbor_password
,
3224 neighbor_password_cmd
,
3225 "neighbor <A.B.C.D|X:X::X:X|WORD> password LINE",
3236 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
3240 ret
= peer_password_set (peer
, argv
[idx_line
]->arg
);
3241 return bgp_vty_return (vty
, ret
);
3244 DEFUN (no_neighbor_password
,
3245 no_neighbor_password_cmd
,
3246 "no neighbor <A.B.C.D|X:X::X:X|WORD> password [LINE]",
3257 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
3261 ret
= peer_password_unset (peer
);
3262 return bgp_vty_return (vty
, ret
);
3266 DEFUN (neighbor_activate
,
3267 neighbor_activate_cmd
,
3268 "neighbor <A.B.C.D|X:X::X:X|WORD> activate",
3271 "Enable the Address Family for this Neighbor\n")
3277 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
3281 ret
= peer_activate (peer
, bgp_node_afi (vty
), bgp_node_safi (vty
));
3288 ALIAS_HIDDEN (neighbor_activate
,
3289 neighbor_activate_hidden_cmd
,
3290 "neighbor <A.B.C.D|X:X::X:X|WORD> activate",
3293 "Enable the Address Family for this Neighbor\n")
3295 DEFUN (no_neighbor_activate
,
3296 no_neighbor_activate_cmd
,
3297 "no neighbor <A.B.C.D|X:X::X:X|WORD> activate",
3301 "Enable the Address Family for this Neighbor\n")
3308 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
3312 ret
= peer_deactivate (peer
, bgp_node_afi (vty
), bgp_node_safi (vty
));
3319 ALIAS_HIDDEN (no_neighbor_activate
,
3320 no_neighbor_activate_hidden_cmd
,
3321 "no neighbor <A.B.C.D|X:X::X:X|WORD> activate",
3325 "Enable the Address Family for this Neighbor\n")
3327 DEFUN (neighbor_set_peer_group
,
3328 neighbor_set_peer_group_cmd
,
3329 "neighbor <A.B.C.D|X:X::X:X|WORD> peer-group WORD",
3332 "Member of the peer-group\n"
3333 "Peer-group name\n")
3335 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
3342 struct peer_group
*group
;
3346 ret
= str2sockunion (argv
[idx_peer
]->arg
, &su
);
3349 peer
= peer_lookup_by_conf_if (bgp
, argv
[idx_peer
]->arg
);
3352 vty_out (vty
, "%% Malformed address or name: %s%s", argv
[idx_peer
]->arg
, VTY_NEWLINE
);
3358 if (peer_address_self_check (bgp
, &su
))
3360 vty_out (vty
, "%% Can not configure the local system as neighbor%s",
3365 /* Disallow for dynamic neighbor. */
3366 peer
= peer_lookup (bgp
, &su
);
3367 if (peer
&& peer_dynamic_neighbor (peer
))
3369 vty_out (vty
, "%% Operation not allowed on a dynamic neighbor%s",
3375 group
= peer_group_lookup (bgp
, argv
[idx_word
]->arg
);
3378 vty_out (vty
, "%% Configure the peer-group first%s", VTY_NEWLINE
);
3382 ret
= peer_group_bind (bgp
, &su
, peer
, group
, &as
);
3384 if (ret
== BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT
)
3386 vty_out (vty
, "%% Peer with AS %u cannot be in this peer-group, members must be all internal or all external%s", as
, VTY_NEWLINE
);
3390 return bgp_vty_return (vty
, ret
);
3393 ALIAS_HIDDEN (neighbor_set_peer_group
,
3394 neighbor_set_peer_group_hidden_cmd
,
3395 "neighbor <A.B.C.D|X:X::X:X|WORD> peer-group WORD",
3398 "Member of the peer-group\n"
3399 "Peer-group name\n")
3401 DEFUN (no_neighbor_set_peer_group
,
3402 no_neighbor_set_peer_group_cmd
,
3403 "no neighbor <A.B.C.D|X:X::X:X|WORD> peer-group WORD",
3407 "Member of the peer-group\n"
3408 "Peer-group name\n")
3410 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
3415 struct peer_group
*group
;
3417 peer
= peer_lookup_vty (vty
, argv
[idx_peer
]->arg
);
3421 group
= peer_group_lookup (bgp
, argv
[idx_word
]->arg
);
3424 vty_out (vty
, "%% Configure the peer-group first%s", VTY_NEWLINE
);
3428 ret
= peer_group_unbind (bgp
, peer
, group
);
3430 return bgp_vty_return (vty
, ret
);
3433 ALIAS_HIDDEN (no_neighbor_set_peer_group
,
3434 no_neighbor_set_peer_group_hidden_cmd
,
3435 "no neighbor <A.B.C.D|X:X::X:X|WORD> peer-group WORD",
3439 "Member of the peer-group\n"
3440 "Peer-group name\n")
3443 peer_flag_modify_vty (struct vty
*vty
, const char *ip_str
,
3444 u_int16_t flag
, int set
)
3449 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
3454 * If 'neighbor <interface>', then this is for directly connected peers,
3455 * we should not accept disable-connected-check.
3457 if (peer
->conf_if
&& (flag
== PEER_FLAG_DISABLE_CONNECTED_CHECK
)) {
3458 vty_out (vty
, "%s is directly connected peer, cannot accept disable-"
3459 "connected-check%s", ip_str
, VTY_NEWLINE
);
3463 if (!set
&& flag
== PEER_FLAG_SHUTDOWN
)
3464 peer_tx_shutdown_message_unset (peer
);
3467 ret
= peer_flag_set (peer
, flag
);
3469 ret
= peer_flag_unset (peer
, flag
);
3471 return bgp_vty_return (vty
, ret
);
3475 peer_flag_set_vty (struct vty
*vty
, const char *ip_str
, u_int16_t flag
)
3477 return peer_flag_modify_vty (vty
, ip_str
, flag
, 1);
3481 peer_flag_unset_vty (struct vty
*vty
, const char *ip_str
, u_int16_t flag
)
3483 return peer_flag_modify_vty (vty
, ip_str
, flag
, 0);
3486 /* neighbor passive. */
3487 DEFUN (neighbor_passive
,
3488 neighbor_passive_cmd
,
3489 "neighbor <A.B.C.D|X:X::X:X|WORD> passive",
3492 "Don't send open messages to this neighbor\n")
3495 return peer_flag_set_vty (vty
, argv
[idx_peer
]->arg
, PEER_FLAG_PASSIVE
);
3498 DEFUN (no_neighbor_passive
,
3499 no_neighbor_passive_cmd
,
3500 "no neighbor <A.B.C.D|X:X::X:X|WORD> passive",
3504 "Don't send open messages to this neighbor\n")
3507 return peer_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, PEER_FLAG_PASSIVE
);
3510 /* neighbor shutdown. */
3511 DEFUN (neighbor_shutdown_msg
,
3512 neighbor_shutdown_msg_cmd
,
3513 "neighbor <A.B.C.D|X:X::X:X|WORD> shutdown message MSG...",
3516 "Administratively shut down this neighbor\n"
3517 "Add a shutdown message (draft-ietf-idr-shutdown-06)\n"
3518 "Shutdown message\n")
3524 struct peer
*peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
3529 message
= argv_concat (argv
, argc
, 4);
3530 peer_tx_shutdown_message_set (peer
, message
);
3531 XFREE (MTYPE_TMP
, message
);
3534 return peer_flag_set_vty (vty
, argv
[idx_peer
]->arg
, PEER_FLAG_SHUTDOWN
);
3537 ALIAS (neighbor_shutdown_msg
,
3538 neighbor_shutdown_cmd
,
3539 "neighbor <A.B.C.D|X:X::X:X|WORD> shutdown",
3542 "Administratively shut down this neighbor\n")
3544 DEFUN (no_neighbor_shutdown_msg
,
3545 no_neighbor_shutdown_msg_cmd
,
3546 "no neighbor <A.B.C.D|X:X::X:X|WORD> shutdown message MSG...",
3550 "Administratively shut down this neighbor\n"
3551 "Remove a shutdown message (draft-ietf-idr-shutdown-06)\n"
3552 "Shutdown message\n")
3556 return peer_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, PEER_FLAG_SHUTDOWN
);
3559 ALIAS (no_neighbor_shutdown_msg
,
3560 no_neighbor_shutdown_cmd
,
3561 "no neighbor <A.B.C.D|X:X::X:X|WORD> shutdown",
3565 "Administratively shut down this neighbor\n")
3567 /* neighbor capability dynamic. */
3568 DEFUN (neighbor_capability_dynamic
,
3569 neighbor_capability_dynamic_cmd
,
3570 "neighbor <A.B.C.D|X:X::X:X|WORD> capability dynamic",
3573 "Advertise capability to the peer\n"
3574 "Advertise dynamic capability to this neighbor\n")
3577 return peer_flag_set_vty (vty
, argv
[idx_peer
]->arg
, PEER_FLAG_DYNAMIC_CAPABILITY
);
3580 DEFUN (no_neighbor_capability_dynamic
,
3581 no_neighbor_capability_dynamic_cmd
,
3582 "no neighbor <A.B.C.D|X:X::X:X|WORD> capability dynamic",
3586 "Advertise capability to the peer\n"
3587 "Advertise dynamic capability to this neighbor\n")
3590 return peer_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, PEER_FLAG_DYNAMIC_CAPABILITY
);
3593 /* neighbor dont-capability-negotiate */
3594 DEFUN (neighbor_dont_capability_negotiate
,
3595 neighbor_dont_capability_negotiate_cmd
,
3596 "neighbor <A.B.C.D|X:X::X:X|WORD> dont-capability-negotiate",
3599 "Do not perform capability negotiation\n")
3602 return peer_flag_set_vty (vty
, argv
[idx_peer
]->arg
, PEER_FLAG_DONT_CAPABILITY
);
3605 DEFUN (no_neighbor_dont_capability_negotiate
,
3606 no_neighbor_dont_capability_negotiate_cmd
,
3607 "no neighbor <A.B.C.D|X:X::X:X|WORD> dont-capability-negotiate",
3611 "Do not perform capability negotiation\n")
3614 return peer_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, PEER_FLAG_DONT_CAPABILITY
);
3617 /* neighbor capability extended next hop encoding */
3618 DEFUN (neighbor_capability_enhe
,
3619 neighbor_capability_enhe_cmd
,
3620 "neighbor <A.B.C.D|X:X::X:X|WORD> capability extended-nexthop",
3623 "Advertise capability to the peer\n"
3624 "Advertise extended next-hop capability to the peer\n")
3627 return peer_flag_set_vty (vty
, argv
[idx_peer
]->arg
, PEER_FLAG_CAPABILITY_ENHE
);
3630 DEFUN (no_neighbor_capability_enhe
,
3631 no_neighbor_capability_enhe_cmd
,
3632 "no neighbor <A.B.C.D|X:X::X:X|WORD> capability extended-nexthop",
3636 "Advertise capability to the peer\n"
3637 "Advertise extended next-hop capability to the peer\n")
3640 return peer_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, PEER_FLAG_CAPABILITY_ENHE
);
3644 peer_af_flag_modify_vty (struct vty
*vty
, const char *peer_str
, afi_t afi
,
3645 safi_t safi
, u_int32_t flag
, int set
)
3650 peer
= peer_and_group_lookup_vty (vty
, peer_str
);
3655 ret
= peer_af_flag_set (peer
, afi
, safi
, flag
);
3657 ret
= peer_af_flag_unset (peer
, afi
, safi
, flag
);
3659 return bgp_vty_return (vty
, ret
);
3663 peer_af_flag_set_vty (struct vty
*vty
, const char *peer_str
, afi_t afi
,
3664 safi_t safi
, u_int32_t flag
)
3666 return peer_af_flag_modify_vty (vty
, peer_str
, afi
, safi
, flag
, 1);
3670 peer_af_flag_unset_vty (struct vty
*vty
, const char *peer_str
, afi_t afi
,
3671 safi_t safi
, u_int32_t flag
)
3673 return peer_af_flag_modify_vty (vty
, peer_str
, afi
, safi
, flag
, 0);
3676 /* neighbor capability orf prefix-list. */
3677 DEFUN (neighbor_capability_orf_prefix
,
3678 neighbor_capability_orf_prefix_cmd
,
3679 "neighbor <A.B.C.D|X:X::X:X|WORD> capability orf prefix-list <both|send|receive>",
3682 "Advertise capability to the peer\n"
3683 "Advertise ORF capability to the peer\n"
3684 "Advertise prefixlist ORF capability to this neighbor\n"
3685 "Capability to SEND and RECEIVE the ORF to/from this neighbor\n"
3686 "Capability to RECEIVE the ORF from this neighbor\n"
3687 "Capability to SEND the ORF to this neighbor\n")
3690 int idx_send_recv
= 5;
3693 if (strncmp (argv
[idx_send_recv
]->arg
, "s", 1) == 0)
3694 flag
= PEER_FLAG_ORF_PREFIX_SM
;
3695 else if (strncmp (argv
[idx_send_recv
]->arg
, "r", 1) == 0)
3696 flag
= PEER_FLAG_ORF_PREFIX_RM
;
3697 else if (strncmp (argv
[idx_send_recv
]->arg
, "b", 1) == 0)
3698 flag
= PEER_FLAG_ORF_PREFIX_SM
|PEER_FLAG_ORF_PREFIX_RM
;
3702 return peer_af_flag_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
3703 bgp_node_safi (vty
), flag
);
3706 ALIAS_HIDDEN (neighbor_capability_orf_prefix
,
3707 neighbor_capability_orf_prefix_hidden_cmd
,
3708 "neighbor <A.B.C.D|X:X::X:X|WORD> capability orf prefix-list <both|send|receive>",
3711 "Advertise capability to the peer\n"
3712 "Advertise ORF capability to the peer\n"
3713 "Advertise prefixlist ORF capability to this neighbor\n"
3714 "Capability to SEND and RECEIVE the ORF to/from this neighbor\n"
3715 "Capability to RECEIVE the ORF from this neighbor\n"
3716 "Capability to SEND the ORF to this neighbor\n")
3718 DEFUN (no_neighbor_capability_orf_prefix
,
3719 no_neighbor_capability_orf_prefix_cmd
,
3720 "no neighbor <A.B.C.D|X:X::X:X|WORD> capability orf prefix-list <both|send|receive>",
3724 "Advertise capability to the peer\n"
3725 "Advertise ORF capability to the peer\n"
3726 "Advertise prefixlist ORF capability to this neighbor\n"
3727 "Capability to SEND and RECEIVE the ORF to/from this neighbor\n"
3728 "Capability to RECEIVE the ORF from this neighbor\n"
3729 "Capability to SEND the ORF to this neighbor\n")
3732 int idx_send_recv
= 6;
3735 if (strncmp (argv
[idx_send_recv
]->arg
, "s", 1) == 0)
3736 flag
= PEER_FLAG_ORF_PREFIX_SM
;
3737 else if (strncmp (argv
[idx_send_recv
]->arg
, "r", 1) == 0)
3738 flag
= PEER_FLAG_ORF_PREFIX_RM
;
3739 else if (strncmp (argv
[idx_send_recv
]->arg
, "b", 1) == 0)
3740 flag
= PEER_FLAG_ORF_PREFIX_SM
|PEER_FLAG_ORF_PREFIX_RM
;
3744 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
3745 bgp_node_safi (vty
), flag
);
3748 ALIAS_HIDDEN (no_neighbor_capability_orf_prefix
,
3749 no_neighbor_capability_orf_prefix_hidden_cmd
,
3750 "no neighbor <A.B.C.D|X:X::X:X|WORD> capability orf prefix-list <both|send|receive>",
3754 "Advertise capability to the peer\n"
3755 "Advertise ORF capability to the peer\n"
3756 "Advertise prefixlist ORF capability to this neighbor\n"
3757 "Capability to SEND and RECEIVE the ORF to/from this neighbor\n"
3758 "Capability to RECEIVE the ORF from this neighbor\n"
3759 "Capability to SEND the ORF to this neighbor\n")
3761 /* neighbor next-hop-self. */
3762 DEFUN (neighbor_nexthop_self
,
3763 neighbor_nexthop_self_cmd
,
3764 "neighbor <A.B.C.D|X:X::X:X|WORD> next-hop-self",
3767 "Disable the next hop calculation for this neighbor\n")
3770 return peer_af_flag_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
3771 bgp_node_safi (vty
), PEER_FLAG_NEXTHOP_SELF
);
3774 ALIAS_HIDDEN (neighbor_nexthop_self
,
3775 neighbor_nexthop_self_hidden_cmd
,
3776 "neighbor <A.B.C.D|X:X::X:X|WORD> next-hop-self",
3779 "Disable the next hop calculation for this neighbor\n")
3781 /* neighbor next-hop-self. */
3782 DEFUN (neighbor_nexthop_self_force
,
3783 neighbor_nexthop_self_force_cmd
,
3784 "neighbor <A.B.C.D|X:X::X:X|WORD> next-hop-self force",
3787 "Disable the next hop calculation for this neighbor\n"
3788 "Set the next hop to self for reflected routes\n")
3791 return peer_af_flag_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
3792 bgp_node_safi (vty
),
3793 PEER_FLAG_FORCE_NEXTHOP_SELF
);
3796 ALIAS_HIDDEN (neighbor_nexthop_self_force
,
3797 neighbor_nexthop_self_force_hidden_cmd
,
3798 "neighbor <A.B.C.D|X:X::X:X|WORD> next-hop-self force",
3801 "Disable the next hop calculation for this neighbor\n"
3802 "Set the next hop to self for reflected routes\n")
3804 DEFUN (no_neighbor_nexthop_self
,
3805 no_neighbor_nexthop_self_cmd
,
3806 "no neighbor <A.B.C.D|X:X::X:X|WORD> next-hop-self",
3810 "Disable the next hop calculation for this neighbor\n")
3813 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
3814 bgp_node_safi (vty
),
3815 PEER_FLAG_NEXTHOP_SELF
);
3818 ALIAS_HIDDEN (no_neighbor_nexthop_self
,
3819 no_neighbor_nexthop_self_hidden_cmd
,
3820 "no neighbor <A.B.C.D|X:X::X:X|WORD> next-hop-self",
3824 "Disable the next hop calculation for this neighbor\n")
3826 DEFUN (no_neighbor_nexthop_self_force
,
3827 no_neighbor_nexthop_self_force_cmd
,
3828 "no neighbor <A.B.C.D|X:X::X:X|WORD> next-hop-self force",
3832 "Disable the next hop calculation for this neighbor\n"
3833 "Set the next hop to self for reflected routes\n")
3836 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
3837 bgp_node_safi (vty
),
3838 PEER_FLAG_FORCE_NEXTHOP_SELF
);
3841 ALIAS_HIDDEN (no_neighbor_nexthop_self_force
,
3842 no_neighbor_nexthop_self_force_hidden_cmd
,
3843 "no neighbor <A.B.C.D|X:X::X:X|WORD> next-hop-self force",
3847 "Disable the next hop calculation for this neighbor\n"
3848 "Set the next hop to self for reflected routes\n")
3850 /* neighbor as-override */
3851 DEFUN (neighbor_as_override
,
3852 neighbor_as_override_cmd
,
3853 "neighbor <A.B.C.D|X:X::X:X|WORD> as-override",
3856 "Override ASNs in outbound updates if aspath equals remote-as\n")
3859 return peer_af_flag_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
3860 bgp_node_safi (vty
),
3861 PEER_FLAG_AS_OVERRIDE
);
3864 ALIAS_HIDDEN (neighbor_as_override
,
3865 neighbor_as_override_hidden_cmd
,
3866 "neighbor <A.B.C.D|X:X::X:X|WORD> as-override",
3869 "Override ASNs in outbound updates if aspath equals remote-as\n")
3871 DEFUN (no_neighbor_as_override
,
3872 no_neighbor_as_override_cmd
,
3873 "no neighbor <A.B.C.D|X:X::X:X|WORD> as-override",
3877 "Override ASNs in outbound updates if aspath equals remote-as\n")
3880 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
3881 bgp_node_safi (vty
),
3882 PEER_FLAG_AS_OVERRIDE
);
3885 ALIAS_HIDDEN (no_neighbor_as_override
,
3886 no_neighbor_as_override_hidden_cmd
,
3887 "no neighbor <A.B.C.D|X:X::X:X|WORD> as-override",
3891 "Override ASNs in outbound updates if aspath equals remote-as\n")
3893 /* neighbor remove-private-AS. */
3894 DEFUN (neighbor_remove_private_as
,
3895 neighbor_remove_private_as_cmd
,
3896 "neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS",
3899 "Remove private ASNs in outbound updates\n")
3902 return peer_af_flag_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
3903 bgp_node_safi (vty
),
3904 PEER_FLAG_REMOVE_PRIVATE_AS
);
3907 ALIAS_HIDDEN (neighbor_remove_private_as
,
3908 neighbor_remove_private_as_hidden_cmd
,
3909 "neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS",
3912 "Remove private ASNs in outbound updates\n")
3914 DEFUN (neighbor_remove_private_as_all
,
3915 neighbor_remove_private_as_all_cmd
,
3916 "neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS all",
3919 "Remove private ASNs in outbound updates\n"
3920 "Apply to all AS numbers")
3923 return peer_af_flag_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
3924 bgp_node_safi (vty
),
3925 PEER_FLAG_REMOVE_PRIVATE_AS_ALL
);
3928 ALIAS_HIDDEN (neighbor_remove_private_as_all
,
3929 neighbor_remove_private_as_all_hidden_cmd
,
3930 "neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS all",
3933 "Remove private ASNs in outbound updates\n"
3934 "Apply to all AS numbers")
3936 DEFUN (neighbor_remove_private_as_replace_as
,
3937 neighbor_remove_private_as_replace_as_cmd
,
3938 "neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS replace-AS",
3941 "Remove private ASNs in outbound updates\n"
3942 "Replace private ASNs with our ASN in outbound updates\n")
3945 return peer_af_flag_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
3946 bgp_node_safi (vty
),
3947 PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE
);
3950 ALIAS_HIDDEN (neighbor_remove_private_as_replace_as
,
3951 neighbor_remove_private_as_replace_as_hidden_cmd
,
3952 "neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS replace-AS",
3955 "Remove private ASNs in outbound updates\n"
3956 "Replace private ASNs with our ASN in outbound updates\n")
3958 DEFUN (neighbor_remove_private_as_all_replace_as
,
3959 neighbor_remove_private_as_all_replace_as_cmd
,
3960 "neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS all replace-AS",
3963 "Remove private ASNs in outbound updates\n"
3964 "Apply to all AS numbers\n"
3965 "Replace private ASNs with our ASN in outbound updates\n")
3968 return peer_af_flag_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
3969 bgp_node_safi (vty
),
3970 PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE
);
3973 ALIAS_HIDDEN (neighbor_remove_private_as_all_replace_as
,
3974 neighbor_remove_private_as_all_replace_as_hidden_cmd
,
3975 "neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS all replace-AS",
3978 "Remove private ASNs in outbound updates\n"
3979 "Apply to all AS numbers\n"
3980 "Replace private ASNs with our ASN in outbound updates\n")
3982 DEFUN (no_neighbor_remove_private_as
,
3983 no_neighbor_remove_private_as_cmd
,
3984 "no neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS",
3988 "Remove private ASNs in outbound updates\n")
3991 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
3992 bgp_node_safi (vty
),
3993 PEER_FLAG_REMOVE_PRIVATE_AS
);
3996 ALIAS_HIDDEN (no_neighbor_remove_private_as
,
3997 no_neighbor_remove_private_as_hidden_cmd
,
3998 "no neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS",
4002 "Remove private ASNs in outbound updates\n")
4004 DEFUN (no_neighbor_remove_private_as_all
,
4005 no_neighbor_remove_private_as_all_cmd
,
4006 "no neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS all",
4010 "Remove private ASNs in outbound updates\n"
4011 "Apply to all AS numbers\n")
4014 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4015 bgp_node_safi (vty
),
4016 PEER_FLAG_REMOVE_PRIVATE_AS_ALL
);
4019 ALIAS_HIDDEN (no_neighbor_remove_private_as_all
,
4020 no_neighbor_remove_private_as_all_hidden_cmd
,
4021 "no neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS all",
4025 "Remove private ASNs in outbound updates\n"
4026 "Apply to all AS numbers\n")
4028 DEFUN (no_neighbor_remove_private_as_replace_as
,
4029 no_neighbor_remove_private_as_replace_as_cmd
,
4030 "no neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS replace-AS",
4034 "Remove private ASNs in outbound updates\n"
4035 "Replace private ASNs with our ASN in outbound updates\n")
4038 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4039 bgp_node_safi (vty
),
4040 PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE
);
4043 ALIAS_HIDDEN (no_neighbor_remove_private_as_replace_as
,
4044 no_neighbor_remove_private_as_replace_as_hidden_cmd
,
4045 "no neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS replace-AS",
4049 "Remove private ASNs in outbound updates\n"
4050 "Replace private ASNs with our ASN in outbound updates\n")
4052 DEFUN (no_neighbor_remove_private_as_all_replace_as
,
4053 no_neighbor_remove_private_as_all_replace_as_cmd
,
4054 "no neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS all replace-AS",
4058 "Remove private ASNs in outbound updates\n"
4059 "Apply to all AS numbers\n"
4060 "Replace private ASNs with our ASN in outbound updates\n")
4063 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4064 bgp_node_safi (vty
),
4065 PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE
);
4068 ALIAS_HIDDEN (no_neighbor_remove_private_as_all_replace_as
,
4069 no_neighbor_remove_private_as_all_replace_as_hidden_cmd
,
4070 "no neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS all replace-AS",
4074 "Remove private ASNs in outbound updates\n"
4075 "Apply to all AS numbers\n"
4076 "Replace private ASNs with our ASN in outbound updates\n")
4079 /* neighbor send-community. */
4080 DEFUN (neighbor_send_community
,
4081 neighbor_send_community_cmd
,
4082 "neighbor <A.B.C.D|X:X::X:X|WORD> send-community",
4085 "Send Community attribute to this neighbor\n")
4088 return peer_af_flag_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4089 bgp_node_safi (vty
),
4090 PEER_FLAG_SEND_COMMUNITY
);
4093 ALIAS_HIDDEN (neighbor_send_community
,
4094 neighbor_send_community_hidden_cmd
,
4095 "neighbor <A.B.C.D|X:X::X:X|WORD> send-community",
4098 "Send Community attribute to this neighbor\n")
4100 DEFUN (no_neighbor_send_community
,
4101 no_neighbor_send_community_cmd
,
4102 "no neighbor <A.B.C.D|X:X::X:X|WORD> send-community",
4106 "Send Community attribute to this neighbor\n")
4109 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4110 bgp_node_safi (vty
),
4111 PEER_FLAG_SEND_COMMUNITY
);
4114 ALIAS_HIDDEN (no_neighbor_send_community
,
4115 no_neighbor_send_community_hidden_cmd
,
4116 "no neighbor <A.B.C.D|X:X::X:X|WORD> send-community",
4120 "Send Community attribute to this neighbor\n")
4122 /* neighbor send-community extended. */
4123 DEFUN (neighbor_send_community_type
,
4124 neighbor_send_community_type_cmd
,
4125 "neighbor <A.B.C.D|X:X::X:X|WORD> send-community <both|all|extended|standard|large>",
4128 "Send Community attribute to this neighbor\n"
4129 "Send Standard and Extended Community attributes\n"
4130 "Send Standard, Large and Extended Community attributes\n"
4131 "Send Extended Community attributes\n"
4132 "Send Standard Community attributes\n"
4133 "Send Large Community attributes\n")
4138 char *peer
= argv
[1]->arg
;
4140 if (argv_find (argv
, argc
, "standard", &idx
))
4141 SET_FLAG (flag
, PEER_FLAG_SEND_COMMUNITY
);
4142 else if (argv_find (argv
, argc
, "extended", &idx
))
4143 SET_FLAG (flag
, PEER_FLAG_SEND_EXT_COMMUNITY
);
4144 else if (argv_find (argv
, argc
, "large", &idx
))
4145 SET_FLAG (flag
, PEER_FLAG_SEND_LARGE_COMMUNITY
);
4146 else if (argv_find (argv
, argc
, "both", &idx
))
4148 SET_FLAG (flag
, PEER_FLAG_SEND_COMMUNITY
);
4149 SET_FLAG (flag
, PEER_FLAG_SEND_EXT_COMMUNITY
);
4153 SET_FLAG (flag
, PEER_FLAG_SEND_COMMUNITY
);
4154 SET_FLAG (flag
, PEER_FLAG_SEND_EXT_COMMUNITY
);
4155 SET_FLAG (flag
, PEER_FLAG_SEND_LARGE_COMMUNITY
);
4158 return peer_af_flag_set_vty (vty
, peer
, bgp_node_afi (vty
), bgp_node_safi (vty
), flag
);
4161 ALIAS_HIDDEN (neighbor_send_community_type
,
4162 neighbor_send_community_type_hidden_cmd
,
4163 "neighbor <A.B.C.D|X:X::X:X|WORD> send-community <both|all|extended|standard|large>",
4166 "Send Community attribute to this neighbor\n"
4167 "Send Standard and Extended Community attributes\n"
4168 "Send Standard, Large and Extended Community attributes\n"
4169 "Send Extended Community attributes\n"
4170 "Send Standard Community attributes\n"
4171 "Send Large Community attributes\n")
4173 DEFUN (no_neighbor_send_community_type
,
4174 no_neighbor_send_community_type_cmd
,
4175 "no neighbor <A.B.C.D|X:X::X:X|WORD> send-community <both|all|extended|standard|large>",
4179 "Send Community attribute to this neighbor\n"
4180 "Send Standard and Extended Community attributes\n"
4181 "Send Standard, Large and Extended Community attributes\n"
4182 "Send Extended Community attributes\n"
4183 "Send Standard Community attributes\n"
4184 "Send Large Community attributes\n")
4188 if (strncmp (argv
[idx_type
]->arg
, "s", 1) == 0)
4189 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4190 bgp_node_safi (vty
),
4191 PEER_FLAG_SEND_COMMUNITY
);
4192 if (strncmp (argv
[idx_type
]->arg
, "e", 1) == 0)
4193 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4194 bgp_node_safi (vty
),
4195 PEER_FLAG_SEND_EXT_COMMUNITY
);
4196 if (strncmp (argv
[idx_type
]->arg
, "l", 1) == 0)
4197 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4198 bgp_node_safi (vty
),
4199 PEER_FLAG_SEND_LARGE_COMMUNITY
);
4200 if (strncmp (argv
[idx_type
]->arg
, "b", 1) == 0)
4201 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4202 bgp_node_safi (vty
),
4203 PEER_FLAG_SEND_COMMUNITY
|
4204 PEER_FLAG_SEND_EXT_COMMUNITY
);
4206 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4207 bgp_node_safi (vty
),
4208 (PEER_FLAG_SEND_COMMUNITY
|
4209 PEER_FLAG_SEND_EXT_COMMUNITY
|
4210 PEER_FLAG_SEND_LARGE_COMMUNITY
));
4213 ALIAS_HIDDEN (no_neighbor_send_community_type
,
4214 no_neighbor_send_community_type_hidden_cmd
,
4215 "no neighbor <A.B.C.D|X:X::X:X|WORD> send-community <both|all|extended|standard|large>",
4219 "Send Community attribute to this neighbor\n"
4220 "Send Standard and Extended Community attributes\n"
4221 "Send Standard, Large and Extended Community attributes\n"
4222 "Send Extended Community attributes\n"
4223 "Send Standard Community attributes\n"
4224 "Send Large Community attributes\n")
4226 /* neighbor soft-reconfig. */
4227 DEFUN (neighbor_soft_reconfiguration
,
4228 neighbor_soft_reconfiguration_cmd
,
4229 "neighbor <A.B.C.D|X:X::X:X|WORD> soft-reconfiguration inbound",
4232 "Per neighbor soft reconfiguration\n"
4233 "Allow inbound soft reconfiguration for this neighbor\n")
4236 return peer_af_flag_set_vty (vty
, argv
[idx_peer
]->arg
,
4237 bgp_node_afi (vty
), bgp_node_safi (vty
),
4238 PEER_FLAG_SOFT_RECONFIG
);
4241 ALIAS_HIDDEN (neighbor_soft_reconfiguration
,
4242 neighbor_soft_reconfiguration_hidden_cmd
,
4243 "neighbor <A.B.C.D|X:X::X:X|WORD> soft-reconfiguration inbound",
4246 "Per neighbor soft reconfiguration\n"
4247 "Allow inbound soft reconfiguration for this neighbor\n")
4249 DEFUN (no_neighbor_soft_reconfiguration
,
4250 no_neighbor_soft_reconfiguration_cmd
,
4251 "no neighbor <A.B.C.D|X:X::X:X|WORD> soft-reconfiguration inbound",
4255 "Per neighbor soft reconfiguration\n"
4256 "Allow inbound soft reconfiguration for this neighbor\n")
4259 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
,
4260 bgp_node_afi (vty
), bgp_node_safi (vty
),
4261 PEER_FLAG_SOFT_RECONFIG
);
4264 ALIAS_HIDDEN (no_neighbor_soft_reconfiguration
,
4265 no_neighbor_soft_reconfiguration_hidden_cmd
,
4266 "no neighbor <A.B.C.D|X:X::X:X|WORD> soft-reconfiguration inbound",
4270 "Per neighbor soft reconfiguration\n"
4271 "Allow inbound soft reconfiguration for this neighbor\n")
4273 DEFUN (neighbor_route_reflector_client
,
4274 neighbor_route_reflector_client_cmd
,
4275 "neighbor <A.B.C.D|X:X::X:X|WORD> route-reflector-client",
4278 "Configure a neighbor as Route Reflector client\n")
4284 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
4288 return peer_af_flag_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4289 bgp_node_safi (vty
),
4290 PEER_FLAG_REFLECTOR_CLIENT
);
4293 ALIAS_HIDDEN (neighbor_route_reflector_client
,
4294 neighbor_route_reflector_client_hidden_cmd
,
4295 "neighbor <A.B.C.D|X:X::X:X|WORD> route-reflector-client",
4298 "Configure a neighbor as Route Reflector client\n")
4300 DEFUN (no_neighbor_route_reflector_client
,
4301 no_neighbor_route_reflector_client_cmd
,
4302 "no neighbor <A.B.C.D|X:X::X:X|WORD> route-reflector-client",
4306 "Configure a neighbor as Route Reflector client\n")
4309 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4310 bgp_node_safi (vty
),
4311 PEER_FLAG_REFLECTOR_CLIENT
);
4314 ALIAS_HIDDEN (no_neighbor_route_reflector_client
,
4315 no_neighbor_route_reflector_client_hidden_cmd
,
4316 "no neighbor <A.B.C.D|X:X::X:X|WORD> route-reflector-client",
4320 "Configure a neighbor as Route Reflector client\n")
4322 /* neighbor route-server-client. */
4323 DEFUN (neighbor_route_server_client
,
4324 neighbor_route_server_client_cmd
,
4325 "neighbor <A.B.C.D|X:X::X:X|WORD> route-server-client",
4328 "Configure a neighbor as Route Server client\n")
4333 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
4336 return peer_af_flag_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4337 bgp_node_safi (vty
),
4338 PEER_FLAG_RSERVER_CLIENT
);
4341 ALIAS_HIDDEN (neighbor_route_server_client
,
4342 neighbor_route_server_client_hidden_cmd
,
4343 "neighbor <A.B.C.D|X:X::X:X|WORD> route-server-client",
4346 "Configure a neighbor as Route Server client\n")
4348 DEFUN (no_neighbor_route_server_client
,
4349 no_neighbor_route_server_client_cmd
,
4350 "no neighbor <A.B.C.D|X:X::X:X|WORD> route-server-client",
4354 "Configure a neighbor as Route Server client\n")
4357 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4358 bgp_node_safi (vty
),
4359 PEER_FLAG_RSERVER_CLIENT
);
4362 ALIAS_HIDDEN (no_neighbor_route_server_client
,
4363 no_neighbor_route_server_client_hidden_cmd
,
4364 "no neighbor <A.B.C.D|X:X::X:X|WORD> route-server-client",
4368 "Configure a neighbor as Route Server client\n")
4370 DEFUN (neighbor_nexthop_local_unchanged
,
4371 neighbor_nexthop_local_unchanged_cmd
,
4372 "neighbor <A.B.C.D|X:X::X:X|WORD> nexthop-local unchanged",
4375 "Configure treatment of outgoing link-local nexthop attribute\n"
4376 "Leave link-local nexthop unchanged for this peer\n")
4379 return peer_af_flag_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4380 bgp_node_safi (vty
),
4381 PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED
);
4384 DEFUN (no_neighbor_nexthop_local_unchanged
,
4385 no_neighbor_nexthop_local_unchanged_cmd
,
4386 "no neighbor <A.B.C.D|X:X::X:X|WORD> nexthop-local unchanged",
4390 "Configure treatment of outgoing link-local-nexthop attribute\n"
4391 "Leave link-local nexthop unchanged for this peer\n")
4394 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4395 bgp_node_safi (vty
),
4396 PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED
);
4399 DEFUN (neighbor_attr_unchanged
,
4400 neighbor_attr_unchanged_cmd
,
4401 "neighbor <A.B.C.D|X:X::X:X|WORD> attribute-unchanged\
4403 as-path [<next-hop [med]|med [next-hop]>]|\
4404 next-hop [<as-path [med]|med [as-path]>]|\
4405 med [<as-path [next-hop]|next-hop [as-path]>]\
4409 "BGP attribute is propagated unchanged to this neighbor\n"
4410 "As-path attribute\n"
4411 "Nexthop attribute\n"
4414 "Nexthop attribute\n"
4415 "Nexthop attribute\n"
4416 "As-path attribute\n"
4419 "As-path attribute\n"
4421 "As-path attribute\n"
4422 "Nexthop attribute\n"
4423 "Nexthop attribute\n"
4424 "As-path attribute\n")
4427 char *peer
= argv
[1]->arg
;
4428 u_int16_t flags
= 0;
4430 if (argv_find (argv
, argc
, "as-path", &idx
))
4431 SET_FLAG (flags
, PEER_FLAG_AS_PATH_UNCHANGED
);
4433 if (argv_find (argv
, argc
, "next-hop", &idx
))
4434 SET_FLAG (flags
, PEER_FLAG_NEXTHOP_UNCHANGED
);
4436 if (argv_find (argv
, argc
, "med", &idx
))
4437 SET_FLAG (flags
, PEER_FLAG_MED_UNCHANGED
);
4439 if (!flags
) // no flags means all of them!
4441 SET_FLAG (flags
, PEER_FLAG_AS_PATH_UNCHANGED
);
4442 SET_FLAG (flags
, PEER_FLAG_NEXTHOP_UNCHANGED
);
4443 SET_FLAG (flags
, PEER_FLAG_MED_UNCHANGED
);
4446 return peer_af_flag_set_vty (vty
, peer
, bgp_node_afi (vty
), bgp_node_safi (vty
), flags
);
4449 ALIAS_HIDDEN (neighbor_attr_unchanged
,
4450 neighbor_attr_unchanged_hidden_cmd
,
4451 "neighbor <A.B.C.D|X:X::X:X|WORD> attribute-unchanged\
4453 as-path [<next-hop [med]|med [next-hop]>]|\
4454 next-hop [<as-path [med]|med [as-path]>]|\
4455 med [<as-path [next-hop]|next-hop [as-path]>]\
4459 "BGP attribute is propagated unchanged to this neighbor\n"
4460 "As-path attribute\n"
4461 "Nexthop attribute\n"
4464 "Nexthop attribute\n"
4465 "Nexthop attribute\n"
4466 "As-path attribute\n"
4469 "As-path attribute\n"
4471 "As-path attribute\n"
4472 "Nexthop attribute\n"
4473 "Nexthop attribute\n"
4474 "As-path attribute\n")
4476 DEFUN (no_neighbor_attr_unchanged
,
4477 no_neighbor_attr_unchanged_cmd
,
4478 "no neighbor <A.B.C.D|X:X::X:X|WORD> attribute-unchanged\
4480 as-path [<next-hop [med]|med [next-hop]>]|\
4481 next-hop [<as-path [med]|med [as-path]>]|\
4482 med [<as-path [next-hop]|next-hop [as-path]>]\
4487 "BGP attribute is propagated unchanged to this neighbor\n"
4488 "As-path attribute\n"
4489 "Nexthop attribute\n"
4492 "Nexthop attribute\n"
4493 "Nexthop attribute\n"
4494 "As-path attribute\n"
4497 "As-path attribute\n"
4499 "As-path attribute\n"
4500 "Nexthop attribute\n"
4501 "Nexthop attribute\n"
4502 "As-path attribute\n")
4505 char *peer
= argv
[2]->arg
;
4506 u_int16_t flags
= 0;
4508 if (argv_find (argv
, argc
, "as-path", &idx
))
4509 SET_FLAG (flags
, PEER_FLAG_AS_PATH_UNCHANGED
);
4511 if (argv_find (argv
, argc
, "next-hop", &idx
))
4512 SET_FLAG (flags
, PEER_FLAG_NEXTHOP_UNCHANGED
);
4514 if (argv_find (argv
, argc
, "med", &idx
))
4515 SET_FLAG (flags
, PEER_FLAG_MED_UNCHANGED
);
4517 if (!flags
) // no flags means all of them!
4519 SET_FLAG (flags
, PEER_FLAG_AS_PATH_UNCHANGED
);
4520 SET_FLAG (flags
, PEER_FLAG_NEXTHOP_UNCHANGED
);
4521 SET_FLAG (flags
, PEER_FLAG_MED_UNCHANGED
);
4524 return peer_af_flag_unset_vty (vty
, peer
, bgp_node_afi (vty
), bgp_node_safi (vty
), flags
);
4527 ALIAS_HIDDEN (no_neighbor_attr_unchanged
,
4528 no_neighbor_attr_unchanged_hidden_cmd
,
4529 "no neighbor <A.B.C.D|X:X::X:X|WORD> attribute-unchanged\
4531 as-path [<next-hop [med]|med [next-hop]>]|\
4532 next-hop [<as-path [med]|med [as-path]>]|\
4533 med [<as-path [next-hop]|next-hop [as-path]>]\
4538 "BGP attribute is propagated unchanged to this neighbor\n"
4539 "As-path attribute\n"
4540 "Nexthop attribute\n"
4543 "Nexthop attribute\n"
4544 "Nexthop attribute\n"
4545 "As-path attribute\n"
4548 "As-path attribute\n"
4550 "As-path attribute\n"
4551 "Nexthop attribute\n"
4552 "Nexthop attribute\n"
4553 "As-path attribute\n")
4556 /* EBGP multihop configuration. */
4558 peer_ebgp_multihop_set_vty (struct vty
*vty
, const char *ip_str
,
4559 const char *ttl_str
)
4564 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
4569 return bgp_vty_return (vty
, BGP_ERR_INVALID_FOR_DIRECT_PEER
);
4574 VTY_GET_INTEGER_RANGE ("TTL", ttl
, ttl_str
, 1, MAXTTL
);
4576 return bgp_vty_return (vty
, peer_ebgp_multihop_set (peer
, ttl
));
4580 peer_ebgp_multihop_unset_vty (struct vty
*vty
, const char *ip_str
)
4584 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
4588 return bgp_vty_return (vty
, peer_ebgp_multihop_unset (peer
));
4591 /* neighbor ebgp-multihop. */
4592 DEFUN (neighbor_ebgp_multihop
,
4593 neighbor_ebgp_multihop_cmd
,
4594 "neighbor <A.B.C.D|X:X::X:X|WORD> ebgp-multihop",
4597 "Allow EBGP neighbors not on directly connected networks\n")
4600 return peer_ebgp_multihop_set_vty (vty
, argv
[idx_peer
]->arg
, NULL
);
4603 DEFUN (neighbor_ebgp_multihop_ttl
,
4604 neighbor_ebgp_multihop_ttl_cmd
,
4605 "neighbor <A.B.C.D|X:X::X:X|WORD> ebgp-multihop (1-255)",
4608 "Allow EBGP neighbors not on directly connected networks\n"
4609 "maximum hop count\n")
4613 return peer_ebgp_multihop_set_vty (vty
, argv
[idx_peer
]->arg
, argv
[idx_number
]->arg
);
4616 DEFUN (no_neighbor_ebgp_multihop
,
4617 no_neighbor_ebgp_multihop_cmd
,
4618 "no neighbor <A.B.C.D|X:X::X:X|WORD> ebgp-multihop [(1-255)]",
4622 "Allow EBGP neighbors not on directly connected networks\n"
4623 "maximum hop count\n")
4626 return peer_ebgp_multihop_unset_vty (vty
, argv
[idx_peer
]->arg
);
4630 /* disable-connected-check */
4631 DEFUN (neighbor_disable_connected_check
,
4632 neighbor_disable_connected_check_cmd
,
4633 "neighbor <A.B.C.D|X:X::X:X|WORD> <disable-connected-check|enforce-multihop>",
4636 "one-hop away EBGP peer using loopback address\n"
4637 "Enforce EBGP neighbors perform multihop\n")
4640 return peer_flag_set_vty (vty
, argv
[idx_peer
]->arg
, PEER_FLAG_DISABLE_CONNECTED_CHECK
);
4643 DEFUN (no_neighbor_disable_connected_check
,
4644 no_neighbor_disable_connected_check_cmd
,
4645 "no neighbor <A.B.C.D|X:X::X:X|WORD> <disable-connected-check|enforce-multihop>",
4649 "one-hop away EBGP peer using loopback address\n"
4650 "Enforce EBGP neighbors perform multihop\n")
4653 return peer_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, PEER_FLAG_DISABLE_CONNECTED_CHECK
);
4656 DEFUN (neighbor_description
,
4657 neighbor_description_cmd
,
4658 "neighbor <A.B.C.D|X:X::X:X|WORD> description LINE...",
4661 "Neighbor specific description\n"
4662 "Up to 80 characters describing this neighbor\n")
4669 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
4673 str
= argv_concat(argv
, argc
, idx_line
);
4675 peer_description_set (peer
, str
);
4677 XFREE (MTYPE_TMP
, str
);
4682 DEFUN (no_neighbor_description
,
4683 no_neighbor_description_cmd
,
4684 "no neighbor <A.B.C.D|X:X::X:X|WORD> description [LINE]",
4688 "Neighbor specific description\n"
4689 "Up to 80 characters describing this neighbor\n")
4694 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
4698 peer_description_unset (peer
);
4704 /* Neighbor update-source. */
4706 peer_update_source_vty (struct vty
*vty
, const char *peer_str
,
4707 const char *source_str
)
4712 peer
= peer_and_group_lookup_vty (vty
, peer_str
);
4722 int ret
= str2sockunion (source_str
, &su
);
4725 peer_update_source_addr_set (peer
, &su
);
4728 if (str2prefix (source_str
, &p
))
4730 vty_out (vty
, "%% Invalid update-source, remove prefix length %s",
4735 peer_update_source_if_set (peer
, source_str
);
4739 peer_update_source_unset (peer
);
4744 #define BGP_UPDATE_SOURCE_HELP_STR \
4747 "Interface name (requires zebra to be running)\n"
4749 DEFUN (neighbor_update_source
,
4750 neighbor_update_source_cmd
,
4751 "neighbor <A.B.C.D|X:X::X:X|WORD> update-source <A.B.C.D|X:X::X:X|WORD>",
4754 "Source of routing updates\n"
4755 BGP_UPDATE_SOURCE_HELP_STR
)
4759 return peer_update_source_vty (vty
, argv
[idx_peer
]->arg
, argv
[idx_peer_2
]->arg
);
4762 DEFUN (no_neighbor_update_source
,
4763 no_neighbor_update_source_cmd
,
4764 "no neighbor <A.B.C.D|X:X::X:X|WORD> update-source [<A.B.C.D|X:X::X:X|WORD>]",
4768 "Source of routing updates\n"
4769 BGP_UPDATE_SOURCE_HELP_STR
)
4772 return peer_update_source_vty (vty
, argv
[idx_peer
]->arg
, NULL
);
4776 peer_default_originate_set_vty (struct vty
*vty
, const char *peer_str
,
4777 afi_t afi
, safi_t safi
,
4778 const char *rmap
, int set
)
4783 peer
= peer_and_group_lookup_vty (vty
, peer_str
);
4788 ret
= peer_default_originate_set (peer
, afi
, safi
, rmap
);
4790 ret
= peer_default_originate_unset (peer
, afi
, safi
);
4792 return bgp_vty_return (vty
, ret
);
4795 /* neighbor default-originate. */
4796 DEFUN (neighbor_default_originate
,
4797 neighbor_default_originate_cmd
,
4798 "neighbor <A.B.C.D|X:X::X:X|WORD> default-originate",
4801 "Originate default route to this neighbor\n")
4804 return peer_default_originate_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4805 bgp_node_safi (vty
), NULL
, 1);
4808 ALIAS_HIDDEN (neighbor_default_originate
,
4809 neighbor_default_originate_hidden_cmd
,
4810 "neighbor <A.B.C.D|X:X::X:X|WORD> default-originate",
4813 "Originate default route to this neighbor\n")
4815 DEFUN (neighbor_default_originate_rmap
,
4816 neighbor_default_originate_rmap_cmd
,
4817 "neighbor <A.B.C.D|X:X::X:X|WORD> default-originate route-map WORD",
4820 "Originate default route to this neighbor\n"
4821 "Route-map to specify criteria to originate default\n"
4826 return peer_default_originate_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4827 bgp_node_safi (vty
), argv
[idx_word
]->arg
, 1);
4830 ALIAS_HIDDEN (neighbor_default_originate_rmap
,
4831 neighbor_default_originate_rmap_hidden_cmd
,
4832 "neighbor <A.B.C.D|X:X::X:X|WORD> default-originate route-map WORD",
4835 "Originate default route to this neighbor\n"
4836 "Route-map to specify criteria to originate default\n"
4839 DEFUN (no_neighbor_default_originate
,
4840 no_neighbor_default_originate_cmd
,
4841 "no neighbor <A.B.C.D|X:X::X:X|WORD> default-originate [route-map WORD]",
4845 "Originate default route to this neighbor\n"
4846 "Route-map to specify criteria to originate default\n"
4850 return peer_default_originate_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4851 bgp_node_safi (vty
), NULL
, 0);
4854 ALIAS_HIDDEN (no_neighbor_default_originate
,
4855 no_neighbor_default_originate_hidden_cmd
,
4856 "no neighbor <A.B.C.D|X:X::X:X|WORD> default-originate [route-map WORD]",
4860 "Originate default route to this neighbor\n"
4861 "Route-map to specify criteria to originate default\n"
4865 /* Set neighbor's BGP port. */
4867 peer_port_vty (struct vty
*vty
, const char *ip_str
, int afi
,
4868 const char *port_str
)
4874 peer
= peer_lookup_vty (vty
, ip_str
);
4880 sp
= getservbyname ("bgp", "tcp");
4881 port
= (sp
== NULL
) ? BGP_PORT_DEFAULT
: ntohs (sp
->s_port
);
4885 VTY_GET_INTEGER("port", port
, port_str
);
4888 peer_port_set (peer
, port
);
4893 /* Set specified peer's BGP port. */
4894 DEFUN (neighbor_port
,
4896 "neighbor <A.B.C.D|X:X::X:X> port (0-65535)",
4899 "Neighbor's BGP port\n"
4900 "TCP port number\n")
4904 return peer_port_vty (vty
, argv
[idx_ip
]->arg
, AFI_IP
, argv
[idx_number
]->arg
);
4907 DEFUN (no_neighbor_port
,
4908 no_neighbor_port_cmd
,
4909 "no neighbor <A.B.C.D|X:X::X:X> port [(0-65535)]",
4913 "Neighbor's BGP port\n"
4914 "TCP port number\n")
4917 return peer_port_vty (vty
, argv
[idx_ip
]->arg
, AFI_IP
, NULL
);
4921 /* neighbor weight. */
4923 peer_weight_set_vty (struct vty
*vty
, const char *ip_str
,
4924 afi_t afi
, safi_t safi
,
4925 const char *weight_str
)
4929 unsigned long weight
;
4931 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
4935 VTY_GET_INTEGER_RANGE("weight", weight
, weight_str
, 0, 65535);
4937 ret
= peer_weight_set (peer
, afi
, safi
, weight
);
4938 return bgp_vty_return (vty
, ret
);
4942 peer_weight_unset_vty (struct vty
*vty
, const char *ip_str
,
4943 afi_t afi
, safi_t safi
)
4948 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
4952 ret
= peer_weight_unset (peer
, afi
, safi
);
4953 return bgp_vty_return (vty
, ret
);
4956 DEFUN (neighbor_weight
,
4957 neighbor_weight_cmd
,
4958 "neighbor <A.B.C.D|X:X::X:X|WORD> weight (0-65535)",
4961 "Set default weight for routes from this neighbor\n"
4966 return peer_weight_set_vty (vty
,
4967 argv
[idx_peer
]->arg
,
4969 bgp_node_safi (vty
),
4970 argv
[idx_number
]->arg
);
4973 ALIAS_HIDDEN (neighbor_weight
,
4974 neighbor_weight_hidden_cmd
,
4975 "neighbor <A.B.C.D|X:X::X:X|WORD> weight (0-65535)",
4978 "Set default weight for routes from this neighbor\n"
4981 DEFUN (no_neighbor_weight
,
4982 no_neighbor_weight_cmd
,
4983 "no neighbor <A.B.C.D|X:X::X:X|WORD> weight [(0-65535)]",
4987 "Set default weight for routes from this neighbor\n"
4991 return peer_weight_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
), bgp_node_safi (vty
));
4994 ALIAS_HIDDEN (no_neighbor_weight
,
4995 no_neighbor_weight_hidden_cmd
,
4996 "no neighbor <A.B.C.D|X:X::X:X|WORD> weight [(0-65535)]",
5000 "Set default weight for routes from this neighbor\n"
5004 /* Override capability negotiation. */
5005 DEFUN (neighbor_override_capability
,
5006 neighbor_override_capability_cmd
,
5007 "neighbor <A.B.C.D|X:X::X:X|WORD> override-capability",
5010 "Override capability negotiation result\n")
5013 return peer_flag_set_vty (vty
, argv
[idx_peer
]->arg
, PEER_FLAG_OVERRIDE_CAPABILITY
);
5016 DEFUN (no_neighbor_override_capability
,
5017 no_neighbor_override_capability_cmd
,
5018 "no neighbor <A.B.C.D|X:X::X:X|WORD> override-capability",
5022 "Override capability negotiation result\n")
5025 return peer_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, PEER_FLAG_OVERRIDE_CAPABILITY
);
5028 DEFUN (neighbor_strict_capability
,
5029 neighbor_strict_capability_cmd
,
5030 "neighbor <A.B.C.D|X:X::X:X> strict-capability-match",
5033 "Strict capability negotiation match\n")
5036 return peer_flag_set_vty (vty
, argv
[idx_ip
]->arg
, PEER_FLAG_STRICT_CAP_MATCH
);
5039 DEFUN (no_neighbor_strict_capability
,
5040 no_neighbor_strict_capability_cmd
,
5041 "no neighbor <A.B.C.D|X:X::X:X> strict-capability-match",
5045 "Strict capability negotiation match\n")
5048 return peer_flag_unset_vty (vty
, argv
[idx_ip
]->arg
, PEER_FLAG_STRICT_CAP_MATCH
);
5052 peer_timers_set_vty (struct vty
*vty
, const char *ip_str
,
5053 const char *keep_str
, const char *hold_str
)
5057 u_int32_t keepalive
;
5060 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
5064 VTY_GET_INTEGER_RANGE ("Keepalive", keepalive
, keep_str
, 0, 65535);
5065 VTY_GET_INTEGER_RANGE ("Holdtime", holdtime
, hold_str
, 0, 65535);
5067 ret
= peer_timers_set (peer
, keepalive
, holdtime
);
5069 return bgp_vty_return (vty
, ret
);
5073 peer_timers_unset_vty (struct vty
*vty
, const char *ip_str
)
5078 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
5082 ret
= peer_timers_unset (peer
);
5084 return bgp_vty_return (vty
, ret
);
5087 DEFUN (neighbor_timers
,
5088 neighbor_timers_cmd
,
5089 "neighbor <A.B.C.D|X:X::X:X|WORD> timers (0-65535) (0-65535)",
5092 "BGP per neighbor timers\n"
5093 "Keepalive interval\n"
5098 int idx_number_2
= 4;
5099 return peer_timers_set_vty (vty
, argv
[idx_peer
]->arg
, argv
[idx_number
]->arg
, argv
[idx_number_2
]->arg
);
5102 DEFUN (no_neighbor_timers
,
5103 no_neighbor_timers_cmd
,
5104 "no neighbor <A.B.C.D|X:X::X:X|WORD> timers [(0-65535) (0-65535)]",
5108 "BGP per neighbor timers\n"
5109 "Keepalive interval\n"
5113 return peer_timers_unset_vty (vty
, argv
[idx_peer
]->arg
);
5118 peer_timers_connect_set_vty (struct vty
*vty
, const char *ip_str
,
5119 const char *time_str
)
5125 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
5129 VTY_GET_INTEGER_RANGE ("Connect time", connect
, time_str
, 0, 65535);
5131 ret
= peer_timers_connect_set (peer
, connect
);
5133 return bgp_vty_return (vty
, ret
);
5137 peer_timers_connect_unset_vty (struct vty
*vty
, const char *ip_str
)
5142 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
5146 ret
= peer_timers_connect_unset (peer
);
5148 return bgp_vty_return (vty
, ret
);
5151 DEFUN (neighbor_timers_connect
,
5152 neighbor_timers_connect_cmd
,
5153 "neighbor <A.B.C.D|X:X::X:X|WORD> timers connect (1-65535)",
5156 "BGP per neighbor timers\n"
5157 "BGP connect timer\n"
5162 return peer_timers_connect_set_vty (vty
, argv
[idx_peer
]->arg
, argv
[idx_number
]->arg
);
5165 DEFUN (no_neighbor_timers_connect
,
5166 no_neighbor_timers_connect_cmd
,
5167 "no neighbor <A.B.C.D|X:X::X:X|WORD> timers connect [(1-65535)]",
5171 "BGP per neighbor timers\n"
5172 "BGP connect timer\n"
5176 return peer_timers_connect_unset_vty (vty
, argv
[idx_peer
]->arg
);
5181 peer_advertise_interval_vty (struct vty
*vty
, const char *ip_str
,
5182 const char *time_str
, int set
)
5186 u_int32_t routeadv
= 0;
5188 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
5193 VTY_GET_INTEGER_RANGE ("advertise interval", routeadv
, time_str
, 0, 600);
5196 ret
= peer_advertise_interval_set (peer
, routeadv
);
5198 ret
= peer_advertise_interval_unset (peer
);
5200 return bgp_vty_return (vty
, ret
);
5203 DEFUN (neighbor_advertise_interval
,
5204 neighbor_advertise_interval_cmd
,
5205 "neighbor <A.B.C.D|X:X::X:X|WORD> advertisement-interval (0-600)",
5208 "Minimum interval between sending BGP routing updates\n"
5209 "time in seconds\n")
5213 return peer_advertise_interval_vty (vty
, argv
[idx_peer
]->arg
, argv
[idx_number
]->arg
, 1);
5216 DEFUN (no_neighbor_advertise_interval
,
5217 no_neighbor_advertise_interval_cmd
,
5218 "no neighbor <A.B.C.D|X:X::X:X|WORD> advertisement-interval [(0-600)]",
5222 "Minimum interval between sending BGP routing updates\n"
5223 "time in seconds\n")
5226 return peer_advertise_interval_vty (vty
, argv
[idx_peer
]->arg
, NULL
, 0);
5230 /* Time to wait before processing route-map updates */
5231 DEFUN (bgp_set_route_map_delay_timer
,
5232 bgp_set_route_map_delay_timer_cmd
,
5233 "bgp route-map delay-timer (0-600)",
5235 "BGP route-map delay timer\n"
5236 "Time in secs to wait before processing route-map changes\n"
5237 "0 disables the timer, no route updates happen when route-maps change\n")
5240 u_int32_t rmap_delay_timer
;
5242 if (argv
[idx_number
]->arg
)
5244 VTY_GET_INTEGER_RANGE ("delay-timer", rmap_delay_timer
, argv
[idx_number
]->arg
, 0, 600);
5245 bm
->rmap_update_timer
= rmap_delay_timer
;
5247 /* if the dynamic update handling is being disabled, and a timer is
5248 * running, stop the timer and act as if the timer has already fired.
5250 if (!rmap_delay_timer
&& bm
->t_rmap_update
)
5252 BGP_TIMER_OFF(bm
->t_rmap_update
);
5253 thread_execute (bm
->master
, bgp_route_map_update_timer
, NULL
, 0);
5261 DEFUN (no_bgp_set_route_map_delay_timer
,
5262 no_bgp_set_route_map_delay_timer_cmd
,
5263 "no bgp route-map delay-timer [(0-600)]",
5266 "Default BGP route-map delay timer\n"
5267 "Reset to default time to wait for processing route-map changes\n"
5268 "0 disables the timer, no route updates happen when route-maps change\n")
5271 bm
->rmap_update_timer
= RMAP_DEFAULT_UPDATE_TIMER
;
5277 /* neighbor interface */
5279 peer_interface_vty (struct vty
*vty
, const char *ip_str
, const char *str
)
5283 peer
= peer_lookup_vty (vty
, ip_str
);
5284 if (! peer
|| peer
->conf_if
)
5288 peer_interface_set (peer
, str
);
5290 peer_interface_unset (peer
);
5295 DEFUN (neighbor_interface
,
5296 neighbor_interface_cmd
,
5297 "neighbor <A.B.C.D|X:X::X:X> interface WORD",
5305 return peer_interface_vty (vty
, argv
[idx_ip
]->arg
, argv
[idx_word
]->arg
);
5308 DEFUN (no_neighbor_interface
,
5309 no_neighbor_interface_cmd
,
5310 "no neighbor <A.B.C.D|X:X::X:X|WORD> interface WORD",
5318 return peer_interface_vty (vty
, argv
[idx_peer
]->arg
, NULL
);
5321 /* Set distribute list to the peer. */
5323 peer_distribute_set_vty (struct vty
*vty
, const char *ip_str
,
5324 afi_t afi
, safi_t safi
,
5325 const char *name_str
, const char *direct_str
)
5329 int direct
= FILTER_IN
;
5331 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
5335 /* Check filter direction. */
5336 if (strncmp (direct_str
, "i", 1) == 0)
5338 else if (strncmp (direct_str
, "o", 1) == 0)
5339 direct
= FILTER_OUT
;
5341 ret
= peer_distribute_set (peer
, afi
, safi
, direct
, name_str
);
5343 return bgp_vty_return (vty
, ret
);
5347 peer_distribute_unset_vty (struct vty
*vty
, const char *ip_str
, afi_t afi
,
5348 safi_t safi
, const char *direct_str
)
5352 int direct
= FILTER_IN
;
5354 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
5358 /* Check filter direction. */
5359 if (strncmp (direct_str
, "i", 1) == 0)
5361 else if (strncmp (direct_str
, "o", 1) == 0)
5362 direct
= FILTER_OUT
;
5364 ret
= peer_distribute_unset (peer
, afi
, safi
, direct
);
5366 return bgp_vty_return (vty
, ret
);
5369 DEFUN (neighbor_distribute_list
,
5370 neighbor_distribute_list_cmd
,
5371 "neighbor <A.B.C.D|X:X::X:X|WORD> distribute-list <(1-199)|(1300-2699)|WORD> <in|out>",
5374 "Filter updates to/from this neighbor\n"
5375 "IP access-list number\n"
5376 "IP access-list number (expanded range)\n"
5377 "IP Access-list name\n"
5378 "Filter incoming updates\n"
5379 "Filter outgoing updates\n")
5384 return peer_distribute_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
5385 bgp_node_safi (vty
), argv
[idx_acl
]->arg
, argv
[idx_in_out
]->arg
);
5388 ALIAS_HIDDEN (neighbor_distribute_list
,
5389 neighbor_distribute_list_hidden_cmd
,
5390 "neighbor <A.B.C.D|X:X::X:X|WORD> distribute-list <(1-199)|(1300-2699)|WORD> <in|out>",
5393 "Filter updates to/from this neighbor\n"
5394 "IP access-list number\n"
5395 "IP access-list number (expanded range)\n"
5396 "IP Access-list name\n"
5397 "Filter incoming updates\n"
5398 "Filter outgoing updates\n")
5400 DEFUN (no_neighbor_distribute_list
,
5401 no_neighbor_distribute_list_cmd
,
5402 "no neighbor <A.B.C.D|X:X::X:X|WORD> distribute-list <(1-199)|(1300-2699)|WORD> <in|out>",
5406 "Filter updates to/from this neighbor\n"
5407 "IP access-list number\n"
5408 "IP access-list number (expanded range)\n"
5409 "IP Access-list name\n"
5410 "Filter incoming updates\n"
5411 "Filter outgoing updates\n")
5415 return peer_distribute_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
5416 bgp_node_safi (vty
), argv
[idx_in_out
]->arg
);
5419 ALIAS_HIDDEN (no_neighbor_distribute_list
,
5420 no_neighbor_distribute_list_hidden_cmd
,
5421 "no neighbor <A.B.C.D|X:X::X:X|WORD> distribute-list <(1-199)|(1300-2699)|WORD> <in|out>",
5425 "Filter updates to/from this neighbor\n"
5426 "IP access-list number\n"
5427 "IP access-list number (expanded range)\n"
5428 "IP Access-list name\n"
5429 "Filter incoming updates\n"
5430 "Filter outgoing updates\n")
5432 /* Set prefix list to the peer. */
5434 peer_prefix_list_set_vty (struct vty
*vty
, const char *ip_str
, afi_t afi
,
5435 safi_t safi
, const char *name_str
,
5436 const char *direct_str
)
5440 int direct
= FILTER_IN
;
5442 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
5446 /* Check filter direction. */
5447 if (strncmp (direct_str
, "i", 1) == 0)
5449 else if (strncmp (direct_str
, "o", 1) == 0)
5450 direct
= FILTER_OUT
;
5452 ret
= peer_prefix_list_set (peer
, afi
, safi
, direct
, name_str
);
5454 return bgp_vty_return (vty
, ret
);
5458 peer_prefix_list_unset_vty (struct vty
*vty
, const char *ip_str
, afi_t afi
,
5459 safi_t safi
, const char *direct_str
)
5463 int direct
= FILTER_IN
;
5465 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
5469 /* Check filter direction. */
5470 if (strncmp (direct_str
, "i", 1) == 0)
5472 else if (strncmp (direct_str
, "o", 1) == 0)
5473 direct
= FILTER_OUT
;
5475 ret
= peer_prefix_list_unset (peer
, afi
, safi
, direct
);
5477 return bgp_vty_return (vty
, ret
);
5480 DEFUN (neighbor_prefix_list
,
5481 neighbor_prefix_list_cmd
,
5482 "neighbor <A.B.C.D|X:X::X:X|WORD> prefix-list WORD <in|out>",
5485 "Filter updates to/from this neighbor\n"
5486 "Name of a prefix list\n"
5487 "Filter incoming updates\n"
5488 "Filter outgoing updates\n")
5493 return peer_prefix_list_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
5494 bgp_node_safi (vty
), argv
[idx_word
]->arg
, argv
[idx_in_out
]->arg
);
5497 ALIAS_HIDDEN (neighbor_prefix_list
,
5498 neighbor_prefix_list_hidden_cmd
,
5499 "neighbor <A.B.C.D|X:X::X:X|WORD> prefix-list WORD <in|out>",
5502 "Filter updates to/from this neighbor\n"
5503 "Name of a prefix list\n"
5504 "Filter incoming updates\n"
5505 "Filter outgoing updates\n")
5507 DEFUN (no_neighbor_prefix_list
,
5508 no_neighbor_prefix_list_cmd
,
5509 "no neighbor <A.B.C.D|X:X::X:X|WORD> prefix-list WORD <in|out>",
5513 "Filter updates to/from this neighbor\n"
5514 "Name of a prefix list\n"
5515 "Filter incoming updates\n"
5516 "Filter outgoing updates\n")
5520 return peer_prefix_list_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
5521 bgp_node_safi (vty
), argv
[idx_in_out
]->arg
);
5524 ALIAS_HIDDEN (no_neighbor_prefix_list
,
5525 no_neighbor_prefix_list_hidden_cmd
,
5526 "no neighbor <A.B.C.D|X:X::X:X|WORD> prefix-list WORD <in|out>",
5530 "Filter updates to/from this neighbor\n"
5531 "Name of a prefix list\n"
5532 "Filter incoming updates\n"
5533 "Filter outgoing updates\n")
5536 peer_aslist_set_vty (struct vty
*vty
, const char *ip_str
,
5537 afi_t afi
, safi_t safi
,
5538 const char *name_str
, const char *direct_str
)
5542 int direct
= FILTER_IN
;
5544 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
5548 /* Check filter direction. */
5549 if (strncmp (direct_str
, "i", 1) == 0)
5551 else if (strncmp (direct_str
, "o", 1) == 0)
5552 direct
= FILTER_OUT
;
5554 ret
= peer_aslist_set (peer
, afi
, safi
, direct
, name_str
);
5556 return bgp_vty_return (vty
, ret
);
5560 peer_aslist_unset_vty (struct vty
*vty
, const char *ip_str
,
5561 afi_t afi
, safi_t safi
,
5562 const char *direct_str
)
5566 int direct
= FILTER_IN
;
5568 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
5572 /* Check filter direction. */
5573 if (strncmp (direct_str
, "i", 1) == 0)
5575 else if (strncmp (direct_str
, "o", 1) == 0)
5576 direct
= FILTER_OUT
;
5578 ret
= peer_aslist_unset (peer
, afi
, safi
, direct
);
5580 return bgp_vty_return (vty
, ret
);
5583 DEFUN (neighbor_filter_list
,
5584 neighbor_filter_list_cmd
,
5585 "neighbor <A.B.C.D|X:X::X:X|WORD> filter-list WORD <in|out>",
5588 "Establish BGP filters\n"
5589 "AS path access-list name\n"
5590 "Filter incoming routes\n"
5591 "Filter outgoing routes\n")
5596 return peer_aslist_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
5597 bgp_node_safi (vty
), argv
[idx_word
]->arg
, argv
[idx_in_out
]->arg
);
5600 ALIAS_HIDDEN (neighbor_filter_list
,
5601 neighbor_filter_list_hidden_cmd
,
5602 "neighbor <A.B.C.D|X:X::X:X|WORD> filter-list WORD <in|out>",
5605 "Establish BGP filters\n"
5606 "AS path access-list name\n"
5607 "Filter incoming routes\n"
5608 "Filter outgoing routes\n")
5610 DEFUN (no_neighbor_filter_list
,
5611 no_neighbor_filter_list_cmd
,
5612 "no neighbor <A.B.C.D|X:X::X:X|WORD> filter-list WORD <in|out>",
5616 "Establish BGP filters\n"
5617 "AS path access-list name\n"
5618 "Filter incoming routes\n"
5619 "Filter outgoing routes\n")
5623 return peer_aslist_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
5624 bgp_node_safi (vty
), argv
[idx_in_out
]->arg
);
5627 ALIAS_HIDDEN (no_neighbor_filter_list
,
5628 no_neighbor_filter_list_hidden_cmd
,
5629 "no neighbor <A.B.C.D|X:X::X:X|WORD> filter-list WORD <in|out>",
5633 "Establish BGP filters\n"
5634 "AS path access-list name\n"
5635 "Filter incoming routes\n"
5636 "Filter outgoing routes\n")
5638 /* Set route-map to the peer. */
5640 peer_route_map_set_vty (struct vty
*vty
, const char *ip_str
,
5641 afi_t afi
, safi_t safi
,
5642 const char *name_str
, const char *direct_str
)
5646 int direct
= RMAP_IN
;
5648 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
5652 /* Check filter direction. */
5653 if (strncmp (direct_str
, "in", 2) == 0)
5655 else if (strncmp (direct_str
, "o", 1) == 0)
5658 ret
= peer_route_map_set (peer
, afi
, safi
, direct
, name_str
);
5660 return bgp_vty_return (vty
, ret
);
5664 peer_route_map_unset_vty (struct vty
*vty
, const char *ip_str
, afi_t afi
,
5665 safi_t safi
, const char *direct_str
)
5669 int direct
= RMAP_IN
;
5671 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
5675 /* Check filter direction. */
5676 if (strncmp (direct_str
, "in", 2) == 0)
5678 else if (strncmp (direct_str
, "o", 1) == 0)
5681 ret
= peer_route_map_unset (peer
, afi
, safi
, direct
);
5683 return bgp_vty_return (vty
, ret
);
5686 DEFUN (neighbor_route_map
,
5687 neighbor_route_map_cmd
,
5688 "neighbor <A.B.C.D|X:X::X:X|WORD> route-map WORD <in|out>",
5691 "Apply route map to neighbor\n"
5692 "Name of route map\n"
5693 "Apply map to incoming routes\n"
5694 "Apply map to outbound routes\n")
5699 return peer_route_map_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
5700 bgp_node_safi (vty
), argv
[idx_word
]->arg
, argv
[idx_in_out
]->arg
);
5703 ALIAS_HIDDEN (neighbor_route_map
,
5704 neighbor_route_map_hidden_cmd
,
5705 "neighbor <A.B.C.D|X:X::X:X|WORD> route-map WORD <in|out>",
5708 "Apply route map to neighbor\n"
5709 "Name of route map\n"
5710 "Apply map to incoming routes\n"
5711 "Apply map to outbound routes\n")
5713 DEFUN (no_neighbor_route_map
,
5714 no_neighbor_route_map_cmd
,
5715 "no neighbor <A.B.C.D|X:X::X:X|WORD> route-map WORD <in|out>",
5719 "Apply route map to neighbor\n"
5720 "Name of route map\n"
5721 "Apply map to incoming routes\n"
5722 "Apply map to outbound routes\n")
5726 return peer_route_map_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
5727 bgp_node_safi (vty
), argv
[idx_in_out
]->arg
);
5730 ALIAS_HIDDEN (no_neighbor_route_map
,
5731 no_neighbor_route_map_hidden_cmd
,
5732 "no neighbor <A.B.C.D|X:X::X:X|WORD> route-map WORD <in|out>",
5736 "Apply route map to neighbor\n"
5737 "Name of route map\n"
5738 "Apply map to incoming routes\n"
5739 "Apply map to outbound routes\n")
5741 /* Set unsuppress-map to the peer. */
5743 peer_unsuppress_map_set_vty (struct vty
*vty
, const char *ip_str
, afi_t afi
,
5744 safi_t safi
, const char *name_str
)
5749 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
5753 ret
= peer_unsuppress_map_set (peer
, afi
, safi
, name_str
);
5755 return bgp_vty_return (vty
, ret
);
5758 /* Unset route-map from the peer. */
5760 peer_unsuppress_map_unset_vty (struct vty
*vty
, const char *ip_str
, afi_t afi
,
5766 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
5770 ret
= peer_unsuppress_map_unset (peer
, afi
, safi
);
5772 return bgp_vty_return (vty
, ret
);
5775 DEFUN (neighbor_unsuppress_map
,
5776 neighbor_unsuppress_map_cmd
,
5777 "neighbor <A.B.C.D|X:X::X:X|WORD> unsuppress-map WORD",
5780 "Route-map to selectively unsuppress suppressed routes\n"
5781 "Name of route map\n")
5785 return peer_unsuppress_map_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
5786 bgp_node_safi (vty
), argv
[idx_word
]->arg
);
5789 ALIAS_HIDDEN (neighbor_unsuppress_map
,
5790 neighbor_unsuppress_map_hidden_cmd
,
5791 "neighbor <A.B.C.D|X:X::X:X|WORD> unsuppress-map WORD",
5794 "Route-map to selectively unsuppress suppressed routes\n"
5795 "Name of route map\n")
5797 DEFUN (no_neighbor_unsuppress_map
,
5798 no_neighbor_unsuppress_map_cmd
,
5799 "no neighbor <A.B.C.D|X:X::X:X|WORD> unsuppress-map WORD",
5803 "Route-map to selectively unsuppress suppressed routes\n"
5804 "Name of route map\n")
5807 return peer_unsuppress_map_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
5808 bgp_node_safi (vty
));
5811 ALIAS_HIDDEN (no_neighbor_unsuppress_map
,
5812 no_neighbor_unsuppress_map_hidden_cmd
,
5813 "no neighbor <A.B.C.D|X:X::X:X|WORD> unsuppress-map WORD",
5817 "Route-map to selectively unsuppress suppressed routes\n"
5818 "Name of route map\n")
5821 peer_maximum_prefix_set_vty (struct vty
*vty
, const char *ip_str
, afi_t afi
,
5822 safi_t safi
, const char *num_str
,
5823 const char *threshold_str
, int warning
,
5824 const char *restart_str
)
5832 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
5836 VTY_GET_INTEGER ("maximum number", max
, num_str
);
5838 threshold
= atoi (threshold_str
);
5840 threshold
= MAXIMUM_PREFIX_THRESHOLD_DEFAULT
;
5843 restart
= atoi (restart_str
);
5847 ret
= peer_maximum_prefix_set (peer
, afi
, safi
, max
, threshold
, warning
, restart
);
5849 return bgp_vty_return (vty
, ret
);
5853 peer_maximum_prefix_unset_vty (struct vty
*vty
, const char *ip_str
, afi_t afi
,
5859 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
5863 ret
= peer_maximum_prefix_unset (peer
, afi
, safi
);
5865 return bgp_vty_return (vty
, ret
);
5868 /* Maximum number of prefix configuration. prefix count is different
5869 for each peer configuration. So this configuration can be set for
5870 each peer configuration. */
5871 DEFUN (neighbor_maximum_prefix
,
5872 neighbor_maximum_prefix_cmd
,
5873 "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295)",
5876 "Maximum number of prefix accept from this peer\n"
5877 "maximum no. of prefix limit\n")
5881 return peer_maximum_prefix_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
5882 bgp_node_safi (vty
), argv
[idx_number
]->arg
, NULL
, 0,
5886 ALIAS_HIDDEN (neighbor_maximum_prefix
,
5887 neighbor_maximum_prefix_hidden_cmd
,
5888 "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295)",
5891 "Maximum number of prefix accept from this peer\n"
5892 "maximum no. of prefix limit\n")
5894 DEFUN (neighbor_maximum_prefix_threshold
,
5895 neighbor_maximum_prefix_threshold_cmd
,
5896 "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295) (1-100)",
5899 "Maximum number of prefix accept from this peer\n"
5900 "maximum no. of prefix limit\n"
5901 "Threshold value (%) at which to generate a warning msg\n")
5905 int idx_number_2
= 4;
5906 return peer_maximum_prefix_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
5907 bgp_node_safi (vty
), argv
[idx_number
]->arg
, argv
[idx_number_2
]->arg
, 0,
5911 ALIAS_HIDDEN (neighbor_maximum_prefix_threshold
,
5912 neighbor_maximum_prefix_threshold_hidden_cmd
,
5913 "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295) (1-100)",
5916 "Maximum number of prefix accept from this peer\n"
5917 "maximum no. of prefix limit\n"
5918 "Threshold value (%) at which to generate a warning msg\n")
5920 DEFUN (neighbor_maximum_prefix_warning
,
5921 neighbor_maximum_prefix_warning_cmd
,
5922 "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295) warning-only",
5925 "Maximum number of prefix accept from this peer\n"
5926 "maximum no. of prefix limit\n"
5927 "Only give warning message when limit is exceeded\n")
5931 return peer_maximum_prefix_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
5932 bgp_node_safi (vty
), argv
[idx_number
]->arg
, NULL
, 1,
5936 ALIAS_HIDDEN (neighbor_maximum_prefix_warning
,
5937 neighbor_maximum_prefix_warning_hidden_cmd
,
5938 "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295) warning-only",
5941 "Maximum number of prefix accept from this peer\n"
5942 "maximum no. of prefix limit\n"
5943 "Only give warning message when limit is exceeded\n")
5945 DEFUN (neighbor_maximum_prefix_threshold_warning
,
5946 neighbor_maximum_prefix_threshold_warning_cmd
,
5947 "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295) (1-100) warning-only",
5950 "Maximum number of prefix accept from this peer\n"
5951 "maximum no. of prefix limit\n"
5952 "Threshold value (%) at which to generate a warning msg\n"
5953 "Only give warning message when limit is exceeded\n")
5957 int idx_number_2
= 4;
5958 return peer_maximum_prefix_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
5959 bgp_node_safi (vty
), argv
[idx_number
]->arg
, argv
[idx_number_2
]->arg
, 1, NULL
);
5962 ALIAS_HIDDEN (neighbor_maximum_prefix_threshold_warning
,
5963 neighbor_maximum_prefix_threshold_warning_hidden_cmd
,
5964 "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295) (1-100) warning-only",
5967 "Maximum number of prefix accept from this peer\n"
5968 "maximum no. of prefix limit\n"
5969 "Threshold value (%) at which to generate a warning msg\n"
5970 "Only give warning message when limit is exceeded\n")
5972 DEFUN (neighbor_maximum_prefix_restart
,
5973 neighbor_maximum_prefix_restart_cmd
,
5974 "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295) restart (1-65535)",
5977 "Maximum number of prefix accept from this peer\n"
5978 "maximum no. of prefix limit\n"
5979 "Restart bgp connection after limit is exceeded\n"
5980 "Restart interval in minutes")
5984 int idx_number_2
= 5;
5985 return peer_maximum_prefix_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
5986 bgp_node_safi (vty
), argv
[idx_number
]->arg
, NULL
, 0, argv
[idx_number_2
]->arg
);
5989 ALIAS_HIDDEN (neighbor_maximum_prefix_restart
,
5990 neighbor_maximum_prefix_restart_hidden_cmd
,
5991 "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295) restart (1-65535)",
5994 "Maximum number of prefix accept from this peer\n"
5995 "maximum no. of prefix limit\n"
5996 "Restart bgp connection after limit is exceeded\n"
5997 "Restart interval in minutes")
5999 DEFUN (neighbor_maximum_prefix_threshold_restart
,
6000 neighbor_maximum_prefix_threshold_restart_cmd
,
6001 "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295) (1-100) restart (1-65535)",
6004 "Maximum number of prefixes to accept from this peer\n"
6005 "maximum no. of prefix limit\n"
6006 "Threshold value (%) at which to generate a warning msg\n"
6007 "Restart bgp connection after limit is exceeded\n"
6008 "Restart interval in minutes\n")
6012 int idx_number_2
= 4;
6013 int idx_number_3
= 6;
6014 return peer_maximum_prefix_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
6015 bgp_node_safi (vty
), argv
[idx_number
]->arg
, argv
[idx_number_2
]->arg
, 0, argv
[idx_number_3
]->arg
);
6018 ALIAS_HIDDEN (neighbor_maximum_prefix_threshold_restart
,
6019 neighbor_maximum_prefix_threshold_restart_hidden_cmd
,
6020 "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295) (1-100) restart (1-65535)",
6023 "Maximum number of prefixes to accept from this peer\n"
6024 "maximum no. of prefix limit\n"
6025 "Threshold value (%) at which to generate a warning msg\n"
6026 "Restart bgp connection after limit is exceeded\n"
6027 "Restart interval in minutes\n")
6029 DEFUN (no_neighbor_maximum_prefix
,
6030 no_neighbor_maximum_prefix_cmd
,
6031 "no neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix [(1-4294967295) [(1-100)] [restart (1-65535)] [warning-only]]",
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"
6040 "Only give warning message when limit is exceeded\n")
6043 return peer_maximum_prefix_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
6044 bgp_node_safi (vty
));
6047 ALIAS_HIDDEN (no_neighbor_maximum_prefix
,
6048 no_neighbor_maximum_prefix_hidden_cmd
,
6049 "no neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix [(1-4294967295) [(1-100)] [restart (1-65535)] [warning-only]]",
6053 "Maximum number of prefixes to accept from this peer\n"
6054 "maximum no. of prefix limit\n"
6055 "Threshold value (%) at which to generate a warning msg\n"
6056 "Restart bgp connection after limit is exceeded\n"
6057 "Restart interval in minutes\n"
6058 "Only give warning message when limit is exceeded\n")
6061 /* "neighbor allowas-in" */
6062 DEFUN (neighbor_allowas_in
,
6063 neighbor_allowas_in_cmd
,
6064 "neighbor <A.B.C.D|X:X::X:X|WORD> allowas-in [<(1-10)|origin>]",
6067 "Accept as-path with my AS present in it\n"
6068 "Number of occurances of AS number\n"
6069 "Only accept my AS in the as-path if the route was originated in my AS\n")
6072 int idx_number_origin
= 3;
6078 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
6082 if (argc
<= idx_number_origin
)
6086 if (argv
[idx_number_origin
]->type
== WORD_TKN
)
6089 allow_num
= atoi (argv
[idx_number_origin
]->arg
);
6092 ret
= peer_allowas_in_set (peer
, bgp_node_afi (vty
), bgp_node_safi (vty
),
6095 return bgp_vty_return (vty
, ret
);
6098 ALIAS_HIDDEN (neighbor_allowas_in
,
6099 neighbor_allowas_in_hidden_cmd
,
6100 "neighbor <A.B.C.D|X:X::X:X|WORD> allowas-in [<(1-10)|origin>]",
6103 "Accept as-path with my AS present in it\n"
6104 "Number of occurances of AS number\n"
6105 "Only accept my AS in the as-path if the route was originated in my AS\n")
6107 DEFUN (no_neighbor_allowas_in
,
6108 no_neighbor_allowas_in_cmd
,
6109 "no neighbor <A.B.C.D|X:X::X:X|WORD> allowas-in [<(1-10)|origin>]",
6113 "allow local ASN appears in aspath attribute\n"
6114 "Number of occurances of AS number\n"
6115 "Only accept my AS in the as-path if the route was originated in my AS\n")
6121 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
6125 ret
= peer_allowas_in_unset (peer
, bgp_node_afi (vty
), bgp_node_safi (vty
));
6127 return bgp_vty_return (vty
, ret
);
6130 ALIAS_HIDDEN (no_neighbor_allowas_in
,
6131 no_neighbor_allowas_in_hidden_cmd
,
6132 "no neighbor <A.B.C.D|X:X::X:X|WORD> allowas-in [<(1-10)|origin>]",
6136 "allow local ASN appears in aspath attribute\n"
6137 "Number of occurances of AS number\n"
6138 "Only accept my AS in the as-path if the route was originated in my AS\n")
6140 DEFUN (neighbor_ttl_security
,
6141 neighbor_ttl_security_cmd
,
6142 "neighbor <A.B.C.D|X:X::X:X|WORD> ttl-security hops (1-254)",
6145 "BGP ttl-security parameters\n"
6146 "Specify the maximum number of hops to the BGP peer\n"
6147 "Number of hops to BGP peer\n")
6154 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
6158 VTY_GET_INTEGER_RANGE ("", gtsm_hops
, argv
[idx_number
]->arg
, 1, 254);
6161 * If 'neighbor swpX', then this is for directly connected peers,
6162 * we should not accept a ttl-security hops value greater than 1.
6164 if (peer
->conf_if
&& (gtsm_hops
> 1)) {
6165 vty_out (vty
, "%s is directly connected peer, hops cannot exceed 1%s",
6166 argv
[idx_peer
]->arg
, VTY_NEWLINE
);
6170 return bgp_vty_return (vty
, peer_ttl_security_hops_set (peer
, gtsm_hops
));
6173 DEFUN (no_neighbor_ttl_security
,
6174 no_neighbor_ttl_security_cmd
,
6175 "no neighbor <A.B.C.D|X:X::X:X|WORD> ttl-security hops (1-254)",
6179 "BGP ttl-security parameters\n"
6180 "Specify the maximum number of hops to the BGP peer\n"
6181 "Number of hops to BGP peer\n")
6186 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
6190 return bgp_vty_return (vty
, peer_ttl_security_hops_unset (peer
));
6193 DEFUN (neighbor_addpath_tx_all_paths
,
6194 neighbor_addpath_tx_all_paths_cmd
,
6195 "neighbor <A.B.C.D|X:X::X:X|WORD> addpath-tx-all-paths",
6198 "Use addpath to advertise all paths to a neighbor\n")
6203 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
6207 return peer_af_flag_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
6208 bgp_node_safi (vty
),
6209 PEER_FLAG_ADDPATH_TX_ALL_PATHS
);
6212 ALIAS_HIDDEN (neighbor_addpath_tx_all_paths
,
6213 neighbor_addpath_tx_all_paths_hidden_cmd
,
6214 "neighbor <A.B.C.D|X:X::X:X|WORD> addpath-tx-all-paths",
6217 "Use addpath to advertise all paths to a neighbor\n")
6219 DEFUN (no_neighbor_addpath_tx_all_paths
,
6220 no_neighbor_addpath_tx_all_paths_cmd
,
6221 "no neighbor <A.B.C.D|X:X::X:X|WORD> addpath-tx-all-paths",
6225 "Use addpath to advertise all paths to a neighbor\n")
6228 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
6229 bgp_node_safi (vty
),
6230 PEER_FLAG_ADDPATH_TX_ALL_PATHS
);
6233 ALIAS_HIDDEN (no_neighbor_addpath_tx_all_paths
,
6234 no_neighbor_addpath_tx_all_paths_hidden_cmd
,
6235 "no neighbor <A.B.C.D|X:X::X:X|WORD> addpath-tx-all-paths",
6239 "Use addpath to advertise all paths to a neighbor\n")
6241 DEFUN (neighbor_addpath_tx_bestpath_per_as
,
6242 neighbor_addpath_tx_bestpath_per_as_cmd
,
6243 "neighbor <A.B.C.D|X:X::X:X|WORD> addpath-tx-bestpath-per-AS",
6246 "Use addpath to advertise the bestpath per each neighboring AS\n")
6251 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
6255 return peer_af_flag_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
6256 bgp_node_safi (vty
),
6257 PEER_FLAG_ADDPATH_TX_BESTPATH_PER_AS
);
6260 ALIAS_HIDDEN (neighbor_addpath_tx_bestpath_per_as
,
6261 neighbor_addpath_tx_bestpath_per_as_hidden_cmd
,
6262 "neighbor <A.B.C.D|X:X::X:X|WORD> addpath-tx-bestpath-per-AS",
6265 "Use addpath to advertise the bestpath per each neighboring AS\n")
6267 DEFUN (no_neighbor_addpath_tx_bestpath_per_as
,
6268 no_neighbor_addpath_tx_bestpath_per_as_cmd
,
6269 "no neighbor <A.B.C.D|X:X::X:X|WORD> addpath-tx-bestpath-per-AS",
6273 "Use addpath to advertise the bestpath per each neighboring AS\n")
6276 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
6277 bgp_node_safi (vty
),
6278 PEER_FLAG_ADDPATH_TX_BESTPATH_PER_AS
);
6281 ALIAS_HIDDEN (no_neighbor_addpath_tx_bestpath_per_as
,
6282 no_neighbor_addpath_tx_bestpath_per_as_hidden_cmd
,
6283 "no 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")
6289 DEFUN_NOSH (address_family_ipv4_safi
,
6290 address_family_ipv4_safi_cmd
,
6291 "address-family ipv4 [<unicast|multicast|vpn|labeled-unicast>]",
6292 "Enter Address Family command mode\n"
6299 safi_t safi
= bgp_vty_safi_from_arg(argv
[2]->arg
);
6300 vty
->node
= bgp_node_type(AFI_IP
, safi
);
6303 vty
->node
= BGP_IPV4_NODE
;
6308 DEFUN_NOSH (address_family_ipv6_safi
,
6309 address_family_ipv6_safi_cmd
,
6310 "address-family ipv6 [<unicast|multicast|vpn|labeled-unicast>]",
6311 "Enter Address Family command mode\n"
6317 safi_t safi
= bgp_vty_safi_from_arg(argv
[2]->arg
);
6318 vty
->node
= bgp_node_type(AFI_IP6
, safi
);
6321 vty
->node
= BGP_IPV6_NODE
;
6326 #ifdef KEEP_OLD_VPN_COMMANDS
6327 DEFUN_NOSH (address_family_vpnv4
,
6328 address_family_vpnv4_cmd
,
6329 "address-family vpnv4 [unicast]",
6330 "Enter Address Family command mode\n"
6332 "Address Family modifier\n")
6334 vty
->node
= BGP_VPNV4_NODE
;
6338 DEFUN_NOSH (address_family_vpnv6
,
6339 address_family_vpnv6_cmd
,
6340 "address-family vpnv6 [unicast]",
6341 "Enter Address Family command mode\n"
6343 "Address Family modifier\n")
6345 vty
->node
= BGP_VPNV6_NODE
;
6350 DEFUN_NOSH (address_family_evpn
,
6351 address_family_evpn_cmd
,
6352 "address-family <l2vpn evpn>",
6353 "Enter Address Family command mode\n"
6354 "EVPN Address family\n"
6355 "Layer2 VPN Address family\n"
6356 "Ethernet Virtual Private Network Subsequent Address Family\n")
6358 vty
->node
= BGP_EVPN_NODE
;
6362 DEFUN_NOSH (exit_address_family
,
6363 exit_address_family_cmd
,
6364 "exit-address-family",
6365 "Exit from Address Family configuration mode\n")
6367 if (vty
->node
== BGP_IPV4_NODE
6368 || vty
->node
== BGP_IPV4M_NODE
6369 || vty
->node
== BGP_IPV4L_NODE
6370 || vty
->node
== BGP_VPNV4_NODE
6371 || vty
->node
== BGP_IPV6_NODE
6372 || vty
->node
== BGP_IPV6M_NODE
6373 || vty
->node
== BGP_IPV6L_NODE
6374 || vty
->node
== BGP_VPNV6_NODE
6375 || vty
->node
== BGP_EVPN_NODE
)
6376 vty
->node
= BGP_NODE
;
6380 /* Recalculate bestpath and re-advertise a prefix */
6382 bgp_clear_prefix (struct vty
*vty
, const char *view_name
, const char *ip_str
,
6383 afi_t afi
, safi_t safi
, struct prefix_rd
*prd
)
6386 struct prefix match
;
6387 struct bgp_node
*rn
;
6388 struct bgp_node
*rm
;
6390 struct bgp_table
*table
;
6391 struct bgp_table
*rib
;
6393 /* BGP structure lookup. */
6396 bgp
= bgp_lookup_by_name (view_name
);
6399 vty_out (vty
, "%% Can't find BGP instance %s%s", view_name
, VTY_NEWLINE
);
6405 bgp
= bgp_get_default ();
6408 vty_out (vty
, "%% No BGP process is configured%s", VTY_NEWLINE
);
6413 /* Check IP address argument. */
6414 ret
= str2prefix (ip_str
, &match
);
6417 vty_out (vty
, "%% address is malformed%s", VTY_NEWLINE
);
6421 match
.family
= afi2family (afi
);
6422 rib
= bgp
->rib
[afi
][safi
];
6424 if (safi
== SAFI_MPLS_VPN
)
6426 for (rn
= bgp_table_top (rib
); rn
; rn
= bgp_route_next (rn
))
6428 if (prd
&& memcmp (rn
->p
.u
.val
, prd
->val
, 8) != 0)
6431 if ((table
= rn
->info
) != NULL
)
6433 if ((rm
= bgp_node_match (table
, &match
)) != NULL
)
6435 if (rm
->p
.prefixlen
== match
.prefixlen
)
6437 SET_FLAG (rn
->flags
, BGP_NODE_USER_CLEAR
);
6438 bgp_process (bgp
, rm
, afi
, safi
);
6440 bgp_unlock_node (rm
);
6447 if ((rn
= bgp_node_match (rib
, &match
)) != NULL
)
6449 if (rn
->p
.prefixlen
== match
.prefixlen
)
6451 SET_FLAG (rn
->flags
, BGP_NODE_USER_CLEAR
);
6452 bgp_process (bgp
, rn
, afi
, safi
);
6454 bgp_unlock_node (rn
);
6461 /* one clear bgp command to rule them all */
6462 DEFUN (clear_ip_bgp_all
,
6463 clear_ip_bgp_all_cmd
,
6464 "clear [ip] bgp [<view|vrf> VIEWVRFNAME] ["BGP_AFI_CMD_STR
" ["BGP_SAFI_CMD_STR
"]] <*|A.B.C.D|X:X::X:X|WORD|(1-4294967295)|external|peer-group WORD> [<soft [<in|out>]|in [prefix-filter]|out>]",
6468 BGP_INSTANCE_HELP_STR
6470 "BGP neighbor address to clear\n"
6471 "BGP IPv6 neighbor to clear\n"
6472 "BGP neighbor on interface to clear\n"
6473 "Clear peers with the AS number\n"
6474 "Clear all external peers\n"
6475 "Clear all members of peer-group\n"
6476 "BGP peer-group name\n"
6483 "Push out prefix-list ORF and do inbound soft reconfig\n"
6488 afi_t afi
= AFI_IP6
;
6489 safi_t safi
= SAFI_UNICAST
;
6490 enum clear_sort clr_sort
= clear_peer
;
6491 enum bgp_clear_type clr_type
;
6492 char *clr_arg
= NULL
;
6496 /* clear [ip] bgp */
6497 if (argv_find (argv
, argc
, "ip", &idx
))
6499 /* [<view|vrf> VIEWVRFNAME] */
6500 if (argv_find (argv
, argc
, "view", &idx
) || argv_find (argv
, argc
, "vrf", &idx
))
6502 vrf
= argv
[idx
+ 1]->arg
;
6505 /* <*|A.B.C.D|X:X::X:X|WORD|(1-4294967295)|external|peer-group WORD> */
6506 if (argv_find (argv
, argc
, "*", &idx
))
6508 clr_sort
= clear_all
;
6510 else if (argv_find (argv
, argc
, "A.B.C.D", &idx
))
6512 clr_sort
= clear_peer
;
6513 clr_arg
= argv
[idx
]->arg
;
6515 else if (argv_find (argv
, argc
, "X:X::X:X", &idx
))
6517 clr_sort
= clear_peer
;
6518 clr_arg
= argv
[idx
]->arg
;
6520 else if (argv_find (argv
, argc
, "peer-group", &idx
))
6522 clr_sort
= clear_group
;
6524 clr_arg
= argv
[idx
]->arg
;
6526 else if (argv_find (argv
, argc
, "WORD", &idx
))
6528 clr_sort
= clear_peer
;
6529 clr_arg
= argv
[idx
]->arg
;
6531 else if (argv_find (argv
, argc
, "(1-4294967295)", &idx
))
6533 clr_sort
= clear_as
;
6534 clr_arg
= argv
[idx
]->arg
;
6536 else if (argv_find (argv
, argc
, "external", &idx
))
6538 clr_sort
= clear_external
;
6540 /* ["BGP_AFI_CMD_STR" ["BGP_SAFI_CMD_STR"]] */
6541 if (argv_find_and_parse_afi (argv
, argc
, &idx
, &afi
))
6543 argv_find_and_parse_safi (argv
, argc
, &idx
, &safi
);
6545 /* [<soft [<in|out>]|in [prefix-filter]|out>] */
6546 if (argv_find (argv
, argc
, "soft", &idx
))
6548 if (argv_find (argv
, argc
, "in", &idx
) || argv_find (argv
, argc
, "out", &idx
))
6549 clr_type
= strmatch (argv
[idx
]->text
, "in") ? BGP_CLEAR_SOFT_IN
: BGP_CLEAR_SOFT_OUT
;
6551 clr_type
= BGP_CLEAR_SOFT_BOTH
;
6553 else if (argv_find (argv
, argc
, "in", &idx
))
6555 clr_type
= argv_find (argv
, argc
, "prefix-filter", &idx
) ? BGP_CLEAR_SOFT_IN_ORF_PREFIX
: BGP_CLEAR_SOFT_IN
;
6557 else if (argv_find (argv
, argc
, "out", &idx
))
6559 clr_type
= BGP_CLEAR_SOFT_OUT
;
6562 clr_type
= BGP_CLEAR_SOFT_NONE
;
6564 return bgp_clear_vty (vty
, vrf
, afi
, safi
, clr_sort
, clr_type
, clr_arg
);
6567 DEFUN (clear_ip_bgp_prefix
,
6568 clear_ip_bgp_prefix_cmd
,
6569 "clear [ip] bgp [<view|vrf> VIEWVRFNAME] prefix A.B.C.D/M",
6573 BGP_INSTANCE_HELP_STR
6574 "Clear bestpath and re-advertise\n"
6578 char *prefix
= NULL
;
6582 /* [<view|vrf> VIEWVRFNAME] */
6583 if (argv_find (argv
, argc
, "WORD", &idx
))
6584 vrf
= argv
[idx
]->arg
;
6586 prefix
= argv
[argc
-1]->arg
;
6588 return bgp_clear_prefix (vty
, vrf
, prefix
, AFI_IP
, SAFI_UNICAST
, NULL
);
6591 DEFUN (clear_bgp_ipv6_safi_prefix
,
6592 clear_bgp_ipv6_safi_prefix_cmd
,
6593 "clear [ip] bgp ipv6 "BGP_SAFI_CMD_STR
" prefix X:X::X:X/M",
6599 "Clear bestpath and re-advertise\n"
6603 int idx_ipv6_prefixlen
= 5;
6604 return bgp_clear_prefix (vty
, NULL
, argv
[idx_ipv6_prefixlen
]->arg
, AFI_IP6
,
6605 bgp_vty_safi_from_arg(argv
[idx_safi
]->arg
), NULL
);
6608 DEFUN (clear_bgp_instance_ipv6_safi_prefix
,
6609 clear_bgp_instance_ipv6_safi_prefix_cmd
,
6610 "clear [ip] bgp <view|vrf> VIEWVRFNAME ipv6 "BGP_SAFI_CMD_STR
" prefix X:X::X:X/M",
6614 BGP_INSTANCE_HELP_STR
6617 "Clear bestpath and re-advertise\n"
6622 int idx_ipv6_prefixlen
= 7;
6623 return bgp_clear_prefix (vty
, argv
[idx_word
]->arg
, argv
[idx_ipv6_prefixlen
]->arg
, AFI_IP6
,
6624 bgp_vty_safi_from_arg(argv
[idx_safi
]->arg
), NULL
);
6627 DEFUN (show_bgp_views
,
6629 "show [ip] bgp views",
6633 "Show the defined BGP views\n")
6635 struct list
*inst
= bm
->bgp
;
6636 struct listnode
*node
;
6639 if (!bgp_option_check (BGP_OPT_MULTIPLE_INSTANCE
))
6641 vty_out (vty
, "BGP Multiple Instance is not enabled%s", VTY_NEWLINE
);
6645 vty_out (vty
, "Defined BGP views:%s", VTY_NEWLINE
);
6646 for (ALL_LIST_ELEMENTS_RO(inst
, node
, bgp
))
6649 if (bgp
->inst_type
== BGP_INSTANCE_TYPE_VRF
)
6651 vty_out (vty
, "\t%s (AS%u)%s",
6652 bgp
->name
? bgp
->name
: "(null)",
6653 bgp
->as
, VTY_NEWLINE
);
6659 DEFUN (show_bgp_vrfs
,
6661 "show [ip] bgp vrfs [json]",
6668 struct list
*inst
= bm
->bgp
;
6669 struct listnode
*node
;
6671 u_char uj
= use_json(argc
, argv
);
6672 json_object
*json
= NULL
;
6673 json_object
*json_vrfs
= NULL
;
6675 static char header
[] = "Type Id RouterId #PeersCfg #PeersEstb Name";
6677 if (!bgp_option_check (BGP_OPT_MULTIPLE_INSTANCE
))
6679 vty_out (vty
, "BGP Multiple Instance is not enabled%s", VTY_NEWLINE
);
6685 json
= json_object_new_object();
6686 json_vrfs
= json_object_new_object();
6689 for (ALL_LIST_ELEMENTS_RO(inst
, node
, bgp
))
6691 const char *name
, *type
;
6693 struct listnode
*node
, *nnode
;
6694 int peers_cfg
, peers_estb
;
6695 json_object
*json_vrf
= NULL
;
6699 if (bgp
->inst_type
== BGP_INSTANCE_TYPE_VIEW
)
6703 if (!uj
&& count
== 1)
6704 vty_out (vty
, "%s%s", header
, VTY_NEWLINE
);
6706 peers_cfg
= peers_estb
= 0;
6708 json_vrf
= json_object_new_object();
6711 for (ALL_LIST_ELEMENTS (bgp
->peer
, node
, nnode
, peer
))
6713 if (!CHECK_FLAG(peer
->flags
, PEER_FLAG_CONFIG_NODE
))
6716 if (peer
->status
== Established
)
6720 if (bgp
->inst_type
== BGP_INSTANCE_TYPE_DEFAULT
)
6731 vrf_id_ui
= (bgp
->vrf_id
== VRF_UNKNOWN
) ? -1 : bgp
->vrf_id
;
6734 json_object_string_add(json_vrf
, "type", type
);
6735 json_object_int_add(json_vrf
, "vrfId", vrf_id_ui
);
6736 json_object_string_add(json_vrf
, "routerId", inet_ntoa (bgp
->router_id
));
6737 json_object_int_add(json_vrf
, "numConfiguredPeers", peers_cfg
);
6738 json_object_int_add(json_vrf
, "numEstablishedPeers", peers_estb
);
6740 json_object_object_add(json_vrfs
, name
, json_vrf
);
6743 vty_out (vty
, "%4s %-5d %-16s %9u %10u %s%s",
6744 type
, vrf_id_ui
, inet_ntoa (bgp
->router_id
),
6745 peers_cfg
, peers_estb
, name
,
6751 json_object_object_add(json
, "vrfs", json_vrfs
);
6753 json_object_int_add(json
, "totalVrfs", count
);
6755 vty_out (vty
, "%s%s", json_object_to_json_string_ext(json
, JSON_C_TO_STRING_PRETTY
), VTY_NEWLINE
);
6756 json_object_free(json
);
6761 vty_out (vty
, "%sTotal number of VRFs (including default): %d%s",
6762 VTY_NEWLINE
, count
, VTY_NEWLINE
);
6768 DEFUN (show_bgp_memory
,
6769 show_bgp_memory_cmd
,
6770 "show [ip] bgp memory",
6774 "Global BGP memory statistics\n")
6776 char memstrbuf
[MTYPE_MEMSTR_LEN
];
6777 unsigned long count
;
6779 /* RIB related usage stats */
6780 count
= mtype_stats_alloc (MTYPE_BGP_NODE
);
6781 vty_out (vty
, "%ld RIB nodes, using %s of memory%s", count
,
6782 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6783 count
* sizeof (struct bgp_node
)),
6786 count
= mtype_stats_alloc (MTYPE_BGP_ROUTE
);
6787 vty_out (vty
, "%ld BGP routes, using %s of memory%s", count
,
6788 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6789 count
* sizeof (struct bgp_info
)),
6791 if ((count
= mtype_stats_alloc (MTYPE_BGP_ROUTE_EXTRA
)))
6792 vty_out (vty
, "%ld BGP route ancillaries, using %s of memory%s", count
,
6793 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6794 count
* sizeof (struct bgp_info_extra
)),
6797 if ((count
= mtype_stats_alloc (MTYPE_BGP_STATIC
)))
6798 vty_out (vty
, "%ld Static routes, using %s of memory%s", count
,
6799 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6800 count
* sizeof (struct bgp_static
)),
6803 if ((count
= mtype_stats_alloc (MTYPE_BGP_PACKET
)))
6804 vty_out (vty
, "%ld Packets, using %s of memory%s", count
,
6805 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6806 count
* sizeof (struct bpacket
)),
6810 if ((count
= mtype_stats_alloc (MTYPE_BGP_ADJ_IN
)))
6811 vty_out (vty
, "%ld Adj-In entries, using %s of memory%s", count
,
6812 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6813 count
* sizeof (struct bgp_adj_in
)),
6815 if ((count
= mtype_stats_alloc (MTYPE_BGP_ADJ_OUT
)))
6816 vty_out (vty
, "%ld Adj-Out entries, using %s of memory%s", count
,
6817 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6818 count
* sizeof (struct bgp_adj_out
)),
6821 if ((count
= mtype_stats_alloc (MTYPE_BGP_NEXTHOP_CACHE
)))
6822 vty_out (vty
, "%ld Nexthop cache entries, using %s of memory%s", count
,
6823 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6824 count
* sizeof (struct bgp_nexthop_cache
)),
6827 if ((count
= mtype_stats_alloc (MTYPE_BGP_DAMP_INFO
)))
6828 vty_out (vty
, "%ld Dampening entries, using %s of memory%s", count
,
6829 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6830 count
* sizeof (struct bgp_damp_info
)),
6834 count
= attr_count();
6835 vty_out (vty
, "%ld BGP attributes, using %s of memory%s", count
,
6836 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6837 count
* sizeof(struct attr
)),
6839 if ((count
= mtype_stats_alloc (MTYPE_ATTR_EXTRA
)))
6840 vty_out (vty
, "%ld BGP extra attributes, using %s of memory%s", count
,
6841 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6842 count
* sizeof(struct attr_extra
)),
6845 if ((count
= attr_unknown_count()))
6846 vty_out (vty
, "%ld unknown attributes%s", count
, VTY_NEWLINE
);
6848 /* AS_PATH attributes */
6849 count
= aspath_count ();
6850 vty_out (vty
, "%ld BGP AS-PATH entries, using %s of memory%s", count
,
6851 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6852 count
* sizeof (struct aspath
)),
6855 count
= mtype_stats_alloc (MTYPE_AS_SEG
);
6856 vty_out (vty
, "%ld BGP AS-PATH segments, using %s of memory%s", count
,
6857 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6858 count
* sizeof (struct assegment
)),
6861 /* Other attributes */
6862 if ((count
= community_count ()))
6863 vty_out (vty
, "%ld BGP community entries, using %s of memory%s", count
,
6864 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6865 count
* sizeof (struct community
)),
6867 if ((count
= mtype_stats_alloc (MTYPE_ECOMMUNITY
)))
6868 vty_out (vty
, "%ld BGP community entries, using %s of memory%s", count
,
6869 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6870 count
* sizeof (struct ecommunity
)),
6872 if ((count
= mtype_stats_alloc (MTYPE_LCOMMUNITY
)))
6873 vty_out (vty
, "%ld BGP large-community entries, using %s of memory%s",
6875 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6876 count
* sizeof (struct lcommunity
)),
6879 if ((count
= mtype_stats_alloc (MTYPE_CLUSTER
)))
6880 vty_out (vty
, "%ld Cluster lists, using %s of memory%s", count
,
6881 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6882 count
* sizeof (struct cluster_list
)),
6885 /* Peer related usage */
6886 count
= mtype_stats_alloc (MTYPE_BGP_PEER
);
6887 vty_out (vty
, "%ld peers, using %s of memory%s", count
,
6888 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6889 count
* sizeof (struct peer
)),
6892 if ((count
= mtype_stats_alloc (MTYPE_PEER_GROUP
)))
6893 vty_out (vty
, "%ld peer groups, using %s of memory%s", count
,
6894 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6895 count
* sizeof (struct peer_group
)),
6899 if ((count
= mtype_stats_alloc (MTYPE_HASH
)))
6900 vty_out (vty
, "%ld hash tables, using %s of memory%s", count
,
6901 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6902 count
* sizeof (struct hash
)),
6904 if ((count
= mtype_stats_alloc (MTYPE_HASH_BACKET
)))
6905 vty_out (vty
, "%ld hash buckets, using %s of memory%s", count
,
6906 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6907 count
* sizeof (struct hash_backet
)),
6909 if ((count
= mtype_stats_alloc (MTYPE_BGP_REGEXP
)))
6910 vty_out (vty
, "%ld compiled regexes, using %s of memory%s", count
,
6911 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6912 count
* sizeof (regex_t
)),
6917 /* Show BGP peer's summary information. */
6919 bgp_show_summary (struct vty
*vty
, struct bgp
*bgp
, int afi
, int safi
,
6920 u_char use_json
, json_object
*json
)
6923 struct listnode
*node
, *nnode
;
6924 unsigned int count
= 0, dn_count
= 0;
6925 char timebuf
[BGP_UPTIME_LEN
], dn_flag
[2];
6926 char neighbor_buf
[VTY_BUFSIZ
];
6927 int neighbor_col_default_width
= 16;
6929 int max_neighbor_width
= 0;
6930 json_object
*json_peer
= NULL
;
6931 json_object
*json_peers
= NULL
;
6936 json
= json_object_new_object();
6938 json_peers
= json_object_new_object();
6942 /* Loop over all neighbors that will be displayed to determine how many
6943 * characters are needed for the Neighbor column
6945 for (ALL_LIST_ELEMENTS (bgp
->peer
, node
, nnode
, peer
))
6947 if (!CHECK_FLAG(peer
->flags
, PEER_FLAG_CONFIG_NODE
))
6950 if (peer
->afc
[afi
][safi
])
6952 memset(dn_flag
, '\0', sizeof(dn_flag
));
6953 if (peer_dynamic_neighbor(peer
))
6956 if (peer
->hostname
&& bgp_flag_check(bgp
, BGP_FLAG_SHOW_HOSTNAME
))
6957 sprintf(neighbor_buf
, "%s%s(%s) ", dn_flag
, peer
->hostname
, peer
->host
);
6959 sprintf(neighbor_buf
, "%s%s ", dn_flag
, peer
->host
);
6961 len
= strlen(neighbor_buf
);
6963 if (len
> max_neighbor_width
)
6964 max_neighbor_width
= len
;
6968 /* Originally we displayed the Neighbor column as 16
6969 * characters wide so make that the default
6971 if (max_neighbor_width
< neighbor_col_default_width
)
6972 max_neighbor_width
= neighbor_col_default_width
;
6975 for (ALL_LIST_ELEMENTS (bgp
->peer
, node
, nnode
, peer
))
6977 if (!CHECK_FLAG(peer
->flags
, PEER_FLAG_CONFIG_NODE
))
6980 if (peer
->afc
[afi
][safi
])
6985 char memstrbuf
[MTYPE_MEMSTR_LEN
];
6988 vrf_id_ui
= (bgp
->vrf_id
== VRF_UNKNOWN
) ? -1 : bgp
->vrf_id
;
6990 /* Usage summary and header */
6993 json_object_string_add(json
, "routerId", inet_ntoa (bgp
->router_id
));
6994 json_object_int_add(json
, "as", bgp
->as
);
6995 json_object_int_add(json
, "vrfId", vrf_id_ui
);
6996 json_object_string_add(json
, "vrfName",
6997 (bgp
->inst_type
== BGP_INSTANCE_TYPE_DEFAULT
)
6998 ? "Default" : bgp
->name
);
7003 "BGP router identifier %s, local AS number %u vrf-id %d",
7004 inet_ntoa (bgp
->router_id
), bgp
->as
, vrf_id_ui
);
7005 vty_out (vty
, "%s", VTY_NEWLINE
);
7008 if (bgp_update_delay_configured(bgp
))
7012 json_object_int_add(json
, "updateDelayLimit", bgp
->v_update_delay
);
7014 if (bgp
->v_update_delay
!= bgp
->v_establish_wait
)
7015 json_object_int_add(json
, "updateDelayEstablishWait", bgp
->v_establish_wait
);
7017 if (bgp_update_delay_active(bgp
))
7019 json_object_string_add(json
, "updateDelayFirstNeighbor", bgp
->update_delay_begin_time
);
7020 json_object_boolean_true_add(json
, "updateDelayInProgress");
7024 if (bgp
->update_delay_over
)
7026 json_object_string_add(json
, "updateDelayFirstNeighbor",
7027 bgp
->update_delay_begin_time
);
7028 json_object_string_add(json
, "updateDelayBestpathResumed",
7029 bgp
->update_delay_end_time
);
7030 json_object_string_add(json
, "updateDelayZebraUpdateResume",
7031 bgp
->update_delay_zebra_resume_time
);
7032 json_object_string_add(json
, "updateDelayPeerUpdateResume",
7033 bgp
->update_delay_peers_resume_time
);
7039 vty_out (vty
, "Read-only mode update-delay limit: %d seconds%s",
7040 bgp
->v_update_delay
, VTY_NEWLINE
);
7041 if (bgp
->v_update_delay
!= bgp
->v_establish_wait
)
7042 vty_out (vty
, " Establish wait: %d seconds%s",
7043 bgp
->v_establish_wait
, VTY_NEWLINE
);
7045 if (bgp_update_delay_active(bgp
))
7047 vty_out (vty
, " First neighbor established: %s%s",
7048 bgp
->update_delay_begin_time
, VTY_NEWLINE
);
7049 vty_out (vty
, " Delay in progress%s", VTY_NEWLINE
);
7053 if (bgp
->update_delay_over
)
7055 vty_out (vty
, " First neighbor established: %s%s",
7056 bgp
->update_delay_begin_time
, VTY_NEWLINE
);
7057 vty_out (vty
, " Best-paths resumed: %s%s",
7058 bgp
->update_delay_end_time
, VTY_NEWLINE
);
7059 vty_out (vty
, " zebra update resumed: %s%s",
7060 bgp
->update_delay_zebra_resume_time
, VTY_NEWLINE
);
7061 vty_out (vty
, " peers update resumed: %s%s",
7062 bgp
->update_delay_peers_resume_time
, VTY_NEWLINE
);
7070 if (bgp_maxmed_onstartup_configured(bgp
) && bgp
->maxmed_active
)
7071 json_object_boolean_true_add(json
, "maxMedOnStartup");
7072 if (bgp
->v_maxmed_admin
)
7073 json_object_boolean_true_add(json
, "maxMedAdministrative");
7075 json_object_int_add(json
, "tableVersion", bgp_table_version(bgp
->rib
[afi
][safi
]));
7077 ents
= bgp_table_count (bgp
->rib
[afi
][safi
]);
7078 json_object_int_add(json
, "ribCount", ents
);
7079 json_object_int_add(json
, "ribMemory", ents
* sizeof (struct bgp_node
));
7081 ents
= listcount (bgp
->peer
);
7082 json_object_int_add(json
, "peerCount", ents
);
7083 json_object_int_add(json
, "peerMemory", ents
* sizeof (struct peer
));
7085 if ((ents
= listcount (bgp
->group
)))
7087 json_object_int_add(json
, "peerGroupCount", ents
);
7088 json_object_int_add(json
, "peerGroupMemory", ents
* sizeof (struct peer_group
));
7091 if (CHECK_FLAG (bgp
->af_flags
[afi
][safi
], BGP_CONFIG_DAMPENING
))
7092 json_object_boolean_true_add(json
, "dampeningEnabled");
7096 if (bgp_maxmed_onstartup_configured(bgp
) && bgp
->maxmed_active
)
7097 vty_out (vty
, "Max-med on-startup active%s", VTY_NEWLINE
);
7098 if (bgp
->v_maxmed_admin
)
7099 vty_out (vty
, "Max-med administrative active%s", VTY_NEWLINE
);
7101 vty_out(vty
, "BGP table version %" PRIu64
"%s",
7102 bgp_table_version(bgp
->rib
[afi
][safi
]), VTY_NEWLINE
);
7104 ents
= bgp_table_count (bgp
->rib
[afi
][safi
]);
7105 vty_out (vty
, "RIB entries %ld, using %s of memory%s", ents
,
7106 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
7107 ents
* sizeof (struct bgp_node
)),
7110 /* Peer related usage */
7111 ents
= listcount (bgp
->peer
);
7112 vty_out (vty
, "Peers %ld, using %s of memory%s",
7114 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
7115 ents
* sizeof (struct peer
)),
7118 if ((ents
= listcount (bgp
->group
)))
7119 vty_out (vty
, "Peer groups %ld, using %s of memory%s", ents
,
7120 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
7121 ents
* sizeof (struct peer_group
)),
7124 if (CHECK_FLAG (bgp
->af_flags
[afi
][safi
], BGP_CONFIG_DAMPENING
))
7125 vty_out (vty
, "Dampening enabled.%s", VTY_NEWLINE
);
7126 vty_out (vty
, "%s", VTY_NEWLINE
);
7128 /* Subtract 8 here because 'Neighbor' is 8 characters */
7129 vty_out (vty
, "Neighbor");
7130 vty_out (vty
, "%*s", max_neighbor_width
- 8, " ");
7131 vty_out (vty
, "V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd%s", VTY_NEWLINE
);
7139 json_peer
= json_object_new_object();
7141 if (peer_dynamic_neighbor(peer
))
7142 json_object_boolean_true_add(json_peer
, "dynamicPeer");
7145 json_object_string_add(json_peer
, "hostname", peer
->hostname
);
7147 if (peer
->domainname
)
7148 json_object_string_add(json_peer
, "domainname", peer
->domainname
);
7150 json_object_int_add(json_peer
, "remoteAs", peer
->as
);
7151 json_object_int_add(json_peer
, "version", 4);
7152 json_object_int_add(json_peer
, "msgRcvd",
7153 peer
->open_in
+ peer
->update_in
+ peer
->keepalive_in
7154 + peer
->notify_in
+ peer
->refresh_in
7155 + peer
->dynamic_cap_in
);
7156 json_object_int_add(json_peer
, "msgSent",
7157 peer
->open_out
+ peer
->update_out
+ peer
->keepalive_out
7158 + peer
->notify_out
+ peer
->refresh_out
7159 + peer
->dynamic_cap_out
);
7161 json_object_int_add(json_peer
, "tableVersion", peer
->version
[afi
][safi
]);
7162 json_object_int_add(json_peer
, "outq", peer
->obuf
->count
);
7163 json_object_int_add(json_peer
, "inq", 0);
7164 peer_uptime (peer
->uptime
, timebuf
, BGP_UPTIME_LEN
, use_json
, json_peer
);
7165 json_object_int_add(json_peer
, "prefixReceivedCount", peer
->pcount
[afi
][safi
]);
7167 if (CHECK_FLAG (peer
->flags
, PEER_FLAG_SHUTDOWN
))
7168 json_object_string_add(json_peer
, "state", "Idle (Admin)");
7169 else if (CHECK_FLAG (peer
->sflags
, PEER_STATUS_PREFIX_OVERFLOW
))
7170 json_object_string_add(json_peer
, "state", "Idle (PfxCt)");
7172 json_object_string_add(json_peer
, "state", lookup_msg(bgp_status_msg
, peer
->status
, NULL
));
7175 json_object_string_add(json_peer
, "idType", "interface");
7176 else if (peer
->su
.sa
.sa_family
== AF_INET
)
7177 json_object_string_add(json_peer
, "idType", "ipv4");
7178 else if (peer
->su
.sa
.sa_family
== AF_INET6
)
7179 json_object_string_add(json_peer
, "idType", "ipv6");
7181 json_object_object_add(json_peers
, peer
->host
, json_peer
);
7185 memset(dn_flag
, '\0', sizeof(dn_flag
));
7186 if (peer_dynamic_neighbor(peer
))
7192 if (peer
->hostname
&& bgp_flag_check(bgp
, BGP_FLAG_SHOW_HOSTNAME
))
7193 len
= vty_out (vty
, "%s%s(%s)", dn_flag
, peer
->hostname
,
7196 len
= vty_out (vty
, "%s%s", dn_flag
, peer
->host
);
7198 /* pad the neighbor column with spaces */
7199 if (len
< max_neighbor_width
)
7200 vty_out (vty
, "%*s", max_neighbor_width
- len
, " ");
7202 vty_out (vty
, "4 %10u %7d %7d %8" PRIu64
" %4d %4zd %8s",
7204 peer
->open_in
+ peer
->update_in
+ peer
->keepalive_in
7205 + peer
->notify_in
+ peer
->refresh_in
7206 + peer
->dynamic_cap_in
,
7207 peer
->open_out
+ peer
->update_out
+ peer
->keepalive_out
7208 + peer
->notify_out
+ peer
->refresh_out
7209 + peer
->dynamic_cap_out
,
7210 peer
->version
[afi
][safi
],
7213 peer_uptime (peer
->uptime
, timebuf
, BGP_UPTIME_LEN
, 0, NULL
));
7215 if (peer
->status
== Established
)
7216 vty_out (vty
, " %12ld", peer
->pcount
[afi
][safi
]);
7219 if (CHECK_FLAG (peer
->flags
, PEER_FLAG_SHUTDOWN
))
7220 vty_out (vty
, " Idle (Admin)");
7221 else if (CHECK_FLAG (peer
->sflags
, PEER_STATUS_PREFIX_OVERFLOW
))
7222 vty_out (vty
, " Idle (PfxCt)");
7224 vty_out (vty
, " %12s", lookup_msg(bgp_status_msg
, peer
->status
, NULL
));
7226 vty_out (vty
, "%s", VTY_NEWLINE
);
7233 json_object_object_add(json
, "peers", json_peers
);
7235 json_object_int_add(json
, "totalPeers", count
);
7236 json_object_int_add(json
, "dynamicPeers", dn_count
);
7238 vty_out (vty
, "%s%s", json_object_to_json_string_ext(json
, JSON_C_TO_STRING_PRETTY
), VTY_NEWLINE
);
7239 json_object_free(json
);
7244 vty_out (vty
, "%sTotal number of neighbors %d%s", VTY_NEWLINE
,
7245 count
, VTY_NEWLINE
);
7249 vty_out(vty
, "{\"error\": {\"message\": \"No %s neighbor configured\"}}%s",
7250 afi_safi_print(afi
, safi
), VTY_NEWLINE
);
7252 vty_out (vty
, "No %s neighbor is configured%s",
7253 afi_safi_print(afi
, safi
), VTY_NEWLINE
);
7256 if (dn_count
&& ! use_json
)
7258 vty_out(vty
, "* - dynamic neighbor%s", VTY_NEWLINE
);
7260 "%d dynamic neighbor(s), limit %d%s",
7261 dn_count
, bgp
->dynamic_neighbors_limit
, VTY_NEWLINE
);
7269 * Return if we have a peer configured to use this afi/safi
7272 bgp_show_summary_afi_safi_peer_exists (struct bgp
*bgp
, int afi
, int safi
)
7274 struct listnode
*node
;
7277 for (ALL_LIST_ELEMENTS_RO (bgp
->peer
, node
, peer
))
7279 if (!CHECK_FLAG (peer
->flags
, PEER_FLAG_CONFIG_NODE
))
7282 if (peer
->afc
[afi
][safi
])
7290 bgp_show_summary_afi_safi (struct vty
*vty
, struct bgp
*bgp
, int afi
, int safi
,
7291 u_char use_json
, json_object
*json
)
7294 int afi_wildcard
= (afi
== AFI_MAX
);
7295 int safi_wildcard
= (safi
== SAFI_MAX
);
7296 int is_wildcard
= (afi_wildcard
|| safi_wildcard
);
7297 bool json_output
= false;
7299 if (use_json
&& is_wildcard
)
7300 vty_out (vty
, "{%s", VTY_NEWLINE
);
7302 afi
= 1; /* AFI_IP */
7303 while (afi
< AFI_MAX
)
7306 safi
= 1; /* SAFI_UNICAST */
7307 while (safi
< SAFI_MAX
)
7309 if (bgp_show_summary_afi_safi_peer_exists (bgp
, afi
, safi
))
7315 * So limit output to those afi/safi pairs that
7316 * actualy have something interesting in them
7320 json
= json_object_new_object();
7323 vty_out (vty
, ",%s", VTY_NEWLINE
);
7327 vty_out(vty
, "\"%s\":", afi_safi_json(afi
, safi
));
7331 vty_out (vty
, "%s%s Summary:%s",
7332 VTY_NEWLINE
, afi_safi_print(afi
, safi
), VTY_NEWLINE
);
7335 bgp_show_summary (vty
, bgp
, afi
, safi
, use_json
, json
);
7338 if (safi
== SAFI_RESERVED_4
||
7339 safi
== SAFI_RESERVED_5
) /* handle special cases to match zebra.h */
7341 if (! safi_wildcard
)
7345 if (! afi_wildcard
||
7346 afi
== AFI_L2VPN
) /* special case, not handled yet */
7350 if (use_json
&& is_wildcard
)
7351 vty_out (vty
, "}%s", VTY_NEWLINE
);
7352 else if (use_json
&& !json_output
)
7353 vty_out (vty
, "{}%s", VTY_NEWLINE
);
7357 bgp_show_all_instances_summary_vty (struct vty
*vty
, afi_t afi
, safi_t safi
,
7360 struct listnode
*node
, *nnode
;
7362 json_object
*json
= NULL
;
7366 vty_out (vty
, "{%s", VTY_NEWLINE
);
7368 for (ALL_LIST_ELEMENTS (bm
->bgp
, node
, nnode
, bgp
))
7372 json
= json_object_new_object();
7375 vty_out (vty
, ",%s", VTY_NEWLINE
);
7379 vty_out(vty
, "\"%s\":", (bgp
->inst_type
== BGP_INSTANCE_TYPE_DEFAULT
)
7380 ? "Default" : bgp
->name
);
7384 vty_out (vty
, "%sInstance %s:%s",
7386 (bgp
->inst_type
== BGP_INSTANCE_TYPE_DEFAULT
)
7387 ? "Default" : bgp
->name
, VTY_NEWLINE
);
7389 bgp_show_summary_afi_safi (vty
, bgp
, afi
, safi
, use_json
, json
);
7393 vty_out (vty
, "}%s", VTY_NEWLINE
);
7398 bgp_show_summary_vty (struct vty
*vty
, const char *name
,
7399 afi_t afi
, safi_t safi
, u_char use_json
)
7405 if (strmatch(name
, "all"))
7407 bgp_show_all_instances_summary_vty (vty
, afi
, safi
, use_json
);
7412 bgp
= bgp_lookup_by_name (name
);
7417 vty_out (vty
, "{}%s", VTY_NEWLINE
);
7419 vty_out (vty
, "%% No such BGP instance exist%s", VTY_NEWLINE
);
7423 bgp_show_summary_afi_safi (vty
, bgp
, afi
, safi
, use_json
, NULL
);
7428 bgp
= bgp_get_default ();
7431 bgp_show_summary_afi_safi (vty
, bgp
, afi
, safi
, use_json
, NULL
);
7436 /* `show [ip] bgp summary' commands. */
7437 DEFUN (show_ip_bgp_summary
,
7438 show_ip_bgp_summary_cmd
,
7439 "show [ip] bgp [<view|vrf> VIEWVRFNAME] ["BGP_AFI_CMD_STR
" ["BGP_SAFI_CMD_STR
"]] summary [json]",
7443 BGP_INSTANCE_HELP_STR
7446 "Summary of BGP neighbor status\n"
7450 afi_t afi
= AFI_MAX
;
7451 safi_t safi
= SAFI_MAX
;
7456 if (argv_find (argv
, argc
, "ip", &idx
))
7458 /* [<view|vrf> VIEWVRFNAME] */
7459 if (argv_find (argv
, argc
, "view", &idx
) || argv_find (argv
, argc
, "vrf", &idx
))
7460 vrf
= argv
[++idx
]->arg
;
7461 /* ["BGP_AFI_CMD_STR" ["BGP_SAFI_CMD_STR"]] */
7462 if (argv_find_and_parse_afi (argv
, argc
, &idx
, &afi
))
7464 argv_find_and_parse_safi (argv
, argc
, &idx
, &safi
);
7467 int uj
= use_json (argc
, argv
);
7469 return bgp_show_summary_vty (vty
, vrf
, afi
, safi
, uj
);
7473 afi_safi_print (afi_t afi
, safi_t safi
)
7475 if (afi
== AFI_IP
&& safi
== SAFI_UNICAST
)
7476 return "IPv4 Unicast";
7477 else if (afi
== AFI_IP
&& safi
== SAFI_MULTICAST
)
7478 return "IPv4 Multicast";
7479 else if (afi
== AFI_IP
&& safi
== SAFI_LABELED_UNICAST
)
7480 return "IPv4 labeled-unicast";
7481 else if (afi
== AFI_IP
&& safi
== SAFI_MPLS_VPN
)
7483 else if (afi
== AFI_IP
&& safi
== SAFI_ENCAP
)
7484 return "IPv4 Encap";
7485 else if (afi
== AFI_IP6
&& safi
== SAFI_UNICAST
)
7486 return "IPv6 Unicast";
7487 else if (afi
== AFI_IP6
&& safi
== SAFI_MULTICAST
)
7488 return "IPv6 Multicast";
7489 else if (afi
== AFI_IP6
&& safi
== SAFI_LABELED_UNICAST
)
7490 return "IPv6 labeled-unicast";
7491 else if (afi
== AFI_IP6
&& safi
== SAFI_MPLS_VPN
)
7493 else if (afi
== AFI_IP6
&& safi
== SAFI_ENCAP
)
7494 return "IPv6 Encap";
7495 else if (afi
== AFI_L2VPN
&& safi
== SAFI_EVPN
)
7496 return "L2VPN EVPN";
7502 * Please note that we have intentionally camelCased
7503 * the return strings here. So if you want
7504 * to use this function, please ensure you
7505 * are doing this within json output
7508 afi_safi_json (afi_t afi
, safi_t safi
)
7510 if (afi
== AFI_IP
&& safi
== SAFI_UNICAST
)
7511 return "ipv4Unicast";
7512 else if (afi
== AFI_IP
&& safi
== SAFI_MULTICAST
)
7513 return "ipv4Multicast";
7514 else if (afi
== AFI_IP
&& safi
== SAFI_LABELED_UNICAST
)
7515 return "ipv4LabeledUnicast";
7516 else if (afi
== AFI_IP
&& safi
== SAFI_MPLS_VPN
)
7518 else if (afi
== AFI_IP
&& safi
== SAFI_ENCAP
)
7520 else if (afi
== AFI_IP6
&& safi
== SAFI_UNICAST
)
7521 return "ipv6Unicast";
7522 else if (afi
== AFI_IP6
&& safi
== SAFI_MULTICAST
)
7523 return "ipv6Multicast";
7524 else if (afi
== AFI_IP6
&& safi
== SAFI_LABELED_UNICAST
)
7525 return "ipv6LabeledUnicast";
7526 else if (afi
== AFI_IP6
&& safi
== SAFI_MPLS_VPN
)
7528 else if (afi
== AFI_IP6
&& safi
== SAFI_ENCAP
)
7530 else if (afi
== AFI_L2VPN
&& safi
== SAFI_EVPN
)
7536 /* Show BGP peer's information. */
7544 bgp_show_peer_afi_orf_cap (struct vty
*vty
, struct peer
*p
, afi_t afi
, safi_t safi
,
7545 u_int16_t adv_smcap
, u_int16_t adv_rmcap
, u_int16_t rcv_smcap
,
7546 u_int16_t rcv_rmcap
, u_char use_json
, json_object
*json_pref
)
7549 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], adv_smcap
)
7550 || CHECK_FLAG (p
->af_cap
[afi
][safi
], rcv_smcap
))
7554 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], adv_smcap
) && CHECK_FLAG (p
->af_cap
[afi
][safi
], rcv_smcap
))
7555 json_object_string_add(json_pref
, "sendMode", "advertisedAndReceived");
7556 else if (CHECK_FLAG (p
->af_cap
[afi
][safi
], adv_smcap
))
7557 json_object_string_add(json_pref
, "sendMode", "advertised");
7558 else if (CHECK_FLAG (p
->af_cap
[afi
][safi
], rcv_smcap
))
7559 json_object_string_add(json_pref
, "sendMode", "received");
7563 vty_out (vty
, " Send-mode: ");
7564 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], adv_smcap
))
7565 vty_out (vty
, "advertised");
7566 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], rcv_smcap
))
7567 vty_out (vty
, "%sreceived",
7568 CHECK_FLAG (p
->af_cap
[afi
][safi
], adv_smcap
) ?
7570 vty_out (vty
, "%s", VTY_NEWLINE
);
7575 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], adv_rmcap
)
7576 || CHECK_FLAG (p
->af_cap
[afi
][safi
], rcv_rmcap
))
7580 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], adv_rmcap
) && CHECK_FLAG (p
->af_cap
[afi
][safi
], rcv_rmcap
))
7581 json_object_string_add(json_pref
, "recvMode", "advertisedAndReceived");
7582 else if (CHECK_FLAG (p
->af_cap
[afi
][safi
], adv_rmcap
))
7583 json_object_string_add(json_pref
, "recvMode", "advertised");
7584 else if (CHECK_FLAG (p
->af_cap
[afi
][safi
], rcv_rmcap
))
7585 json_object_string_add(json_pref
, "recvMode", "received");
7589 vty_out (vty
, " Receive-mode: ");
7590 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], adv_rmcap
))
7591 vty_out (vty
, "advertised");
7592 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], rcv_rmcap
))
7593 vty_out (vty
, "%sreceived",
7594 CHECK_FLAG (p
->af_cap
[afi
][safi
], adv_rmcap
) ?
7596 vty_out (vty
, "%s", VTY_NEWLINE
);
7602 bgp_show_peer_afi (struct vty
*vty
, struct peer
*p
, afi_t afi
, safi_t safi
,
7603 u_char use_json
, json_object
*json_neigh
)
7605 struct bgp_filter
*filter
;
7606 struct peer_af
*paf
;
7607 char orf_pfx_name
[BUFSIZ
];
7609 json_object
*json_af
= NULL
;
7610 json_object
*json_prefA
= NULL
;
7611 json_object
*json_prefB
= NULL
;
7612 json_object
*json_addr
= NULL
;
7616 json_addr
= json_object_new_object();
7617 json_af
= json_object_new_object();
7618 filter
= &p
->filter
[afi
][safi
];
7620 if (peer_group_active(p
))
7621 json_object_string_add(json_addr
, "peerGroupMember", p
->group
->name
);
7623 paf
= peer_af_find(p
, afi
, safi
);
7624 if (paf
&& PAF_SUBGRP(paf
))
7626 json_object_int_add(json_addr
, "updateGroupId", PAF_UPDGRP(paf
)->id
);
7627 json_object_int_add(json_addr
, "subGroupId", PAF_SUBGRP(paf
)->id
);
7628 json_object_int_add(json_addr
, "packetQueueLength", bpacket_queue_virtual_length(paf
));
7631 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_ADV
)
7632 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_RCV
)
7633 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_ADV
)
7634 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_RCV
))
7636 json_object_int_add(json_af
, "orfType", ORF_TYPE_PREFIX
);
7637 json_prefA
= json_object_new_object();
7638 bgp_show_peer_afi_orf_cap (vty
, p
, afi
, safi
,
7639 PEER_CAP_ORF_PREFIX_SM_ADV
,
7640 PEER_CAP_ORF_PREFIX_RM_ADV
,
7641 PEER_CAP_ORF_PREFIX_SM_RCV
,
7642 PEER_CAP_ORF_PREFIX_RM_RCV
, use_json
, json_prefA
);
7643 json_object_object_add(json_af
, "orfPrefixList", json_prefA
);
7646 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_ADV
)
7647 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_OLD_RCV
)
7648 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_ADV
)
7649 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_OLD_RCV
))
7651 json_object_int_add(json_af
, "orfOldType", ORF_TYPE_PREFIX_OLD
);
7652 json_prefB
= json_object_new_object();
7653 bgp_show_peer_afi_orf_cap (vty
, p
, afi
, safi
,
7654 PEER_CAP_ORF_PREFIX_SM_ADV
,
7655 PEER_CAP_ORF_PREFIX_RM_ADV
,
7656 PEER_CAP_ORF_PREFIX_SM_OLD_RCV
,
7657 PEER_CAP_ORF_PREFIX_RM_OLD_RCV
, use_json
, json_prefB
);
7658 json_object_object_add(json_af
, "orfOldPrefixList", json_prefB
);
7661 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_ADV
)
7662 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_RCV
)
7663 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_OLD_RCV
)
7664 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_ADV
)
7665 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_RCV
)
7666 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_OLD_RCV
))
7667 json_object_object_add(json_addr
, "afDependentCap", json_af
);
7669 json_object_free(json_af
);
7671 sprintf (orf_pfx_name
, "%s.%d.%d", p
->host
, afi
, safi
);
7672 orf_pfx_count
= prefix_bgp_show_prefix_list (NULL
, afi
, orf_pfx_name
, use_json
);
7674 if (CHECK_FLAG (p
->af_sflags
[afi
][safi
], PEER_STATUS_ORF_PREFIX_SEND
)
7677 if (CHECK_FLAG (p
->af_sflags
[afi
][safi
], PEER_STATUS_ORF_PREFIX_SEND
))
7678 json_object_boolean_true_add(json_neigh
, "orfSent");
7680 json_object_int_add(json_addr
, "orfRecvCounter", orf_pfx_count
);
7682 if (CHECK_FLAG (p
->af_sflags
[afi
][safi
], PEER_STATUS_ORF_WAIT_REFRESH
))
7683 json_object_string_add(json_addr
, "orfFirstUpdate", "deferredUntilORFOrRouteRefreshRecvd");
7685 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_REFLECTOR_CLIENT
))
7686 json_object_boolean_true_add(json_addr
, "routeReflectorClient");
7687 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_RSERVER_CLIENT
))
7688 json_object_boolean_true_add(json_addr
, "routeServerClient");
7689 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_SOFT_RECONFIG
))
7690 json_object_boolean_true_add(json_addr
, "inboundSoftConfigPermit");
7692 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE
))
7693 json_object_boolean_true_add(json_addr
, "privateAsNumsAllReplacedInUpdatesToNbr");
7694 else if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE
))
7695 json_object_boolean_true_add(json_addr
, "privateAsNumsReplacedInUpdatesToNbr");
7696 else if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_REMOVE_PRIVATE_AS_ALL
))
7697 json_object_boolean_true_add(json_addr
, "privateAsNumsAllRemovedInUpdatesToNbr");
7698 else if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_REMOVE_PRIVATE_AS
))
7699 json_object_boolean_true_add(json_addr
, "privateAsNumsRemovedInUpdatesToNbr");
7701 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_ADDPATH_TX_ALL_PATHS
))
7702 json_object_boolean_true_add(json_addr
, "addpathTxAllPaths");
7704 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_ADDPATH_TX_BESTPATH_PER_AS
))
7705 json_object_boolean_true_add(json_addr
, "addpathTxBestpathPerAS");
7707 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_AS_OVERRIDE
))
7708 json_object_string_add(json_addr
, "overrideASNsInOutboundUpdates", "ifAspathEqualRemoteAs");
7710 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_NEXTHOP_SELF
) ||
7711 CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_FORCE_NEXTHOP_SELF
))
7712 json_object_boolean_true_add(json_addr
, "routerAlwaysNextHop");
7713 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_AS_PATH_UNCHANGED
))
7714 json_object_boolean_true_add(json_addr
, "unchangedAsPathPropogatedToNbr");
7715 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_NEXTHOP_UNCHANGED
))
7716 json_object_boolean_true_add(json_addr
, "unchangedNextHopPropogatedToNbr");
7717 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_MED_UNCHANGED
))
7718 json_object_boolean_true_add(json_addr
, "unchangedMedPropogatedToNbr");
7719 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_SEND_COMMUNITY
)
7720 || CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_SEND_EXT_COMMUNITY
))
7722 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_SEND_COMMUNITY
)
7723 && CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_SEND_EXT_COMMUNITY
))
7724 json_object_string_add(json_addr
, "commAttriSentToNbr", "extendedAndStandard");
7725 else if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_SEND_EXT_COMMUNITY
))
7726 json_object_string_add(json_addr
, "commAttriSentToNbr", "extended");
7728 json_object_string_add(json_addr
, "commAttriSentToNbr", "standard");
7730 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_DEFAULT_ORIGINATE
))
7732 if (p
->default_rmap
[afi
][safi
].name
)
7733 json_object_string_add(json_addr
, "defaultRouteMap", p
->default_rmap
[afi
][safi
].name
);
7735 if (paf
&& PAF_SUBGRP(paf
) && CHECK_FLAG(PAF_SUBGRP(paf
)->sflags
, SUBGRP_STATUS_DEFAULT_ORIGINATE
))
7736 json_object_boolean_true_add(json_addr
, "defaultSent");
7738 json_object_boolean_true_add(json_addr
, "defaultNotSent");
7741 if (filter
->plist
[FILTER_IN
].name
7742 || filter
->dlist
[FILTER_IN
].name
7743 || filter
->aslist
[FILTER_IN
].name
7744 || filter
->map
[RMAP_IN
].name
)
7745 json_object_boolean_true_add(json_addr
, "inboundPathPolicyConfig");
7746 if (filter
->plist
[FILTER_OUT
].name
7747 || filter
->dlist
[FILTER_OUT
].name
7748 || filter
->aslist
[FILTER_OUT
].name
7749 || filter
->map
[RMAP_OUT
].name
7750 || filter
->usmap
.name
)
7751 json_object_boolean_true_add(json_addr
, "outboundPathPolicyConfig");
7754 if (filter
->plist
[FILTER_IN
].name
)
7755 json_object_string_add(json_addr
, "incomingUpdatePrefixFilterList", filter
->plist
[FILTER_IN
].name
);
7756 if (filter
->plist
[FILTER_OUT
].name
)
7757 json_object_string_add(json_addr
, "outgoingUpdatePrefixFilterList", filter
->plist
[FILTER_OUT
].name
);
7759 /* distribute-list */
7760 if (filter
->dlist
[FILTER_IN
].name
)
7761 json_object_string_add(json_addr
, "incomingUpdateNetworkFilterList", filter
->dlist
[FILTER_IN
].name
);
7762 if (filter
->dlist
[FILTER_OUT
].name
)
7763 json_object_string_add(json_addr
, "outgoingUpdateNetworkFilterList", filter
->dlist
[FILTER_OUT
].name
);
7766 if (filter
->aslist
[FILTER_IN
].name
)
7767 json_object_string_add(json_addr
, "incomingUpdateAsPathFilterList", filter
->aslist
[FILTER_IN
].name
);
7768 if (filter
->aslist
[FILTER_OUT
].name
)
7769 json_object_string_add(json_addr
, "outgoingUpdateAsPathFilterList", filter
->aslist
[FILTER_OUT
].name
);
7772 if (filter
->map
[RMAP_IN
].name
)
7773 json_object_string_add(json_addr
, "routeMapForIncomingAdvertisements", filter
->map
[RMAP_IN
].name
);
7774 if (filter
->map
[RMAP_OUT
].name
)
7775 json_object_string_add(json_addr
, "routeMapForOutgoingAdvertisements", filter
->map
[RMAP_OUT
].name
);
7777 /* unsuppress-map */
7778 if (filter
->usmap
.name
)
7779 json_object_string_add(json_addr
, "selectiveUnsuppressRouteMap", filter
->usmap
.name
);
7781 /* Receive prefix count */
7782 json_object_int_add(json_addr
, "acceptedPrefixCounter", p
->pcount
[afi
][safi
]);
7784 /* Maximum prefix */
7785 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_MAX_PREFIX
))
7787 json_object_int_add(json_addr
, "prefixAllowedMax", p
->pmax
[afi
][safi
]);
7788 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_MAX_PREFIX_WARNING
))
7789 json_object_boolean_true_add(json_addr
, "prefixAllowedMaxWarning");
7790 json_object_int_add(json_addr
, "prefixAllowedWarningThresh", p
->pmax_threshold
[afi
][safi
]);
7791 if (p
->pmax_restart
[afi
][safi
])
7792 json_object_int_add(json_addr
, "prefixAllowedRestartIntervalMsecs", p
->pmax_restart
[afi
][safi
] * 60000);
7794 json_object_object_add(json_neigh
, afi_safi_print (afi
, safi
), json_addr
);
7799 filter
= &p
->filter
[afi
][safi
];
7801 vty_out (vty
, " For address family: %s%s", afi_safi_print (afi
, safi
),
7804 if (peer_group_active(p
))
7805 vty_out (vty
, " %s peer-group member%s", p
->group
->name
, VTY_NEWLINE
);
7807 paf
= peer_af_find(p
, afi
, safi
);
7808 if (paf
&& PAF_SUBGRP(paf
))
7810 vty_out (vty
, " Update group %" PRIu64
", subgroup %" PRIu64
"%s",
7811 PAF_UPDGRP(paf
)->id
, PAF_SUBGRP(paf
)->id
, VTY_NEWLINE
);
7812 vty_out (vty
, " Packet Queue length %d%s",
7813 bpacket_queue_virtual_length(paf
), VTY_NEWLINE
);
7817 vty_out(vty
, " Not part of any update group%s", VTY_NEWLINE
);
7819 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_ADV
)
7820 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_RCV
)
7821 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_OLD_RCV
)
7822 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_ADV
)
7823 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_RCV
)
7824 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_OLD_RCV
))
7825 vty_out (vty
, " AF-dependant capabilities:%s", VTY_NEWLINE
);
7827 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_ADV
)
7828 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_RCV
)
7829 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_ADV
)
7830 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_RCV
))
7832 vty_out (vty
, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s",
7833 ORF_TYPE_PREFIX
, VTY_NEWLINE
);
7834 bgp_show_peer_afi_orf_cap (vty
, p
, afi
, safi
,
7835 PEER_CAP_ORF_PREFIX_SM_ADV
,
7836 PEER_CAP_ORF_PREFIX_RM_ADV
,
7837 PEER_CAP_ORF_PREFIX_SM_RCV
,
7838 PEER_CAP_ORF_PREFIX_RM_RCV
, use_json
, NULL
);
7840 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_ADV
)
7841 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_OLD_RCV
)
7842 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_ADV
)
7843 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_OLD_RCV
))
7845 vty_out (vty
, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s",
7846 ORF_TYPE_PREFIX_OLD
, VTY_NEWLINE
);
7847 bgp_show_peer_afi_orf_cap (vty
, p
, afi
, safi
,
7848 PEER_CAP_ORF_PREFIX_SM_ADV
,
7849 PEER_CAP_ORF_PREFIX_RM_ADV
,
7850 PEER_CAP_ORF_PREFIX_SM_OLD_RCV
,
7851 PEER_CAP_ORF_PREFIX_RM_OLD_RCV
, use_json
, NULL
);
7854 sprintf (orf_pfx_name
, "%s.%d.%d", p
->host
, afi
, safi
);
7855 orf_pfx_count
= prefix_bgp_show_prefix_list (NULL
, afi
, orf_pfx_name
, use_json
);
7857 if (CHECK_FLAG (p
->af_sflags
[afi
][safi
], PEER_STATUS_ORF_PREFIX_SEND
)
7860 vty_out (vty
, " Outbound Route Filter (ORF):");
7861 if (CHECK_FLAG (p
->af_sflags
[afi
][safi
], PEER_STATUS_ORF_PREFIX_SEND
))
7862 vty_out (vty
, " sent;");
7864 vty_out (vty
, " received (%d entries)", orf_pfx_count
);
7865 vty_out (vty
, "%s", VTY_NEWLINE
);
7867 if (CHECK_FLAG (p
->af_sflags
[afi
][safi
], PEER_STATUS_ORF_WAIT_REFRESH
))
7868 vty_out (vty
, " First update is deferred until ORF or ROUTE-REFRESH is received%s", VTY_NEWLINE
);
7870 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_REFLECTOR_CLIENT
))
7871 vty_out (vty
, " Route-Reflector Client%s", VTY_NEWLINE
);
7872 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_RSERVER_CLIENT
))
7873 vty_out (vty
, " Route-Server Client%s", VTY_NEWLINE
);
7874 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_SOFT_RECONFIG
))
7875 vty_out (vty
, " Inbound soft reconfiguration allowed%s", VTY_NEWLINE
);
7877 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE
))
7878 vty_out (vty
, " Private AS numbers (all) replaced in updates to this neighbor%s", VTY_NEWLINE
);
7879 else if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE
))
7880 vty_out (vty
, " Private AS numbers replaced in updates to this neighbor%s", VTY_NEWLINE
);
7881 else if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_REMOVE_PRIVATE_AS_ALL
))
7882 vty_out (vty
, " Private AS numbers (all) removed in updates to this neighbor%s", VTY_NEWLINE
);
7883 else if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_REMOVE_PRIVATE_AS
))
7884 vty_out (vty
, " Private AS numbers removed in updates to this neighbor%s", VTY_NEWLINE
);
7886 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_ADDPATH_TX_ALL_PATHS
))
7887 vty_out (vty
, " Advertise all paths via addpath%s", VTY_NEWLINE
);
7889 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_ADDPATH_TX_BESTPATH_PER_AS
))
7890 vty_out (vty
, " Advertise bestpath per AS via addpath%s", VTY_NEWLINE
);
7892 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_AS_OVERRIDE
))
7893 vty_out (vty
, " Override ASNs in outbound updates if aspath equals remote-as%s", VTY_NEWLINE
);
7895 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_NEXTHOP_SELF
) ||
7896 CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_FORCE_NEXTHOP_SELF
))
7897 vty_out (vty
, " NEXT_HOP is always this router%s", VTY_NEWLINE
);
7898 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_AS_PATH_UNCHANGED
))
7899 vty_out (vty
, " AS_PATH is propagated unchanged to this neighbor%s", VTY_NEWLINE
);
7900 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_NEXTHOP_UNCHANGED
))
7901 vty_out (vty
, " NEXT_HOP is propagated unchanged to this neighbor%s", VTY_NEWLINE
);
7902 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_MED_UNCHANGED
))
7903 vty_out (vty
, " MED is propagated unchanged to this neighbor%s", VTY_NEWLINE
);
7904 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_SEND_COMMUNITY
)
7905 || CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_SEND_EXT_COMMUNITY
)
7906 || CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_SEND_LARGE_COMMUNITY
))
7908 vty_out (vty
, " Community attribute sent to this neighbor");
7909 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_SEND_COMMUNITY
)
7910 && CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_SEND_EXT_COMMUNITY
)
7911 && CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_SEND_LARGE_COMMUNITY
))
7912 vty_out (vty
, "(all)%s", VTY_NEWLINE
);
7913 else if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_SEND_LARGE_COMMUNITY
))
7914 vty_out (vty
, "(large)%s", VTY_NEWLINE
);
7915 else if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_SEND_EXT_COMMUNITY
))
7916 vty_out (vty
, "(extended)%s", VTY_NEWLINE
);
7918 vty_out (vty
, "(standard)%s", VTY_NEWLINE
);
7920 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_DEFAULT_ORIGINATE
))
7922 vty_out (vty
, " Default information originate,");
7924 if (p
->default_rmap
[afi
][safi
].name
)
7925 vty_out (vty
, " default route-map %s%s,",
7926 p
->default_rmap
[afi
][safi
].map
? "*" : "",
7927 p
->default_rmap
[afi
][safi
].name
);
7928 if (paf
&& PAF_SUBGRP(paf
) && CHECK_FLAG(PAF_SUBGRP(paf
)->sflags
, SUBGRP_STATUS_DEFAULT_ORIGINATE
))
7929 vty_out (vty
, " default sent%s", VTY_NEWLINE
);
7931 vty_out (vty
, " default not sent%s", VTY_NEWLINE
);
7934 if (filter
->plist
[FILTER_IN
].name
7935 || filter
->dlist
[FILTER_IN
].name
7936 || filter
->aslist
[FILTER_IN
].name
7937 || filter
->map
[RMAP_IN
].name
)
7938 vty_out (vty
, " Inbound path policy configured%s", VTY_NEWLINE
);
7939 if (filter
->plist
[FILTER_OUT
].name
7940 || filter
->dlist
[FILTER_OUT
].name
7941 || filter
->aslist
[FILTER_OUT
].name
7942 || filter
->map
[RMAP_OUT
].name
7943 || filter
->usmap
.name
)
7944 vty_out (vty
, " Outbound path policy configured%s", VTY_NEWLINE
);
7947 if (filter
->plist
[FILTER_IN
].name
)
7948 vty_out (vty
, " Incoming update prefix filter list is %s%s%s",
7949 filter
->plist
[FILTER_IN
].plist
? "*" : "",
7950 filter
->plist
[FILTER_IN
].name
,
7952 if (filter
->plist
[FILTER_OUT
].name
)
7953 vty_out (vty
, " Outgoing update prefix filter list is %s%s%s",
7954 filter
->plist
[FILTER_OUT
].plist
? "*" : "",
7955 filter
->plist
[FILTER_OUT
].name
,
7958 /* distribute-list */
7959 if (filter
->dlist
[FILTER_IN
].name
)
7960 vty_out (vty
, " Incoming update network filter list is %s%s%s",
7961 filter
->dlist
[FILTER_IN
].alist
? "*" : "",
7962 filter
->dlist
[FILTER_IN
].name
,
7964 if (filter
->dlist
[FILTER_OUT
].name
)
7965 vty_out (vty
, " Outgoing update network filter list is %s%s%s",
7966 filter
->dlist
[FILTER_OUT
].alist
? "*" : "",
7967 filter
->dlist
[FILTER_OUT
].name
,
7971 if (filter
->aslist
[FILTER_IN
].name
)
7972 vty_out (vty
, " Incoming update AS path filter list is %s%s%s",
7973 filter
->aslist
[FILTER_IN
].aslist
? "*" : "",
7974 filter
->aslist
[FILTER_IN
].name
,
7976 if (filter
->aslist
[FILTER_OUT
].name
)
7977 vty_out (vty
, " Outgoing update AS path filter list is %s%s%s",
7978 filter
->aslist
[FILTER_OUT
].aslist
? "*" : "",
7979 filter
->aslist
[FILTER_OUT
].name
,
7983 if (filter
->map
[RMAP_IN
].name
)
7984 vty_out (vty
, " Route map for incoming advertisements is %s%s%s",
7985 filter
->map
[RMAP_IN
].map
? "*" : "",
7986 filter
->map
[RMAP_IN
].name
,
7988 if (filter
->map
[RMAP_OUT
].name
)
7989 vty_out (vty
, " Route map for outgoing advertisements is %s%s%s",
7990 filter
->map
[RMAP_OUT
].map
? "*" : "",
7991 filter
->map
[RMAP_OUT
].name
,
7994 /* unsuppress-map */
7995 if (filter
->usmap
.name
)
7996 vty_out (vty
, " Route map for selective unsuppress is %s%s%s",
7997 filter
->usmap
.map
? "*" : "",
7998 filter
->usmap
.name
, VTY_NEWLINE
);
8000 /* Receive prefix count */
8001 vty_out (vty
, " %ld accepted prefixes%s", p
->pcount
[afi
][safi
], VTY_NEWLINE
);
8003 /* Maximum prefix */
8004 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_MAX_PREFIX
))
8006 vty_out (vty
, " Maximum prefixes allowed %ld%s%s", p
->pmax
[afi
][safi
],
8007 CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_MAX_PREFIX_WARNING
)
8008 ? " (warning-only)" : "", VTY_NEWLINE
);
8009 vty_out (vty
, " Threshold for warning message %d%%",
8010 p
->pmax_threshold
[afi
][safi
]);
8011 if (p
->pmax_restart
[afi
][safi
])
8012 vty_out (vty
, ", restart interval %d min", p
->pmax_restart
[afi
][safi
]);
8013 vty_out (vty
, "%s", VTY_NEWLINE
);
8016 vty_out (vty
, "%s", VTY_NEWLINE
);
8021 bgp_show_peer (struct vty
*vty
, struct peer
*p
, u_char use_json
, json_object
*json
)
8024 char buf1
[PREFIX2STR_BUFFER
], buf
[SU_ADDRSTRLEN
];
8025 char timebuf
[BGP_UPTIME_LEN
];
8027 const char *subcode_str
;
8028 const char *code_str
;
8033 json_object
*json_neigh
= NULL
;
8039 json_neigh
= json_object_new_object();
8041 memset (dn_flag
, '\0', sizeof (dn_flag
));
8042 if (!p
->conf_if
&& peer_dynamic_neighbor (p
))
8047 if (p
->conf_if
) /* Configured interface name. */
8048 vty_out (vty
, "BGP neighbor on %s: %s, ", p
->conf_if
,
8049 BGP_PEER_SU_UNSPEC(p
) ? "None" :
8050 sockunion2str (&p
->su
, buf
, SU_ADDRSTRLEN
));
8051 else /* Configured IP address. */
8052 vty_out (vty
, "BGP neighbor is %s%s, ", dn_flag
, p
->host
);
8057 if (p
->conf_if
&& BGP_PEER_SU_UNSPEC(p
))
8058 json_object_string_add(json_neigh
, "bgpNeighborAddr", "none");
8059 else if (p
->conf_if
&& !BGP_PEER_SU_UNSPEC(p
))
8060 json_object_string_add(json_neigh
, "bgpNeighborAddr", sockunion2str (&p
->su
, buf
, SU_ADDRSTRLEN
));
8062 json_object_int_add(json_neigh
, "remoteAs", p
->as
);
8064 if (p
->change_local_as
)
8065 json_object_int_add(json_neigh
, "localAs", p
->change_local_as
);
8067 json_object_int_add(json_neigh
, "localAs", p
->local_as
);
8069 if (CHECK_FLAG (p
->flags
, PEER_FLAG_LOCAL_AS_NO_PREPEND
))
8070 json_object_boolean_true_add(json_neigh
, "localAsNoPrepend");
8072 if (CHECK_FLAG (p
->flags
, PEER_FLAG_LOCAL_AS_REPLACE_AS
))
8073 json_object_boolean_true_add(json_neigh
, "localAsReplaceAs");
8077 if ((p
->as_type
== AS_SPECIFIED
) ||
8078 (p
->as_type
== AS_EXTERNAL
) ||
8079 (p
->as_type
== AS_INTERNAL
))
8080 vty_out (vty
, "remote AS %u, ", p
->as
);
8082 vty_out (vty
, "remote AS Unspecified, ");
8083 vty_out (vty
, "local AS %u%s%s, ",
8084 p
->change_local_as
? p
->change_local_as
: p
->local_as
,
8085 CHECK_FLAG (p
->flags
, PEER_FLAG_LOCAL_AS_NO_PREPEND
) ?
8087 CHECK_FLAG (p
->flags
, PEER_FLAG_LOCAL_AS_REPLACE_AS
) ?
8088 " replace-as" : "");
8090 /* peer type internal, external, confed-internal or confed-external */
8091 if (p
->as
== p
->local_as
)
8095 if (CHECK_FLAG(bgp
->config
, BGP_CONFIG_CONFEDERATION
))
8096 json_object_boolean_true_add(json_neigh
, "nbrConfedInternalLink");
8098 json_object_boolean_true_add(json_neigh
, "nbrInternalLink");
8102 if (CHECK_FLAG(bgp
->config
, BGP_CONFIG_CONFEDERATION
))
8103 vty_out (vty
, "confed-internal link%s", VTY_NEWLINE
);
8105 vty_out (vty
, "internal link%s", VTY_NEWLINE
);
8112 if (CHECK_FLAG(bgp
->config
, BGP_CONFIG_CONFEDERATION
))
8113 json_object_boolean_true_add(json_neigh
, "nbrConfedExternalLink");
8115 json_object_boolean_true_add(json_neigh
, "nbrExternalLink");
8119 if (bgp_confederation_peers_check(bgp
, p
->as
))
8120 vty_out (vty
, "confed-external link%s", VTY_NEWLINE
);
8122 vty_out (vty
, "external link%s", VTY_NEWLINE
);
8130 json_object_string_add(json_neigh
, "nbrDesc", p
->desc
);
8132 vty_out (vty
, " Description: %s%s", p
->desc
, VTY_NEWLINE
);
8140 json_object_string_add(json_neigh
, "hostname", p
->hostname
);
8143 json_object_string_add(json_neigh
, "domainname", p
->domainname
);
8147 if (p
->domainname
&& (p
->domainname
[0] != '\0'))
8148 vty_out(vty
, "Hostname: %s.%s%s", p
->hostname
, p
->domainname
,
8151 vty_out(vty
, "Hostname: %s%s", p
->hostname
, VTY_NEWLINE
);
8161 json_object_string_add(json_neigh
, "peerGroup", p
->group
->name
);
8165 struct prefix prefix
, *range
= NULL
;
8167 sockunion2hostprefix(&(p
->su
), &prefix
);
8168 range
= peer_group_lookup_dynamic_neighbor_range (p
->group
, &prefix
);
8172 prefix2str(range
, buf1
, sizeof(buf1
));
8173 json_object_string_add(json_neigh
, "peerSubnetRangeGroup", buf1
);
8179 vty_out (vty
, " Member of peer-group %s for session parameters%s",
8180 p
->group
->name
, VTY_NEWLINE
);
8184 struct prefix prefix
, *range
= NULL
;
8186 sockunion2hostprefix(&(p
->su
), &prefix
);
8187 range
= peer_group_lookup_dynamic_neighbor_range (p
->group
, &prefix
);
8191 prefix2str(range
, buf1
, sizeof(buf1
));
8192 vty_out (vty
, " Belongs to the subnet range group: %s%s", buf1
, VTY_NEWLINE
);
8200 /* Administrative shutdown. */
8201 if (CHECK_FLAG (p
->flags
, PEER_FLAG_SHUTDOWN
))
8202 json_object_boolean_true_add(json_neigh
, "adminShutDown");
8205 json_object_int_add(json_neigh
, "bgpVersion", 4);
8206 json_object_string_add(json_neigh
, "remoteRouterId",
8207 inet_ntop (AF_INET
, &p
->remote_id
, buf1
, sizeof(buf1
)));
8210 if (CHECK_FLAG (bgp
->config
, BGP_CONFIG_CONFEDERATION
) && bgp_confederation_peers_check (bgp
, p
->as
))
8211 json_object_boolean_true_add(json_neigh
, "nbrCommonAdmin");
8214 json_object_string_add(json_neigh
, "bgpState", lookup_msg(bgp_status_msg
, p
->status
, NULL
));
8216 if (p
->status
== Established
)
8221 uptime
= bgp_clock();
8222 uptime
-= p
->uptime
;
8223 tm
= gmtime(&uptime
);
8224 epoch_tbuf
= time(NULL
) - uptime
;
8226 json_object_int_add(json_neigh
, "bgpTimerUp", (tm
->tm_sec
* 1000) + (tm
->tm_min
* 60000) + (tm
->tm_hour
* 3600000));
8227 json_object_string_add(json_neigh
, "bgpTimerUpString", peer_uptime (p
->uptime
, timebuf
, BGP_UPTIME_LEN
, 0, NULL
));
8228 json_object_int_add(json_neigh
, "bgpTimerUpEstablishedEpoch", epoch_tbuf
);
8231 else if (p
->status
== Active
)
8233 if (CHECK_FLAG (p
->flags
, PEER_FLAG_PASSIVE
))
8234 json_object_string_add(json_neigh
, "bgpStateIs", "passive");
8235 else if (CHECK_FLAG (p
->sflags
, PEER_STATUS_NSF_WAIT
))
8236 json_object_string_add(json_neigh
, "bgpStateIs", "passiveNSF");
8243 uptime
= bgp_clock();
8244 uptime
-= p
->readtime
;
8245 tm
= gmtime(&uptime
);
8246 json_object_int_add(json_neigh
, "bgpTimerLastRead", (tm
->tm_sec
* 1000) + (tm
->tm_min
* 60000) + (tm
->tm_hour
* 3600000));
8248 uptime
= bgp_clock();
8249 uptime
-= p
->last_write
;
8250 tm
= gmtime(&uptime
);
8251 json_object_int_add(json_neigh
, "bgpTimerLastWrite", (tm
->tm_sec
* 1000) + (tm
->tm_min
* 60000) + (tm
->tm_hour
* 3600000));
8253 uptime
= bgp_clock();
8254 uptime
-= p
->update_time
;
8255 tm
= gmtime(&uptime
);
8256 json_object_int_add(json_neigh
, "bgpInUpdateElapsedTimeMsecs",
8257 (tm
->tm_sec
* 1000) + (tm
->tm_min
* 60000) + (tm
->tm_hour
* 3600000));
8259 /* Configured timer values. */
8260 json_object_int_add(json_neigh
, "bgpTimerHoldTimeMsecs", p
->v_holdtime
* 1000);
8261 json_object_int_add(json_neigh
, "bgpTimerKeepAliveIntervalMsecs", p
->v_keepalive
* 1000);
8263 if (CHECK_FLAG (p
->config
, PEER_CONFIG_TIMER
))
8265 json_object_int_add(json_neigh
, "bgpTimerConfiguredHoldTimeMsecs", p
->holdtime
* 1000);
8266 json_object_int_add(json_neigh
, "bgpTimerConfiguredKeepAliveIntervalMsecs", p
->keepalive
* 1000);
8271 /* Administrative shutdown. */
8272 if (CHECK_FLAG (p
->flags
, PEER_FLAG_SHUTDOWN
))
8273 vty_out (vty
, " Administratively shut down%s", VTY_NEWLINE
);
8276 vty_out (vty
, " BGP version 4");
8277 vty_out (vty
, ", remote router ID %s%s",
8278 inet_ntop (AF_INET
, &p
->remote_id
, buf1
, sizeof(buf1
)),
8282 if (CHECK_FLAG (bgp
->config
, BGP_CONFIG_CONFEDERATION
)
8283 && bgp_confederation_peers_check (bgp
, p
->as
))
8284 vty_out (vty
, " Neighbor under common administration%s", VTY_NEWLINE
);
8287 vty_out (vty
, " BGP state = %s", lookup_msg(bgp_status_msg
, p
->status
, NULL
));
8289 if (p
->status
== Established
)
8290 vty_out (vty
, ", up for %8s", peer_uptime (p
->uptime
, timebuf
, BGP_UPTIME_LEN
, 0, NULL
));
8292 else if (p
->status
== Active
)
8294 if (CHECK_FLAG (p
->flags
, PEER_FLAG_PASSIVE
))
8295 vty_out (vty
, " (passive)");
8296 else if (CHECK_FLAG (p
->sflags
, PEER_STATUS_NSF_WAIT
))
8297 vty_out (vty
, " (NSF passive)");
8299 vty_out (vty
, "%s", VTY_NEWLINE
);
8302 vty_out (vty
, " Last read %s", peer_uptime (p
->readtime
, timebuf
, BGP_UPTIME_LEN
, 0, NULL
));
8303 vty_out (vty
, ", Last write %s%s",
8304 peer_uptime (p
->last_write
, timebuf
, BGP_UPTIME_LEN
, 0, NULL
), VTY_NEWLINE
);
8306 /* Configured timer values. */
8307 vty_out (vty
, " Hold time is %d, keepalive interval is %d seconds%s",
8308 p
->v_holdtime
, p
->v_keepalive
, VTY_NEWLINE
);
8309 if (CHECK_FLAG (p
->config
, PEER_CONFIG_TIMER
))
8311 vty_out (vty
, " Configured hold time is %d", p
->holdtime
);
8312 vty_out (vty
, ", keepalive interval is %d seconds%s",
8313 p
->keepalive
, VTY_NEWLINE
);
8317 if (p
->status
== Established
)
8320 || p
->afc_adv
[AFI_IP
][SAFI_UNICAST
]
8321 || p
->afc_recv
[AFI_IP
][SAFI_UNICAST
]
8322 || p
->afc_adv
[AFI_IP
][SAFI_MULTICAST
]
8323 || p
->afc_recv
[AFI_IP
][SAFI_MULTICAST
]
8324 || p
->afc_adv
[AFI_IP6
][SAFI_UNICAST
]
8325 || p
->afc_recv
[AFI_IP6
][SAFI_UNICAST
]
8326 || p
->afc_adv
[AFI_IP6
][SAFI_MULTICAST
]
8327 || p
->afc_recv
[AFI_IP6
][SAFI_MULTICAST
]
8328 || p
->afc_adv
[AFI_IP6
][SAFI_MPLS_VPN
]
8329 || p
->afc_recv
[AFI_IP6
][SAFI_MPLS_VPN
]
8330 || p
->afc_adv
[AFI_IP6
][SAFI_ENCAP
]
8331 || p
->afc_recv
[AFI_IP6
][SAFI_ENCAP
]
8332 || p
->afc_adv
[AFI_IP
][SAFI_ENCAP
]
8333 || p
->afc_recv
[AFI_IP
][SAFI_ENCAP
]
8334 || p
->afc_adv
[AFI_IP
][SAFI_MPLS_VPN
]
8335 || p
->afc_recv
[AFI_IP
][SAFI_MPLS_VPN
])
8339 json_object
*json_cap
= NULL
;
8341 json_cap
= json_object_new_object();
8344 if (CHECK_FLAG (p
->cap
, PEER_CAP_AS4_RCV
)
8345 || CHECK_FLAG (p
->cap
, PEER_CAP_AS4_ADV
))
8347 if (CHECK_FLAG (p
->cap
, PEER_CAP_AS4_ADV
) && CHECK_FLAG (p
->cap
, PEER_CAP_AS4_RCV
))
8348 json_object_string_add(json_cap
, "4byteAs", "advertisedAndReceived");
8349 else if (CHECK_FLAG (p
->cap
, PEER_CAP_AS4_ADV
))
8350 json_object_string_add(json_cap
, "4byteAs", "advertised");
8351 else if (CHECK_FLAG (p
->cap
, PEER_CAP_AS4_RCV
))
8352 json_object_string_add(json_cap
, "4byteAs", "received");
8356 if (CHECK_FLAG (p
->cap
, PEER_CAP_ADDPATH_RCV
)
8357 || CHECK_FLAG (p
->cap
, PEER_CAP_ADDPATH_ADV
))
8359 json_object
*json_add
= NULL
;
8360 const char *print_store
;
8362 json_add
= json_object_new_object();
8364 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
8365 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
8367 json_object
*json_sub
= NULL
;
8368 json_sub
= json_object_new_object();
8369 print_store
= afi_safi_print (afi
, safi
);
8371 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_TX_ADV
) ||
8372 CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_TX_RCV
))
8374 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_TX_ADV
) && CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_TX_RCV
))
8375 json_object_boolean_true_add(json_sub
, "txAdvertisedAndReceived");
8376 else if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_TX_ADV
))
8377 json_object_boolean_true_add(json_sub
, "txAdvertised");
8378 else if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_TX_RCV
))
8379 json_object_boolean_true_add(json_sub
, "txReceived");
8382 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_RX_ADV
) ||
8383 CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_RX_RCV
))
8385 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_RX_ADV
) && CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_RX_RCV
))
8386 json_object_boolean_true_add(json_sub
, "rxAdvertisedAndReceived");
8387 else if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_RX_ADV
))
8388 json_object_boolean_true_add(json_sub
, "rxAdvertised");
8389 else if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_RX_RCV
))
8390 json_object_boolean_true_add(json_sub
, "rxReceived");
8393 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_TX_ADV
) ||
8394 CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_TX_RCV
) ||
8395 CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_RX_ADV
) ||
8396 CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_RX_RCV
))
8397 json_object_object_add(json_add
, print_store
, json_sub
);
8399 json_object_free(json_sub
);
8402 json_object_object_add(json_cap
, "addPath", json_add
);
8406 if (CHECK_FLAG (p
->cap
, PEER_CAP_DYNAMIC_RCV
)
8407 || CHECK_FLAG (p
->cap
, PEER_CAP_DYNAMIC_ADV
))
8409 if (CHECK_FLAG (p
->cap
, PEER_CAP_DYNAMIC_ADV
) && CHECK_FLAG (p
->cap
, PEER_CAP_DYNAMIC_RCV
))
8410 json_object_string_add(json_cap
, "dynamic", "advertisedAndReceived");
8411 else if (CHECK_FLAG (p
->cap
, PEER_CAP_DYNAMIC_ADV
))
8412 json_object_string_add(json_cap
, "dynamic", "advertised");
8413 else if (CHECK_FLAG (p
->cap
, PEER_CAP_DYNAMIC_RCV
))
8414 json_object_string_add(json_cap
, "dynamic", "received");
8417 /* Extended nexthop */
8418 if (CHECK_FLAG (p
->cap
, PEER_CAP_ENHE_RCV
)
8419 || CHECK_FLAG (p
->cap
, PEER_CAP_ENHE_ADV
))
8421 json_object
*json_nxt
= NULL
;
8422 const char *print_store
;
8425 if (CHECK_FLAG (p
->cap
, PEER_CAP_ENHE_ADV
) && CHECK_FLAG (p
->cap
, PEER_CAP_ENHE_RCV
))
8426 json_object_string_add(json_cap
, "extendedNexthop", "advertisedAndReceived");
8427 else if (CHECK_FLAG (p
->cap
, PEER_CAP_ENHE_ADV
))
8428 json_object_string_add(json_cap
, "extendedNexthop", "advertised");
8429 else if (CHECK_FLAG (p
->cap
, PEER_CAP_ENHE_RCV
))
8430 json_object_string_add(json_cap
, "extendedNexthop", "received");
8432 if (CHECK_FLAG (p
->cap
, PEER_CAP_ENHE_RCV
))
8434 json_nxt
= json_object_new_object();
8436 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
8438 if (CHECK_FLAG (p
->af_cap
[AFI_IP
][safi
], PEER_CAP_ENHE_AF_RCV
))
8440 print_store
= afi_safi_print (AFI_IP
, safi
);
8441 json_object_string_add(json_nxt
, print_store
, "recieved");
8444 json_object_object_add(json_cap
, "extendedNexthopFamililesByPeer", json_nxt
);
8449 if (CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_ADV
)
8450 || CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_NEW_RCV
)
8451 || CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_OLD_RCV
))
8453 if (CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_ADV
) && (CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_NEW_RCV
) || CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_OLD_RCV
)))
8455 if (CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_OLD_RCV
) && CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_NEW_RCV
))
8456 json_object_string_add(json_cap
, "routeRefresh", "advertisedAndReceivedOldNew");
8459 if (CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_OLD_RCV
))
8460 json_object_string_add(json_cap
, "routeRefresh", "advertisedAndReceivedOld");
8462 json_object_string_add(json_cap
, "routeRefresh", "advertisedAndReceivedNew");
8465 else if (CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_ADV
))
8466 json_object_string_add(json_cap
, "routeRefresh", "advertised");
8467 else if (CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_NEW_RCV
) || CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_OLD_RCV
))
8468 json_object_string_add(json_cap
, "routeRefresh", "received");
8471 /* Multiprotocol Extensions */
8472 json_object
*json_multi
= NULL
;
8473 json_multi
= json_object_new_object();
8475 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
8477 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
8479 if (p
->afc_adv
[afi
][safi
] || p
->afc_recv
[afi
][safi
])
8481 json_object
*json_exten
= NULL
;
8482 json_exten
= json_object_new_object();
8484 if (p
->afc_adv
[afi
][safi
] && p
->afc_recv
[afi
][safi
])
8485 json_object_boolean_true_add(json_exten
, "advertisedAndReceived");
8486 else if (p
->afc_adv
[afi
][safi
])
8487 json_object_boolean_true_add(json_exten
, "advertised");
8488 else if (p
->afc_recv
[afi
][safi
])
8489 json_object_boolean_true_add(json_exten
, "received");
8491 json_object_object_add(json_multi
, afi_safi_print (afi
, safi
), json_exten
);
8495 json_object_object_add(json_cap
, "multiprotocolExtensions", json_multi
);
8497 /* Gracefull Restart */
8498 if (CHECK_FLAG (p
->cap
, PEER_CAP_RESTART_RCV
)
8499 || CHECK_FLAG (p
->cap
, PEER_CAP_RESTART_ADV
))
8501 if (CHECK_FLAG (p
->cap
, PEER_CAP_RESTART_ADV
) && CHECK_FLAG (p
->cap
, PEER_CAP_RESTART_RCV
))
8502 json_object_string_add(json_cap
, "gracefulRestart", "advertisedAndReceived");
8503 else if (CHECK_FLAG (p
->cap
, PEER_CAP_RESTART_ADV
))
8504 json_object_string_add(json_cap
, "gracefulRestartCapability", "advertised");
8505 else if (CHECK_FLAG (p
->cap
, PEER_CAP_RESTART_RCV
))
8506 json_object_string_add(json_cap
, "gracefulRestartCapability", "received");
8508 if (CHECK_FLAG (p
->cap
, PEER_CAP_RESTART_RCV
))
8510 int restart_af_count
= 0;
8511 json_object
*json_restart
= NULL
;
8512 json_restart
= json_object_new_object();
8514 json_object_int_add(json_cap
, "gracefulRestartRemoteTimerMsecs", p
->v_gr_restart
* 1000);
8516 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
8518 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
8520 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_RESTART_AF_RCV
))
8522 json_object
*json_sub
= NULL
;
8523 json_sub
= json_object_new_object();
8525 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_RESTART_AF_PRESERVE_RCV
))
8526 json_object_boolean_true_add(json_sub
, "preserved");
8528 json_object_object_add(json_restart
, afi_safi_print (afi
, safi
), json_sub
);
8532 if (! restart_af_count
)
8534 json_object_string_add(json_cap
, "addressFamiliesByPeer", "none");
8535 json_object_free(json_restart
);
8538 json_object_object_add(json_cap
, "addressFamiliesByPeer", json_restart
);
8541 json_object_object_add(json_neigh
, "neighborCapabilities", json_cap
);
8545 vty_out (vty
, " Neighbor capabilities:%s", VTY_NEWLINE
);
8548 if (CHECK_FLAG (p
->cap
, PEER_CAP_AS4_RCV
)
8549 || CHECK_FLAG (p
->cap
, PEER_CAP_AS4_ADV
))
8551 vty_out (vty
, " 4 Byte AS:");
8552 if (CHECK_FLAG (p
->cap
, PEER_CAP_AS4_ADV
))
8553 vty_out (vty
, " advertised");
8554 if (CHECK_FLAG (p
->cap
, PEER_CAP_AS4_RCV
))
8555 vty_out (vty
, " %sreceived",
8556 CHECK_FLAG (p
->cap
, PEER_CAP_AS4_ADV
) ? "and " : "");
8557 vty_out (vty
, "%s", VTY_NEWLINE
);
8561 if (CHECK_FLAG (p
->cap
, PEER_CAP_ADDPATH_RCV
)
8562 || CHECK_FLAG (p
->cap
, PEER_CAP_ADDPATH_ADV
))
8564 vty_out (vty
, " AddPath:%s", VTY_NEWLINE
);
8566 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
8567 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
8569 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_TX_ADV
) ||
8570 CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_TX_RCV
))
8572 vty_out (vty
, " %s: TX ", afi_safi_print (afi
, safi
));
8574 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_TX_ADV
))
8575 vty_out (vty
, "advertised %s", afi_safi_print (afi
, safi
));
8577 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_TX_RCV
))
8578 vty_out (vty
, "%sreceived", CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_TX_ADV
) ? " and " : "" );
8580 vty_out (vty
, "%s", VTY_NEWLINE
);
8583 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_RX_ADV
) ||
8584 CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_RX_RCV
))
8586 vty_out (vty
, " %s: RX ", afi_safi_print (afi
, safi
));
8588 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_RX_ADV
))
8589 vty_out (vty
, "advertised %s", afi_safi_print (afi
, safi
));
8591 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_RX_RCV
))
8592 vty_out (vty
, "%sreceived", CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_RX_ADV
) ? " and " : "" );
8594 vty_out (vty
, "%s", VTY_NEWLINE
);
8600 if (CHECK_FLAG (p
->cap
, PEER_CAP_DYNAMIC_RCV
)
8601 || CHECK_FLAG (p
->cap
, PEER_CAP_DYNAMIC_ADV
))
8603 vty_out (vty
, " Dynamic:");
8604 if (CHECK_FLAG (p
->cap
, PEER_CAP_DYNAMIC_ADV
))
8605 vty_out (vty
, " advertised");
8606 if (CHECK_FLAG (p
->cap
, PEER_CAP_DYNAMIC_RCV
))
8607 vty_out (vty
, " %sreceived",
8608 CHECK_FLAG (p
->cap
, PEER_CAP_DYNAMIC_ADV
) ? "and " : "");
8609 vty_out (vty
, "%s", VTY_NEWLINE
);
8612 /* Extended nexthop */
8613 if (CHECK_FLAG (p
->cap
, PEER_CAP_ENHE_RCV
)
8614 || CHECK_FLAG (p
->cap
, PEER_CAP_ENHE_ADV
))
8616 vty_out (vty
, " Extended nexthop:");
8617 if (CHECK_FLAG (p
->cap
, PEER_CAP_ENHE_ADV
))
8618 vty_out (vty
, " advertised");
8619 if (CHECK_FLAG (p
->cap
, PEER_CAP_ENHE_RCV
))
8620 vty_out (vty
, " %sreceived",
8621 CHECK_FLAG (p
->cap
, PEER_CAP_ENHE_ADV
) ? "and " : "");
8622 vty_out (vty
, "%s", VTY_NEWLINE
);
8624 if (CHECK_FLAG (p
->cap
, PEER_CAP_ENHE_RCV
))
8626 vty_out (vty
, " Address families by peer:%s ", VTY_NEWLINE
);
8627 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
8628 if (CHECK_FLAG (p
->af_cap
[AFI_IP
][safi
], PEER_CAP_ENHE_AF_RCV
))
8629 vty_out (vty
, " %s%s",
8630 afi_safi_print (AFI_IP
, safi
), VTY_NEWLINE
);
8635 if (CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_ADV
)
8636 || CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_NEW_RCV
)
8637 || CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_OLD_RCV
))
8639 vty_out (vty
, " Route refresh:");
8640 if (CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_ADV
))
8641 vty_out (vty
, " advertised");
8642 if (CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_NEW_RCV
)
8643 || CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_OLD_RCV
))
8644 vty_out (vty
, " %sreceived(%s)",
8645 CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_ADV
) ? "and " : "",
8646 (CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_OLD_RCV
)
8647 && CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_NEW_RCV
)) ?
8648 "old & new" : CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_OLD_RCV
) ? "old" : "new");
8650 vty_out (vty
, "%s", VTY_NEWLINE
);
8653 /* Multiprotocol Extensions */
8654 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
8655 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
8656 if (p
->afc_adv
[afi
][safi
] || p
->afc_recv
[afi
][safi
])
8658 vty_out (vty
, " Address Family %s:", afi_safi_print (afi
, safi
));
8659 if (p
->afc_adv
[afi
][safi
])
8660 vty_out (vty
, " advertised");
8661 if (p
->afc_recv
[afi
][safi
])
8662 vty_out (vty
, " %sreceived", p
->afc_adv
[afi
][safi
] ? "and " : "");
8663 vty_out (vty
, "%s", VTY_NEWLINE
);
8666 /* Hostname capability */
8667 if (CHECK_FLAG(p
->cap
, PEER_CAP_HOSTNAME_ADV
) ||
8668 CHECK_FLAG(p
->cap
, PEER_CAP_HOSTNAME_RCV
))
8670 vty_out (vty
, " Hostname Capability:");
8671 if (CHECK_FLAG (p
->cap
, PEER_CAP_HOSTNAME_ADV
))
8672 vty_out (vty
, " advertised");
8673 if (CHECK_FLAG (p
->cap
, PEER_CAP_HOSTNAME_RCV
))
8674 vty_out (vty
, " %sreceived",
8675 CHECK_FLAG (p
->cap
, PEER_CAP_HOSTNAME_ADV
) ? "and " : "");
8676 vty_out (vty
, "%s", VTY_NEWLINE
);
8679 /* Gracefull Restart */
8680 if (CHECK_FLAG (p
->cap
, PEER_CAP_RESTART_RCV
)
8681 || CHECK_FLAG (p
->cap
, PEER_CAP_RESTART_ADV
))
8683 vty_out (vty
, " Graceful Restart Capabilty:");
8684 if (CHECK_FLAG (p
->cap
, PEER_CAP_RESTART_ADV
))
8685 vty_out (vty
, " advertised");
8686 if (CHECK_FLAG (p
->cap
, PEER_CAP_RESTART_RCV
))
8687 vty_out (vty
, " %sreceived",
8688 CHECK_FLAG (p
->cap
, PEER_CAP_RESTART_ADV
) ? "and " : "");
8689 vty_out (vty
, "%s", VTY_NEWLINE
);
8691 if (CHECK_FLAG (p
->cap
, PEER_CAP_RESTART_RCV
))
8693 int restart_af_count
= 0;
8695 vty_out (vty
, " Remote Restart timer is %d seconds%s",
8696 p
->v_gr_restart
, VTY_NEWLINE
);
8697 vty_out (vty
, " Address families by peer:%s ", VTY_NEWLINE
);
8699 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
8700 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
8701 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_RESTART_AF_RCV
))
8703 vty_out (vty
, "%s%s(%s)", restart_af_count
? ", " : "",
8704 afi_safi_print (afi
, safi
),
8705 CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_RESTART_AF_PRESERVE_RCV
) ?
8706 "preserved" : "not preserved");
8709 if (! restart_af_count
)
8710 vty_out (vty
, "none");
8711 vty_out (vty
, "%s", VTY_NEWLINE
);
8718 /* graceful restart information */
8719 if (CHECK_FLAG (p
->cap
, PEER_CAP_RESTART_RCV
)
8723 json_object
*json_grace
= NULL
;
8724 json_object
*json_grace_send
= NULL
;
8725 json_object
*json_grace_recv
= NULL
;
8726 int eor_send_af_count
= 0;
8727 int eor_receive_af_count
= 0;
8731 json_grace
= json_object_new_object();
8732 json_grace_send
= json_object_new_object();
8733 json_grace_recv
= json_object_new_object();
8735 if (p
->status
== Established
)
8737 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
8739 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
8741 if (CHECK_FLAG (p
->af_sflags
[afi
][safi
], PEER_STATUS_EOR_SEND
))
8743 json_object_boolean_true_add(json_grace_send
, afi_safi_print (afi
, safi
));
8744 eor_send_af_count
++;
8748 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
8750 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
8752 if (CHECK_FLAG (p
->af_sflags
[afi
][safi
], PEER_STATUS_EOR_RECEIVED
))
8754 json_object_boolean_true_add(json_grace_recv
, afi_safi_print (afi
, safi
));
8755 eor_receive_af_count
++;
8761 json_object_object_add(json_grace
, "endOfRibSend", json_grace_send
);
8762 json_object_object_add(json_grace
, "endOfRibRecv", json_grace_recv
);
8764 if (p
->t_gr_restart
)
8765 json_object_int_add(json_grace
, "gracefulRestartTimerMsecs", thread_timer_remain_second (p
->t_gr_restart
) * 1000);
8768 json_object_int_add(json_grace
, "gracefulStalepathTimerMsecs", thread_timer_remain_second (p
->t_gr_stale
) * 1000);
8770 json_object_object_add(json_neigh
, "gracefulRestartInfo", json_grace
);
8774 vty_out (vty
, " Graceful restart informations:%s", VTY_NEWLINE
);
8775 if (p
->status
== Established
)
8777 vty_out (vty
, " End-of-RIB send: ");
8778 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
8780 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
8782 if (CHECK_FLAG (p
->af_sflags
[afi
][safi
], PEER_STATUS_EOR_SEND
))
8784 vty_out (vty
, "%s%s", eor_send_af_count
? ", " : "",
8785 afi_safi_print (afi
, safi
));
8786 eor_send_af_count
++;
8790 vty_out (vty
, "%s", VTY_NEWLINE
);
8791 vty_out (vty
, " End-of-RIB received: ");
8792 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
8794 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
8796 if (CHECK_FLAG (p
->af_sflags
[afi
][safi
], PEER_STATUS_EOR_RECEIVED
))
8798 vty_out (vty
, "%s%s", eor_receive_af_count
? ", " : "",
8799 afi_safi_print (afi
, safi
));
8800 eor_receive_af_count
++;
8804 vty_out (vty
, "%s", VTY_NEWLINE
);
8807 if (p
->t_gr_restart
)
8808 vty_out (vty
, " The remaining time of restart timer is %ld%s",
8809 thread_timer_remain_second (p
->t_gr_restart
), VTY_NEWLINE
);
8812 vty_out (vty
, " The remaining time of stalepath timer is %ld%s",
8813 thread_timer_remain_second (p
->t_gr_stale
), VTY_NEWLINE
);
8818 json_object
*json_stat
= NULL
;
8819 json_stat
= json_object_new_object();
8820 /* Packet counts. */
8821 json_object_int_add(json_stat
, "depthInq", 0);
8822 json_object_int_add(json_stat
, "depthOutq", (unsigned long) p
->obuf
->count
);
8823 json_object_int_add(json_stat
, "opensSent", p
->open_out
);
8824 json_object_int_add(json_stat
, "opensRecv", p
->open_in
);
8825 json_object_int_add(json_stat
, "notificationsSent", p
->notify_out
);
8826 json_object_int_add(json_stat
, "notificationsRecv", p
->notify_in
);
8827 json_object_int_add(json_stat
, "updatesSent", p
->update_out
);
8828 json_object_int_add(json_stat
, "updatesRecv", p
->update_in
);
8829 json_object_int_add(json_stat
, "keepalivesSent", p
->keepalive_out
);
8830 json_object_int_add(json_stat
, "keepalivesRecv", p
->keepalive_in
);
8831 json_object_int_add(json_stat
, "routeRefreshSent", p
->refresh_out
);
8832 json_object_int_add(json_stat
, "routeRefreshRecv", p
->refresh_in
);
8833 json_object_int_add(json_stat
, "capabilitySent", p
->dynamic_cap_out
);
8834 json_object_int_add(json_stat
, "capabilityRecv", p
->dynamic_cap_in
);
8835 json_object_int_add(json_stat
, "totalSent", p
->open_out
+ p
->notify_out
+ p
->update_out
+ p
->keepalive_out
+ p
->refresh_out
+ p
->dynamic_cap_out
);
8836 json_object_int_add(json_stat
, "totalRecv", p
->open_in
+ p
->notify_in
+ p
->update_in
+ p
->keepalive_in
+ p
->refresh_in
+ p
->dynamic_cap_in
);
8837 json_object_object_add(json_neigh
, "messageStats", json_stat
);
8841 /* Packet counts. */
8842 vty_out (vty
, " Message statistics:%s", VTY_NEWLINE
);
8843 vty_out (vty
, " Inq depth is 0%s", VTY_NEWLINE
);
8844 vty_out (vty
, " Outq depth is %lu%s", (unsigned long) p
->obuf
->count
, VTY_NEWLINE
);
8845 vty_out (vty
, " Sent Rcvd%s", VTY_NEWLINE
);
8846 vty_out (vty
, " Opens: %10d %10d%s", p
->open_out
, p
->open_in
, VTY_NEWLINE
);
8847 vty_out (vty
, " Notifications: %10d %10d%s", p
->notify_out
, p
->notify_in
, VTY_NEWLINE
);
8848 vty_out (vty
, " Updates: %10d %10d%s", p
->update_out
, p
->update_in
, VTY_NEWLINE
);
8849 vty_out (vty
, " Keepalives: %10d %10d%s", p
->keepalive_out
, p
->keepalive_in
, VTY_NEWLINE
);
8850 vty_out (vty
, " Route Refresh: %10d %10d%s", p
->refresh_out
, p
->refresh_in
, VTY_NEWLINE
);
8851 vty_out (vty
, " Capability: %10d %10d%s", p
->dynamic_cap_out
, p
->dynamic_cap_in
, VTY_NEWLINE
);
8852 vty_out (vty
, " Total: %10d %10d%s", p
->open_out
+ p
->notify_out
+
8853 p
->update_out
+ p
->keepalive_out
+ p
->refresh_out
+ p
->dynamic_cap_out
,
8854 p
->open_in
+ p
->notify_in
+ p
->update_in
+ p
->keepalive_in
+ p
->refresh_in
+
8855 p
->dynamic_cap_in
, VTY_NEWLINE
);
8860 /* advertisement-interval */
8861 json_object_int_add(json_neigh
, "minBtwnAdvertisementRunsTimerMsecs", p
->v_routeadv
* 1000);
8863 /* Update-source. */
8864 if (p
->update_if
|| p
->update_source
)
8867 json_object_string_add(json_neigh
, "updateSource", p
->update_if
);
8868 else if (p
->update_source
)
8869 json_object_string_add(json_neigh
, "updateSource", sockunion2str (p
->update_source
, buf1
, SU_ADDRSTRLEN
));
8874 /* advertisement-interval */
8875 vty_out (vty
, " Minimum time between advertisement runs is %d seconds%s",
8876 p
->v_routeadv
, VTY_NEWLINE
);
8878 /* Update-source. */
8879 if (p
->update_if
|| p
->update_source
)
8881 vty_out (vty
, " Update source is ");
8883 vty_out (vty
, "%s", p
->update_if
);
8884 else if (p
->update_source
)
8885 vty_out (vty
, "%s", sockunion2str (p
->update_source
, buf1
, SU_ADDRSTRLEN
));
8886 vty_out (vty
, "%s", VTY_NEWLINE
);
8889 vty_out (vty
, "%s", VTY_NEWLINE
);
8892 /* Address Family Information */
8893 json_object
*json_hold
= NULL
;
8896 json_hold
= json_object_new_object();
8898 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
8899 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
8900 if (p
->afc
[afi
][safi
])
8901 bgp_show_peer_afi (vty
, p
, afi
, safi
, use_json
, json_hold
);
8905 json_object_object_add(json_neigh
, "addressFamilyInfo", json_hold
);
8906 json_object_int_add(json_neigh
, "connectionsEstablished", p
->established
);
8907 json_object_int_add(json_neigh
, "connectionsDropped", p
->dropped
);
8910 vty_out (vty
, " Connections established %d; dropped %d%s", p
->established
, p
->dropped
,
8913 if (! p
->last_reset
)
8916 json_object_string_add(json_neigh
, "lastReset", "never");
8918 vty_out (vty
, " Last reset never%s", VTY_NEWLINE
);
8927 uptime
= bgp_clock();
8928 uptime
-= p
->resettime
;
8929 tm
= gmtime(&uptime
);
8930 json_object_int_add(json_neigh
, "lastResetTimerMsecs", (tm
->tm_sec
* 1000) + (tm
->tm_min
* 60000) + (tm
->tm_hour
* 3600000));
8931 json_object_string_add(json_neigh
, "lastResetDueTo", peer_down_str
[(int) p
->last_reset
]);
8932 if (p
->last_reset
== PEER_DOWN_NOTIFY_SEND
||
8933 p
->last_reset
== PEER_DOWN_NOTIFY_RECEIVED
)
8935 char errorcodesubcode_hexstr
[5];
8936 char errorcodesubcode_str
[256];
8938 code_str
= bgp_notify_code_str(p
->notify
.code
);
8939 subcode_str
= bgp_notify_subcode_str(p
->notify
.code
, p
->notify
.subcode
);
8941 sprintf(errorcodesubcode_hexstr
, "%02X%02X", p
->notify
.code
, p
->notify
.subcode
);
8942 json_object_string_add(json_neigh
, "lastErrorCodeSubcode", errorcodesubcode_hexstr
);
8943 snprintf(errorcodesubcode_str
, 255, "%s%s", code_str
, subcode_str
);
8944 json_object_string_add(json_neigh
, "lastNotificationReason", errorcodesubcode_str
);
8945 if (p
->last_reset
== PEER_DOWN_NOTIFY_RECEIVED
8946 && p
->notify
.code
== BGP_NOTIFY_CEASE
8947 && (p
->notify
.subcode
== BGP_NOTIFY_CEASE_ADMIN_SHUTDOWN
8948 || p
->notify
.subcode
== BGP_NOTIFY_CEASE_ADMIN_RESET
)
8949 && p
->notify
.length
)
8952 const char *msg_str
;
8954 msg_str
= bgp_notify_admin_message(msgbuf
, sizeof(msgbuf
),
8955 (u_char
*)p
->notify
.data
, p
->notify
.length
);
8957 json_object_string_add(json_neigh
, "lastShutdownDescription", msg_str
);
8963 vty_out (vty
, " Last reset %s, ",
8964 peer_uptime (p
->resettime
, timebuf
, BGP_UPTIME_LEN
, 0, NULL
));
8966 if (p
->last_reset
== PEER_DOWN_NOTIFY_SEND
||
8967 p
->last_reset
== PEER_DOWN_NOTIFY_RECEIVED
)
8969 code_str
= bgp_notify_code_str(p
->notify
.code
);
8970 subcode_str
= bgp_notify_subcode_str(p
->notify
.code
, p
->notify
.subcode
);
8971 vty_out (vty
, "due to NOTIFICATION %s (%s%s)%s",
8972 p
->last_reset
== PEER_DOWN_NOTIFY_SEND
? "sent" : "received",
8973 code_str
, subcode_str
, VTY_NEWLINE
);
8974 if (p
->last_reset
== PEER_DOWN_NOTIFY_RECEIVED
8975 && p
->notify
.code
== BGP_NOTIFY_CEASE
8976 && (p
->notify
.subcode
== BGP_NOTIFY_CEASE_ADMIN_SHUTDOWN
8977 || p
->notify
.subcode
== BGP_NOTIFY_CEASE_ADMIN_RESET
)
8978 && p
->notify
.length
)
8981 const char *msg_str
;
8983 msg_str
= bgp_notify_admin_message(msgbuf
, sizeof(msgbuf
),
8984 (u_char
*)p
->notify
.data
, p
->notify
.length
);
8986 vty_out (vty
, " Message: \"%s\"%s", msg_str
, VTY_NEWLINE
);
8991 vty_out (vty
, "due to %s%s",
8992 peer_down_str
[(int) p
->last_reset
], VTY_NEWLINE
);
8995 if (p
->last_reset_cause_size
)
8997 msg
= p
->last_reset_cause
;
8998 vty_out(vty
, " Message received that caused BGP to send a NOTIFICATION:%s ", VTY_NEWLINE
);
8999 for (i
= 1; i
<= p
->last_reset_cause_size
; i
++)
9001 vty_out(vty
, "%02X", *msg
++);
9003 if (i
!= p
->last_reset_cause_size
)
9007 vty_out(vty
, "%s ", VTY_NEWLINE
);
9009 else if (i
% 4 == 0)
9015 vty_out(vty
, "%s", VTY_NEWLINE
);
9020 if (CHECK_FLAG (p
->sflags
, PEER_STATUS_PREFIX_OVERFLOW
))
9023 json_object_boolean_true_add(json_neigh
, "prefixesConfigExceedMax");
9025 vty_out (vty
, " Peer had exceeded the max. no. of prefixes configured.%s", VTY_NEWLINE
);
9027 if (p
->t_pmax_restart
)
9031 json_object_boolean_true_add(json_neigh
, "reducePrefixNumFrom");
9032 json_object_int_add(json_neigh
, "restartInTimerMsec", thread_timer_remain_second (p
->t_pmax_restart
) * 1000);
9035 vty_out (vty
, " Reduce the no. of prefix from %s, will restart in %ld seconds%s",
9036 p
->host
, thread_timer_remain_second (p
->t_pmax_restart
),
9042 json_object_boolean_true_add(json_neigh
, "reducePrefixNumAndClearIpBgp");
9044 vty_out (vty
, " Reduce the no. of prefix and clear ip bgp %s to restore peering%s",
9045 p
->host
, VTY_NEWLINE
);
9049 /* EBGP Multihop and GTSM */
9050 if (p
->sort
!= BGP_PEER_IBGP
)
9054 if (p
->gtsm_hops
> 0)
9055 json_object_int_add(json_neigh
, "externalBgpNbrMaxHopsAway", p
->gtsm_hops
);
9056 else if (p
->ttl
> 1)
9057 json_object_int_add(json_neigh
, "externalBgpNbrMaxHopsAway", p
->ttl
);
9061 if (p
->gtsm_hops
> 0)
9062 vty_out (vty
, " External BGP neighbor may be up to %d hops away.%s",
9063 p
->gtsm_hops
, VTY_NEWLINE
);
9064 else if (p
->ttl
> 1)
9065 vty_out (vty
, " External BGP neighbor may be up to %d hops away.%s",
9066 p
->ttl
, VTY_NEWLINE
);
9071 if (p
->gtsm_hops
> 0)
9074 json_object_int_add(json_neigh
, "internalBgpNbrMaxHopsAway", p
->gtsm_hops
);
9076 vty_out (vty
, " Internal BGP neighbor may be up to %d hops away.%s",
9077 p
->gtsm_hops
, VTY_NEWLINE
);
9081 /* Local address. */
9086 json_object_string_add(json_neigh
, "hostLocal", sockunion2str (p
->su_local
, buf1
, SU_ADDRSTRLEN
));
9087 json_object_int_add(json_neigh
, "portLocal", ntohs (p
->su_local
->sin
.sin_port
));
9090 vty_out (vty
, "Local host: %s, Local port: %d%s",
9091 sockunion2str (p
->su_local
, buf1
, SU_ADDRSTRLEN
),
9092 ntohs (p
->su_local
->sin
.sin_port
),
9096 /* Remote address. */
9101 json_object_string_add(json_neigh
, "hostForeign", sockunion2str (p
->su_remote
, buf1
, SU_ADDRSTRLEN
));
9102 json_object_int_add(json_neigh
, "portForeign", ntohs (p
->su_remote
->sin
.sin_port
));
9105 vty_out (vty
, "Foreign host: %s, Foreign port: %d%s",
9106 sockunion2str (p
->su_remote
, buf1
, SU_ADDRSTRLEN
),
9107 ntohs (p
->su_remote
->sin
.sin_port
),
9111 /* Nexthop display. */
9116 json_object_string_add(json_neigh
, "nexthop",
9117 inet_ntop (AF_INET
, &p
->nexthop
.v4
, buf1
, sizeof(buf1
)));
9118 json_object_string_add(json_neigh
, "nexthopGlobal",
9119 inet_ntop (AF_INET6
, &p
->nexthop
.v6_global
, buf1
, sizeof(buf1
)));
9120 json_object_string_add(json_neigh
, "nexthopLocal",
9121 inet_ntop (AF_INET6
, &p
->nexthop
.v6_local
, buf1
, sizeof(buf1
)));
9122 if (p
->shared_network
)
9123 json_object_string_add(json_neigh
, "bgpConnection", "sharedNetwork");
9125 json_object_string_add(json_neigh
, "bgpConnection", "nonSharedNetwork");
9129 vty_out (vty
, "Nexthop: %s%s",
9130 inet_ntop (AF_INET
, &p
->nexthop
.v4
, buf1
, sizeof(buf1
)),
9132 vty_out (vty
, "Nexthop global: %s%s",
9133 inet_ntop (AF_INET6
, &p
->nexthop
.v6_global
, buf1
, sizeof(buf1
)),
9135 vty_out (vty
, "Nexthop local: %s%s",
9136 inet_ntop (AF_INET6
, &p
->nexthop
.v6_local
, buf1
, sizeof(buf1
)),
9138 vty_out (vty
, "BGP connection: %s%s",
9139 p
->shared_network
? "shared network" : "non shared network",
9144 /* Timer information. */
9147 json_object_int_add(json_neigh
, "connectRetryTimer", p
->v_connect
);
9148 if (p
->status
== Established
&& p
->rtt
)
9149 json_object_int_add(json_neigh
, "estimatedRttInMsecs", p
->rtt
);
9151 json_object_int_add(json_neigh
, "nextStartTimerDueInMsecs", thread_timer_remain_second (p
->t_start
) * 1000);
9153 json_object_int_add(json_neigh
, "nextConnectTimerDueInMsecs", thread_timer_remain_second (p
->t_connect
) * 1000);
9156 json_object_int_add(json_neigh
, "mraiInterval", p
->v_routeadv
);
9157 json_object_int_add(json_neigh
, "mraiTimerExpireInMsecs", thread_timer_remain_second (p
->t_routeadv
) * 1000);
9160 json_object_int_add(json_neigh
, "authenticationEnabled", 1);
9163 json_object_string_add(json_neigh
, "readThread", "on");
9165 json_object_string_add(json_neigh
, "readThread", "off");
9167 json_object_string_add(json_neigh
, "writeThread", "on");
9169 json_object_string_add(json_neigh
, "writeThread", "off");
9173 vty_out (vty
, "BGP Connect Retry Timer in Seconds: %d%s",
9174 p
->v_connect
, VTY_NEWLINE
);
9175 if (p
->status
== Established
&& p
->rtt
)
9176 vty_out (vty
, "Estimated round trip time: %d ms%s",
9177 p
->rtt
, VTY_NEWLINE
);
9179 vty_out (vty
, "Next start timer due in %ld seconds%s",
9180 thread_timer_remain_second (p
->t_start
), VTY_NEWLINE
);
9182 vty_out (vty
, "Next connect timer due in %ld seconds%s",
9183 thread_timer_remain_second (p
->t_connect
), VTY_NEWLINE
);
9185 vty_out (vty
, "MRAI (interval %u) timer expires in %ld seconds%s",
9186 p
->v_routeadv
, thread_timer_remain_second (p
->t_routeadv
),
9189 vty_out (vty
, "Peer Authentication Enabled%s", VTY_NEWLINE
);
9191 vty_out (vty
, "Read thread: %s Write thread: %s%s",
9192 p
->t_read
? "on" : "off",
9193 p
->t_write
? "on" : "off",
9197 if (p
->notify
.code
== BGP_NOTIFY_OPEN_ERR
9198 && p
->notify
.subcode
== BGP_NOTIFY_OPEN_UNSUP_CAPBL
)
9199 bgp_capability_vty_out (vty
, p
, use_json
, json_neigh
);
9202 vty_out (vty
, "%s", VTY_NEWLINE
);
9204 /* BFD information. */
9205 bgp_bfd_show_info(vty
, p
, use_json
, json_neigh
);
9209 if (p
->conf_if
) /* Configured interface name. */
9210 json_object_object_add(json
, p
->conf_if
, json_neigh
);
9211 else /* Configured IP address. */
9212 json_object_object_add(json
, p
->host
, json_neigh
);
9217 bgp_show_neighbor (struct vty
*vty
, struct bgp
*bgp
, enum show_type type
,
9218 union sockunion
*su
, const char *conf_if
, u_char use_json
, json_object
*json
)
9220 struct listnode
*node
, *nnode
;
9224 for (ALL_LIST_ELEMENTS (bgp
->peer
, node
, nnode
, peer
))
9226 if (!CHECK_FLAG(peer
->flags
, PEER_FLAG_CONFIG_NODE
))
9232 bgp_show_peer (vty
, peer
, use_json
, json
);
9237 if ((peer
->conf_if
&& !strcmp(peer
->conf_if
, conf_if
)) ||
9238 (peer
->hostname
&& !strcmp(peer
->hostname
, conf_if
)))
9241 bgp_show_peer (vty
, peer
, use_json
, json
);
9246 if (sockunion_same (&peer
->su
, su
))
9249 bgp_show_peer (vty
, peer
, use_json
, json
);
9256 if (type
== show_peer
&& ! find
)
9259 json_object_boolean_true_add(json
, "bgpNoSuchNeighbor");
9261 vty_out (vty
, "%% No such neighbor%s", VTY_NEWLINE
);
9266 vty_out (vty
, "%s%s", json_object_to_json_string_ext(json
, JSON_C_TO_STRING_PRETTY
), VTY_NEWLINE
);
9267 json_object_free(json
);
9271 vty_out (vty
, "%s", VTY_NEWLINE
);
9278 bgp_show_all_instances_neighbors_vty (struct vty
*vty
, u_char use_json
)
9280 struct listnode
*node
, *nnode
;
9282 json_object
*json
= NULL
;
9286 vty_out (vty
, "{%s", VTY_NEWLINE
);
9288 for (ALL_LIST_ELEMENTS (bm
->bgp
, node
, nnode
, bgp
))
9292 if (!(json
= json_object_new_object()))
9294 zlog_err("Unable to allocate memory for JSON object");
9296 "{\"error\": {\"message:\": \"Unable to allocate memory for JSON object\"}}}%s",
9301 json_object_int_add(json
, "vrfId",
9302 (bgp
->vrf_id
== VRF_UNKNOWN
)
9303 ? -1 : bgp
->vrf_id
);
9304 json_object_string_add(json
, "vrfName",
9305 (bgp
->inst_type
== BGP_INSTANCE_TYPE_DEFAULT
)
9306 ? "Default" : bgp
->name
);
9309 vty_out (vty
, ",%s", VTY_NEWLINE
);
9313 vty_out(vty
, "\"%s\":", (bgp
->inst_type
== BGP_INSTANCE_TYPE_DEFAULT
)
9314 ? "Default" : bgp
->name
);
9318 vty_out (vty
, "%sInstance %s:%s",
9320 (bgp
->inst_type
== BGP_INSTANCE_TYPE_DEFAULT
)
9321 ? "Default" : bgp
->name
,
9324 bgp_show_neighbor (vty
, bgp
, show_all
, NULL
, NULL
, use_json
, json
);
9328 vty_out (vty
, "}%s", VTY_NEWLINE
);
9332 bgp_show_neighbor_vty (struct vty
*vty
, const char *name
,
9333 enum show_type type
, const char *ip_str
, u_char use_json
)
9338 json_object
*json
= NULL
;
9342 if (strmatch(name
, "all"))
9344 bgp_show_all_instances_neighbors_vty (vty
, use_json
);
9349 bgp
= bgp_lookup_by_name (name
);
9354 json
= json_object_new_object();
9355 json_object_boolean_true_add(json
, "bgpNoSuchInstance");
9356 vty_out (vty
, "%s%s", json_object_to_json_string_ext(json
, JSON_C_TO_STRING_PRETTY
), VTY_NEWLINE
);
9357 json_object_free(json
);
9360 vty_out (vty
, "%% No such BGP instance exist%s", VTY_NEWLINE
);
9368 bgp
= bgp_get_default ();
9373 json
= json_object_new_object();
9376 ret
= str2sockunion (ip_str
, &su
);
9378 bgp_show_neighbor (vty
, bgp
, type
, NULL
, ip_str
, use_json
, json
);
9380 bgp_show_neighbor (vty
, bgp
, type
, &su
, NULL
, use_json
, json
);
9384 bgp_show_neighbor (vty
, bgp
, type
, NULL
, NULL
, use_json
, json
);
9386 json_object_free (json
);
9392 /* "show [ip] bgp neighbors" commands. */
9393 DEFUN (show_ip_bgp_neighbors
,
9394 show_ip_bgp_neighbors_cmd
,
9395 "show [ip] bgp [<view|vrf> VIEWVRFNAME] [<ipv4|ipv6|vpnv4 <all|rd ASN:nn_or_IP-address:nn>>] neighbors [<A.B.C.D|X:X::X:X|WORD>] [json]",
9399 BGP_INSTANCE_HELP_STR
9403 "Display information about all VPNv4 NLRIs\n"
9404 "Display information for a route distinguisher\n"
9405 "VPN Route Distinguisher\n"
9406 "Detailed information on TCP and BGP neighbor connections\n"
9407 "Neighbor to display information about\n"
9408 "Neighbor to display information about\n"
9409 "Neighbor on BGP configured interface\n"
9413 char *sh_arg
= NULL
;
9414 enum show_type sh_type
;
9416 u_char uj
= use_json(argc
, argv
);
9420 if (argv_find (argv
, argc
, "view", &idx
) ||
9421 argv_find (argv
, argc
, "vrf", &idx
))
9422 vrf
= argv
[idx
+1]->arg
;
9425 if (argv_find (argv
, argc
, "A.B.C.D", &idx
) ||
9426 argv_find (argv
, argc
, "X:X::X:X", &idx
) ||
9427 argv_find (argv
, argc
, "WORD", &idx
))
9429 sh_type
= show_peer
;
9430 sh_arg
= argv
[idx
]->arg
;
9435 return bgp_show_neighbor_vty (vty
, vrf
, sh_type
, sh_arg
, uj
);
9438 /* Show BGP's AS paths internal data. There are both `show [ip] bgp
9439 paths' and `show ip mbgp paths'. Those functions results are the
9441 DEFUN (show_ip_bgp_paths
,
9442 show_ip_bgp_paths_cmd
,
9443 "show [ip] bgp ["BGP_SAFI_CMD_STR
"] paths",
9448 "Path information\n")
9450 vty_out (vty
, "Address Refcnt Path%s", VTY_NEWLINE
);
9451 aspath_print_all_vty (vty
);
9458 community_show_all_iterator (struct hash_backet
*backet
, struct vty
*vty
)
9460 struct community
*com
;
9462 com
= (struct community
*) backet
->data
;
9463 vty_out (vty
, "[%p] (%ld) %s%s", (void *)backet
, com
->refcnt
,
9464 community_str (com
), VTY_NEWLINE
);
9467 /* Show BGP's community internal data. */
9468 DEFUN (show_ip_bgp_community_info
,
9469 show_ip_bgp_community_info_cmd
,
9470 "show [ip] bgp community-info",
9474 "List all bgp community information\n")
9476 vty_out (vty
, "Address Refcnt Community%s", VTY_NEWLINE
);
9478 hash_iterate (community_hash (),
9479 (void (*) (struct hash_backet
*, void *))
9480 community_show_all_iterator
,
9487 lcommunity_show_all_iterator (struct hash_backet
*backet
, struct vty
*vty
)
9489 struct lcommunity
*lcom
;
9491 lcom
= (struct lcommunity
*) backet
->data
;
9492 vty_out (vty
, "[%p] (%ld) %s%s", (void *)backet
, lcom
->refcnt
,
9493 lcommunity_str (lcom
), VTY_NEWLINE
);
9496 /* Show BGP's community internal data. */
9497 DEFUN (show_ip_bgp_lcommunity_info
,
9498 show_ip_bgp_lcommunity_info_cmd
,
9499 "show ip bgp large-community-info",
9503 "List all bgp large-community information\n")
9505 vty_out (vty
, "Address Refcnt Large-community%s", VTY_NEWLINE
);
9507 hash_iterate (lcommunity_hash (),
9508 (void (*) (struct hash_backet
*, void *))
9509 lcommunity_show_all_iterator
,
9516 DEFUN (show_ip_bgp_attr_info
,
9517 show_ip_bgp_attr_info_cmd
,
9518 "show [ip] bgp attribute-info",
9522 "List all bgp attribute information\n")
9524 attr_show_all (vty
);
9529 bgp_show_all_instances_updgrps_vty (struct vty
*vty
, afi_t afi
, safi_t safi
)
9531 struct listnode
*node
, *nnode
;
9534 for (ALL_LIST_ELEMENTS (bm
->bgp
, node
, nnode
, bgp
))
9536 vty_out (vty
, "%sInstance %s:%s",
9538 (bgp
->inst_type
== BGP_INSTANCE_TYPE_DEFAULT
) ? "Default" : bgp
->name
,
9540 update_group_show(bgp
, afi
, safi
, vty
, 0);
9545 bgp_show_update_groups(struct vty
*vty
, const char *name
,
9553 if (strmatch (name
, "all"))
9555 bgp_show_all_instances_updgrps_vty (vty
, afi
, safi
);
9560 bgp
= bgp_lookup_by_name (name
);
9565 bgp
= bgp_get_default ();
9569 update_group_show(bgp
, afi
, safi
, vty
, subgrp_id
);
9573 DEFUN (show_ip_bgp_updgrps
,
9574 show_ip_bgp_updgrps_cmd
,
9575 "show [ip] bgp [<view|vrf> VIEWVRFNAME] ["BGP_AFI_CMD_STR
" ["BGP_SAFI_CMD_STR
"]] update-groups [SUBGROUP-ID]",
9579 BGP_INSTANCE_HELP_STR
9582 "Detailed info about dynamic update groups\n"
9583 "Specific subgroup to display detailed info for\n")
9586 afi_t afi
= AFI_IP6
;
9587 safi_t safi
= SAFI_UNICAST
;
9588 uint64_t subgrp_id
= 0;
9593 if (argv_find (argv
, argc
, "ip", &idx
))
9595 /* [<view|vrf> VIEWVRFNAME] */
9596 if (argv_find (argv
, argc
, "view", &idx
) || argv_find (argv
, argc
, "vrf", &idx
))
9597 vrf
= argv
[++idx
]->arg
;
9598 /* ["BGP_AFI_CMD_STR" ["BGP_SAFI_CMD_STR"]] */
9599 if (argv_find_and_parse_afi (argv
, argc
, &idx
, &afi
))
9601 argv_find_and_parse_safi (argv
, argc
, &idx
, &safi
);
9604 /* get subgroup id, if provided */
9606 if (argv
[idx
]->type
== VARIABLE_TKN
)
9607 VTY_GET_ULL("subgroup-id", subgrp_id
, argv
[idx
]->arg
);
9609 return (bgp_show_update_groups(vty
, vrf
, afi
, safi
, subgrp_id
));
9612 DEFUN (show_bgp_instance_all_ipv6_updgrps
,
9613 show_bgp_instance_all_ipv6_updgrps_cmd
,
9614 "show [ip] bgp <view|vrf> all update-groups",
9618 BGP_INSTANCE_ALL_HELP_STR
9619 "Detailed info about dynamic update groups\n")
9621 bgp_show_all_instances_updgrps_vty (vty
, AFI_IP6
, SAFI_UNICAST
);
9625 DEFUN (show_bgp_updgrps_stats
,
9626 show_bgp_updgrps_stats_cmd
,
9627 "show [ip] bgp update-groups statistics",
9631 "Detailed info about dynamic update groups\n"
9636 bgp
= bgp_get_default();
9638 update_group_show_stats(bgp
, vty
);
9643 DEFUN (show_bgp_instance_updgrps_stats
,
9644 show_bgp_instance_updgrps_stats_cmd
,
9645 "show [ip] bgp <view|vrf> VIEWVRFNAME update-groups statistics",
9649 BGP_INSTANCE_HELP_STR
9650 "Detailed info about dynamic update groups\n"
9656 bgp
= bgp_lookup_by_name (argv
[idx_word
]->arg
);
9658 update_group_show_stats(bgp
, vty
);
9664 show_bgp_updgrps_adj_info_aux (struct vty
*vty
, const char *name
,
9665 afi_t afi
, safi_t safi
,
9666 const char *what
, uint64_t subgrp_id
)
9671 bgp
= bgp_lookup_by_name (name
);
9673 bgp
= bgp_get_default ();
9677 if (!strcmp(what
, "advertise-queue"))
9678 update_group_show_adj_queue(bgp
, afi
, safi
, vty
, subgrp_id
);
9679 else if (!strcmp(what
, "advertised-routes"))
9680 update_group_show_advertised(bgp
, afi
, safi
, vty
, subgrp_id
);
9681 else if (!strcmp(what
, "packet-queue"))
9682 update_group_show_packet_queue(bgp
, afi
, safi
, vty
, subgrp_id
);
9686 DEFUN (show_ip_bgp_updgrps_adj
,
9687 show_ip_bgp_updgrps_adj_cmd
,
9688 "show [ip] bgp update-groups <advertise-queue|advertised-routes|packet-queue>",
9692 "Detailed info about dynamic update groups\n"
9693 "Advertisement queue\n"
9694 "Announced routes\n"
9699 show_bgp_updgrps_adj_info_aux(vty
, NULL
, AFI_IP
, SAFI_UNICAST
, argv
[idx_type
]->arg
, 0);
9703 DEFUN (show_ip_bgp_instance_updgrps_adj
,
9704 show_ip_bgp_instance_updgrps_adj_cmd
,
9705 "show [ip] bgp <view|vrf> VIEWVRFNAME update-groups <advertise-queue|advertised-routes|packet-queue>",
9709 BGP_INSTANCE_HELP_STR
9710 "Detailed info about dynamic update groups\n"
9711 "Advertisement queue\n"
9712 "Announced routes\n"
9718 show_bgp_updgrps_adj_info_aux(vty
, argv
[idx_word
]->arg
, AFI_IP
, SAFI_UNICAST
, argv
[idx_type
]->arg
, 0);
9722 DEFUN (show_bgp_updgrps_afi_adj
,
9723 show_bgp_updgrps_afi_adj_cmd
,
9724 "show [ip] bgp "BGP_AFI_SAFI_CMD_STR
" update-groups <advertise-queue|advertised-routes|packet-queue>",
9728 BGP_AFI_SAFI_HELP_STR
9729 "Detailed info about dynamic update groups\n"
9730 "Advertisement queue\n"
9731 "Announced routes\n"
9733 "Specific subgroup info wanted for\n")
9738 show_bgp_updgrps_adj_info_aux(vty
, NULL
,
9739 bgp_vty_afi_from_arg(argv
[idx_afi
]->arg
),
9740 bgp_vty_safi_from_arg(argv
[idx_safi
]->arg
),
9741 argv
[idx_type
]->arg
, 0);
9745 DEFUN (show_bgp_updgrps_adj
,
9746 show_bgp_updgrps_adj_cmd
,
9747 "show [ip] bgp update-groups <advertise-queue|advertised-routes|packet-queue>",
9751 "Detailed info about dynamic update groups\n"
9752 "Advertisement queue\n"
9753 "Announced routes\n"
9757 show_bgp_updgrps_adj_info_aux(vty
, NULL
, AFI_IP6
, SAFI_UNICAST
, argv
[idx_type
]->arg
, 0);
9761 DEFUN (show_bgp_instance_updgrps_adj
,
9762 show_bgp_instance_updgrps_adj_cmd
,
9763 "show [ip] bgp <view|vrf> VIEWVRFNAME update-groups <advertise-queue|advertised-routes|packet-queue>",
9767 BGP_INSTANCE_HELP_STR
9768 "Detailed info about dynamic update groups\n"
9769 "Advertisement queue\n"
9770 "Announced routes\n"
9775 show_bgp_updgrps_adj_info_aux(vty
, argv
[idx_word
]->arg
, AFI_IP6
, SAFI_UNICAST
, argv
[idx_type
]->arg
, 0);
9779 DEFUN (show_ip_bgp_updgrps_adj_s
,
9780 show_ip_bgp_updgrps_adj_s_cmd
,
9781 "show [ip] bgp update-groups SUBGROUP-ID <advertise-queue|advertised-routes|packet-queue>",
9785 "Detailed info about dynamic update groups\n"
9786 "Specific subgroup to display info for\n"
9787 "Advertisement queue\n"
9788 "Announced routes\n"
9792 int idx_subgroup_id
= 4;
9796 VTY_GET_ULL("subgroup-id", subgrp_id
, argv
[idx_subgroup_id
]->arg
);
9798 show_bgp_updgrps_adj_info_aux(vty
, NULL
, AFI_IP
, SAFI_UNICAST
, argv
[idx_type
]->arg
, subgrp_id
);
9802 DEFUN (show_ip_bgp_instance_updgrps_adj_s
,
9803 show_ip_bgp_instance_updgrps_adj_s_cmd
,
9804 "show [ip] bgp <view|vrf> VIEWVRFNAME update-groups SUBGROUP-ID <advertise-queue|advertised-routes|packet-queue>",
9808 BGP_INSTANCE_HELP_STR
9809 "Detailed info about dynamic update groups\n"
9810 "Specific subgroup to display info for\n"
9811 "Advertisement queue\n"
9812 "Announced routes\n"
9817 int idx_subgroup_id
= 6;
9821 VTY_GET_ULL("subgroup-id", subgrp_id
, argv
[idx_subgroup_id
]->arg
);
9823 show_bgp_updgrps_adj_info_aux(vty
, argv
[idx_vrf
]->arg
, AFI_IP
, SAFI_UNICAST
, argv
[idx_type
]->arg
, subgrp_id
);
9827 DEFUN (show_bgp_updgrps_afi_adj_s
,
9828 show_bgp_updgrps_afi_adj_s_cmd
,
9829 "show [ip] bgp "BGP_AFI_SAFI_CMD_STR
" update-groups SUBGROUP-ID <advertise-queue|advertised-routes|packet-queue>",
9833 BGP_AFI_SAFI_HELP_STR
9834 "Detailed info about dynamic update groups\n"
9835 "Specific subgroup to display info for\n"
9836 "Advertisement queue\n"
9837 "Announced routes\n"
9839 "Specific subgroup info wanted for\n")
9843 int idx_subgroup_id
= 5;
9847 VTY_GET_ULL("subgroup-id", subgrp_id
, argv
[idx_subgroup_id
]->arg
);
9849 show_bgp_updgrps_adj_info_aux(vty
, NULL
,
9850 bgp_vty_afi_from_arg(argv
[idx_afi
]->arg
),
9851 bgp_vty_safi_from_arg(argv
[idx_safi
]->arg
),
9852 argv
[idx_type
]->arg
, subgrp_id
);
9856 DEFUN (show_bgp_updgrps_adj_s
,
9857 show_bgp_updgrps_adj_s_cmd
,
9858 "show [ip] bgp update-groups SUBGROUP-ID <advertise-queue|advertised-routes|packet-queue>",
9862 "Detailed info about dynamic update groups\n"
9863 "Specific subgroup to display info for\n"
9864 "Advertisement queue\n"
9865 "Announced routes\n"
9868 int idx_subgroup_id
= 3;
9872 VTY_GET_ULL("subgroup-id", subgrp_id
, argv
[idx_subgroup_id
]->arg
);
9874 show_bgp_updgrps_adj_info_aux(vty
, NULL
, AFI_IP6
, SAFI_UNICAST
, argv
[idx_type
]->arg
, subgrp_id
);
9878 DEFUN (show_bgp_instance_updgrps_adj_s
,
9879 show_bgp_instance_updgrps_adj_s_cmd
,
9880 "show [ip] bgp <view|vrf> VIEWVRFNAME update-groups SUBGROUP-ID <advertise-queue|advertised-routes|packet-queue>",
9884 BGP_INSTANCE_HELP_STR
9885 "Detailed info about dynamic update groups\n"
9886 "Specific subgroup to display info for\n"
9887 "Advertisement queue\n"
9888 "Announced routes\n"
9892 int idx_subgroup_id
= 5;
9896 VTY_GET_ULL("subgroup-id", subgrp_id
, argv
[idx_subgroup_id
]->arg
);
9898 show_bgp_updgrps_adj_info_aux(vty
, argv
[idx_vrf
]->arg
, AFI_IP6
, SAFI_UNICAST
, argv
[idx_type
]->arg
, subgrp_id
);
9905 bgp_show_one_peer_group (struct vty
*vty
, struct peer_group
*group
)
9907 struct listnode
*node
, *nnode
;
9908 struct prefix
*range
;
9911 char buf
[PREFIX2STR_BUFFER
];
9914 const char *peer_status
;
9922 if (conf
->as_type
== AS_SPECIFIED
||
9923 conf
->as_type
== AS_EXTERNAL
) {
9924 vty_out (vty
, "%sBGP peer-group %s, remote AS %d%s",
9925 VTY_NEWLINE
, group
->name
, conf
->as
, VTY_NEWLINE
);
9926 } else if (conf
->as_type
== AS_INTERNAL
) {
9927 vty_out (vty
, "%sBGP peer-group %s, remote AS %d%s",
9928 VTY_NEWLINE
, group
->name
, group
->bgp
->as
, VTY_NEWLINE
);
9930 vty_out (vty
, "%sBGP peer-group %s%s",
9931 VTY_NEWLINE
, group
->name
, VTY_NEWLINE
);
9934 if ((group
->bgp
->as
== conf
->as
) || (conf
->as_type
== AS_INTERNAL
))
9935 vty_out (vty
, " Peer-group type is internal%s", VTY_NEWLINE
);
9937 vty_out (vty
, " Peer-group type is external%s", VTY_NEWLINE
);
9939 /* Display AFs configured. */
9940 vty_out (vty
, " Configured address-families:");
9941 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
9942 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
9944 if (conf
->afc
[afi
][safi
])
9947 vty_out (vty
, " %s;", afi_safi_print(afi
, safi
));
9951 vty_out (vty
, " none%s", VTY_NEWLINE
);
9953 vty_out (vty
, "%s", VTY_NEWLINE
);
9955 /* Display listen ranges (for dynamic neighbors), if any */
9956 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
9960 else if (afi
== AFI_IP6
)
9964 lr_count
= listcount(group
->listen_range
[afi
]);
9968 " %d %s listen range(s)%s",
9969 lr_count
, af_str
, VTY_NEWLINE
);
9972 for (ALL_LIST_ELEMENTS (group
->listen_range
[afi
], node
,
9975 prefix2str(range
, buf
, sizeof(buf
));
9976 vty_out(vty
, " %s%s", buf
, VTY_NEWLINE
);
9981 /* Display group members and their status */
9982 if (listcount(group
->peer
))
9984 vty_out (vty
, " Peer-group members:%s", VTY_NEWLINE
);
9985 for (ALL_LIST_ELEMENTS (group
->peer
, node
, nnode
, peer
))
9987 if (CHECK_FLAG (peer
->flags
, PEER_FLAG_SHUTDOWN
))
9988 peer_status
= "Idle (Admin)";
9989 else if (CHECK_FLAG (peer
->sflags
, PEER_STATUS_PREFIX_OVERFLOW
))
9990 peer_status
= "Idle (PfxCt)";
9992 peer_status
= lookup_msg(bgp_status_msg
, peer
->status
, NULL
);
9994 dynamic
= peer_dynamic_neighbor(peer
);
9995 vty_out (vty
, " %s %s %s %s",
9996 peer
->host
, dynamic
? "(dynamic)" : "",
9997 peer_status
, VTY_NEWLINE
);
10001 return CMD_SUCCESS
;
10004 /* Show BGP peer group's information. */
10005 enum show_group_type
10012 bgp_show_peer_group (struct vty
*vty
, struct bgp
*bgp
,
10013 enum show_group_type type
, const char *group_name
)
10015 struct listnode
*node
, *nnode
;
10016 struct peer_group
*group
;
10019 for (ALL_LIST_ELEMENTS (bgp
->group
, node
, nnode
, group
))
10023 case show_all_groups
:
10024 bgp_show_one_peer_group (vty
, group
);
10026 case show_peer_group
:
10027 if (group_name
&& (strcmp(group
->name
, group_name
) == 0))
10030 bgp_show_one_peer_group (vty
, group
);
10036 if (type
== show_peer_group
&& ! find
)
10037 vty_out (vty
, "%% No such peer-group%s", VTY_NEWLINE
);
10039 return CMD_SUCCESS
;
10043 bgp_show_peer_group_vty (struct vty
*vty
, const char *name
,
10044 enum show_group_type type
, const char *group_name
)
10047 int ret
= CMD_SUCCESS
;
10050 bgp
= bgp_lookup_by_name (name
);
10052 bgp
= bgp_get_default ();
10056 vty_out (vty
, "%% No such BGP instance exist%s", VTY_NEWLINE
);
10057 return CMD_WARNING
;
10060 ret
= bgp_show_peer_group (vty
, bgp
, type
, group_name
);
10065 DEFUN (show_ip_bgp_peer_groups
,
10066 show_ip_bgp_peer_groups_cmd
,
10067 "show [ip] bgp [<view|vrf> VIEWVRFNAME] peer-group [PGNAME]",
10071 BGP_INSTANCE_HELP_STR
10072 "Detailed information on BGP peer groups\n"
10073 "Peer group name\n")
10079 vrf
= argv_find (argv
, argc
, "WORD", &idx
) ? argv
[idx
]->arg
: NULL
;
10080 pg
= argv_find (argv
, argc
, "PGNAME", &idx
) ? argv
[idx
]->arg
: NULL
;
10082 return bgp_show_peer_group_vty (vty
, vrf
, show_all_groups
, pg
);
10086 /* Redistribute VTY commands. */
10088 DEFUN (bgp_redistribute_ipv4
,
10089 bgp_redistribute_ipv4_cmd
,
10090 "redistribute " FRR_IP_REDIST_STR_BGPD
,
10091 "Redistribute information from another routing protocol\n"
10092 FRR_IP_REDIST_HELP_STR_BGPD
)
10094 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
10095 int idx_protocol
= 1;
10098 type
= proto_redistnum (AFI_IP
, argv
[idx_protocol
]->text
);
10101 vty_out (vty
, "%% Invalid route type%s", VTY_NEWLINE
);
10102 return CMD_WARNING
;
10104 bgp_redist_add(bgp
, AFI_IP
, type
, 0);
10105 return bgp_redistribute_set (bgp
, AFI_IP
, type
, 0);
10108 ALIAS_HIDDEN (bgp_redistribute_ipv4
,
10109 bgp_redistribute_ipv4_hidden_cmd
,
10110 "redistribute " FRR_IP_REDIST_STR_BGPD
,
10111 "Redistribute information from another routing protocol\n"
10112 FRR_IP_REDIST_HELP_STR_BGPD
)
10114 DEFUN (bgp_redistribute_ipv4_rmap
,
10115 bgp_redistribute_ipv4_rmap_cmd
,
10116 "redistribute " FRR_IP_REDIST_STR_BGPD
" route-map WORD",
10117 "Redistribute information from another routing protocol\n"
10118 FRR_IP_REDIST_HELP_STR_BGPD
10119 "Route map reference\n"
10120 "Pointer to route-map entries\n")
10122 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
10123 int idx_protocol
= 1;
10126 struct bgp_redist
*red
;
10128 type
= proto_redistnum (AFI_IP
, argv
[idx_protocol
]->text
);
10131 vty_out (vty
, "%% Invalid route type%s", VTY_NEWLINE
);
10132 return CMD_WARNING
;
10135 red
= bgp_redist_add(bgp
, AFI_IP
, type
, 0);
10136 bgp_redistribute_rmap_set (red
, argv
[idx_word
]->arg
);
10137 return bgp_redistribute_set (bgp
, AFI_IP
, type
, 0);
10140 ALIAS_HIDDEN (bgp_redistribute_ipv4_rmap
,
10141 bgp_redistribute_ipv4_rmap_hidden_cmd
,
10142 "redistribute " FRR_IP_REDIST_STR_BGPD
" route-map WORD",
10143 "Redistribute information from another routing protocol\n"
10144 FRR_IP_REDIST_HELP_STR_BGPD
10145 "Route map reference\n"
10146 "Pointer to route-map entries\n")
10148 DEFUN (bgp_redistribute_ipv4_metric
,
10149 bgp_redistribute_ipv4_metric_cmd
,
10150 "redistribute " FRR_IP_REDIST_STR_BGPD
" metric (0-4294967295)",
10151 "Redistribute information from another routing protocol\n"
10152 FRR_IP_REDIST_HELP_STR_BGPD
10153 "Metric for redistributed routes\n"
10154 "Default metric\n")
10156 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
10157 int idx_protocol
= 1;
10158 int idx_number
= 3;
10161 struct bgp_redist
*red
;
10163 type
= proto_redistnum (AFI_IP
, argv
[idx_protocol
]->text
);
10166 vty_out (vty
, "%% Invalid route type%s", VTY_NEWLINE
);
10167 return CMD_WARNING
;
10169 VTY_GET_INTEGER ("metric", metric
, argv
[idx_number
]->arg
);
10171 red
= bgp_redist_add(bgp
, AFI_IP
, type
, 0);
10172 bgp_redistribute_metric_set(bgp
, red
, AFI_IP
, type
, metric
);
10173 return bgp_redistribute_set (bgp
, AFI_IP
, type
, 0);
10176 ALIAS_HIDDEN (bgp_redistribute_ipv4_metric
,
10177 bgp_redistribute_ipv4_metric_hidden_cmd
,
10178 "redistribute " FRR_IP_REDIST_STR_BGPD
" metric (0-4294967295)",
10179 "Redistribute information from another routing protocol\n"
10180 FRR_IP_REDIST_HELP_STR_BGPD
10181 "Metric for redistributed routes\n"
10182 "Default metric\n")
10184 DEFUN (bgp_redistribute_ipv4_rmap_metric
,
10185 bgp_redistribute_ipv4_rmap_metric_cmd
,
10186 "redistribute " FRR_IP_REDIST_STR_BGPD
" route-map WORD metric (0-4294967295)",
10187 "Redistribute information from another routing protocol\n"
10188 FRR_IP_REDIST_HELP_STR_BGPD
10189 "Route map reference\n"
10190 "Pointer to route-map entries\n"
10191 "Metric for redistributed routes\n"
10192 "Default metric\n")
10194 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
10195 int idx_protocol
= 1;
10197 int idx_number
= 5;
10200 struct bgp_redist
*red
;
10202 type
= proto_redistnum (AFI_IP
, argv
[idx_protocol
]->text
);
10205 vty_out (vty
, "%% Invalid route type%s", VTY_NEWLINE
);
10206 return CMD_WARNING
;
10208 VTY_GET_INTEGER ("metric", metric
, argv
[idx_number
]->arg
);
10210 red
= bgp_redist_add(bgp
, AFI_IP
, type
, 0);
10211 bgp_redistribute_rmap_set (red
, argv
[idx_word
]->arg
);
10212 bgp_redistribute_metric_set(bgp
, red
, AFI_IP
, type
, metric
);
10213 return bgp_redistribute_set (bgp
, AFI_IP
, type
, 0);
10216 ALIAS_HIDDEN (bgp_redistribute_ipv4_rmap_metric
,
10217 bgp_redistribute_ipv4_rmap_metric_hidden_cmd
,
10218 "redistribute " FRR_IP_REDIST_STR_BGPD
" route-map WORD metric (0-4294967295)",
10219 "Redistribute information from another routing protocol\n"
10220 FRR_IP_REDIST_HELP_STR_BGPD
10221 "Route map reference\n"
10222 "Pointer to route-map entries\n"
10223 "Metric for redistributed routes\n"
10224 "Default metric\n")
10226 DEFUN (bgp_redistribute_ipv4_metric_rmap
,
10227 bgp_redistribute_ipv4_metric_rmap_cmd
,
10228 "redistribute " FRR_IP_REDIST_STR_BGPD
" metric (0-4294967295) route-map WORD",
10229 "Redistribute information from another routing protocol\n"
10230 FRR_IP_REDIST_HELP_STR_BGPD
10231 "Metric for redistributed routes\n"
10233 "Route map reference\n"
10234 "Pointer to route-map entries\n")
10236 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
10237 int idx_protocol
= 1;
10238 int idx_number
= 3;
10242 struct bgp_redist
*red
;
10244 type
= proto_redistnum (AFI_IP
, argv
[idx_protocol
]->text
);
10247 vty_out (vty
, "%% Invalid route type%s", VTY_NEWLINE
);
10248 return CMD_WARNING
;
10250 VTY_GET_INTEGER ("metric", metric
, argv
[idx_number
]->arg
);
10252 red
= bgp_redist_add(bgp
, AFI_IP
, type
, 0);
10253 bgp_redistribute_metric_set(bgp
, red
, AFI_IP
, type
, metric
);
10254 bgp_redistribute_rmap_set (red
, argv
[idx_word
]->arg
);
10255 return bgp_redistribute_set (bgp
, AFI_IP
, type
, 0);
10258 ALIAS_HIDDEN (bgp_redistribute_ipv4_metric_rmap
,
10259 bgp_redistribute_ipv4_metric_rmap_hidden_cmd
,
10260 "redistribute " FRR_IP_REDIST_STR_BGPD
" metric (0-4294967295) route-map WORD",
10261 "Redistribute information from another routing protocol\n"
10262 FRR_IP_REDIST_HELP_STR_BGPD
10263 "Metric for redistributed routes\n"
10265 "Route map reference\n"
10266 "Pointer to route-map entries\n")
10268 DEFUN (bgp_redistribute_ipv4_ospf
,
10269 bgp_redistribute_ipv4_ospf_cmd
,
10270 "redistribute <ospf|table> (1-65535)",
10271 "Redistribute information from another routing protocol\n"
10272 "Open Shortest Path First (OSPFv2)\n"
10273 "Non-main Kernel Routing Table\n"
10274 "Instance ID/Table ID\n")
10276 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
10277 int idx_ospf_table
= 1;
10278 int idx_number
= 2;
10282 VTY_GET_INTEGER ("Instance ID", instance
, argv
[idx_number
]->arg
);
10284 if (strncmp(argv
[idx_ospf_table
]->arg
, "o", 1) == 0)
10285 protocol
= ZEBRA_ROUTE_OSPF
;
10287 protocol
= ZEBRA_ROUTE_TABLE
;
10289 bgp_redist_add(bgp
, AFI_IP
, protocol
, instance
);
10290 return bgp_redistribute_set (bgp
, AFI_IP
, protocol
, instance
);
10293 ALIAS_HIDDEN (bgp_redistribute_ipv4_ospf
,
10294 bgp_redistribute_ipv4_ospf_hidden_cmd
,
10295 "redistribute <ospf|table> (1-65535)",
10296 "Redistribute information from another routing protocol\n"
10297 "Open Shortest Path First (OSPFv2)\n"
10298 "Non-main Kernel Routing Table\n"
10299 "Instance ID/Table ID\n")
10301 DEFUN (bgp_redistribute_ipv4_ospf_rmap
,
10302 bgp_redistribute_ipv4_ospf_rmap_cmd
,
10303 "redistribute <ospf|table> (1-65535) route-map WORD",
10304 "Redistribute information from another routing protocol\n"
10305 "Open Shortest Path First (OSPFv2)\n"
10306 "Non-main Kernel Routing Table\n"
10307 "Instance ID/Table ID\n"
10308 "Route map reference\n"
10309 "Pointer to route-map entries\n")
10311 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
10312 int idx_ospf_table
= 1;
10313 int idx_number
= 2;
10315 struct bgp_redist
*red
;
10319 if (strncmp(argv
[idx_ospf_table
]->arg
, "o", 1) == 0)
10320 protocol
= ZEBRA_ROUTE_OSPF
;
10322 protocol
= ZEBRA_ROUTE_TABLE
;
10324 VTY_GET_INTEGER ("Instance ID", instance
, argv
[idx_number
]->arg
);
10325 red
= bgp_redist_add(bgp
, AFI_IP
, protocol
, instance
);
10326 bgp_redistribute_rmap_set (red
, argv
[idx_word
]->arg
);
10327 return bgp_redistribute_set (bgp
, AFI_IP
, protocol
, instance
);
10330 ALIAS_HIDDEN (bgp_redistribute_ipv4_ospf_rmap
,
10331 bgp_redistribute_ipv4_ospf_rmap_hidden_cmd
,
10332 "redistribute <ospf|table> (1-65535) route-map WORD",
10333 "Redistribute information from another routing protocol\n"
10334 "Open Shortest Path First (OSPFv2)\n"
10335 "Non-main Kernel Routing Table\n"
10336 "Instance ID/Table ID\n"
10337 "Route map reference\n"
10338 "Pointer to route-map entries\n")
10340 DEFUN (bgp_redistribute_ipv4_ospf_metric
,
10341 bgp_redistribute_ipv4_ospf_metric_cmd
,
10342 "redistribute <ospf|table> (1-65535) metric (0-4294967295)",
10343 "Redistribute information from another routing protocol\n"
10344 "Open Shortest Path First (OSPFv2)\n"
10345 "Non-main Kernel Routing Table\n"
10346 "Instance ID/Table ID\n"
10347 "Metric for redistributed routes\n"
10348 "Default metric\n")
10350 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
10351 int idx_ospf_table
= 1;
10352 int idx_number
= 2;
10353 int idx_number_2
= 4;
10355 struct bgp_redist
*red
;
10359 if (strncmp(argv
[idx_ospf_table
]->arg
, "o", 1) == 0)
10360 protocol
= ZEBRA_ROUTE_OSPF
;
10362 protocol
= ZEBRA_ROUTE_TABLE
;
10364 VTY_GET_INTEGER ("Instance ID", instance
, argv
[idx_number
]->arg
);
10365 VTY_GET_INTEGER ("metric", metric
, argv
[idx_number_2
]->arg
);
10367 red
= bgp_redist_add(bgp
, AFI_IP
, protocol
, instance
);
10368 bgp_redistribute_metric_set(bgp
, red
, AFI_IP
, protocol
, metric
);
10369 return bgp_redistribute_set (bgp
, AFI_IP
, protocol
, instance
);
10372 ALIAS_HIDDEN (bgp_redistribute_ipv4_ospf_metric
,
10373 bgp_redistribute_ipv4_ospf_metric_hidden_cmd
,
10374 "redistribute <ospf|table> (1-65535) metric (0-4294967295)",
10375 "Redistribute information from another routing protocol\n"
10376 "Open Shortest Path First (OSPFv2)\n"
10377 "Non-main Kernel Routing Table\n"
10378 "Instance ID/Table ID\n"
10379 "Metric for redistributed routes\n"
10380 "Default metric\n")
10382 DEFUN (bgp_redistribute_ipv4_ospf_rmap_metric
,
10383 bgp_redistribute_ipv4_ospf_rmap_metric_cmd
,
10384 "redistribute <ospf|table> (1-65535) route-map WORD metric (0-4294967295)",
10385 "Redistribute information from another routing protocol\n"
10386 "Open Shortest Path First (OSPFv2)\n"
10387 "Non-main Kernel Routing Table\n"
10388 "Instance ID/Table ID\n"
10389 "Route map reference\n"
10390 "Pointer to route-map entries\n"
10391 "Metric for redistributed routes\n"
10392 "Default metric\n")
10394 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
10395 int idx_ospf_table
= 1;
10396 int idx_number
= 2;
10398 int idx_number_2
= 6;
10400 struct bgp_redist
*red
;
10404 if (strncmp(argv
[idx_ospf_table
]->arg
, "o", 1) == 0)
10405 protocol
= ZEBRA_ROUTE_OSPF
;
10407 protocol
= ZEBRA_ROUTE_TABLE
;
10409 VTY_GET_INTEGER ("Instance ID", instance
, argv
[idx_number
]->arg
);
10410 VTY_GET_INTEGER ("metric", metric
, argv
[idx_number_2
]->arg
);
10412 red
= bgp_redist_add(bgp
, AFI_IP
, protocol
, instance
);
10413 bgp_redistribute_rmap_set (red
, argv
[idx_word
]->arg
);
10414 bgp_redistribute_metric_set(bgp
, red
, AFI_IP
, protocol
, metric
);
10415 return bgp_redistribute_set (bgp
, AFI_IP
, protocol
, instance
);
10418 ALIAS_HIDDEN (bgp_redistribute_ipv4_ospf_rmap_metric
,
10419 bgp_redistribute_ipv4_ospf_rmap_metric_hidden_cmd
,
10420 "redistribute <ospf|table> (1-65535) route-map WORD metric (0-4294967295)",
10421 "Redistribute information from another routing protocol\n"
10422 "Open Shortest Path First (OSPFv2)\n"
10423 "Non-main Kernel Routing Table\n"
10424 "Instance ID/Table ID\n"
10425 "Route map reference\n"
10426 "Pointer to route-map entries\n"
10427 "Metric for redistributed routes\n"
10428 "Default metric\n")
10430 DEFUN (bgp_redistribute_ipv4_ospf_metric_rmap
,
10431 bgp_redistribute_ipv4_ospf_metric_rmap_cmd
,
10432 "redistribute <ospf|table> (1-65535) metric (0-4294967295) route-map WORD",
10433 "Redistribute information from another routing protocol\n"
10434 "Open Shortest Path First (OSPFv2)\n"
10435 "Non-main Kernel Routing Table\n"
10436 "Instance ID/Table ID\n"
10437 "Metric for redistributed routes\n"
10439 "Route map reference\n"
10440 "Pointer to route-map entries\n")
10442 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
10443 int idx_ospf_table
= 1;
10444 int idx_number
= 2;
10445 int idx_number_2
= 4;
10448 struct bgp_redist
*red
;
10452 if (strncmp(argv
[idx_ospf_table
]->arg
, "o", 1) == 0)
10453 protocol
= ZEBRA_ROUTE_OSPF
;
10455 protocol
= ZEBRA_ROUTE_TABLE
;
10457 VTY_GET_INTEGER ("Instance ID", instance
, argv
[idx_number
]->arg
);
10458 VTY_GET_INTEGER ("metric", metric
, argv
[idx_number_2
]->arg
);
10460 red
= bgp_redist_add(bgp
, AFI_IP
, protocol
, instance
);
10461 bgp_redistribute_metric_set(bgp
, red
, AFI_IP
, protocol
, metric
);
10462 bgp_redistribute_rmap_set (red
, argv
[idx_word
]->arg
);
10463 return bgp_redistribute_set (bgp
, AFI_IP
, protocol
, instance
);
10466 ALIAS_HIDDEN (bgp_redistribute_ipv4_ospf_metric_rmap
,
10467 bgp_redistribute_ipv4_ospf_metric_rmap_hidden_cmd
,
10468 "redistribute <ospf|table> (1-65535) metric (0-4294967295) route-map WORD",
10469 "Redistribute information from another routing protocol\n"
10470 "Open Shortest Path First (OSPFv2)\n"
10471 "Non-main Kernel Routing Table\n"
10472 "Instance ID/Table ID\n"
10473 "Metric for redistributed routes\n"
10475 "Route map reference\n"
10476 "Pointer to route-map entries\n")
10478 DEFUN (no_bgp_redistribute_ipv4_ospf
,
10479 no_bgp_redistribute_ipv4_ospf_cmd
,
10480 "no redistribute <ospf|table> (1-65535) [metric (0-4294967295)] [route-map WORD]",
10482 "Redistribute information from another routing protocol\n"
10483 "Open Shortest Path First (OSPFv2)\n"
10484 "Non-main Kernel Routing Table\n"
10485 "Instance ID/Table ID\n"
10486 "Metric for redistributed routes\n"
10488 "Route map reference\n"
10489 "Pointer to route-map entries\n")
10491 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
10492 int idx_ospf_table
= 2;
10493 int idx_number
= 3;
10497 if (strncmp(argv
[idx_ospf_table
]->arg
, "o", 1) == 0)
10498 protocol
= ZEBRA_ROUTE_OSPF
;
10500 protocol
= ZEBRA_ROUTE_TABLE
;
10502 VTY_GET_INTEGER ("Instance ID", instance
, argv
[idx_number
]->arg
);
10503 return bgp_redistribute_unset (bgp
, AFI_IP
, protocol
, instance
);
10506 ALIAS_HIDDEN (no_bgp_redistribute_ipv4_ospf
,
10507 no_bgp_redistribute_ipv4_ospf_hidden_cmd
,
10508 "no redistribute <ospf|table> (1-65535) [metric (0-4294967295)] [route-map WORD]",
10510 "Redistribute information from another routing protocol\n"
10511 "Open Shortest Path First (OSPFv2)\n"
10512 "Non-main Kernel Routing Table\n"
10513 "Instance ID/Table ID\n"
10514 "Metric for redistributed routes\n"
10516 "Route map reference\n"
10517 "Pointer to route-map entries\n")
10519 DEFUN (no_bgp_redistribute_ipv4
,
10520 no_bgp_redistribute_ipv4_cmd
,
10521 "no redistribute " FRR_IP_REDIST_STR_BGPD
" [metric (0-4294967295)] [route-map WORD]",
10523 "Redistribute information from another routing protocol\n"
10524 FRR_IP_REDIST_HELP_STR_BGPD
10525 "Metric for redistributed routes\n"
10527 "Route map reference\n"
10528 "Pointer to route-map entries\n")
10530 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
10531 int idx_protocol
= 2;
10534 type
= proto_redistnum (AFI_IP
, argv
[idx_protocol
]->text
);
10537 vty_out (vty
, "%% Invalid route type%s", VTY_NEWLINE
);
10538 return CMD_WARNING
;
10540 return bgp_redistribute_unset (bgp
, AFI_IP
, type
, 0);
10543 ALIAS_HIDDEN (no_bgp_redistribute_ipv4
,
10544 no_bgp_redistribute_ipv4_hidden_cmd
,
10545 "no redistribute " FRR_IP_REDIST_STR_BGPD
" [metric (0-4294967295)] [route-map WORD]",
10547 "Redistribute information from another routing protocol\n"
10548 FRR_IP_REDIST_HELP_STR_BGPD
10549 "Metric for redistributed routes\n"
10551 "Route map reference\n"
10552 "Pointer to route-map entries\n")
10554 DEFUN (bgp_redistribute_ipv6
,
10555 bgp_redistribute_ipv6_cmd
,
10556 "redistribute " FRR_IP6_REDIST_STR_BGPD
,
10557 "Redistribute information from another routing protocol\n"
10558 FRR_IP6_REDIST_HELP_STR_BGPD
)
10560 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
10561 int idx_protocol
= 1;
10564 type
= proto_redistnum (AFI_IP6
, argv
[idx_protocol
]->text
);
10567 vty_out (vty
, "%% Invalid route type%s", VTY_NEWLINE
);
10568 return CMD_WARNING
;
10571 bgp_redist_add(bgp
, AFI_IP6
, type
, 0);
10572 return bgp_redistribute_set (bgp
, AFI_IP6
, type
, 0);
10575 DEFUN (bgp_redistribute_ipv6_rmap
,
10576 bgp_redistribute_ipv6_rmap_cmd
,
10577 "redistribute " FRR_IP6_REDIST_STR_BGPD
" route-map WORD",
10578 "Redistribute information from another routing protocol\n"
10579 FRR_IP6_REDIST_HELP_STR_BGPD
10580 "Route map reference\n"
10581 "Pointer to route-map entries\n")
10583 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
10584 int idx_protocol
= 1;
10587 struct bgp_redist
*red
;
10589 type
= proto_redistnum (AFI_IP6
, argv
[idx_protocol
]->text
);
10592 vty_out (vty
, "%% Invalid route type%s", VTY_NEWLINE
);
10593 return CMD_WARNING
;
10596 red
= bgp_redist_add(bgp
, AFI_IP6
, type
, 0);
10597 bgp_redistribute_rmap_set (red
, argv
[idx_word
]->arg
);
10598 return bgp_redistribute_set (bgp
, AFI_IP6
, type
, 0);
10601 DEFUN (bgp_redistribute_ipv6_metric
,
10602 bgp_redistribute_ipv6_metric_cmd
,
10603 "redistribute " FRR_IP6_REDIST_STR_BGPD
" metric (0-4294967295)",
10604 "Redistribute information from another routing protocol\n"
10605 FRR_IP6_REDIST_HELP_STR_BGPD
10606 "Metric for redistributed routes\n"
10607 "Default metric\n")
10609 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
10610 int idx_protocol
= 1;
10611 int idx_number
= 3;
10614 struct bgp_redist
*red
;
10616 type
= proto_redistnum (AFI_IP6
, argv
[idx_protocol
]->text
);
10619 vty_out (vty
, "%% Invalid route type%s", VTY_NEWLINE
);
10620 return CMD_WARNING
;
10622 VTY_GET_INTEGER ("metric", metric
, argv
[idx_number
]->arg
);
10624 red
= bgp_redist_add(bgp
, AFI_IP6
, type
, 0);
10625 bgp_redistribute_metric_set(bgp
, red
, AFI_IP6
, type
, metric
);
10626 return bgp_redistribute_set (bgp
, AFI_IP6
, type
, 0);
10629 DEFUN (bgp_redistribute_ipv6_rmap_metric
,
10630 bgp_redistribute_ipv6_rmap_metric_cmd
,
10631 "redistribute " FRR_IP6_REDIST_STR_BGPD
" route-map WORD metric (0-4294967295)",
10632 "Redistribute information from another routing protocol\n"
10633 FRR_IP6_REDIST_HELP_STR_BGPD
10634 "Route map reference\n"
10635 "Pointer to route-map entries\n"
10636 "Metric for redistributed routes\n"
10637 "Default metric\n")
10639 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
10640 int idx_protocol
= 1;
10642 int idx_number
= 5;
10645 struct bgp_redist
*red
;
10647 type
= proto_redistnum (AFI_IP6
, argv
[idx_protocol
]->text
);
10650 vty_out (vty
, "%% Invalid route type%s", VTY_NEWLINE
);
10651 return CMD_WARNING
;
10653 VTY_GET_INTEGER ("metric", metric
, argv
[idx_number
]->arg
);
10655 red
= bgp_redist_add(bgp
, AFI_IP6
, type
, 0);
10656 bgp_redistribute_rmap_set (red
, argv
[idx_word
]->arg
);
10657 bgp_redistribute_metric_set(bgp
, red
, AFI_IP6
, type
, metric
);
10658 return bgp_redistribute_set (bgp
, AFI_IP6
, type
, 0);
10661 DEFUN (bgp_redistribute_ipv6_metric_rmap
,
10662 bgp_redistribute_ipv6_metric_rmap_cmd
,
10663 "redistribute " FRR_IP6_REDIST_STR_BGPD
" metric (0-4294967295) route-map WORD",
10664 "Redistribute information from another routing protocol\n"
10665 FRR_IP6_REDIST_HELP_STR_BGPD
10666 "Metric for redistributed routes\n"
10668 "Route map reference\n"
10669 "Pointer to route-map entries\n")
10671 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
10672 int idx_protocol
= 1;
10673 int idx_number
= 3;
10677 struct bgp_redist
*red
;
10679 type
= proto_redistnum (AFI_IP6
, argv
[idx_protocol
]->text
);
10682 vty_out (vty
, "%% Invalid route type%s", VTY_NEWLINE
);
10683 return CMD_WARNING
;
10685 VTY_GET_INTEGER ("metric", metric
, argv
[idx_number
]->arg
);
10687 red
= bgp_redist_add(bgp
, AFI_IP6
, type
, 0);
10688 bgp_redistribute_metric_set(bgp
, red
, AFI_IP6
, SAFI_UNICAST
, metric
);
10689 bgp_redistribute_rmap_set (red
, argv
[idx_word
]->arg
);
10690 return bgp_redistribute_set (bgp
, AFI_IP6
, type
, 0);
10693 DEFUN (no_bgp_redistribute_ipv6
,
10694 no_bgp_redistribute_ipv6_cmd
,
10695 "no redistribute " FRR_IP6_REDIST_STR_BGPD
" [metric (0-4294967295)] [route-map WORD]",
10697 "Redistribute information from another routing protocol\n"
10698 FRR_IP6_REDIST_HELP_STR_BGPD
10699 "Metric for redistributed routes\n"
10701 "Route map reference\n"
10702 "Pointer to route-map entries\n")
10704 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
10705 int idx_protocol
= 2;
10708 type
= proto_redistnum (AFI_IP6
, argv
[idx_protocol
]->text
);
10711 vty_out (vty
, "%% Invalid route type%s", VTY_NEWLINE
);
10712 return CMD_WARNING
;
10715 return bgp_redistribute_unset (bgp
, AFI_IP6
, type
, 0);
10719 bgp_config_write_redistribute (struct vty
*vty
, struct bgp
*bgp
, afi_t afi
,
10720 safi_t safi
, int *write
)
10724 /* Unicast redistribution only. */
10725 if (safi
!= SAFI_UNICAST
)
10728 for (i
= 0; i
< ZEBRA_ROUTE_MAX
; i
++)
10730 /* Redistribute BGP does not make sense. */
10731 if (i
!= ZEBRA_ROUTE_BGP
)
10733 struct list
*red_list
;
10734 struct listnode
*node
;
10735 struct bgp_redist
*red
;
10737 red_list
= bgp
->redist
[afi
][i
];
10741 for (ALL_LIST_ELEMENTS_RO(red_list
, node
, red
))
10743 /* Display "address-family" when it is not yet diplayed. */
10744 bgp_config_write_family_header (vty
, afi
, safi
, write
);
10746 /* "redistribute" configuration. */
10747 vty_out (vty
, " redistribute %s", zebra_route_string(i
));
10749 vty_out (vty
, " %d", red
->instance
);
10750 if (red
->redist_metric_flag
)
10751 vty_out (vty
, " metric %u", red
->redist_metric
);
10752 if (red
->rmap
.name
)
10753 vty_out (vty
, " route-map %s", red
->rmap
.name
);
10754 vty_out (vty
, "%s", VTY_NEWLINE
);
10761 /* BGP node structure. */
10762 static struct cmd_node bgp_node
=
10765 "%s(config-router)# ",
10769 static struct cmd_node bgp_ipv4_unicast_node
=
10772 "%s(config-router-af)# ",
10776 static struct cmd_node bgp_ipv4_multicast_node
=
10779 "%s(config-router-af)# ",
10783 static struct cmd_node bgp_ipv4_labeled_unicast_node
=
10786 "%s(config-router-af)# ",
10790 static struct cmd_node bgp_ipv6_unicast_node
=
10793 "%s(config-router-af)# ",
10797 static struct cmd_node bgp_ipv6_multicast_node
=
10800 "%s(config-router-af)# ",
10804 static struct cmd_node bgp_ipv6_labeled_unicast_node
=
10807 "%s(config-router-af)# ",
10811 static struct cmd_node bgp_vpnv4_node
=
10814 "%s(config-router-af)# ",
10818 static struct cmd_node bgp_vpnv6_node
=
10821 "%s(config-router-af-vpnv6)# ",
10825 static struct cmd_node bgp_evpn_node
=
10828 "%s(config-router-evpn)# ",
10832 static void community_list_vty (void);
10835 bgp_ac_neighbor (vector comps
, struct cmd_token
*token
)
10839 struct peer_group
*group
;
10840 struct listnode
*lnbgp
, *lnpeer
;
10842 for (ALL_LIST_ELEMENTS_RO (bm
->bgp
, lnbgp
, bgp
))
10844 for (ALL_LIST_ELEMENTS_RO (bgp
->peer
, lnpeer
, peer
))
10846 /* only provide suggestions on the appropriate input token type,
10847 * they'll otherwise show up multiple times */
10848 enum cmd_token_type match_type
;
10849 char *name
= peer
->host
;
10853 match_type
= VARIABLE_TKN
;
10854 name
= peer
->conf_if
;
10856 else if (strchr(peer
->host
, ':'))
10857 match_type
= IPV6_TKN
;
10859 match_type
= IPV4_TKN
;
10861 if (token
->type
!= match_type
)
10864 vector_set(comps
, XSTRDUP(MTYPE_COMPLETION
, name
));
10867 if (token
->type
== VARIABLE_TKN
)
10868 for (ALL_LIST_ELEMENTS_RO (bgp
->group
, lnpeer
, group
))
10869 vector_set(comps
, XSTRDUP(MTYPE_COMPLETION
, group
->name
));
10873 static const struct cmd_variable_handler bgp_var_neighbor
[] = {
10875 .varname
= "neighbor",
10876 .completions
= bgp_ac_neighbor
10878 .varname
= "neighbors",
10879 .completions
= bgp_ac_neighbor
10881 .completions
= NULL
10886 bgp_vty_init (void)
10888 cmd_variable_handler_register(bgp_var_neighbor
);
10890 /* Install bgp top node. */
10891 install_node (&bgp_node
, bgp_config_write
);
10892 install_node (&bgp_ipv4_unicast_node
, NULL
);
10893 install_node (&bgp_ipv4_multicast_node
, NULL
);
10894 install_node (&bgp_ipv4_labeled_unicast_node
, NULL
);
10895 install_node (&bgp_ipv6_unicast_node
, NULL
);
10896 install_node (&bgp_ipv6_multicast_node
, NULL
);
10897 install_node (&bgp_ipv6_labeled_unicast_node
, NULL
);
10898 install_node (&bgp_vpnv4_node
, NULL
);
10899 install_node (&bgp_vpnv6_node
, NULL
);
10900 install_node (&bgp_evpn_node
, NULL
);
10902 /* Install default VTY commands to new nodes. */
10903 install_default (BGP_NODE
);
10904 install_default (BGP_IPV4_NODE
);
10905 install_default (BGP_IPV4M_NODE
);
10906 install_default (BGP_IPV4L_NODE
);
10907 install_default (BGP_IPV6_NODE
);
10908 install_default (BGP_IPV6M_NODE
);
10909 install_default (BGP_IPV6L_NODE
);
10910 install_default (BGP_VPNV4_NODE
);
10911 install_default (BGP_VPNV6_NODE
);
10912 install_default (BGP_EVPN_NODE
);
10914 /* "bgp multiple-instance" commands. */
10915 install_element (CONFIG_NODE
, &bgp_multiple_instance_cmd
);
10916 install_element (CONFIG_NODE
, &no_bgp_multiple_instance_cmd
);
10918 /* "bgp config-type" commands. */
10919 install_element (CONFIG_NODE
, &bgp_config_type_cmd
);
10920 install_element (CONFIG_NODE
, &no_bgp_config_type_cmd
);
10922 /* bgp route-map delay-timer commands. */
10923 install_element (CONFIG_NODE
, &bgp_set_route_map_delay_timer_cmd
);
10924 install_element (CONFIG_NODE
, &no_bgp_set_route_map_delay_timer_cmd
);
10926 /* Dummy commands (Currently not supported) */
10927 install_element (BGP_NODE
, &no_synchronization_cmd
);
10928 install_element (BGP_NODE
, &no_auto_summary_cmd
);
10930 /* "router bgp" commands. */
10931 install_element (CONFIG_NODE
, &router_bgp_cmd
);
10933 /* "no router bgp" commands. */
10934 install_element (CONFIG_NODE
, &no_router_bgp_cmd
);
10936 /* "bgp router-id" commands. */
10937 install_element (BGP_NODE
, &bgp_router_id_cmd
);
10938 install_element (BGP_NODE
, &no_bgp_router_id_cmd
);
10940 /* "bgp cluster-id" commands. */
10941 install_element (BGP_NODE
, &bgp_cluster_id_cmd
);
10942 install_element (BGP_NODE
, &no_bgp_cluster_id_cmd
);
10944 /* "bgp confederation" commands. */
10945 install_element (BGP_NODE
, &bgp_confederation_identifier_cmd
);
10946 install_element (BGP_NODE
, &no_bgp_confederation_identifier_cmd
);
10948 /* "bgp confederation peers" commands. */
10949 install_element (BGP_NODE
, &bgp_confederation_peers_cmd
);
10950 install_element (BGP_NODE
, &no_bgp_confederation_peers_cmd
);
10952 /* bgp max-med command */
10953 install_element (BGP_NODE
, &bgp_maxmed_admin_cmd
);
10954 install_element (BGP_NODE
, &no_bgp_maxmed_admin_cmd
);
10955 install_element (BGP_NODE
, &bgp_maxmed_admin_medv_cmd
);
10956 install_element (BGP_NODE
, &bgp_maxmed_onstartup_cmd
);
10957 install_element (BGP_NODE
, &no_bgp_maxmed_onstartup_cmd
);
10959 /* bgp disable-ebgp-connected-nh-check */
10960 install_element (BGP_NODE
, &bgp_disable_connected_route_check_cmd
);
10961 install_element (BGP_NODE
, &no_bgp_disable_connected_route_check_cmd
);
10963 /* bgp update-delay command */
10964 install_element (BGP_NODE
, &bgp_update_delay_cmd
);
10965 install_element (BGP_NODE
, &no_bgp_update_delay_cmd
);
10966 install_element (BGP_NODE
, &bgp_update_delay_establish_wait_cmd
);
10968 install_element (BGP_NODE
, &bgp_wpkt_quanta_cmd
);
10969 install_element (BGP_NODE
, &no_bgp_wpkt_quanta_cmd
);
10971 install_element (BGP_NODE
, &bgp_coalesce_time_cmd
);
10972 install_element (BGP_NODE
, &no_bgp_coalesce_time_cmd
);
10974 /* "maximum-paths" commands. */
10975 install_element (BGP_NODE
, &bgp_maxpaths_hidden_cmd
);
10976 install_element (BGP_NODE
, &no_bgp_maxpaths_hidden_cmd
);
10977 install_element (BGP_IPV4_NODE
, &bgp_maxpaths_cmd
);
10978 install_element (BGP_IPV4_NODE
, &no_bgp_maxpaths_cmd
);
10979 install_element (BGP_IPV6_NODE
, &bgp_maxpaths_cmd
);
10980 install_element (BGP_IPV6_NODE
, &no_bgp_maxpaths_cmd
);
10981 install_element (BGP_NODE
, &bgp_maxpaths_ibgp_hidden_cmd
);
10982 install_element (BGP_NODE
, &bgp_maxpaths_ibgp_cluster_hidden_cmd
);
10983 install_element (BGP_NODE
, &no_bgp_maxpaths_ibgp_hidden_cmd
);
10984 install_element (BGP_IPV4_NODE
, &bgp_maxpaths_ibgp_cmd
);
10985 install_element (BGP_IPV4_NODE
, &bgp_maxpaths_ibgp_cluster_cmd
);
10986 install_element (BGP_IPV4_NODE
, &no_bgp_maxpaths_ibgp_cmd
);
10987 install_element (BGP_IPV6_NODE
, &bgp_maxpaths_ibgp_cmd
);
10988 install_element (BGP_IPV6_NODE
, &bgp_maxpaths_ibgp_cluster_cmd
);
10989 install_element (BGP_IPV6_NODE
, &no_bgp_maxpaths_ibgp_cmd
);
10991 install_element (BGP_IPV4L_NODE
, &bgp_maxpaths_cmd
);
10992 install_element (BGP_IPV4L_NODE
, &no_bgp_maxpaths_cmd
);
10993 install_element (BGP_IPV6L_NODE
, &bgp_maxpaths_cmd
);
10994 install_element (BGP_IPV6L_NODE
, &no_bgp_maxpaths_cmd
);
10996 install_element (BGP_IPV4L_NODE
, &bgp_maxpaths_ibgp_cmd
);
10997 install_element (BGP_IPV4L_NODE
, &bgp_maxpaths_ibgp_cluster_cmd
);
10998 install_element (BGP_IPV4L_NODE
, &no_bgp_maxpaths_ibgp_cmd
);
10999 install_element (BGP_IPV6L_NODE
, &bgp_maxpaths_ibgp_cmd
);
11000 install_element (BGP_IPV6L_NODE
, &bgp_maxpaths_ibgp_cluster_cmd
);
11001 install_element (BGP_IPV6L_NODE
, &no_bgp_maxpaths_ibgp_cmd
);
11003 /* "timers bgp" commands. */
11004 install_element (BGP_NODE
, &bgp_timers_cmd
);
11005 install_element (BGP_NODE
, &no_bgp_timers_cmd
);
11007 /* route-map delay-timer commands - per instance for backwards compat. */
11008 install_element (BGP_NODE
, &bgp_set_route_map_delay_timer_cmd
);
11009 install_element (BGP_NODE
, &no_bgp_set_route_map_delay_timer_cmd
);
11011 /* "bgp client-to-client reflection" commands */
11012 install_element (BGP_NODE
, &no_bgp_client_to_client_reflection_cmd
);
11013 install_element (BGP_NODE
, &bgp_client_to_client_reflection_cmd
);
11015 /* "bgp always-compare-med" commands */
11016 install_element (BGP_NODE
, &bgp_always_compare_med_cmd
);
11017 install_element (BGP_NODE
, &no_bgp_always_compare_med_cmd
);
11019 /* "bgp deterministic-med" commands */
11020 install_element (BGP_NODE
, &bgp_deterministic_med_cmd
);
11021 install_element (BGP_NODE
, &no_bgp_deterministic_med_cmd
);
11023 /* "bgp graceful-restart" commands */
11024 install_element (BGP_NODE
, &bgp_graceful_restart_cmd
);
11025 install_element (BGP_NODE
, &no_bgp_graceful_restart_cmd
);
11026 install_element (BGP_NODE
, &bgp_graceful_restart_stalepath_time_cmd
);
11027 install_element (BGP_NODE
, &no_bgp_graceful_restart_stalepath_time_cmd
);
11028 install_element (BGP_NODE
, &bgp_graceful_restart_restart_time_cmd
);
11029 install_element (BGP_NODE
, &no_bgp_graceful_restart_restart_time_cmd
);
11031 install_element (BGP_NODE
, &bgp_graceful_restart_preserve_fw_cmd
);
11032 install_element (BGP_NODE
, &no_bgp_graceful_restart_preserve_fw_cmd
);
11034 /* "bgp fast-external-failover" commands */
11035 install_element (BGP_NODE
, &bgp_fast_external_failover_cmd
);
11036 install_element (BGP_NODE
, &no_bgp_fast_external_failover_cmd
);
11038 /* "bgp enforce-first-as" commands */
11039 install_element (BGP_NODE
, &bgp_enforce_first_as_cmd
);
11040 install_element (BGP_NODE
, &no_bgp_enforce_first_as_cmd
);
11042 /* "bgp bestpath compare-routerid" commands */
11043 install_element (BGP_NODE
, &bgp_bestpath_compare_router_id_cmd
);
11044 install_element (BGP_NODE
, &no_bgp_bestpath_compare_router_id_cmd
);
11046 /* "bgp bestpath as-path ignore" commands */
11047 install_element (BGP_NODE
, &bgp_bestpath_aspath_ignore_cmd
);
11048 install_element (BGP_NODE
, &no_bgp_bestpath_aspath_ignore_cmd
);
11050 /* "bgp bestpath as-path confed" commands */
11051 install_element (BGP_NODE
, &bgp_bestpath_aspath_confed_cmd
);
11052 install_element (BGP_NODE
, &no_bgp_bestpath_aspath_confed_cmd
);
11054 /* "bgp bestpath as-path multipath-relax" commands */
11055 install_element (BGP_NODE
, &bgp_bestpath_aspath_multipath_relax_cmd
);
11056 install_element (BGP_NODE
, &no_bgp_bestpath_aspath_multipath_relax_cmd
);
11058 /* "bgp log-neighbor-changes" commands */
11059 install_element (BGP_NODE
, &bgp_log_neighbor_changes_cmd
);
11060 install_element (BGP_NODE
, &no_bgp_log_neighbor_changes_cmd
);
11062 /* "bgp bestpath med" commands */
11063 install_element (BGP_NODE
, &bgp_bestpath_med_cmd
);
11064 install_element (BGP_NODE
, &no_bgp_bestpath_med_cmd
);
11066 /* "no bgp default ipv4-unicast" commands. */
11067 install_element (BGP_NODE
, &no_bgp_default_ipv4_unicast_cmd
);
11068 install_element (BGP_NODE
, &bgp_default_ipv4_unicast_cmd
);
11070 /* "bgp network import-check" commands. */
11071 install_element (BGP_NODE
, &bgp_network_import_check_cmd
);
11072 install_element (BGP_NODE
, &bgp_network_import_check_exact_cmd
);
11073 install_element (BGP_NODE
, &no_bgp_network_import_check_cmd
);
11075 /* "bgp default local-preference" commands. */
11076 install_element (BGP_NODE
, &bgp_default_local_preference_cmd
);
11077 install_element (BGP_NODE
, &no_bgp_default_local_preference_cmd
);
11079 /* bgp default show-hostname */
11080 install_element (BGP_NODE
, &bgp_default_show_hostname_cmd
);
11081 install_element (BGP_NODE
, &no_bgp_default_show_hostname_cmd
);
11083 /* "bgp default subgroup-pkt-queue-max" commands. */
11084 install_element (BGP_NODE
, &bgp_default_subgroup_pkt_queue_max_cmd
);
11085 install_element (BGP_NODE
, &no_bgp_default_subgroup_pkt_queue_max_cmd
);
11087 /* bgp ibgp-allow-policy-mods command */
11088 install_element (BGP_NODE
, &bgp_rr_allow_outbound_policy_cmd
);
11089 install_element (BGP_NODE
, &no_bgp_rr_allow_outbound_policy_cmd
);
11091 /* "bgp listen limit" commands. */
11092 install_element (BGP_NODE
, &bgp_listen_limit_cmd
);
11093 install_element (BGP_NODE
, &no_bgp_listen_limit_cmd
);
11095 /* "bgp listen range" commands. */
11096 install_element (BGP_NODE
, &bgp_listen_range_cmd
);
11097 install_element (BGP_NODE
, &no_bgp_listen_range_cmd
);
11099 /* "neighbor remote-as" commands. */
11100 install_element (BGP_NODE
, &neighbor_remote_as_cmd
);
11101 install_element (BGP_NODE
, &neighbor_interface_config_cmd
);
11102 install_element (BGP_NODE
, &neighbor_interface_config_v6only_cmd
);
11103 install_element (BGP_NODE
, &neighbor_interface_config_remote_as_cmd
);
11104 install_element (BGP_NODE
, &neighbor_interface_v6only_config_remote_as_cmd
);
11105 install_element (BGP_NODE
, &no_neighbor_cmd
);
11106 install_element (BGP_NODE
, &no_neighbor_interface_config_cmd
);
11108 /* "neighbor peer-group" commands. */
11109 install_element (BGP_NODE
, &neighbor_peer_group_cmd
);
11110 install_element (BGP_NODE
, &no_neighbor_peer_group_cmd
);
11111 install_element (BGP_NODE
, &no_neighbor_interface_peer_group_remote_as_cmd
);
11113 /* "neighbor local-as" commands. */
11114 install_element (BGP_NODE
, &neighbor_local_as_cmd
);
11115 install_element (BGP_NODE
, &neighbor_local_as_no_prepend_cmd
);
11116 install_element (BGP_NODE
, &neighbor_local_as_no_prepend_replace_as_cmd
);
11117 install_element (BGP_NODE
, &no_neighbor_local_as_cmd
);
11119 /* "neighbor solo" commands. */
11120 install_element (BGP_NODE
, &neighbor_solo_cmd
);
11121 install_element (BGP_NODE
, &no_neighbor_solo_cmd
);
11123 /* "neighbor password" commands. */
11124 install_element (BGP_NODE
, &neighbor_password_cmd
);
11125 install_element (BGP_NODE
, &no_neighbor_password_cmd
);
11127 /* "neighbor activate" commands. */
11128 install_element (BGP_NODE
, &neighbor_activate_hidden_cmd
);
11129 install_element (BGP_IPV4_NODE
, &neighbor_activate_cmd
);
11130 install_element (BGP_IPV4M_NODE
, &neighbor_activate_cmd
);
11131 install_element (BGP_IPV4L_NODE
, &neighbor_activate_cmd
);
11132 install_element (BGP_IPV6_NODE
, &neighbor_activate_cmd
);
11133 install_element (BGP_IPV6M_NODE
, &neighbor_activate_cmd
);
11134 install_element (BGP_IPV6L_NODE
, &neighbor_activate_cmd
);
11135 install_element (BGP_VPNV4_NODE
, &neighbor_activate_cmd
);
11136 install_element (BGP_VPNV6_NODE
, &neighbor_activate_cmd
);
11137 install_element (BGP_EVPN_NODE
, &neighbor_activate_cmd
);
11139 /* "no neighbor activate" commands. */
11140 install_element (BGP_NODE
, &no_neighbor_activate_hidden_cmd
);
11141 install_element (BGP_IPV4_NODE
, &no_neighbor_activate_cmd
);
11142 install_element (BGP_IPV4M_NODE
, &no_neighbor_activate_cmd
);
11143 install_element (BGP_IPV4L_NODE
, &no_neighbor_activate_cmd
);
11144 install_element (BGP_IPV6_NODE
, &no_neighbor_activate_cmd
);
11145 install_element (BGP_IPV6M_NODE
, &no_neighbor_activate_cmd
);
11146 install_element (BGP_IPV6L_NODE
, &no_neighbor_activate_cmd
);
11147 install_element (BGP_VPNV4_NODE
, &no_neighbor_activate_cmd
);
11148 install_element (BGP_VPNV6_NODE
, &no_neighbor_activate_cmd
);
11149 install_element (BGP_EVPN_NODE
, &no_neighbor_activate_cmd
);
11151 /* "neighbor peer-group" set commands. */
11152 install_element (BGP_NODE
, &neighbor_set_peer_group_cmd
);
11153 install_element (BGP_IPV4_NODE
, &neighbor_set_peer_group_hidden_cmd
);
11154 install_element (BGP_IPV4M_NODE
, &neighbor_set_peer_group_hidden_cmd
);
11155 install_element (BGP_IPV4L_NODE
, &neighbor_set_peer_group_hidden_cmd
);
11156 install_element (BGP_IPV6_NODE
, &neighbor_set_peer_group_hidden_cmd
);
11157 install_element (BGP_IPV6M_NODE
, &neighbor_set_peer_group_hidden_cmd
);
11158 install_element (BGP_IPV6L_NODE
, &neighbor_set_peer_group_hidden_cmd
);
11159 install_element (BGP_VPNV4_NODE
, &neighbor_set_peer_group_hidden_cmd
);
11160 install_element (BGP_VPNV6_NODE
, &neighbor_set_peer_group_hidden_cmd
);
11162 /* "no neighbor peer-group unset" commands. */
11163 install_element (BGP_NODE
, &no_neighbor_set_peer_group_cmd
);
11164 install_element (BGP_IPV4_NODE
, &no_neighbor_set_peer_group_hidden_cmd
);
11165 install_element (BGP_IPV4M_NODE
, &no_neighbor_set_peer_group_hidden_cmd
);
11166 install_element (BGP_IPV4L_NODE
, &no_neighbor_set_peer_group_hidden_cmd
);
11167 install_element (BGP_IPV6_NODE
, &no_neighbor_set_peer_group_hidden_cmd
);
11168 install_element (BGP_IPV6M_NODE
, &no_neighbor_set_peer_group_hidden_cmd
);
11169 install_element (BGP_IPV6L_NODE
, &no_neighbor_set_peer_group_hidden_cmd
);
11170 install_element (BGP_VPNV4_NODE
, &no_neighbor_set_peer_group_hidden_cmd
);
11171 install_element (BGP_VPNV6_NODE
, &no_neighbor_set_peer_group_hidden_cmd
);
11173 /* "neighbor softreconfiguration inbound" commands.*/
11174 install_element (BGP_NODE
, &neighbor_soft_reconfiguration_hidden_cmd
);
11175 install_element (BGP_NODE
, &no_neighbor_soft_reconfiguration_hidden_cmd
);
11176 install_element (BGP_IPV4_NODE
, &neighbor_soft_reconfiguration_cmd
);
11177 install_element (BGP_IPV4_NODE
, &no_neighbor_soft_reconfiguration_cmd
);
11178 install_element (BGP_IPV4L_NODE
, &neighbor_soft_reconfiguration_cmd
);
11179 install_element (BGP_IPV4L_NODE
, &no_neighbor_soft_reconfiguration_cmd
);
11180 install_element (BGP_IPV4M_NODE
, &neighbor_soft_reconfiguration_cmd
);
11181 install_element (BGP_IPV4M_NODE
, &no_neighbor_soft_reconfiguration_cmd
);
11182 install_element (BGP_IPV6_NODE
, &neighbor_soft_reconfiguration_cmd
);
11183 install_element (BGP_IPV6_NODE
, &no_neighbor_soft_reconfiguration_cmd
);
11184 install_element (BGP_IPV6M_NODE
, &neighbor_soft_reconfiguration_cmd
);
11185 install_element (BGP_IPV6M_NODE
, &no_neighbor_soft_reconfiguration_cmd
);
11186 install_element (BGP_IPV6L_NODE
, &neighbor_soft_reconfiguration_cmd
);
11187 install_element (BGP_IPV6L_NODE
, &no_neighbor_soft_reconfiguration_cmd
);
11188 install_element (BGP_VPNV4_NODE
, &neighbor_soft_reconfiguration_cmd
);
11189 install_element (BGP_VPNV4_NODE
, &no_neighbor_soft_reconfiguration_cmd
);
11190 install_element (BGP_VPNV6_NODE
, &neighbor_soft_reconfiguration_cmd
);
11191 install_element (BGP_VPNV6_NODE
, &no_neighbor_soft_reconfiguration_cmd
);
11193 /* "neighbor attribute-unchanged" commands. */
11194 install_element (BGP_NODE
, &neighbor_attr_unchanged_hidden_cmd
);
11195 install_element (BGP_NODE
, &no_neighbor_attr_unchanged_hidden_cmd
);
11196 install_element (BGP_IPV4_NODE
, &neighbor_attr_unchanged_cmd
);
11197 install_element (BGP_IPV4_NODE
, &no_neighbor_attr_unchanged_cmd
);
11198 install_element (BGP_IPV4M_NODE
, &neighbor_attr_unchanged_cmd
);
11199 install_element (BGP_IPV4M_NODE
, &no_neighbor_attr_unchanged_cmd
);
11200 install_element (BGP_IPV4L_NODE
, &neighbor_attr_unchanged_cmd
);
11201 install_element (BGP_IPV4L_NODE
, &no_neighbor_attr_unchanged_cmd
);
11202 install_element (BGP_IPV6_NODE
, &neighbor_attr_unchanged_cmd
);
11203 install_element (BGP_IPV6_NODE
, &no_neighbor_attr_unchanged_cmd
);
11204 install_element (BGP_IPV6M_NODE
, &neighbor_attr_unchanged_cmd
);
11205 install_element (BGP_IPV6M_NODE
, &no_neighbor_attr_unchanged_cmd
);
11206 install_element (BGP_IPV6L_NODE
, &neighbor_attr_unchanged_cmd
);
11207 install_element (BGP_IPV6L_NODE
, &no_neighbor_attr_unchanged_cmd
);
11208 install_element (BGP_VPNV4_NODE
, &neighbor_attr_unchanged_cmd
);
11209 install_element (BGP_VPNV4_NODE
, &no_neighbor_attr_unchanged_cmd
);
11210 install_element (BGP_VPNV6_NODE
, &neighbor_attr_unchanged_cmd
);
11211 install_element (BGP_VPNV6_NODE
, &no_neighbor_attr_unchanged_cmd
);
11213 install_element (BGP_EVPN_NODE
, &neighbor_attr_unchanged_cmd
);
11214 install_element (BGP_EVPN_NODE
, &no_neighbor_attr_unchanged_cmd
);
11216 /* "nexthop-local unchanged" commands */
11217 install_element (BGP_IPV6_NODE
, &neighbor_nexthop_local_unchanged_cmd
);
11218 install_element (BGP_IPV6_NODE
, &no_neighbor_nexthop_local_unchanged_cmd
);
11220 /* "neighbor next-hop-self" commands. */
11221 install_element (BGP_NODE
, &neighbor_nexthop_self_hidden_cmd
);
11222 install_element (BGP_NODE
, &no_neighbor_nexthop_self_hidden_cmd
);
11223 install_element (BGP_IPV4_NODE
, &neighbor_nexthop_self_cmd
);
11224 install_element (BGP_IPV4_NODE
, &no_neighbor_nexthop_self_cmd
);
11225 install_element (BGP_IPV4M_NODE
, &neighbor_nexthop_self_cmd
);
11226 install_element (BGP_IPV4M_NODE
, &no_neighbor_nexthop_self_cmd
);
11227 install_element (BGP_IPV4L_NODE
, &neighbor_nexthop_self_cmd
);
11228 install_element (BGP_IPV4L_NODE
, &no_neighbor_nexthop_self_cmd
);
11229 install_element (BGP_IPV6_NODE
, &neighbor_nexthop_self_cmd
);
11230 install_element (BGP_IPV6_NODE
, &no_neighbor_nexthop_self_cmd
);
11231 install_element (BGP_IPV6M_NODE
, &neighbor_nexthop_self_cmd
);
11232 install_element (BGP_IPV6M_NODE
, &no_neighbor_nexthop_self_cmd
);
11233 install_element (BGP_IPV6L_NODE
, &neighbor_nexthop_self_cmd
);
11234 install_element (BGP_IPV6L_NODE
, &no_neighbor_nexthop_self_cmd
);
11235 install_element (BGP_VPNV4_NODE
, &neighbor_nexthop_self_cmd
);
11236 install_element (BGP_VPNV4_NODE
, &no_neighbor_nexthop_self_cmd
);
11237 install_element (BGP_VPNV6_NODE
, &neighbor_nexthop_self_cmd
);
11238 install_element (BGP_VPNV6_NODE
, &no_neighbor_nexthop_self_cmd
);
11240 /* "neighbor next-hop-self force" commands. */
11241 install_element (BGP_NODE
, &neighbor_nexthop_self_force_hidden_cmd
);
11242 install_element (BGP_NODE
, &no_neighbor_nexthop_self_force_hidden_cmd
);
11243 install_element (BGP_IPV4_NODE
, &neighbor_nexthop_self_force_cmd
);
11244 install_element (BGP_IPV4_NODE
, &no_neighbor_nexthop_self_force_cmd
);
11245 install_element (BGP_IPV4M_NODE
, &neighbor_nexthop_self_force_cmd
);
11246 install_element (BGP_IPV4M_NODE
, &no_neighbor_nexthop_self_force_cmd
);
11247 install_element (BGP_IPV4L_NODE
, &neighbor_nexthop_self_force_cmd
);
11248 install_element (BGP_IPV4L_NODE
, &no_neighbor_nexthop_self_force_cmd
);
11249 install_element (BGP_IPV6_NODE
, &neighbor_nexthop_self_force_cmd
);
11250 install_element (BGP_IPV6_NODE
, &no_neighbor_nexthop_self_force_cmd
);
11251 install_element (BGP_IPV6M_NODE
, &neighbor_nexthop_self_force_cmd
);
11252 install_element (BGP_IPV6M_NODE
, &no_neighbor_nexthop_self_force_cmd
);
11253 install_element (BGP_IPV6L_NODE
, &neighbor_nexthop_self_force_cmd
);
11254 install_element (BGP_IPV6L_NODE
, &no_neighbor_nexthop_self_force_cmd
);
11255 install_element (BGP_VPNV4_NODE
, &neighbor_nexthop_self_force_cmd
);
11256 install_element (BGP_VPNV4_NODE
, &no_neighbor_nexthop_self_force_cmd
);
11257 install_element (BGP_VPNV6_NODE
, &neighbor_nexthop_self_force_cmd
);
11258 install_element (BGP_VPNV6_NODE
, &no_neighbor_nexthop_self_force_cmd
);
11260 /* "neighbor as-override" commands. */
11261 install_element (BGP_NODE
, &neighbor_as_override_hidden_cmd
);
11262 install_element (BGP_NODE
, &no_neighbor_as_override_hidden_cmd
);
11263 install_element (BGP_IPV4_NODE
, &neighbor_as_override_cmd
);
11264 install_element (BGP_IPV4_NODE
, &no_neighbor_as_override_cmd
);
11265 install_element (BGP_IPV4M_NODE
, &neighbor_as_override_cmd
);
11266 install_element (BGP_IPV4M_NODE
, &no_neighbor_as_override_cmd
);
11267 install_element (BGP_IPV4L_NODE
, &neighbor_as_override_cmd
);
11268 install_element (BGP_IPV4L_NODE
, &no_neighbor_as_override_cmd
);
11269 install_element (BGP_IPV6_NODE
, &neighbor_as_override_cmd
);
11270 install_element (BGP_IPV6_NODE
, &no_neighbor_as_override_cmd
);
11271 install_element (BGP_IPV6M_NODE
, &neighbor_as_override_cmd
);
11272 install_element (BGP_IPV6M_NODE
, &no_neighbor_as_override_cmd
);
11273 install_element (BGP_IPV6L_NODE
, &neighbor_as_override_cmd
);
11274 install_element (BGP_IPV6L_NODE
, &no_neighbor_as_override_cmd
);
11275 install_element (BGP_VPNV4_NODE
, &neighbor_as_override_cmd
);
11276 install_element (BGP_VPNV4_NODE
, &no_neighbor_as_override_cmd
);
11277 install_element (BGP_VPNV6_NODE
, &neighbor_as_override_cmd
);
11278 install_element (BGP_VPNV6_NODE
, &no_neighbor_as_override_cmd
);
11280 /* "neighbor remove-private-AS" commands. */
11281 install_element (BGP_NODE
, &neighbor_remove_private_as_hidden_cmd
);
11282 install_element (BGP_NODE
, &no_neighbor_remove_private_as_hidden_cmd
);
11283 install_element (BGP_NODE
, &neighbor_remove_private_as_all_hidden_cmd
);
11284 install_element (BGP_NODE
, &no_neighbor_remove_private_as_all_hidden_cmd
);
11285 install_element (BGP_NODE
, &neighbor_remove_private_as_replace_as_hidden_cmd
);
11286 install_element (BGP_NODE
, &no_neighbor_remove_private_as_replace_as_hidden_cmd
);
11287 install_element (BGP_NODE
, &neighbor_remove_private_as_all_replace_as_hidden_cmd
);
11288 install_element (BGP_NODE
, &no_neighbor_remove_private_as_all_replace_as_hidden_cmd
);
11289 install_element (BGP_IPV4_NODE
, &neighbor_remove_private_as_cmd
);
11290 install_element (BGP_IPV4_NODE
, &no_neighbor_remove_private_as_cmd
);
11291 install_element (BGP_IPV4_NODE
, &neighbor_remove_private_as_all_cmd
);
11292 install_element (BGP_IPV4_NODE
, &no_neighbor_remove_private_as_all_cmd
);
11293 install_element (BGP_IPV4_NODE
, &neighbor_remove_private_as_replace_as_cmd
);
11294 install_element (BGP_IPV4_NODE
, &no_neighbor_remove_private_as_replace_as_cmd
);
11295 install_element (BGP_IPV4_NODE
, &neighbor_remove_private_as_all_replace_as_cmd
);
11296 install_element (BGP_IPV4_NODE
, &no_neighbor_remove_private_as_all_replace_as_cmd
);
11297 install_element (BGP_IPV4M_NODE
, &neighbor_remove_private_as_cmd
);
11298 install_element (BGP_IPV4M_NODE
, &no_neighbor_remove_private_as_cmd
);
11299 install_element (BGP_IPV4M_NODE
, &neighbor_remove_private_as_all_cmd
);
11300 install_element (BGP_IPV4M_NODE
, &no_neighbor_remove_private_as_all_cmd
);
11301 install_element (BGP_IPV4M_NODE
, &neighbor_remove_private_as_replace_as_cmd
);
11302 install_element (BGP_IPV4M_NODE
, &no_neighbor_remove_private_as_replace_as_cmd
);
11303 install_element (BGP_IPV4M_NODE
, &neighbor_remove_private_as_all_replace_as_cmd
);
11304 install_element (BGP_IPV4M_NODE
, &no_neighbor_remove_private_as_all_replace_as_cmd
);
11305 install_element (BGP_IPV4L_NODE
, &neighbor_remove_private_as_cmd
);
11306 install_element (BGP_IPV4L_NODE
, &no_neighbor_remove_private_as_cmd
);
11307 install_element (BGP_IPV4L_NODE
, &neighbor_remove_private_as_all_cmd
);
11308 install_element (BGP_IPV4L_NODE
, &no_neighbor_remove_private_as_all_cmd
);
11309 install_element (BGP_IPV4L_NODE
, &neighbor_remove_private_as_replace_as_cmd
);
11310 install_element (BGP_IPV4L_NODE
, &no_neighbor_remove_private_as_replace_as_cmd
);
11311 install_element (BGP_IPV4L_NODE
, &neighbor_remove_private_as_all_replace_as_cmd
);
11312 install_element (BGP_IPV4L_NODE
, &no_neighbor_remove_private_as_all_replace_as_cmd
);
11313 install_element (BGP_IPV6_NODE
, &neighbor_remove_private_as_cmd
);
11314 install_element (BGP_IPV6_NODE
, &no_neighbor_remove_private_as_cmd
);
11315 install_element (BGP_IPV6_NODE
, &neighbor_remove_private_as_all_cmd
);
11316 install_element (BGP_IPV6_NODE
, &no_neighbor_remove_private_as_all_cmd
);
11317 install_element (BGP_IPV6_NODE
, &neighbor_remove_private_as_replace_as_cmd
);
11318 install_element (BGP_IPV6_NODE
, &no_neighbor_remove_private_as_replace_as_cmd
);
11319 install_element (BGP_IPV6_NODE
, &neighbor_remove_private_as_all_replace_as_cmd
);
11320 install_element (BGP_IPV6_NODE
, &no_neighbor_remove_private_as_all_replace_as_cmd
);
11321 install_element (BGP_IPV6M_NODE
, &neighbor_remove_private_as_cmd
);
11322 install_element (BGP_IPV6M_NODE
, &no_neighbor_remove_private_as_cmd
);
11323 install_element (BGP_IPV6M_NODE
, &neighbor_remove_private_as_all_cmd
);
11324 install_element (BGP_IPV6M_NODE
, &no_neighbor_remove_private_as_all_cmd
);
11325 install_element (BGP_IPV6M_NODE
, &neighbor_remove_private_as_replace_as_cmd
);
11326 install_element (BGP_IPV6M_NODE
, &no_neighbor_remove_private_as_replace_as_cmd
);
11327 install_element (BGP_IPV6M_NODE
, &neighbor_remove_private_as_all_replace_as_cmd
);
11328 install_element (BGP_IPV6M_NODE
, &no_neighbor_remove_private_as_all_replace_as_cmd
);
11329 install_element (BGP_IPV6L_NODE
, &neighbor_remove_private_as_cmd
);
11330 install_element (BGP_IPV6L_NODE
, &no_neighbor_remove_private_as_cmd
);
11331 install_element (BGP_IPV6L_NODE
, &neighbor_remove_private_as_all_cmd
);
11332 install_element (BGP_IPV6L_NODE
, &no_neighbor_remove_private_as_all_cmd
);
11333 install_element (BGP_IPV6L_NODE
, &neighbor_remove_private_as_replace_as_cmd
);
11334 install_element (BGP_IPV6L_NODE
, &no_neighbor_remove_private_as_replace_as_cmd
);
11335 install_element (BGP_IPV6L_NODE
, &neighbor_remove_private_as_all_replace_as_cmd
);
11336 install_element (BGP_IPV6L_NODE
, &no_neighbor_remove_private_as_all_replace_as_cmd
);
11337 install_element (BGP_VPNV4_NODE
, &neighbor_remove_private_as_cmd
);
11338 install_element (BGP_VPNV4_NODE
, &no_neighbor_remove_private_as_cmd
);
11339 install_element (BGP_VPNV4_NODE
, &neighbor_remove_private_as_all_cmd
);
11340 install_element (BGP_VPNV4_NODE
, &no_neighbor_remove_private_as_all_cmd
);
11341 install_element (BGP_VPNV4_NODE
, &neighbor_remove_private_as_replace_as_cmd
);
11342 install_element (BGP_VPNV4_NODE
, &no_neighbor_remove_private_as_replace_as_cmd
);
11343 install_element (BGP_VPNV4_NODE
, &neighbor_remove_private_as_all_replace_as_cmd
);
11344 install_element (BGP_VPNV4_NODE
, &no_neighbor_remove_private_as_all_replace_as_cmd
);
11345 install_element (BGP_VPNV6_NODE
, &neighbor_remove_private_as_cmd
);
11346 install_element (BGP_VPNV6_NODE
, &no_neighbor_remove_private_as_cmd
);
11347 install_element (BGP_VPNV6_NODE
, &neighbor_remove_private_as_all_cmd
);
11348 install_element (BGP_VPNV6_NODE
, &no_neighbor_remove_private_as_all_cmd
);
11349 install_element (BGP_VPNV6_NODE
, &neighbor_remove_private_as_replace_as_cmd
);
11350 install_element (BGP_VPNV6_NODE
, &no_neighbor_remove_private_as_replace_as_cmd
);
11351 install_element (BGP_VPNV6_NODE
, &neighbor_remove_private_as_all_replace_as_cmd
);
11352 install_element (BGP_VPNV6_NODE
, &no_neighbor_remove_private_as_all_replace_as_cmd
);
11354 /* "neighbor send-community" commands.*/
11355 install_element (BGP_NODE
, &neighbor_send_community_hidden_cmd
);
11356 install_element (BGP_NODE
, &neighbor_send_community_type_hidden_cmd
);
11357 install_element (BGP_NODE
, &no_neighbor_send_community_hidden_cmd
);
11358 install_element (BGP_NODE
, &no_neighbor_send_community_type_hidden_cmd
);
11359 install_element (BGP_IPV4_NODE
, &neighbor_send_community_cmd
);
11360 install_element (BGP_IPV4_NODE
, &neighbor_send_community_type_cmd
);
11361 install_element (BGP_IPV4_NODE
, &no_neighbor_send_community_cmd
);
11362 install_element (BGP_IPV4_NODE
, &no_neighbor_send_community_type_cmd
);
11363 install_element (BGP_IPV4M_NODE
, &neighbor_send_community_cmd
);
11364 install_element (BGP_IPV4M_NODE
, &neighbor_send_community_type_cmd
);
11365 install_element (BGP_IPV4M_NODE
, &no_neighbor_send_community_cmd
);
11366 install_element (BGP_IPV4M_NODE
, &no_neighbor_send_community_type_cmd
);
11367 install_element (BGP_IPV4L_NODE
, &neighbor_send_community_cmd
);
11368 install_element (BGP_IPV4L_NODE
, &neighbor_send_community_type_cmd
);
11369 install_element (BGP_IPV4L_NODE
, &no_neighbor_send_community_cmd
);
11370 install_element (BGP_IPV4L_NODE
, &no_neighbor_send_community_type_cmd
);
11371 install_element (BGP_IPV6_NODE
, &neighbor_send_community_cmd
);
11372 install_element (BGP_IPV6_NODE
, &neighbor_send_community_type_cmd
);
11373 install_element (BGP_IPV6_NODE
, &no_neighbor_send_community_cmd
);
11374 install_element (BGP_IPV6_NODE
, &no_neighbor_send_community_type_cmd
);
11375 install_element (BGP_IPV6M_NODE
, &neighbor_send_community_cmd
);
11376 install_element (BGP_IPV6M_NODE
, &neighbor_send_community_type_cmd
);
11377 install_element (BGP_IPV6M_NODE
, &no_neighbor_send_community_cmd
);
11378 install_element (BGP_IPV6M_NODE
, &no_neighbor_send_community_type_cmd
);
11379 install_element (BGP_IPV6L_NODE
, &neighbor_send_community_cmd
);
11380 install_element (BGP_IPV6L_NODE
, &neighbor_send_community_type_cmd
);
11381 install_element (BGP_IPV6L_NODE
, &no_neighbor_send_community_cmd
);
11382 install_element (BGP_IPV6L_NODE
, &no_neighbor_send_community_type_cmd
);
11383 install_element (BGP_VPNV4_NODE
, &neighbor_send_community_cmd
);
11384 install_element (BGP_VPNV4_NODE
, &neighbor_send_community_type_cmd
);
11385 install_element (BGP_VPNV4_NODE
, &no_neighbor_send_community_cmd
);
11386 install_element (BGP_VPNV4_NODE
, &no_neighbor_send_community_type_cmd
);
11387 install_element (BGP_VPNV6_NODE
, &neighbor_send_community_cmd
);
11388 install_element (BGP_VPNV6_NODE
, &neighbor_send_community_type_cmd
);
11389 install_element (BGP_VPNV6_NODE
, &no_neighbor_send_community_cmd
);
11390 install_element (BGP_VPNV6_NODE
, &no_neighbor_send_community_type_cmd
);
11392 /* "neighbor route-reflector" commands.*/
11393 install_element (BGP_NODE
, &neighbor_route_reflector_client_hidden_cmd
);
11394 install_element (BGP_NODE
, &no_neighbor_route_reflector_client_hidden_cmd
);
11395 install_element (BGP_IPV4_NODE
, &neighbor_route_reflector_client_cmd
);
11396 install_element (BGP_IPV4_NODE
, &no_neighbor_route_reflector_client_cmd
);
11397 install_element (BGP_IPV4M_NODE
, &neighbor_route_reflector_client_cmd
);
11398 install_element (BGP_IPV4M_NODE
, &no_neighbor_route_reflector_client_cmd
);
11399 install_element (BGP_IPV4L_NODE
, &neighbor_route_reflector_client_cmd
);
11400 install_element (BGP_IPV4L_NODE
, &no_neighbor_route_reflector_client_cmd
);
11401 install_element (BGP_IPV6_NODE
, &neighbor_route_reflector_client_cmd
);
11402 install_element (BGP_IPV6_NODE
, &no_neighbor_route_reflector_client_cmd
);
11403 install_element (BGP_IPV6M_NODE
, &neighbor_route_reflector_client_cmd
);
11404 install_element (BGP_IPV6M_NODE
, &no_neighbor_route_reflector_client_cmd
);
11405 install_element (BGP_IPV6L_NODE
, &neighbor_route_reflector_client_cmd
);
11406 install_element (BGP_IPV6L_NODE
, &no_neighbor_route_reflector_client_cmd
);
11407 install_element (BGP_VPNV4_NODE
, &neighbor_route_reflector_client_cmd
);
11408 install_element (BGP_VPNV4_NODE
, &no_neighbor_route_reflector_client_cmd
);
11409 install_element (BGP_VPNV6_NODE
, &neighbor_route_reflector_client_cmd
);
11410 install_element (BGP_VPNV6_NODE
, &no_neighbor_route_reflector_client_cmd
);
11412 /* "neighbor route-server" commands.*/
11413 install_element (BGP_NODE
, &neighbor_route_server_client_hidden_cmd
);
11414 install_element (BGP_NODE
, &no_neighbor_route_server_client_hidden_cmd
);
11415 install_element (BGP_IPV4_NODE
, &neighbor_route_server_client_cmd
);
11416 install_element (BGP_IPV4_NODE
, &no_neighbor_route_server_client_cmd
);
11417 install_element (BGP_IPV4M_NODE
, &neighbor_route_server_client_cmd
);
11418 install_element (BGP_IPV4M_NODE
, &no_neighbor_route_server_client_cmd
);
11419 install_element (BGP_IPV4L_NODE
, &neighbor_route_server_client_cmd
);
11420 install_element (BGP_IPV4L_NODE
, &no_neighbor_route_server_client_cmd
);
11421 install_element (BGP_IPV6_NODE
, &neighbor_route_server_client_cmd
);
11422 install_element (BGP_IPV6_NODE
, &no_neighbor_route_server_client_cmd
);
11423 install_element (BGP_IPV6M_NODE
, &neighbor_route_server_client_cmd
);
11424 install_element (BGP_IPV6M_NODE
, &no_neighbor_route_server_client_cmd
);
11425 install_element (BGP_IPV6L_NODE
, &neighbor_route_server_client_cmd
);
11426 install_element (BGP_IPV6L_NODE
, &no_neighbor_route_server_client_cmd
);
11427 install_element (BGP_VPNV4_NODE
, &neighbor_route_server_client_cmd
);
11428 install_element (BGP_VPNV4_NODE
, &no_neighbor_route_server_client_cmd
);
11429 install_element (BGP_VPNV6_NODE
, &neighbor_route_server_client_cmd
);
11430 install_element (BGP_VPNV6_NODE
, &no_neighbor_route_server_client_cmd
);
11432 /* "neighbor addpath-tx-all-paths" commands.*/
11433 install_element (BGP_NODE
, &neighbor_addpath_tx_all_paths_hidden_cmd
);
11434 install_element (BGP_NODE
, &no_neighbor_addpath_tx_all_paths_hidden_cmd
);
11435 install_element (BGP_IPV4_NODE
, &neighbor_addpath_tx_all_paths_cmd
);
11436 install_element (BGP_IPV4_NODE
, &no_neighbor_addpath_tx_all_paths_cmd
);
11437 install_element (BGP_IPV4M_NODE
, &neighbor_addpath_tx_all_paths_cmd
);
11438 install_element (BGP_IPV4M_NODE
, &no_neighbor_addpath_tx_all_paths_cmd
);
11439 install_element (BGP_IPV4L_NODE
, &neighbor_addpath_tx_all_paths_cmd
);
11440 install_element (BGP_IPV4L_NODE
, &no_neighbor_addpath_tx_all_paths_cmd
);
11441 install_element (BGP_IPV6_NODE
, &neighbor_addpath_tx_all_paths_cmd
);
11442 install_element (BGP_IPV6_NODE
, &no_neighbor_addpath_tx_all_paths_cmd
);
11443 install_element (BGP_IPV6M_NODE
, &neighbor_addpath_tx_all_paths_cmd
);
11444 install_element (BGP_IPV6M_NODE
, &no_neighbor_addpath_tx_all_paths_cmd
);
11445 install_element (BGP_IPV6L_NODE
, &neighbor_addpath_tx_all_paths_cmd
);
11446 install_element (BGP_IPV6L_NODE
, &no_neighbor_addpath_tx_all_paths_cmd
);
11447 install_element (BGP_VPNV4_NODE
, &neighbor_addpath_tx_all_paths_cmd
);
11448 install_element (BGP_VPNV4_NODE
, &no_neighbor_addpath_tx_all_paths_cmd
);
11449 install_element (BGP_VPNV6_NODE
, &neighbor_addpath_tx_all_paths_cmd
);
11450 install_element (BGP_VPNV6_NODE
, &no_neighbor_addpath_tx_all_paths_cmd
);
11452 /* "neighbor addpath-tx-bestpath-per-AS" commands.*/
11453 install_element (BGP_NODE
, &neighbor_addpath_tx_bestpath_per_as_hidden_cmd
);
11454 install_element (BGP_NODE
, &no_neighbor_addpath_tx_bestpath_per_as_hidden_cmd
);
11455 install_element (BGP_IPV4_NODE
, &neighbor_addpath_tx_bestpath_per_as_cmd
);
11456 install_element (BGP_IPV4_NODE
, &no_neighbor_addpath_tx_bestpath_per_as_cmd
);
11457 install_element (BGP_IPV4M_NODE
, &neighbor_addpath_tx_bestpath_per_as_cmd
);
11458 install_element (BGP_IPV4M_NODE
, &no_neighbor_addpath_tx_bestpath_per_as_cmd
);
11459 install_element (BGP_IPV4L_NODE
, &neighbor_addpath_tx_bestpath_per_as_cmd
);
11460 install_element (BGP_IPV4L_NODE
, &no_neighbor_addpath_tx_bestpath_per_as_cmd
);
11461 install_element (BGP_IPV6_NODE
, &neighbor_addpath_tx_bestpath_per_as_cmd
);
11462 install_element (BGP_IPV6_NODE
, &no_neighbor_addpath_tx_bestpath_per_as_cmd
);
11463 install_element (BGP_IPV6M_NODE
, &neighbor_addpath_tx_bestpath_per_as_cmd
);
11464 install_element (BGP_IPV6M_NODE
, &no_neighbor_addpath_tx_bestpath_per_as_cmd
);
11465 install_element (BGP_IPV6L_NODE
, &neighbor_addpath_tx_bestpath_per_as_cmd
);
11466 install_element (BGP_IPV6L_NODE
, &no_neighbor_addpath_tx_bestpath_per_as_cmd
);
11467 install_element (BGP_VPNV4_NODE
, &neighbor_addpath_tx_bestpath_per_as_cmd
);
11468 install_element (BGP_VPNV4_NODE
, &no_neighbor_addpath_tx_bestpath_per_as_cmd
);
11469 install_element (BGP_VPNV6_NODE
, &neighbor_addpath_tx_bestpath_per_as_cmd
);
11470 install_element (BGP_VPNV6_NODE
, &no_neighbor_addpath_tx_bestpath_per_as_cmd
);
11472 /* "neighbor passive" commands. */
11473 install_element (BGP_NODE
, &neighbor_passive_cmd
);
11474 install_element (BGP_NODE
, &no_neighbor_passive_cmd
);
11477 /* "neighbor shutdown" commands. */
11478 install_element (BGP_NODE
, &neighbor_shutdown_cmd
);
11479 install_element (BGP_NODE
, &no_neighbor_shutdown_cmd
);
11480 install_element (BGP_NODE
, &neighbor_shutdown_msg_cmd
);
11481 install_element (BGP_NODE
, &no_neighbor_shutdown_msg_cmd
);
11483 /* "neighbor capability extended-nexthop" commands.*/
11484 install_element (BGP_NODE
, &neighbor_capability_enhe_cmd
);
11485 install_element (BGP_NODE
, &no_neighbor_capability_enhe_cmd
);
11487 /* "neighbor capability orf prefix-list" commands.*/
11488 install_element (BGP_NODE
, &neighbor_capability_orf_prefix_hidden_cmd
);
11489 install_element (BGP_NODE
, &no_neighbor_capability_orf_prefix_hidden_cmd
);
11490 install_element (BGP_IPV4_NODE
, &neighbor_capability_orf_prefix_cmd
);
11491 install_element (BGP_IPV4_NODE
, &no_neighbor_capability_orf_prefix_cmd
);
11492 install_element (BGP_IPV4M_NODE
, &neighbor_capability_orf_prefix_cmd
);
11493 install_element (BGP_IPV4M_NODE
, &no_neighbor_capability_orf_prefix_cmd
);
11494 install_element (BGP_IPV4L_NODE
, &neighbor_capability_orf_prefix_cmd
);
11495 install_element (BGP_IPV4L_NODE
, &no_neighbor_capability_orf_prefix_cmd
);
11496 install_element (BGP_IPV6_NODE
, &neighbor_capability_orf_prefix_cmd
);
11497 install_element (BGP_IPV6_NODE
, &no_neighbor_capability_orf_prefix_cmd
);
11498 install_element (BGP_IPV6M_NODE
, &neighbor_capability_orf_prefix_cmd
);
11499 install_element (BGP_IPV6M_NODE
, &no_neighbor_capability_orf_prefix_cmd
);
11500 install_element (BGP_IPV6L_NODE
, &neighbor_capability_orf_prefix_cmd
);
11501 install_element (BGP_IPV6L_NODE
, &no_neighbor_capability_orf_prefix_cmd
);
11503 /* "neighbor capability dynamic" commands.*/
11504 install_element (BGP_NODE
, &neighbor_capability_dynamic_cmd
);
11505 install_element (BGP_NODE
, &no_neighbor_capability_dynamic_cmd
);
11507 /* "neighbor dont-capability-negotiate" commands. */
11508 install_element (BGP_NODE
, &neighbor_dont_capability_negotiate_cmd
);
11509 install_element (BGP_NODE
, &no_neighbor_dont_capability_negotiate_cmd
);
11511 /* "neighbor ebgp-multihop" commands. */
11512 install_element (BGP_NODE
, &neighbor_ebgp_multihop_cmd
);
11513 install_element (BGP_NODE
, &neighbor_ebgp_multihop_ttl_cmd
);
11514 install_element (BGP_NODE
, &no_neighbor_ebgp_multihop_cmd
);
11516 /* "neighbor disable-connected-check" commands. */
11517 install_element (BGP_NODE
, &neighbor_disable_connected_check_cmd
);
11518 install_element (BGP_NODE
, &no_neighbor_disable_connected_check_cmd
);
11520 /* "neighbor description" commands. */
11521 install_element (BGP_NODE
, &neighbor_description_cmd
);
11522 install_element (BGP_NODE
, &no_neighbor_description_cmd
);
11524 /* "neighbor update-source" commands. "*/
11525 install_element (BGP_NODE
, &neighbor_update_source_cmd
);
11526 install_element (BGP_NODE
, &no_neighbor_update_source_cmd
);
11528 /* "neighbor default-originate" commands. */
11529 install_element (BGP_NODE
, &neighbor_default_originate_hidden_cmd
);
11530 install_element (BGP_NODE
, &neighbor_default_originate_rmap_hidden_cmd
);
11531 install_element (BGP_NODE
, &no_neighbor_default_originate_hidden_cmd
);
11532 install_element (BGP_IPV4_NODE
, &neighbor_default_originate_cmd
);
11533 install_element (BGP_IPV4_NODE
, &neighbor_default_originate_rmap_cmd
);
11534 install_element (BGP_IPV4_NODE
, &no_neighbor_default_originate_cmd
);
11535 install_element (BGP_IPV4M_NODE
, &neighbor_default_originate_cmd
);
11536 install_element (BGP_IPV4M_NODE
, &neighbor_default_originate_rmap_cmd
);
11537 install_element (BGP_IPV4M_NODE
, &no_neighbor_default_originate_cmd
);
11538 install_element (BGP_IPV4L_NODE
, &neighbor_default_originate_cmd
);
11539 install_element (BGP_IPV4L_NODE
, &neighbor_default_originate_rmap_cmd
);
11540 install_element (BGP_IPV4L_NODE
, &no_neighbor_default_originate_cmd
);
11541 install_element (BGP_IPV6_NODE
, &neighbor_default_originate_cmd
);
11542 install_element (BGP_IPV6_NODE
, &neighbor_default_originate_rmap_cmd
);
11543 install_element (BGP_IPV6_NODE
, &no_neighbor_default_originate_cmd
);
11544 install_element (BGP_IPV6M_NODE
, &neighbor_default_originate_cmd
);
11545 install_element (BGP_IPV6M_NODE
, &neighbor_default_originate_rmap_cmd
);
11546 install_element (BGP_IPV6M_NODE
, &no_neighbor_default_originate_cmd
);
11547 install_element (BGP_IPV6L_NODE
, &neighbor_default_originate_cmd
);
11548 install_element (BGP_IPV6L_NODE
, &neighbor_default_originate_rmap_cmd
);
11549 install_element (BGP_IPV6L_NODE
, &no_neighbor_default_originate_cmd
);
11551 /* "neighbor port" commands. */
11552 install_element (BGP_NODE
, &neighbor_port_cmd
);
11553 install_element (BGP_NODE
, &no_neighbor_port_cmd
);
11555 /* "neighbor weight" commands. */
11556 install_element (BGP_NODE
, &neighbor_weight_hidden_cmd
);
11557 install_element (BGP_NODE
, &no_neighbor_weight_hidden_cmd
);
11559 install_element (BGP_IPV4_NODE
, &neighbor_weight_cmd
);
11560 install_element (BGP_IPV4_NODE
, &no_neighbor_weight_cmd
);
11561 install_element (BGP_IPV4M_NODE
, &neighbor_weight_cmd
);
11562 install_element (BGP_IPV4M_NODE
, &no_neighbor_weight_cmd
);
11563 install_element (BGP_IPV4L_NODE
, &neighbor_weight_cmd
);
11564 install_element (BGP_IPV4L_NODE
, &no_neighbor_weight_cmd
);
11565 install_element (BGP_IPV6_NODE
, &neighbor_weight_cmd
);
11566 install_element (BGP_IPV6_NODE
, &no_neighbor_weight_cmd
);
11567 install_element (BGP_IPV6M_NODE
, &neighbor_weight_cmd
);
11568 install_element (BGP_IPV6M_NODE
, &no_neighbor_weight_cmd
);
11569 install_element (BGP_IPV6L_NODE
, &neighbor_weight_cmd
);
11570 install_element (BGP_IPV6L_NODE
, &no_neighbor_weight_cmd
);
11571 install_element (BGP_VPNV4_NODE
, &neighbor_weight_cmd
);
11572 install_element (BGP_VPNV4_NODE
, &no_neighbor_weight_cmd
);
11573 install_element (BGP_VPNV6_NODE
, &neighbor_weight_cmd
);
11574 install_element (BGP_VPNV6_NODE
, &no_neighbor_weight_cmd
);
11576 /* "neighbor override-capability" commands. */
11577 install_element (BGP_NODE
, &neighbor_override_capability_cmd
);
11578 install_element (BGP_NODE
, &no_neighbor_override_capability_cmd
);
11580 /* "neighbor strict-capability-match" commands. */
11581 install_element (BGP_NODE
, &neighbor_strict_capability_cmd
);
11582 install_element (BGP_NODE
, &no_neighbor_strict_capability_cmd
);
11584 /* "neighbor timers" commands. */
11585 install_element (BGP_NODE
, &neighbor_timers_cmd
);
11586 install_element (BGP_NODE
, &no_neighbor_timers_cmd
);
11588 /* "neighbor timers connect" commands. */
11589 install_element (BGP_NODE
, &neighbor_timers_connect_cmd
);
11590 install_element (BGP_NODE
, &no_neighbor_timers_connect_cmd
);
11592 /* "neighbor advertisement-interval" commands. */
11593 install_element (BGP_NODE
, &neighbor_advertise_interval_cmd
);
11594 install_element (BGP_NODE
, &no_neighbor_advertise_interval_cmd
);
11596 /* "neighbor interface" commands. */
11597 install_element (BGP_NODE
, &neighbor_interface_cmd
);
11598 install_element (BGP_NODE
, &no_neighbor_interface_cmd
);
11600 /* "neighbor distribute" commands. */
11601 install_element (BGP_NODE
, &neighbor_distribute_list_hidden_cmd
);
11602 install_element (BGP_NODE
, &no_neighbor_distribute_list_hidden_cmd
);
11603 install_element (BGP_IPV4_NODE
, &neighbor_distribute_list_cmd
);
11604 install_element (BGP_IPV4_NODE
, &no_neighbor_distribute_list_cmd
);
11605 install_element (BGP_IPV4M_NODE
, &neighbor_distribute_list_cmd
);
11606 install_element (BGP_IPV4M_NODE
, &no_neighbor_distribute_list_cmd
);
11607 install_element (BGP_IPV4L_NODE
, &neighbor_distribute_list_cmd
);
11608 install_element (BGP_IPV4L_NODE
, &no_neighbor_distribute_list_cmd
);
11609 install_element (BGP_IPV6_NODE
, &neighbor_distribute_list_cmd
);
11610 install_element (BGP_IPV6_NODE
, &no_neighbor_distribute_list_cmd
);
11611 install_element (BGP_IPV6M_NODE
, &neighbor_distribute_list_cmd
);
11612 install_element (BGP_IPV6M_NODE
, &no_neighbor_distribute_list_cmd
);
11613 install_element (BGP_IPV6L_NODE
, &neighbor_distribute_list_cmd
);
11614 install_element (BGP_IPV6L_NODE
, &no_neighbor_distribute_list_cmd
);
11615 install_element (BGP_VPNV4_NODE
, &neighbor_distribute_list_cmd
);
11616 install_element (BGP_VPNV4_NODE
, &no_neighbor_distribute_list_cmd
);
11617 install_element (BGP_VPNV6_NODE
, &neighbor_distribute_list_cmd
);
11618 install_element (BGP_VPNV6_NODE
, &no_neighbor_distribute_list_cmd
);
11620 /* "neighbor prefix-list" commands. */
11621 install_element (BGP_NODE
, &neighbor_prefix_list_hidden_cmd
);
11622 install_element (BGP_NODE
, &no_neighbor_prefix_list_hidden_cmd
);
11623 install_element (BGP_IPV4_NODE
, &neighbor_prefix_list_cmd
);
11624 install_element (BGP_IPV4_NODE
, &no_neighbor_prefix_list_cmd
);
11625 install_element (BGP_IPV4M_NODE
, &neighbor_prefix_list_cmd
);
11626 install_element (BGP_IPV4M_NODE
, &no_neighbor_prefix_list_cmd
);
11627 install_element (BGP_IPV4L_NODE
, &neighbor_prefix_list_cmd
);
11628 install_element (BGP_IPV4L_NODE
, &no_neighbor_prefix_list_cmd
);
11629 install_element (BGP_IPV6_NODE
, &neighbor_prefix_list_cmd
);
11630 install_element (BGP_IPV6_NODE
, &no_neighbor_prefix_list_cmd
);
11631 install_element (BGP_IPV6M_NODE
, &neighbor_prefix_list_cmd
);
11632 install_element (BGP_IPV6M_NODE
, &no_neighbor_prefix_list_cmd
);
11633 install_element (BGP_IPV6L_NODE
, &neighbor_prefix_list_cmd
);
11634 install_element (BGP_IPV6L_NODE
, &no_neighbor_prefix_list_cmd
);
11635 install_element (BGP_VPNV4_NODE
, &neighbor_prefix_list_cmd
);
11636 install_element (BGP_VPNV4_NODE
, &no_neighbor_prefix_list_cmd
);
11637 install_element (BGP_VPNV6_NODE
, &neighbor_prefix_list_cmd
);
11638 install_element (BGP_VPNV6_NODE
, &no_neighbor_prefix_list_cmd
);
11640 /* "neighbor filter-list" commands. */
11641 install_element (BGP_NODE
, &neighbor_filter_list_hidden_cmd
);
11642 install_element (BGP_NODE
, &no_neighbor_filter_list_hidden_cmd
);
11643 install_element (BGP_IPV4_NODE
, &neighbor_filter_list_cmd
);
11644 install_element (BGP_IPV4_NODE
, &no_neighbor_filter_list_cmd
);
11645 install_element (BGP_IPV4M_NODE
, &neighbor_filter_list_cmd
);
11646 install_element (BGP_IPV4M_NODE
, &no_neighbor_filter_list_cmd
);
11647 install_element (BGP_IPV4L_NODE
, &neighbor_filter_list_cmd
);
11648 install_element (BGP_IPV4L_NODE
, &no_neighbor_filter_list_cmd
);
11649 install_element (BGP_IPV6_NODE
, &neighbor_filter_list_cmd
);
11650 install_element (BGP_IPV6_NODE
, &no_neighbor_filter_list_cmd
);
11651 install_element (BGP_IPV6M_NODE
, &neighbor_filter_list_cmd
);
11652 install_element (BGP_IPV6M_NODE
, &no_neighbor_filter_list_cmd
);
11653 install_element (BGP_IPV6L_NODE
, &neighbor_filter_list_cmd
);
11654 install_element (BGP_IPV6L_NODE
, &no_neighbor_filter_list_cmd
);
11655 install_element (BGP_VPNV4_NODE
, &neighbor_filter_list_cmd
);
11656 install_element (BGP_VPNV4_NODE
, &no_neighbor_filter_list_cmd
);
11657 install_element (BGP_VPNV6_NODE
, &neighbor_filter_list_cmd
);
11658 install_element (BGP_VPNV6_NODE
, &no_neighbor_filter_list_cmd
);
11660 /* "neighbor route-map" commands. */
11661 install_element (BGP_NODE
, &neighbor_route_map_hidden_cmd
);
11662 install_element (BGP_NODE
, &no_neighbor_route_map_hidden_cmd
);
11663 install_element (BGP_IPV4_NODE
, &neighbor_route_map_cmd
);
11664 install_element (BGP_IPV4_NODE
, &no_neighbor_route_map_cmd
);
11665 install_element (BGP_IPV4M_NODE
, &neighbor_route_map_cmd
);
11666 install_element (BGP_IPV4M_NODE
, &no_neighbor_route_map_cmd
);
11667 install_element (BGP_IPV4L_NODE
, &neighbor_route_map_cmd
);
11668 install_element (BGP_IPV4L_NODE
, &no_neighbor_route_map_cmd
);
11669 install_element (BGP_IPV6_NODE
, &neighbor_route_map_cmd
);
11670 install_element (BGP_IPV6_NODE
, &no_neighbor_route_map_cmd
);
11671 install_element (BGP_IPV6M_NODE
, &neighbor_route_map_cmd
);
11672 install_element (BGP_IPV6M_NODE
, &no_neighbor_route_map_cmd
);
11673 install_element (BGP_IPV6L_NODE
, &neighbor_route_map_cmd
);
11674 install_element (BGP_IPV6L_NODE
, &no_neighbor_route_map_cmd
);
11675 install_element (BGP_VPNV4_NODE
, &neighbor_route_map_cmd
);
11676 install_element (BGP_VPNV4_NODE
, &no_neighbor_route_map_cmd
);
11677 install_element (BGP_VPNV6_NODE
, &neighbor_route_map_cmd
);
11678 install_element (BGP_VPNV6_NODE
, &no_neighbor_route_map_cmd
);
11680 /* "neighbor unsuppress-map" commands. */
11681 install_element (BGP_NODE
, &neighbor_unsuppress_map_hidden_cmd
);
11682 install_element (BGP_NODE
, &no_neighbor_unsuppress_map_hidden_cmd
);
11683 install_element (BGP_IPV4_NODE
, &neighbor_unsuppress_map_cmd
);
11684 install_element (BGP_IPV4_NODE
, &no_neighbor_unsuppress_map_cmd
);
11685 install_element (BGP_IPV4M_NODE
, &neighbor_unsuppress_map_cmd
);
11686 install_element (BGP_IPV4M_NODE
, &no_neighbor_unsuppress_map_cmd
);
11687 install_element (BGP_IPV4L_NODE
, &neighbor_unsuppress_map_cmd
);
11688 install_element (BGP_IPV4L_NODE
, &no_neighbor_unsuppress_map_cmd
);
11689 install_element (BGP_IPV6_NODE
, &neighbor_unsuppress_map_cmd
);
11690 install_element (BGP_IPV6_NODE
, &no_neighbor_unsuppress_map_cmd
);
11691 install_element (BGP_IPV6M_NODE
, &neighbor_unsuppress_map_cmd
);
11692 install_element (BGP_IPV6M_NODE
, &no_neighbor_unsuppress_map_cmd
);
11693 install_element (BGP_IPV6L_NODE
, &neighbor_unsuppress_map_cmd
);
11694 install_element (BGP_IPV6L_NODE
, &no_neighbor_unsuppress_map_cmd
);
11695 install_element (BGP_VPNV4_NODE
, &neighbor_unsuppress_map_cmd
);
11696 install_element (BGP_VPNV4_NODE
, &no_neighbor_unsuppress_map_cmd
);
11697 install_element (BGP_VPNV6_NODE
, &neighbor_unsuppress_map_cmd
);
11698 install_element (BGP_VPNV6_NODE
, &no_neighbor_unsuppress_map_cmd
);
11700 /* "neighbor maximum-prefix" commands. */
11701 install_element (BGP_NODE
, &neighbor_maximum_prefix_hidden_cmd
);
11702 install_element (BGP_NODE
, &neighbor_maximum_prefix_threshold_hidden_cmd
);
11703 install_element (BGP_NODE
, &neighbor_maximum_prefix_warning_hidden_cmd
);
11704 install_element (BGP_NODE
, &neighbor_maximum_prefix_threshold_warning_hidden_cmd
);
11705 install_element (BGP_NODE
, &neighbor_maximum_prefix_restart_hidden_cmd
);
11706 install_element (BGP_NODE
, &neighbor_maximum_prefix_threshold_restart_hidden_cmd
);
11707 install_element (BGP_NODE
, &no_neighbor_maximum_prefix_hidden_cmd
);
11708 install_element (BGP_IPV4_NODE
, &neighbor_maximum_prefix_cmd
);
11709 install_element (BGP_IPV4_NODE
, &neighbor_maximum_prefix_threshold_cmd
);
11710 install_element (BGP_IPV4_NODE
, &neighbor_maximum_prefix_warning_cmd
);
11711 install_element (BGP_IPV4_NODE
, &neighbor_maximum_prefix_threshold_warning_cmd
);
11712 install_element (BGP_IPV4_NODE
, &neighbor_maximum_prefix_restart_cmd
);
11713 install_element (BGP_IPV4_NODE
, &neighbor_maximum_prefix_threshold_restart_cmd
);
11714 install_element (BGP_IPV4_NODE
, &no_neighbor_maximum_prefix_cmd
);
11715 install_element (BGP_IPV4M_NODE
, &neighbor_maximum_prefix_cmd
);
11716 install_element (BGP_IPV4M_NODE
, &neighbor_maximum_prefix_threshold_cmd
);
11717 install_element (BGP_IPV4M_NODE
, &neighbor_maximum_prefix_warning_cmd
);
11718 install_element (BGP_IPV4M_NODE
, &neighbor_maximum_prefix_threshold_warning_cmd
);
11719 install_element (BGP_IPV4M_NODE
, &neighbor_maximum_prefix_restart_cmd
);
11720 install_element (BGP_IPV4M_NODE
, &neighbor_maximum_prefix_threshold_restart_cmd
);
11721 install_element (BGP_IPV4M_NODE
, &no_neighbor_maximum_prefix_cmd
);
11722 install_element (BGP_IPV4L_NODE
, &neighbor_maximum_prefix_cmd
);
11723 install_element (BGP_IPV4L_NODE
, &neighbor_maximum_prefix_threshold_cmd
);
11724 install_element (BGP_IPV4L_NODE
, &neighbor_maximum_prefix_warning_cmd
);
11725 install_element (BGP_IPV4L_NODE
, &neighbor_maximum_prefix_threshold_warning_cmd
);
11726 install_element (BGP_IPV4L_NODE
, &neighbor_maximum_prefix_restart_cmd
);
11727 install_element (BGP_IPV4L_NODE
, &neighbor_maximum_prefix_threshold_restart_cmd
);
11728 install_element (BGP_IPV4L_NODE
, &no_neighbor_maximum_prefix_cmd
);
11729 install_element (BGP_IPV6_NODE
, &neighbor_maximum_prefix_cmd
);
11730 install_element (BGP_IPV6_NODE
, &neighbor_maximum_prefix_threshold_cmd
);
11731 install_element (BGP_IPV6_NODE
, &neighbor_maximum_prefix_warning_cmd
);
11732 install_element (BGP_IPV6_NODE
, &neighbor_maximum_prefix_threshold_warning_cmd
);
11733 install_element (BGP_IPV6_NODE
, &neighbor_maximum_prefix_restart_cmd
);
11734 install_element (BGP_IPV6_NODE
, &neighbor_maximum_prefix_threshold_restart_cmd
);
11735 install_element (BGP_IPV6_NODE
, &no_neighbor_maximum_prefix_cmd
);
11736 install_element (BGP_IPV6M_NODE
, &neighbor_maximum_prefix_cmd
);
11737 install_element (BGP_IPV6M_NODE
, &neighbor_maximum_prefix_threshold_cmd
);
11738 install_element (BGP_IPV6M_NODE
, &neighbor_maximum_prefix_warning_cmd
);
11739 install_element (BGP_IPV6M_NODE
, &neighbor_maximum_prefix_threshold_warning_cmd
);
11740 install_element (BGP_IPV6M_NODE
, &neighbor_maximum_prefix_restart_cmd
);
11741 install_element (BGP_IPV6M_NODE
, &neighbor_maximum_prefix_threshold_restart_cmd
);
11742 install_element (BGP_IPV6M_NODE
, &no_neighbor_maximum_prefix_cmd
);
11743 install_element (BGP_IPV6L_NODE
, &neighbor_maximum_prefix_cmd
);
11744 install_element (BGP_IPV6L_NODE
, &neighbor_maximum_prefix_threshold_cmd
);
11745 install_element (BGP_IPV6L_NODE
, &neighbor_maximum_prefix_warning_cmd
);
11746 install_element (BGP_IPV6L_NODE
, &neighbor_maximum_prefix_threshold_warning_cmd
);
11747 install_element (BGP_IPV6L_NODE
, &neighbor_maximum_prefix_restart_cmd
);
11748 install_element (BGP_IPV6L_NODE
, &neighbor_maximum_prefix_threshold_restart_cmd
);
11749 install_element (BGP_IPV6L_NODE
, &no_neighbor_maximum_prefix_cmd
);
11750 install_element (BGP_VPNV4_NODE
, &neighbor_maximum_prefix_cmd
);
11751 install_element (BGP_VPNV4_NODE
, &neighbor_maximum_prefix_threshold_cmd
);
11752 install_element (BGP_VPNV4_NODE
, &neighbor_maximum_prefix_warning_cmd
);
11753 install_element (BGP_VPNV4_NODE
, &neighbor_maximum_prefix_threshold_warning_cmd
);
11754 install_element (BGP_VPNV4_NODE
, &neighbor_maximum_prefix_restart_cmd
);
11755 install_element (BGP_VPNV4_NODE
, &neighbor_maximum_prefix_threshold_restart_cmd
);
11756 install_element (BGP_VPNV4_NODE
, &no_neighbor_maximum_prefix_cmd
);
11757 install_element (BGP_VPNV6_NODE
, &neighbor_maximum_prefix_cmd
);
11758 install_element (BGP_VPNV6_NODE
, &neighbor_maximum_prefix_threshold_cmd
);
11759 install_element (BGP_VPNV6_NODE
, &neighbor_maximum_prefix_warning_cmd
);
11760 install_element (BGP_VPNV6_NODE
, &neighbor_maximum_prefix_threshold_warning_cmd
);
11761 install_element (BGP_VPNV6_NODE
, &neighbor_maximum_prefix_restart_cmd
);
11762 install_element (BGP_VPNV6_NODE
, &neighbor_maximum_prefix_threshold_restart_cmd
);
11763 install_element (BGP_VPNV6_NODE
, &no_neighbor_maximum_prefix_cmd
);
11765 /* "neighbor allowas-in" */
11766 install_element (BGP_NODE
, &neighbor_allowas_in_hidden_cmd
);
11767 install_element (BGP_NODE
, &no_neighbor_allowas_in_hidden_cmd
);
11768 install_element (BGP_IPV4_NODE
, &neighbor_allowas_in_cmd
);
11769 install_element (BGP_IPV4_NODE
, &no_neighbor_allowas_in_cmd
);
11770 install_element (BGP_IPV4M_NODE
, &neighbor_allowas_in_cmd
);
11771 install_element (BGP_IPV4M_NODE
, &no_neighbor_allowas_in_cmd
);
11772 install_element (BGP_IPV4L_NODE
, &neighbor_allowas_in_cmd
);
11773 install_element (BGP_IPV4L_NODE
, &no_neighbor_allowas_in_cmd
);
11774 install_element (BGP_IPV6_NODE
, &neighbor_allowas_in_cmd
);
11775 install_element (BGP_IPV6_NODE
, &no_neighbor_allowas_in_cmd
);
11776 install_element (BGP_IPV6M_NODE
, &neighbor_allowas_in_cmd
);
11777 install_element (BGP_IPV6M_NODE
, &no_neighbor_allowas_in_cmd
);
11778 install_element (BGP_IPV6L_NODE
, &neighbor_allowas_in_cmd
);
11779 install_element (BGP_IPV6L_NODE
, &no_neighbor_allowas_in_cmd
);
11780 install_element (BGP_VPNV4_NODE
, &neighbor_allowas_in_cmd
);
11781 install_element (BGP_VPNV4_NODE
, &no_neighbor_allowas_in_cmd
);
11782 install_element (BGP_VPNV6_NODE
, &neighbor_allowas_in_cmd
);
11783 install_element (BGP_VPNV6_NODE
, &no_neighbor_allowas_in_cmd
);
11785 /* address-family commands. */
11786 install_element (BGP_NODE
, &address_family_ipv4_safi_cmd
);
11787 install_element (BGP_NODE
, &address_family_ipv6_safi_cmd
);
11788 #ifdef KEEP_OLD_VPN_COMMANDS
11789 install_element (BGP_NODE
, &address_family_vpnv4_cmd
);
11790 install_element (BGP_NODE
, &address_family_vpnv6_cmd
);
11791 #endif /* KEEP_OLD_VPN_COMMANDS */
11793 install_element (BGP_NODE
, &address_family_evpn_cmd
);
11795 /* "exit-address-family" command. */
11796 install_element (BGP_IPV4_NODE
, &exit_address_family_cmd
);
11797 install_element (BGP_IPV4M_NODE
, &exit_address_family_cmd
);
11798 install_element (BGP_IPV4L_NODE
, &exit_address_family_cmd
);
11799 install_element (BGP_IPV6_NODE
, &exit_address_family_cmd
);
11800 install_element (BGP_IPV6M_NODE
, &exit_address_family_cmd
);
11801 install_element (BGP_IPV6L_NODE
, &exit_address_family_cmd
);
11802 install_element (BGP_VPNV4_NODE
, &exit_address_family_cmd
);
11803 install_element (BGP_VPNV6_NODE
, &exit_address_family_cmd
);
11804 install_element (BGP_EVPN_NODE
, &exit_address_family_cmd
);
11806 /* "clear ip bgp commands" */
11807 install_element (ENABLE_NODE
, &clear_ip_bgp_all_cmd
);
11809 /* clear ip bgp prefix */
11810 install_element (ENABLE_NODE
, &clear_ip_bgp_prefix_cmd
);
11811 install_element (ENABLE_NODE
, &clear_bgp_ipv6_safi_prefix_cmd
);
11812 install_element (ENABLE_NODE
, &clear_bgp_instance_ipv6_safi_prefix_cmd
);
11814 /* "show [ip] bgp summary" commands. */
11815 install_element (VIEW_NODE
, &show_bgp_instance_all_ipv6_updgrps_cmd
);
11816 install_element (VIEW_NODE
, &show_bgp_instance_updgrps_adj_cmd
);
11817 install_element (VIEW_NODE
, &show_bgp_instance_updgrps_adj_s_cmd
);
11818 install_element (VIEW_NODE
, &show_bgp_instance_updgrps_stats_cmd
);
11819 install_element (VIEW_NODE
, &show_bgp_updgrps_adj_cmd
);
11820 install_element (VIEW_NODE
, &show_bgp_updgrps_adj_s_cmd
);
11821 install_element (VIEW_NODE
, &show_bgp_updgrps_afi_adj_cmd
);
11822 install_element (VIEW_NODE
, &show_bgp_updgrps_afi_adj_s_cmd
);
11823 install_element (VIEW_NODE
, &show_bgp_updgrps_stats_cmd
);
11824 install_element (VIEW_NODE
, &show_ip_bgp_instance_updgrps_adj_cmd
);
11825 install_element (VIEW_NODE
, &show_ip_bgp_instance_updgrps_adj_s_cmd
);
11826 install_element (VIEW_NODE
, &show_ip_bgp_summary_cmd
);
11827 install_element (VIEW_NODE
, &show_ip_bgp_updgrps_adj_cmd
);
11828 install_element (VIEW_NODE
, &show_ip_bgp_updgrps_adj_s_cmd
);
11829 install_element (VIEW_NODE
, &show_ip_bgp_updgrps_cmd
);
11831 /* "show [ip] bgp neighbors" commands. */
11832 install_element (VIEW_NODE
, &show_ip_bgp_neighbors_cmd
);
11834 /* "show [ip] bgp peer-group" commands. */
11835 install_element (VIEW_NODE
, &show_ip_bgp_peer_groups_cmd
);
11837 /* "show [ip] bgp paths" commands. */
11838 install_element (VIEW_NODE
, &show_ip_bgp_paths_cmd
);
11840 /* "show [ip] bgp community" commands. */
11841 install_element (VIEW_NODE
, &show_ip_bgp_community_info_cmd
);
11843 /* "show ip bgp large-community" commands. */
11844 install_element (VIEW_NODE
, &show_ip_bgp_lcommunity_info_cmd
);
11845 /* "show [ip] bgp attribute-info" commands. */
11846 install_element (VIEW_NODE
, &show_ip_bgp_attr_info_cmd
);
11848 /* "redistribute" commands. */
11849 install_element (BGP_NODE
, &bgp_redistribute_ipv4_hidden_cmd
);
11850 install_element (BGP_NODE
, &no_bgp_redistribute_ipv4_hidden_cmd
);
11851 install_element (BGP_NODE
, &bgp_redistribute_ipv4_rmap_hidden_cmd
);
11852 install_element (BGP_NODE
, &bgp_redistribute_ipv4_metric_hidden_cmd
);
11853 install_element (BGP_NODE
, &bgp_redistribute_ipv4_rmap_metric_hidden_cmd
);
11854 install_element (BGP_NODE
, &bgp_redistribute_ipv4_metric_rmap_hidden_cmd
);
11855 install_element (BGP_NODE
, &bgp_redistribute_ipv4_ospf_hidden_cmd
);
11856 install_element (BGP_NODE
, &no_bgp_redistribute_ipv4_ospf_hidden_cmd
);
11857 install_element (BGP_NODE
, &bgp_redistribute_ipv4_ospf_rmap_hidden_cmd
);
11858 install_element (BGP_NODE
, &bgp_redistribute_ipv4_ospf_metric_hidden_cmd
);
11859 install_element (BGP_NODE
, &bgp_redistribute_ipv4_ospf_rmap_metric_hidden_cmd
);
11860 install_element (BGP_NODE
, &bgp_redistribute_ipv4_ospf_metric_rmap_hidden_cmd
);
11861 install_element (BGP_IPV4_NODE
, &bgp_redistribute_ipv4_cmd
);
11862 install_element (BGP_IPV4_NODE
, &no_bgp_redistribute_ipv4_cmd
);
11863 install_element (BGP_IPV4_NODE
, &bgp_redistribute_ipv4_rmap_cmd
);
11864 install_element (BGP_IPV4_NODE
, &bgp_redistribute_ipv4_metric_cmd
);
11865 install_element (BGP_IPV4_NODE
, &bgp_redistribute_ipv4_rmap_metric_cmd
);
11866 install_element (BGP_IPV4_NODE
, &bgp_redistribute_ipv4_metric_rmap_cmd
);
11867 install_element (BGP_IPV4_NODE
, &bgp_redistribute_ipv4_ospf_cmd
);
11868 install_element (BGP_IPV4_NODE
, &no_bgp_redistribute_ipv4_ospf_cmd
);
11869 install_element (BGP_IPV4_NODE
, &bgp_redistribute_ipv4_ospf_rmap_cmd
);
11870 install_element (BGP_IPV4_NODE
, &bgp_redistribute_ipv4_ospf_metric_cmd
);
11871 install_element (BGP_IPV4_NODE
, &bgp_redistribute_ipv4_ospf_rmap_metric_cmd
);
11872 install_element (BGP_IPV4_NODE
, &bgp_redistribute_ipv4_ospf_metric_rmap_cmd
);
11873 install_element (BGP_IPV6_NODE
, &bgp_redistribute_ipv6_cmd
);
11874 install_element (BGP_IPV6_NODE
, &no_bgp_redistribute_ipv6_cmd
);
11875 install_element (BGP_IPV6_NODE
, &bgp_redistribute_ipv6_rmap_cmd
);
11876 install_element (BGP_IPV6_NODE
, &bgp_redistribute_ipv6_metric_cmd
);
11877 install_element (BGP_IPV6_NODE
, &bgp_redistribute_ipv6_rmap_metric_cmd
);
11878 install_element (BGP_IPV6_NODE
, &bgp_redistribute_ipv6_metric_rmap_cmd
);
11880 /* ttl_security commands */
11881 install_element (BGP_NODE
, &neighbor_ttl_security_cmd
);
11882 install_element (BGP_NODE
, &no_neighbor_ttl_security_cmd
);
11884 /* "show [ip] bgp memory" commands. */
11885 install_element (VIEW_NODE
, &show_bgp_memory_cmd
);
11887 /* "show [ip] bgp views" commands. */
11888 install_element (VIEW_NODE
, &show_bgp_views_cmd
);
11890 /* "show [ip] bgp vrfs" commands. */
11891 install_element (VIEW_NODE
, &show_bgp_vrfs_cmd
);
11893 /* Community-list. */
11894 community_list_vty ();
11897 #include "memory.h"
11898 #include "bgp_regex.h"
11899 #include "bgp_clist.h"
11900 #include "bgp_ecommunity.h"
11902 /* VTY functions. */
11904 /* Direction value to string conversion. */
11905 static const char *
11906 community_direct_str (int direct
)
11910 case COMMUNITY_DENY
:
11912 case COMMUNITY_PERMIT
:
11919 /* Display error string. */
11921 community_list_perror (struct vty
*vty
, int ret
)
11925 case COMMUNITY_LIST_ERR_CANT_FIND_LIST
:
11926 vty_out (vty
, "%% Can't find community-list%s", VTY_NEWLINE
);
11928 case COMMUNITY_LIST_ERR_MALFORMED_VAL
:
11929 vty_out (vty
, "%% Malformed community-list value%s", VTY_NEWLINE
);
11931 case COMMUNITY_LIST_ERR_STANDARD_CONFLICT
:
11932 vty_out (vty
, "%% Community name conflict, previously defined as standard community%s", VTY_NEWLINE
);
11934 case COMMUNITY_LIST_ERR_EXPANDED_CONFLICT
:
11935 vty_out (vty
, "%% Community name conflict, previously defined as expanded community%s", VTY_NEWLINE
);
11940 /* "community-list" keyword help string. */
11941 #define COMMUNITY_LIST_STR "Add a community list entry\n"
11944 /* ip community-list standard */
11945 DEFUN (ip_community_list_standard
,
11946 ip_community_list_standard_cmd
,
11947 "ip community-list <(1-99)|standard WORD> <deny|permit> AA:NN...",
11950 "Community list number (standard)\n"
11951 "Add an standard community-list entry\n"
11952 "Community list name\n"
11953 "Specify community to reject\n"
11954 "Specify community to accept\n"
11957 char *cl_name_or_number
= NULL
;
11959 int style
= COMMUNITY_LIST_STANDARD
;
11962 argv_find (argv
, argc
, "(1-99)", &idx
);
11963 argv_find (argv
, argc
, "WORD", &idx
);
11964 cl_name_or_number
= argv
[idx
]->arg
;
11965 direct
= argv_find (argv
, argc
, "permit", &idx
) ? COMMUNITY_PERMIT
: COMMUNITY_DENY
;
11966 argv_find (argv
, argc
, "AA:NN", &idx
);
11967 char *str
= argv_concat (argv
, argc
, idx
);
11969 int ret
= community_list_set (bgp_clist
, cl_name_or_number
, str
, direct
, style
);
11971 XFREE (MTYPE_TMP
, str
);
11975 /* Display error string. */
11976 community_list_perror (vty
, ret
);
11977 return CMD_WARNING
;
11980 return CMD_SUCCESS
;
11983 DEFUN (no_ip_community_list_standard_all
,
11984 no_ip_community_list_standard_all_cmd
,
11985 "no ip community-list <(1-99)|standard WORD> <deny|permit> AA:NN...",
11989 "Community list number (standard)\n"
11990 "Add an standard community-list entry\n"
11991 "Community list name\n"
11992 "Specify community to reject\n"
11993 "Specify community to accept\n"
11996 int delete_all
= 0;
11998 char *cl_name_or_number
= NULL
;
12000 int style
= COMMUNITY_LIST_STANDARD
;
12003 argv_find (argv
, argc
, "(1-99)", &idx
);
12004 argv_find (argv
, argc
, "WORD", &idx
);
12005 cl_name_or_number
= argv
[idx
]->arg
;
12006 direct
= argv_find (argv
, argc
, "permit", &idx
) ? COMMUNITY_PERMIT
: COMMUNITY_DENY
;
12007 argv_find (argv
, argc
, "AA:NN", &idx
);
12008 char *str
= argv_concat (argv
, argc
, idx
);
12010 int ret
= community_list_unset (bgp_clist
, cl_name_or_number
, str
, direct
, style
, delete_all
);
12012 XFREE (MTYPE_TMP
, str
);
12016 community_list_perror (vty
, ret
);
12017 return CMD_WARNING
;
12020 return CMD_SUCCESS
;
12023 /* ip community-list expanded */
12024 DEFUN (ip_community_list_expanded_all
,
12025 ip_community_list_expanded_all_cmd
,
12026 "ip community-list <(100-500)|expanded WORD> <deny|permit> AA:NN...",
12029 "Community list number (expanded)\n"
12030 "Add an expanded community-list entry\n"
12031 "Community list name\n"
12032 "Specify community to reject\n"
12033 "Specify community to accept\n"
12036 char *cl_name_or_number
= NULL
;
12038 int style
= COMMUNITY_LIST_EXPANDED
;
12041 argv_find (argv
, argc
, "(100-500)", &idx
);
12042 argv_find (argv
, argc
, "WORD", &idx
);
12043 cl_name_or_number
= argv
[idx
]->arg
;
12044 direct
= argv_find (argv
, argc
, "permit", &idx
) ? COMMUNITY_PERMIT
: COMMUNITY_DENY
;
12045 argv_find (argv
, argc
, "AA:NN", &idx
);
12046 char *str
= argv_concat (argv
, argc
, idx
);
12048 int ret
= community_list_set (bgp_clist
, cl_name_or_number
, str
, direct
, style
);
12050 XFREE (MTYPE_TMP
, str
);
12054 /* Display error string. */
12055 community_list_perror (vty
, ret
);
12056 return CMD_WARNING
;
12059 return CMD_SUCCESS
;
12062 DEFUN (no_ip_community_list_expanded_all
,
12063 no_ip_community_list_expanded_all_cmd
,
12064 "no ip community-list <(100-500)|expanded WORD> <deny|permit> AA:NN...",
12068 "Community list number (expanded)\n"
12069 "Add an expanded community-list entry\n"
12070 "Community list name\n"
12071 "Specify community to reject\n"
12072 "Specify community to accept\n"
12075 int delete_all
= 0;
12077 char *cl_name_or_number
= NULL
;
12079 int style
= COMMUNITY_LIST_EXPANDED
;
12082 argv_find (argv
, argc
, "(100-500)", &idx
);
12083 argv_find (argv
, argc
, "WORD", &idx
);
12084 cl_name_or_number
= argv
[idx
]->arg
;
12085 direct
= argv_find (argv
, argc
, "permit", &idx
) ? COMMUNITY_PERMIT
: COMMUNITY_DENY
;
12086 argv_find (argv
, argc
, "AA:NN", &idx
);
12087 char *str
= argv_concat (argv
, argc
, idx
);
12089 int ret
= community_list_unset (bgp_clist
, cl_name_or_number
, str
, direct
, style
, delete_all
);
12091 XFREE (MTYPE_TMP
, str
);
12095 community_list_perror (vty
, ret
);
12096 return CMD_WARNING
;
12099 return CMD_SUCCESS
;
12103 community_list_show (struct vty
*vty
, struct community_list
*list
)
12105 struct community_entry
*entry
;
12107 for (entry
= list
->head
; entry
; entry
= entry
->next
)
12109 if (entry
== list
->head
)
12111 if (all_digit (list
->name
))
12112 vty_out (vty
, "Community %s list %s%s",
12113 entry
->style
== COMMUNITY_LIST_STANDARD
?
12114 "standard" : "(expanded) access",
12115 list
->name
, VTY_NEWLINE
);
12117 vty_out (vty
, "Named Community %s list %s%s",
12118 entry
->style
== COMMUNITY_LIST_STANDARD
?
12119 "standard" : "expanded",
12120 list
->name
, VTY_NEWLINE
);
12123 vty_out (vty
, " %s%s",
12124 community_direct_str (entry
->direct
), VTY_NEWLINE
);
12126 vty_out (vty
, " %s %s%s",
12127 community_direct_str (entry
->direct
),
12128 entry
->style
== COMMUNITY_LIST_STANDARD
12129 ? community_str (entry
->u
.com
) : entry
->config
,
12134 DEFUN (show_ip_community_list
,
12135 show_ip_community_list_cmd
,
12136 "show ip community-list",
12139 "List community-list\n")
12141 struct community_list
*list
;
12142 struct community_list_master
*cm
;
12144 cm
= community_list_master_lookup (bgp_clist
, COMMUNITY_LIST_MASTER
);
12146 return CMD_SUCCESS
;
12148 for (list
= cm
->num
.head
; list
; list
= list
->next
)
12149 community_list_show (vty
, list
);
12151 for (list
= cm
->str
.head
; list
; list
= list
->next
)
12152 community_list_show (vty
, list
);
12154 return CMD_SUCCESS
;
12157 DEFUN (show_ip_community_list_arg
,
12158 show_ip_community_list_arg_cmd
,
12159 "show ip community-list <(1-500)|WORD>",
12162 "List community-list\n"
12163 "Community-list number\n"
12164 "Community-list name\n")
12166 int idx_comm_list
= 3;
12167 struct community_list
*list
;
12169 list
= community_list_lookup (bgp_clist
, argv
[idx_comm_list
]->arg
, COMMUNITY_LIST_MASTER
);
12172 vty_out (vty
, "%% Can't find community-list%s", VTY_NEWLINE
);
12173 return CMD_WARNING
;
12176 community_list_show (vty
, list
);
12178 return CMD_SUCCESS
;
12182 * Large Community code.
12185 lcommunity_list_set_vty (struct vty
*vty
, int argc
, struct cmd_token
**argv
,
12186 int style
, int reject_all_digit_name
)
12194 direct
= argv_find (argv
, argc
, "permit", &idx
) ? COMMUNITY_PERMIT
: COMMUNITY_DENY
;
12196 /* All digit name check. */
12198 argv_find (argv
, argc
, "WORD", &idx
);
12199 argv_find (argv
, argc
, "(1-99)", &idx
);
12200 argv_find (argv
, argc
, "(100-500)", &idx
);
12201 cl_name
= argv
[idx
]->arg
;
12202 if (reject_all_digit_name
&& all_digit (cl_name
))
12204 vty_out (vty
, "%% Community name cannot have all digits%s", VTY_NEWLINE
);
12205 return CMD_WARNING
;
12209 argv_find (argv
, argc
, "AA:BB:CC", &idx
);
12210 argv_find (argv
, argc
, "LINE", &idx
);
12211 /* Concat community string argument. */
12213 str
= argv_concat (argv
, argc
, idx
);
12217 ret
= lcommunity_list_set (bgp_clist
, cl_name
, str
, direct
, style
);
12219 /* Free temporary community list string allocated by
12222 XFREE (MTYPE_TMP
, str
);
12226 community_list_perror (vty
, ret
);
12227 return CMD_WARNING
;
12229 return CMD_SUCCESS
;
12233 lcommunity_list_unset_vty (struct vty
*vty
, int argc
, struct cmd_token
**argv
,
12241 argv_find (argv
, argc
, "permit", &idx
);
12242 argv_find (argv
, argc
, "deny", &idx
);
12246 /* Check the list direct. */
12247 if (strncmp (argv
[idx
]->arg
, "p", 1) == 0)
12248 direct
= COMMUNITY_PERMIT
;
12250 direct
= COMMUNITY_DENY
;
12253 argv_find (argv
, argc
, "LINE", &idx
);
12254 argv_find (argv
, argc
, "AA:AA:NN", &idx
);
12255 /* Concat community string argument. */
12256 str
= argv_concat (argv
, argc
, idx
);
12260 argv_find (argv
, argc
, "(1-99)", &idx
);
12261 argv_find (argv
, argc
, "(100-500)", &idx
);
12262 argv_find (argv
, argc
, "WORD", &idx
);
12264 /* Unset community list. */
12265 ret
= lcommunity_list_unset (bgp_clist
, argv
[idx
]->arg
, str
, direct
, style
);
12267 /* Free temporary community list string allocated by
12270 XFREE (MTYPE_TMP
, str
);
12274 community_list_perror (vty
, ret
);
12275 return CMD_WARNING
;
12278 return CMD_SUCCESS
;
12281 /* "large-community-list" keyword help string. */
12282 #define LCOMMUNITY_LIST_STR "Add a large community list entry\n"
12283 #define LCOMMUNITY_VAL_STR "large community in 'aa:bb:cc' format\n"
12285 DEFUN (ip_lcommunity_list_standard
,
12286 ip_lcommunity_list_standard_cmd
,
12287 "ip large-community-list (1-99) <deny|permit>",
12289 LCOMMUNITY_LIST_STR
12290 "Large Community list number (standard)\n"
12291 "Specify large community to reject\n"
12292 "Specify large community to accept\n"
12293 LCOMMUNITY_VAL_STR
)
12295 return lcommunity_list_set_vty (vty
, argc
, argv
, LARGE_COMMUNITY_LIST_STANDARD
, 0);
12298 DEFUN (ip_lcommunity_list_standard1
,
12299 ip_lcommunity_list_standard1_cmd
,
12300 "ip large-community-list (1-99) <deny|permit> AA:BB:CC...",
12302 LCOMMUNITY_LIST_STR
12303 "Large Community list number (standard)\n"
12304 "Specify large community to reject\n"
12305 "Specify large community to accept\n"
12306 LCOMMUNITY_VAL_STR
)
12308 return lcommunity_list_set_vty (vty
, argc
, argv
, LARGE_COMMUNITY_LIST_STANDARD
, 0);
12311 DEFUN (ip_lcommunity_list_expanded
,
12312 ip_lcommunity_list_expanded_cmd
,
12313 "ip large-community-list (100-500) <deny|permit> LINE...",
12315 LCOMMUNITY_LIST_STR
12316 "Large Community list number (expanded)\n"
12317 "Specify large community to reject\n"
12318 "Specify large community to accept\n"
12319 "An ordered list as a regular-expression\n")
12321 return lcommunity_list_set_vty (vty
, argc
, argv
, LARGE_COMMUNITY_LIST_EXPANDED
, 0);
12324 DEFUN (ip_lcommunity_list_name_standard
,
12325 ip_lcommunity_list_name_standard_cmd
,
12326 "ip large-community-list standard WORD <deny|permit>",
12328 LCOMMUNITY_LIST_STR
12329 "Specify standard large-community-list\n"
12330 "Large Community list name\n"
12331 "Specify large community to reject\n"
12332 "Specify large community to accept\n")
12334 return lcommunity_list_set_vty (vty
, argc
, argv
, LARGE_COMMUNITY_LIST_STANDARD
, 1);
12337 DEFUN (ip_lcommunity_list_name_standard1
,
12338 ip_lcommunity_list_name_standard1_cmd
,
12339 "ip large-community-list standard WORD <deny|permit> AA:BB:CC...",
12341 LCOMMUNITY_LIST_STR
12342 "Specify standard large-community-list\n"
12343 "Large Community list name\n"
12344 "Specify large community to reject\n"
12345 "Specify large community to accept\n"
12346 LCOMMUNITY_VAL_STR
)
12348 return lcommunity_list_set_vty (vty
, argc
, argv
, LARGE_COMMUNITY_LIST_STANDARD
, 1);
12351 DEFUN (ip_lcommunity_list_name_expanded
,
12352 ip_lcommunity_list_name_expanded_cmd
,
12353 "ip large-community-list expanded WORD <deny|permit> LINE...",
12355 LCOMMUNITY_LIST_STR
12356 "Specify expanded large-community-list\n"
12357 "Large Community list name\n"
12358 "Specify large community to reject\n"
12359 "Specify large community to accept\n"
12360 "An ordered list as a regular-expression\n")
12362 return lcommunity_list_set_vty (vty
, argc
, argv
, LARGE_COMMUNITY_LIST_EXPANDED
, 1);
12365 DEFUN (no_ip_lcommunity_list_standard_all
,
12366 no_ip_lcommunity_list_standard_all_cmd
,
12367 "no ip large-community-list <(1-99)|(100-500)|WORD>",
12370 LCOMMUNITY_LIST_STR
12371 "Large Community list number (standard)\n"
12372 "Large Community list number (expanded)\n"
12373 "Large Community list name\n")
12375 return lcommunity_list_unset_vty (vty
, argc
, argv
, LARGE_COMMUNITY_LIST_STANDARD
);
12378 DEFUN (no_ip_lcommunity_list_name_expanded_all
,
12379 no_ip_lcommunity_list_name_expanded_all_cmd
,
12380 "no ip large-community-list expanded WORD",
12383 LCOMMUNITY_LIST_STR
12384 "Specify expanded large-community-list\n"
12385 "Large Community list name\n")
12387 return lcommunity_list_unset_vty (vty
, argc
, argv
, LARGE_COMMUNITY_LIST_EXPANDED
);
12390 DEFUN (no_ip_lcommunity_list_standard
,
12391 no_ip_lcommunity_list_standard_cmd
,
12392 "no ip large-community-list (1-99) <deny|permit> AA:AA:NN...",
12395 LCOMMUNITY_LIST_STR
12396 "Large Community list number (standard)\n"
12397 "Specify large community to reject\n"
12398 "Specify large community to accept\n"
12399 LCOMMUNITY_VAL_STR
)
12401 return lcommunity_list_unset_vty (vty
, argc
, argv
, LARGE_COMMUNITY_LIST_STANDARD
);
12404 DEFUN (no_ip_lcommunity_list_expanded
,
12405 no_ip_lcommunity_list_expanded_cmd
,
12406 "no ip large-community-list (100-500) <deny|permit> LINE...",
12409 LCOMMUNITY_LIST_STR
12410 "Large Community list number (expanded)\n"
12411 "Specify large community to reject\n"
12412 "Specify large community to accept\n"
12413 "An ordered list as a regular-expression\n")
12415 return lcommunity_list_unset_vty (vty
, argc
, argv
, LARGE_COMMUNITY_LIST_EXPANDED
);
12418 DEFUN (no_ip_lcommunity_list_name_standard
,
12419 no_ip_lcommunity_list_name_standard_cmd
,
12420 "no ip large-community-list standard WORD <deny|permit> AA:AA:NN...",
12423 LCOMMUNITY_LIST_STR
12424 "Specify standard large-community-list\n"
12425 "Large Community list name\n"
12426 "Specify large community to reject\n"
12427 "Specify large community to accept\n"
12428 LCOMMUNITY_VAL_STR
)
12430 return lcommunity_list_unset_vty (vty
, argc
, argv
, LARGE_COMMUNITY_LIST_STANDARD
);
12433 DEFUN (no_ip_lcommunity_list_name_expanded
,
12434 no_ip_lcommunity_list_name_expanded_cmd
,
12435 "no ip large-community-list expanded WORD <deny|permit> LINE...",
12438 LCOMMUNITY_LIST_STR
12439 "Specify expanded large-community-list\n"
12440 "Large community list name\n"
12441 "Specify large community to reject\n"
12442 "Specify large community to accept\n"
12443 "An ordered list as a regular-expression\n")
12445 return lcommunity_list_unset_vty (vty
, argc
, argv
, LARGE_COMMUNITY_LIST_EXPANDED
);
12449 lcommunity_list_show (struct vty
*vty
, struct community_list
*list
)
12451 struct community_entry
*entry
;
12453 for (entry
= list
->head
; entry
; entry
= entry
->next
)
12455 if (entry
== list
->head
)
12457 if (all_digit (list
->name
))
12458 vty_out (vty
, "Large community %s list %s%s",
12459 entry
->style
== EXTCOMMUNITY_LIST_STANDARD
?
12460 "standard" : "(expanded) access",
12461 list
->name
, VTY_NEWLINE
);
12463 vty_out (vty
, "Named large community %s list %s%s",
12464 entry
->style
== EXTCOMMUNITY_LIST_STANDARD
?
12465 "standard" : "expanded",
12466 list
->name
, VTY_NEWLINE
);
12469 vty_out (vty
, " %s%s",
12470 community_direct_str (entry
->direct
), VTY_NEWLINE
);
12472 vty_out (vty
, " %s %s%s",
12473 community_direct_str (entry
->direct
),
12474 entry
->style
== EXTCOMMUNITY_LIST_STANDARD
?
12475 entry
->u
.ecom
->str
: entry
->config
,
12480 DEFUN (show_ip_lcommunity_list
,
12481 show_ip_lcommunity_list_cmd
,
12482 "show ip large-community-list",
12485 "List large-community list\n")
12487 struct community_list
*list
;
12488 struct community_list_master
*cm
;
12490 cm
= community_list_master_lookup (bgp_clist
, LARGE_COMMUNITY_LIST_MASTER
);
12492 return CMD_SUCCESS
;
12494 for (list
= cm
->num
.head
; list
; list
= list
->next
)
12495 lcommunity_list_show (vty
, list
);
12497 for (list
= cm
->str
.head
; list
; list
= list
->next
)
12498 lcommunity_list_show (vty
, list
);
12500 return CMD_SUCCESS
;
12503 DEFUN (show_ip_lcommunity_list_arg
,
12504 show_ip_lcommunity_list_arg_cmd
,
12505 "show ip large-community-list <(1-500)|WORD>",
12508 "List large-community list\n"
12509 "large-community-list number\n"
12510 "large-community-list name\n")
12512 struct community_list
*list
;
12514 list
= community_list_lookup (bgp_clist
, argv
[3]->arg
, LARGE_COMMUNITY_LIST_MASTER
);
12517 vty_out (vty
, "%% Can't find extcommunity-list%s", VTY_NEWLINE
);
12518 return CMD_WARNING
;
12521 lcommunity_list_show (vty
, list
);
12523 return CMD_SUCCESS
;
12526 /* "extcommunity-list" keyword help string. */
12527 #define EXTCOMMUNITY_LIST_STR "Add a extended community list entry\n"
12528 #define EXTCOMMUNITY_VAL_STR "Extended community attribute in 'rt aa:nn_or_IPaddr:nn' OR 'soo aa:nn_or_IPaddr:nn' format\n"
12530 DEFUN (ip_extcommunity_list_standard
,
12531 ip_extcommunity_list_standard_cmd
,
12532 "ip extcommunity-list <(1-99)|standard WORD> <deny|permit> AA:NN...",
12534 EXTCOMMUNITY_LIST_STR
12535 "Extended Community list number (standard)\n"
12536 "Specify standard extcommunity-list\n"
12537 "Community list name\n"
12538 "Specify community to reject\n"
12539 "Specify community to accept\n"
12540 EXTCOMMUNITY_VAL_STR
)
12542 int style
= EXTCOMMUNITY_LIST_STANDARD
;
12544 char *cl_number_or_name
= NULL
;
12547 argv_find (argv
, argc
, "(1-99)", &idx
);
12548 argv_find (argv
, argc
, "WORD", &idx
);
12549 cl_number_or_name
= argv
[idx
]->arg
;
12550 direct
= argv_find (argv
, argc
, "permit", &idx
) ? COMMUNITY_PERMIT
: COMMUNITY_DENY
;
12551 argv_find (argv
, argc
, "AA:NN", &idx
);
12552 char *str
= argv_concat (argv
, argc
, idx
);
12554 int ret
= extcommunity_list_set (bgp_clist
, cl_number_or_name
, str
, direct
, style
);
12556 XFREE (MTYPE_TMP
, str
);
12560 community_list_perror (vty
, ret
);
12561 return CMD_WARNING
;
12564 return CMD_SUCCESS
;
12567 DEFUN (ip_extcommunity_list_name_expanded
,
12568 ip_extcommunity_list_name_expanded_cmd
,
12569 "ip extcommunity-list <(100-500)|expanded WORD> <deny|permit> LINE...",
12571 EXTCOMMUNITY_LIST_STR
12572 "Extended Community list number (expanded)\n"
12573 "Specify expanded extcommunity-list\n"
12574 "Extended Community list name\n"
12575 "Specify community to reject\n"
12576 "Specify community to accept\n"
12577 "An ordered list as a regular-expression\n")
12579 int style
= EXTCOMMUNITY_LIST_EXPANDED
;
12581 char *cl_number_or_name
= NULL
;
12584 argv_find (argv
, argc
, "(100-500)", &idx
);
12585 argv_find (argv
, argc
, "WORD", &idx
);
12586 cl_number_or_name
= argv
[idx
]->arg
;
12587 direct
= argv_find (argv
, argc
, "permit", &idx
) ? COMMUNITY_PERMIT
: COMMUNITY_DENY
;
12588 argv_find (argv
, argc
, "LINE", &idx
);
12589 char *str
= argv_concat (argv
, argc
, idx
);
12591 int ret
= extcommunity_list_set (bgp_clist
, cl_number_or_name
, str
, direct
, style
);
12593 XFREE (MTYPE_TMP
, str
);
12597 community_list_perror (vty
, ret
);
12598 return CMD_WARNING
;
12601 return CMD_SUCCESS
;
12604 DEFUN (no_ip_extcommunity_list_standard_all
,
12605 no_ip_extcommunity_list_standard_all_cmd
,
12606 "no ip extcommunity-list <(1-99)|standard WORD> <deny|permit> AA:NN...",
12609 EXTCOMMUNITY_LIST_STR
12610 "Extended Community list number (standard)\n"
12611 "Specify standard extcommunity-list\n"
12612 "Community list name\n"
12613 "Specify community to reject\n"
12614 "Specify community to accept\n"
12615 EXTCOMMUNITY_VAL_STR
)
12619 int style
= EXTCOMMUNITY_LIST_STANDARD
;
12621 char *cl_number_or_name
= NULL
;
12624 argv_find (argv
, argc
, "(1-99)", &idx
);
12625 argv_find (argv
, argc
, "WORD", &idx
);
12626 cl_number_or_name
= argv
[idx
]->arg
;
12627 direct
= argv_find (argv
, argc
, "permit", &idx
) ? COMMUNITY_PERMIT
: COMMUNITY_DENY
;
12628 argv_find (argv
, argc
, "AA:NN", &idx
);
12629 char *str
= argv_concat (argv
, argc
, idx
);
12631 int ret
= extcommunity_list_unset (bgp_clist
, cl_number_or_name
, str
, direct
, style
, deleteall
);
12633 XFREE (MTYPE_TMP
, str
);
12637 community_list_perror (vty
, ret
);
12638 return CMD_WARNING
;
12641 return CMD_SUCCESS
;
12644 DEFUN (no_ip_extcommunity_list_expanded_all
,
12645 no_ip_extcommunity_list_expanded_all_cmd
,
12646 "no ip extcommunity-list <(100-500)|expanded WORD> <deny|permit> LINE...",
12649 EXTCOMMUNITY_LIST_STR
12650 "Extended Community list number (expanded)\n"
12651 "Specify expanded extcommunity-list\n"
12652 "Extended Community list name\n"
12653 "Specify community to reject\n"
12654 "Specify community to accept\n"
12655 "An ordered list as a regular-expression\n")
12659 int style
= EXTCOMMUNITY_LIST_EXPANDED
;
12661 char *cl_number_or_name
= NULL
;
12664 argv_find (argv
, argc
, "(100-500)", &idx
);
12665 argv_find (argv
, argc
, "WORD", &idx
);
12666 cl_number_or_name
= argv
[idx
]->arg
;
12667 direct
= argv_find (argv
, argc
, "permit", &idx
) ? COMMUNITY_PERMIT
: COMMUNITY_DENY
;
12668 argv_find (argv
, argc
, "LINE", &idx
);
12669 char *str
= argv_concat (argv
, argc
, idx
);
12671 int ret
= extcommunity_list_unset (bgp_clist
, cl_number_or_name
, str
, direct
, style
, deleteall
);
12673 XFREE (MTYPE_TMP
, str
);
12677 community_list_perror (vty
, ret
);
12678 return CMD_WARNING
;
12681 return CMD_SUCCESS
;
12685 extcommunity_list_show (struct vty
*vty
, struct community_list
*list
)
12687 struct community_entry
*entry
;
12689 for (entry
= list
->head
; entry
; entry
= entry
->next
)
12691 if (entry
== list
->head
)
12693 if (all_digit (list
->name
))
12694 vty_out (vty
, "Extended community %s list %s%s",
12695 entry
->style
== EXTCOMMUNITY_LIST_STANDARD
?
12696 "standard" : "(expanded) access",
12697 list
->name
, VTY_NEWLINE
);
12699 vty_out (vty
, "Named extended community %s list %s%s",
12700 entry
->style
== EXTCOMMUNITY_LIST_STANDARD
?
12701 "standard" : "expanded",
12702 list
->name
, VTY_NEWLINE
);
12705 vty_out (vty
, " %s%s",
12706 community_direct_str (entry
->direct
), VTY_NEWLINE
);
12708 vty_out (vty
, " %s %s%s",
12709 community_direct_str (entry
->direct
),
12710 entry
->style
== EXTCOMMUNITY_LIST_STANDARD
?
12711 entry
->u
.ecom
->str
: entry
->config
,
12716 DEFUN (show_ip_extcommunity_list
,
12717 show_ip_extcommunity_list_cmd
,
12718 "show ip extcommunity-list",
12721 "List extended-community list\n")
12723 struct community_list
*list
;
12724 struct community_list_master
*cm
;
12726 cm
= community_list_master_lookup (bgp_clist
, EXTCOMMUNITY_LIST_MASTER
);
12728 return CMD_SUCCESS
;
12730 for (list
= cm
->num
.head
; list
; list
= list
->next
)
12731 extcommunity_list_show (vty
, list
);
12733 for (list
= cm
->str
.head
; list
; list
= list
->next
)
12734 extcommunity_list_show (vty
, list
);
12736 return CMD_SUCCESS
;
12739 DEFUN (show_ip_extcommunity_list_arg
,
12740 show_ip_extcommunity_list_arg_cmd
,
12741 "show ip extcommunity-list <(1-500)|WORD>",
12744 "List extended-community list\n"
12745 "Extcommunity-list number\n"
12746 "Extcommunity-list name\n")
12748 int idx_comm_list
= 3;
12749 struct community_list
*list
;
12751 list
= community_list_lookup (bgp_clist
, argv
[idx_comm_list
]->arg
, EXTCOMMUNITY_LIST_MASTER
);
12754 vty_out (vty
, "%% Can't find extcommunity-list%s", VTY_NEWLINE
);
12755 return CMD_WARNING
;
12758 extcommunity_list_show (vty
, list
);
12760 return CMD_SUCCESS
;
12763 /* Return configuration string of community-list entry. */
12764 static const char *
12765 community_list_config_str (struct community_entry
*entry
)
12773 if (entry
->style
== COMMUNITY_LIST_STANDARD
)
12774 str
= community_str (entry
->u
.com
);
12776 str
= entry
->config
;
12781 /* Display community-list and extcommunity-list configuration. */
12783 community_list_config_write (struct vty
*vty
)
12785 struct community_list
*list
;
12786 struct community_entry
*entry
;
12787 struct community_list_master
*cm
;
12790 /* Community-list. */
12791 cm
= community_list_master_lookup (bgp_clist
, COMMUNITY_LIST_MASTER
);
12793 for (list
= cm
->num
.head
; list
; list
= list
->next
)
12794 for (entry
= list
->head
; entry
; entry
= entry
->next
)
12796 vty_out (vty
, "ip community-list %s %s %s%s",
12797 list
->name
, community_direct_str (entry
->direct
),
12798 community_list_config_str (entry
),
12802 for (list
= cm
->str
.head
; list
; list
= list
->next
)
12803 for (entry
= list
->head
; entry
; entry
= entry
->next
)
12805 vty_out (vty
, "ip community-list %s %s %s %s%s",
12806 entry
->style
== COMMUNITY_LIST_STANDARD
12807 ? "standard" : "expanded",
12808 list
->name
, community_direct_str (entry
->direct
),
12809 community_list_config_str (entry
),
12814 /* Extcommunity-list. */
12815 cm
= community_list_master_lookup (bgp_clist
, EXTCOMMUNITY_LIST_MASTER
);
12817 for (list
= cm
->num
.head
; list
; list
= list
->next
)
12818 for (entry
= list
->head
; entry
; entry
= entry
->next
)
12820 vty_out (vty
, "ip extcommunity-list %s %s %s%s",
12821 list
->name
, community_direct_str (entry
->direct
),
12822 community_list_config_str (entry
), VTY_NEWLINE
);
12825 for (list
= cm
->str
.head
; list
; list
= list
->next
)
12826 for (entry
= list
->head
; entry
; entry
= entry
->next
)
12828 vty_out (vty
, "ip extcommunity-list %s %s %s %s%s",
12829 entry
->style
== EXTCOMMUNITY_LIST_STANDARD
12830 ? "standard" : "expanded",
12831 list
->name
, community_direct_str (entry
->direct
),
12832 community_list_config_str (entry
), VTY_NEWLINE
);
12837 /* lcommunity-list. */
12838 cm
= community_list_master_lookup (bgp_clist
, LARGE_COMMUNITY_LIST_MASTER
);
12840 for (list
= cm
->num
.head
; list
; list
= list
->next
)
12841 for (entry
= list
->head
; entry
; entry
= entry
->next
)
12843 vty_out (vty
, "ip large-community-list %s %s %s%s",
12844 list
->name
, community_direct_str (entry
->direct
),
12845 community_list_config_str (entry
), VTY_NEWLINE
);
12848 for (list
= cm
->str
.head
; list
; list
= list
->next
)
12849 for (entry
= list
->head
; entry
; entry
= entry
->next
)
12851 vty_out (vty
, "ip large-community-list %s %s %s %s%s",
12852 entry
->style
== LARGE_COMMUNITY_LIST_STANDARD
12853 ? "standard" : "expanded",
12854 list
->name
, community_direct_str (entry
->direct
),
12855 community_list_config_str (entry
), VTY_NEWLINE
);
12862 static struct cmd_node community_list_node
=
12864 COMMUNITY_LIST_NODE
,
12866 1 /* Export to vtysh. */
12870 community_list_vty (void)
12872 install_node (&community_list_node
, community_list_config_write
);
12874 /* Community-list. */
12875 install_element (CONFIG_NODE
, &ip_community_list_standard_cmd
);
12876 install_element (CONFIG_NODE
, &ip_community_list_expanded_all_cmd
);
12877 install_element (CONFIG_NODE
, &no_ip_community_list_standard_all_cmd
);
12878 install_element (CONFIG_NODE
, &no_ip_community_list_expanded_all_cmd
);
12879 install_element (VIEW_NODE
, &show_ip_community_list_cmd
);
12880 install_element (VIEW_NODE
, &show_ip_community_list_arg_cmd
);
12882 /* Extcommunity-list. */
12883 install_element (CONFIG_NODE
, &ip_extcommunity_list_standard_cmd
);
12884 install_element (CONFIG_NODE
, &ip_extcommunity_list_name_expanded_cmd
);
12885 install_element (CONFIG_NODE
, &no_ip_extcommunity_list_standard_all_cmd
);
12886 install_element (CONFIG_NODE
, &no_ip_extcommunity_list_expanded_all_cmd
);
12887 install_element (VIEW_NODE
, &show_ip_extcommunity_list_cmd
);
12888 install_element (VIEW_NODE
, &show_ip_extcommunity_list_arg_cmd
);
12890 /* Large Community List */
12891 install_element (CONFIG_NODE
, &ip_lcommunity_list_standard_cmd
);
12892 install_element (CONFIG_NODE
, &ip_lcommunity_list_standard1_cmd
);
12893 install_element (CONFIG_NODE
, &ip_lcommunity_list_expanded_cmd
);
12894 install_element (CONFIG_NODE
, &ip_lcommunity_list_name_standard_cmd
);
12895 install_element (CONFIG_NODE
, &ip_lcommunity_list_name_standard1_cmd
);
12896 install_element (CONFIG_NODE
, &ip_lcommunity_list_name_expanded_cmd
);
12897 install_element (CONFIG_NODE
, &no_ip_lcommunity_list_standard_all_cmd
);
12898 install_element (CONFIG_NODE
, &no_ip_lcommunity_list_name_expanded_all_cmd
);
12899 install_element (CONFIG_NODE
, &no_ip_lcommunity_list_standard_cmd
);
12900 install_element (CONFIG_NODE
, &no_ip_lcommunity_list_expanded_cmd
);
12901 install_element (CONFIG_NODE
, &no_ip_lcommunity_list_name_standard_cmd
);
12902 install_element (CONFIG_NODE
, &no_ip_lcommunity_list_name_expanded_cmd
);
12903 install_element (VIEW_NODE
, &show_ip_lcommunity_list_cmd
);
12904 install_element (VIEW_NODE
, &show_ip_lcommunity_list_arg_cmd
);