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 /* BGP global configuration. */
782 DEFUN (bgp_multiple_instance_func
,
783 bgp_multiple_instance_cmd
,
784 "bgp multiple-instance",
786 "Enable bgp multiple instance\n")
788 bgp_option_set (BGP_OPT_MULTIPLE_INSTANCE
);
792 DEFUN (no_bgp_multiple_instance
,
793 no_bgp_multiple_instance_cmd
,
794 "no bgp multiple-instance",
797 "BGP multiple instance\n")
801 ret
= bgp_option_unset (BGP_OPT_MULTIPLE_INSTANCE
);
804 vty_out (vty
, "%% There are more than two BGP instances%s", VTY_NEWLINE
);
810 DEFUN (bgp_config_type
,
812 "bgp config-type <cisco|zebra>",
814 "Configuration type\n"
819 if (strncmp (argv
[idx_vendor
]->arg
, "c", 1) == 0)
820 bgp_option_set (BGP_OPT_CONFIG_CISCO
);
822 bgp_option_unset (BGP_OPT_CONFIG_CISCO
);
827 DEFUN (no_bgp_config_type
,
828 no_bgp_config_type_cmd
,
829 "no bgp config-type [<cisco|zebra>]",
832 "Display configuration type\n"
836 bgp_option_unset (BGP_OPT_CONFIG_CISCO
);
841 DEFUN (no_synchronization
,
842 no_synchronization_cmd
,
843 "no synchronization",
845 "Perform IGP synchronization\n")
850 DEFUN (no_auto_summary
,
854 "Enable automatic network number summarization\n")
859 /* "router bgp" commands. */
860 DEFUN_NOSH (router_bgp
,
862 "router bgp [(1-4294967295) [<view|vrf> VIEWVRFNAME]]",
866 BGP_INSTANCE_HELP_STR
)
869 int idx_view_vrf
= 3;
874 const char *name
= NULL
;
875 enum bgp_instance_type inst_type
;
877 // "router bgp" without an ASN
880 //Pending: Make VRF option available for ASN less config
881 bgp
= bgp_get_default();
885 vty_out (vty
, "%% No BGP process is configured%s", VTY_NEWLINE
);
889 if (listcount(bm
->bgp
) > 1)
891 vty_out (vty
, "%% Multiple BGP processes are configured%s", VTY_NEWLINE
);
899 VTY_GET_INTEGER_RANGE ("AS", as
, argv
[idx_asn
]->arg
, 1, BGP_AS4_MAX
);
901 inst_type
= BGP_INSTANCE_TYPE_DEFAULT
;
904 name
= argv
[idx_vrf
]->arg
;
906 if (!strcmp(argv
[idx_view_vrf
]->text
, "vrf"))
907 inst_type
= BGP_INSTANCE_TYPE_VRF
;
908 else if (!strcmp(argv
[idx_view_vrf
]->text
, "view"))
909 inst_type
= BGP_INSTANCE_TYPE_VIEW
;
912 ret
= bgp_get (&bgp
, &as
, name
, inst_type
);
915 case BGP_ERR_MULTIPLE_INSTANCE_NOT_SET
:
916 vty_out (vty
, "Please specify 'bgp multiple-instance' first%s",
919 case BGP_ERR_AS_MISMATCH
:
920 vty_out (vty
, "BGP is already running; AS is %u%s", as
, VTY_NEWLINE
);
922 case BGP_ERR_INSTANCE_MISMATCH
:
923 vty_out (vty
, "BGP instance name and AS number mismatch%s", VTY_NEWLINE
);
924 vty_out (vty
, "BGP instance is already running; AS is %u%s",
929 /* Pending: handle when user tries to change a view to vrf n vv. */
932 VTY_PUSH_CONTEXT(BGP_NODE
, bgp
);
937 /* "no router bgp" commands. */
938 DEFUN (no_router_bgp
,
940 "no router bgp [(1-4294967295) [<view|vrf> VIEWVRFNAME]]",
945 BGP_INSTANCE_HELP_STR
)
951 const char *name
= NULL
;
953 // "no router bgp" without an ASN
956 //Pending: Make VRF option available for ASN less config
957 bgp
= bgp_get_default();
961 vty_out (vty
, "%% No BGP process is configured%s", VTY_NEWLINE
);
965 if (listcount(bm
->bgp
) > 1)
967 vty_out (vty
, "%% Multiple BGP processes are configured%s", VTY_NEWLINE
);
973 VTY_GET_INTEGER_RANGE ("AS", as
, argv
[idx_asn
]->arg
, 1, BGP_AS4_MAX
);
976 name
= argv
[idx_vrf
]->arg
;
978 /* Lookup bgp structure. */
979 bgp
= bgp_lookup (as
, name
);
982 vty_out (vty
, "%% Can't find BGP instance%s", VTY_NEWLINE
);
996 DEFUN (bgp_router_id
,
998 "bgp router-id A.B.C.D",
1000 "Override configured router identifier\n"
1001 "Manually configured router identifier\n")
1003 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1008 ret
= inet_aton (argv
[idx_ipv4
]->arg
, &id
);
1011 vty_out (vty
, "%% Malformed bgp router identifier%s", VTY_NEWLINE
);
1015 bgp_router_id_static_set (bgp
, id
);
1020 DEFUN (no_bgp_router_id
,
1021 no_bgp_router_id_cmd
,
1022 "no bgp router-id [A.B.C.D]",
1025 "Override configured router identifier\n"
1026 "Manually configured router identifier\n")
1028 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1029 int idx_router_id
= 3;
1033 if (argc
> idx_router_id
)
1035 ret
= inet_aton (argv
[idx_router_id
]->arg
, &id
);
1038 vty_out (vty
, "%% Malformed BGP router identifier%s", VTY_NEWLINE
);
1042 if (! IPV4_ADDR_SAME (&bgp
->router_id_static
, &id
))
1044 vty_out (vty
, "%% BGP router-id doesn't match%s", VTY_NEWLINE
);
1050 bgp_router_id_static_set (bgp
, id
);
1056 /* BGP Cluster ID. */
1057 DEFUN (bgp_cluster_id
,
1059 "bgp cluster-id <A.B.C.D|(1-4294967295)>",
1061 "Configure Route-Reflector Cluster-id\n"
1062 "Route-Reflector Cluster-id in IP address format\n"
1063 "Route-Reflector Cluster-id as 32 bit quantity\n")
1065 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1068 struct in_addr cluster
;
1070 ret
= inet_aton (argv
[idx_ipv4
]->arg
, &cluster
);
1073 vty_out (vty
, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE
);
1077 bgp_cluster_id_set (bgp
, &cluster
);
1078 bgp_clear_star_soft_out (vty
, bgp
->name
);
1083 DEFUN (no_bgp_cluster_id
,
1084 no_bgp_cluster_id_cmd
,
1085 "no bgp cluster-id [<A.B.C.D|(1-4294967295)>]",
1088 "Configure Route-Reflector Cluster-id\n"
1089 "Route-Reflector Cluster-id in IP address format\n"
1090 "Route-Reflector Cluster-id as 32 bit quantity\n")
1092 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1093 bgp_cluster_id_unset (bgp
);
1094 bgp_clear_star_soft_out (vty
, bgp
->name
);
1099 DEFUN (bgp_confederation_identifier
,
1100 bgp_confederation_identifier_cmd
,
1101 "bgp confederation identifier (1-4294967295)",
1102 "BGP specific commands\n"
1103 "AS confederation parameters\n"
1105 "Set routing domain confederation AS\n")
1107 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1111 VTY_GET_INTEGER_RANGE ("AS", as
, argv
[idx_number
]->arg
, 1, BGP_AS4_MAX
);
1113 bgp_confederation_id_set (bgp
, as
);
1118 DEFUN (no_bgp_confederation_identifier
,
1119 no_bgp_confederation_identifier_cmd
,
1120 "no bgp confederation identifier [(1-4294967295)]",
1122 "BGP specific commands\n"
1123 "AS confederation parameters\n"
1125 "Set routing domain confederation AS\n")
1127 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1128 bgp_confederation_id_unset (bgp
);
1133 DEFUN (bgp_confederation_peers
,
1134 bgp_confederation_peers_cmd
,
1135 "bgp confederation peers (1-4294967295)...",
1136 "BGP specific commands\n"
1137 "AS confederation parameters\n"
1138 "Peer ASs in BGP confederation\n"
1141 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1146 for (i
= idx_asn
; i
< argc
; i
++)
1148 VTY_GET_INTEGER_RANGE ("AS", as
, argv
[i
]->arg
, 1, BGP_AS4_MAX
);
1152 vty_out (vty
, "%% Local member-AS not allowed in confed peer list%s",
1157 bgp_confederation_peers_add (bgp
, as
);
1162 DEFUN (no_bgp_confederation_peers
,
1163 no_bgp_confederation_peers_cmd
,
1164 "no bgp confederation peers (1-4294967295)...",
1166 "BGP specific commands\n"
1167 "AS confederation parameters\n"
1168 "Peer ASs in BGP confederation\n"
1171 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1176 for (i
= idx_asn
; i
< argc
; i
++)
1178 VTY_GET_INTEGER_RANGE ("AS", as
, argv
[i
]->arg
, 1, BGP_AS4_MAX
);
1180 bgp_confederation_peers_remove (bgp
, as
);
1186 * Central routine for maximum-paths configuration.
1187 * @peer_type: BGP_PEER_EBGP or BGP_PEER_IBGP
1188 * @set: 1 for setting values, 0 for removing the max-paths config.
1191 bgp_maxpaths_config_vty (struct vty
*vty
, int peer_type
, const char *mpaths
,
1192 u_int16_t options
, int set
)
1194 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1195 u_int16_t maxpaths
= 0;
1200 afi
= bgp_node_afi (vty
);
1201 safi
= bgp_node_safi (vty
);
1205 maxpaths
= strtol(mpaths
, NULL
, 10);
1206 if (maxpaths
> multipath_num
)
1209 "%% Maxpaths Specified: %d is > than multipath num specified on bgp command line %d",
1210 maxpaths
, multipath_num
);
1213 ret
= bgp_maximum_paths_set (bgp
, afi
, safi
, peer_type
, maxpaths
, options
);
1216 ret
= bgp_maximum_paths_unset (bgp
, afi
, safi
, peer_type
);
1221 "%% Failed to %sset maximum-paths %s %u for afi %u, safi %u%s",
1222 (set
== 1) ? "" : "un",
1223 (peer_type
== BGP_PEER_EBGP
) ? "ebgp" : "ibgp",
1224 maxpaths
, afi
, safi
, VTY_NEWLINE
);
1228 bgp_recalculate_all_bestpaths (bgp
);
1233 DEFUN (bgp_maxmed_admin
,
1234 bgp_maxmed_admin_cmd
,
1235 "bgp max-med administrative ",
1237 "Advertise routes with max-med\n"
1238 "Administratively applied, for an indefinite period\n")
1240 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1242 bgp
->v_maxmed_admin
= 1;
1243 bgp
->maxmed_admin_value
= BGP_MAXMED_VALUE_DEFAULT
;
1245 bgp_maxmed_update(bgp
);
1250 DEFUN (bgp_maxmed_admin_medv
,
1251 bgp_maxmed_admin_medv_cmd
,
1252 "bgp max-med administrative (0-4294967295)",
1254 "Advertise routes with max-med\n"
1255 "Administratively applied, for an indefinite period\n"
1256 "Max MED value to be used\n")
1258 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1261 bgp
->v_maxmed_admin
= 1;
1262 bgp
->maxmed_admin_value
= strtoul (argv
[idx_number
]->arg
, NULL
, 10);
1264 bgp_maxmed_update(bgp
);
1269 DEFUN (no_bgp_maxmed_admin
,
1270 no_bgp_maxmed_admin_cmd
,
1271 "no bgp max-med administrative [(0-4294967295)]",
1274 "Advertise routes with max-med\n"
1275 "Administratively applied, for an indefinite period\n"
1276 "Max MED value to be used\n")
1278 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1279 bgp
->v_maxmed_admin
= BGP_MAXMED_ADMIN_UNCONFIGURED
;
1280 bgp
->maxmed_admin_value
= BGP_MAXMED_VALUE_DEFAULT
;
1281 bgp_maxmed_update(bgp
);
1286 DEFUN (bgp_maxmed_onstartup
,
1287 bgp_maxmed_onstartup_cmd
,
1288 "bgp max-med on-startup (5-86400) [(0-4294967295)]",
1290 "Advertise routes with max-med\n"
1291 "Effective on a startup\n"
1292 "Time (seconds) period for max-med\n"
1293 "Max MED value to be used\n")
1295 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1298 argv_find (argv
, argc
, "(5-86400)", &idx
);
1299 bgp
->v_maxmed_onstartup
= strtoul (argv
[idx
]->arg
, NULL
, 10);
1300 if (argv_find (argv
, argc
, "(0-4294967295)", &idx
))
1301 bgp
->maxmed_onstartup_value
= strtoul (argv
[idx
]->arg
, NULL
, 10);
1303 bgp
->maxmed_onstartup_value
= BGP_MAXMED_VALUE_DEFAULT
;
1305 bgp_maxmed_update(bgp
);
1310 DEFUN (no_bgp_maxmed_onstartup
,
1311 no_bgp_maxmed_onstartup_cmd
,
1312 "no bgp max-med on-startup [(5-86400) [(0-4294967295)]]",
1315 "Advertise routes with max-med\n"
1316 "Effective on a startup\n"
1317 "Time (seconds) period for max-med\n"
1318 "Max MED value to be used\n")
1320 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1322 /* Cancel max-med onstartup if its on */
1323 if (bgp
->t_maxmed_onstartup
)
1325 THREAD_TIMER_OFF (bgp
->t_maxmed_onstartup
);
1326 bgp
->maxmed_onstartup_over
= 1;
1329 bgp
->v_maxmed_onstartup
= BGP_MAXMED_ONSTARTUP_UNCONFIGURED
;
1330 bgp
->maxmed_onstartup_value
= BGP_MAXMED_VALUE_DEFAULT
;
1332 bgp_maxmed_update(bgp
);
1338 bgp_update_delay_config_vty (struct vty
*vty
, const char *delay
,
1341 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1342 u_int16_t update_delay
;
1343 u_int16_t establish_wait
;
1345 VTY_GET_INTEGER_RANGE ("update-delay", update_delay
, delay
,
1346 BGP_UPDATE_DELAY_MIN
, BGP_UPDATE_DELAY_MAX
);
1348 if (!wait
) /* update-delay <delay> */
1350 bgp
->v_update_delay
= update_delay
;
1351 bgp
->v_establish_wait
= bgp
->v_update_delay
;
1355 /* update-delay <delay> <establish-wait> */
1356 establish_wait
= atoi (wait
);
1357 if (update_delay
< establish_wait
)
1359 vty_out (vty
, "%%Failed: update-delay less than the establish-wait!%s",
1364 bgp
->v_update_delay
= update_delay
;
1365 bgp
->v_establish_wait
= establish_wait
;
1371 bgp_update_delay_deconfig_vty (struct vty
*vty
)
1373 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1375 bgp
->v_update_delay
= BGP_UPDATE_DELAY_DEF
;
1376 bgp
->v_establish_wait
= bgp
->v_update_delay
;
1382 bgp_config_write_update_delay (struct vty
*vty
, struct bgp
*bgp
)
1384 if (bgp
->v_update_delay
!= BGP_UPDATE_DELAY_DEF
)
1386 vty_out (vty
, " update-delay %d", bgp
->v_update_delay
);
1387 if (bgp
->v_update_delay
!= bgp
->v_establish_wait
)
1388 vty_out (vty
, " %d", bgp
->v_establish_wait
);
1389 vty_out (vty
, "%s", VTY_NEWLINE
);
1396 /* Update-delay configuration */
1397 DEFUN (bgp_update_delay
,
1398 bgp_update_delay_cmd
,
1399 "update-delay (0-3600)",
1400 "Force initial delay for best-path and updates\n"
1404 return bgp_update_delay_config_vty(vty
, argv
[idx_number
]->arg
, NULL
);
1407 DEFUN (bgp_update_delay_establish_wait
,
1408 bgp_update_delay_establish_wait_cmd
,
1409 "update-delay (0-3600) (1-3600)",
1410 "Force initial delay for best-path and updates\n"
1412 "Wait for peers to be established\n"
1416 int idx_number_2
= 2;
1417 return bgp_update_delay_config_vty(vty
, argv
[idx_number
]->arg
, argv
[idx_number_2
]->arg
);
1420 /* Update-delay deconfiguration */
1421 DEFUN (no_bgp_update_delay
,
1422 no_bgp_update_delay_cmd
,
1423 "no update-delay [(0-3600) [(1-3600)]]",
1425 "Force initial delay for best-path and updates\n"
1427 "Wait for peers to be established\n")
1429 return bgp_update_delay_deconfig_vty(vty
);
1434 bgp_wpkt_quanta_config_vty (struct vty
*vty
, const char *num
, char set
)
1436 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1439 VTY_GET_INTEGER_RANGE ("write-quanta", bgp
->wpkt_quanta
, num
,
1442 bgp
->wpkt_quanta
= BGP_WRITE_PACKET_MAX
;
1448 bgp_config_write_wpkt_quanta (struct vty
*vty
, struct bgp
*bgp
)
1450 if (bgp
->wpkt_quanta
!= BGP_WRITE_PACKET_MAX
)
1451 vty_out (vty
, " write-quanta %d%s",
1452 bgp
->wpkt_quanta
, VTY_NEWLINE
);
1458 /* Update-delay configuration */
1459 DEFUN (bgp_wpkt_quanta
,
1460 bgp_wpkt_quanta_cmd
,
1461 "write-quanta (1-10000)",
1462 "How many packets to write to peer socket per run\n"
1463 "Number of packets\n")
1466 return bgp_wpkt_quanta_config_vty(vty
, argv
[idx_number
]->arg
, 1);
1469 /* Update-delay deconfiguration */
1470 DEFUN (no_bgp_wpkt_quanta
,
1471 no_bgp_wpkt_quanta_cmd
,
1472 "no write-quanta (1-10000)",
1474 "How many packets to write to peer socket per run\n"
1475 "Number of packets\n")
1478 return bgp_wpkt_quanta_config_vty(vty
, argv
[idx_number
]->arg
, 0);
1482 bgp_config_write_coalesce_time (struct vty
*vty
, struct bgp
*bgp
)
1484 if (bgp
->coalesce_time
!= BGP_DEFAULT_SUBGROUP_COALESCE_TIME
)
1485 vty_out (vty
, " coalesce-time %u%s",
1486 bgp
->coalesce_time
, VTY_NEWLINE
);
1492 DEFUN (bgp_coalesce_time
,
1493 bgp_coalesce_time_cmd
,
1494 "coalesce-time (0-4294967295)",
1495 "Subgroup coalesce timer\n"
1496 "Subgroup coalesce timer value (in ms)\n")
1498 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1501 argv_find (argv
, argc
, "(0-4294967295)", &idx
);
1502 bgp
->coalesce_time
= strtoul (argv
[idx
]->arg
, NULL
, 10);
1506 DEFUN (no_bgp_coalesce_time
,
1507 no_bgp_coalesce_time_cmd
,
1508 "no coalesce-time (0-4294967295)",
1510 "Subgroup coalesce timer\n"
1511 "Subgroup coalesce timer value (in ms)\n")
1513 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1515 bgp
->coalesce_time
= BGP_DEFAULT_SUBGROUP_COALESCE_TIME
;
1519 /* Maximum-paths configuration */
1520 DEFUN (bgp_maxpaths
,
1522 "maximum-paths (1-255)",
1523 "Forward packets over multiple paths\n"
1524 "Number of paths\n")
1527 return bgp_maxpaths_config_vty(vty
, BGP_PEER_EBGP
, argv
[idx_number
]->arg
, 0, 1);
1530 ALIAS_HIDDEN (bgp_maxpaths
,
1531 bgp_maxpaths_hidden_cmd
,
1532 "maximum-paths (1-255)",
1533 "Forward packets over multiple paths\n"
1534 "Number of paths\n")
1536 DEFUN (bgp_maxpaths_ibgp
,
1537 bgp_maxpaths_ibgp_cmd
,
1538 "maximum-paths ibgp (1-255)",
1539 "Forward packets over multiple paths\n"
1541 "Number of paths\n")
1544 return bgp_maxpaths_config_vty(vty
, BGP_PEER_IBGP
, argv
[idx_number
]->arg
, 0, 1);
1547 ALIAS_HIDDEN (bgp_maxpaths_ibgp
,
1548 bgp_maxpaths_ibgp_hidden_cmd
,
1549 "maximum-paths ibgp (1-255)",
1550 "Forward packets over multiple paths\n"
1552 "Number of paths\n")
1554 DEFUN (bgp_maxpaths_ibgp_cluster
,
1555 bgp_maxpaths_ibgp_cluster_cmd
,
1556 "maximum-paths ibgp (1-255) equal-cluster-length",
1557 "Forward packets over multiple paths\n"
1560 "Match the cluster length\n")
1563 return bgp_maxpaths_config_vty(vty
, BGP_PEER_IBGP
, argv
[idx_number
]->arg
,
1564 BGP_FLAG_IBGP_MULTIPATH_SAME_CLUSTERLEN
, 1);
1567 ALIAS_HIDDEN (bgp_maxpaths_ibgp_cluster
,
1568 bgp_maxpaths_ibgp_cluster_hidden_cmd
,
1569 "maximum-paths ibgp (1-255) equal-cluster-length",
1570 "Forward packets over multiple paths\n"
1573 "Match the cluster length\n")
1575 DEFUN (no_bgp_maxpaths
,
1576 no_bgp_maxpaths_cmd
,
1577 "no maximum-paths [(1-255)]",
1579 "Forward packets over multiple paths\n"
1580 "Number of paths\n")
1582 return bgp_maxpaths_config_vty(vty
, BGP_PEER_EBGP
, NULL
, 0, 0);
1585 ALIAS_HIDDEN (no_bgp_maxpaths
,
1586 no_bgp_maxpaths_hidden_cmd
,
1587 "no maximum-paths [(1-255)]",
1589 "Forward packets over multiple paths\n"
1590 "Number of paths\n")
1592 DEFUN (no_bgp_maxpaths_ibgp
,
1593 no_bgp_maxpaths_ibgp_cmd
,
1594 "no maximum-paths ibgp [(1-255) [equal-cluster-length]]",
1596 "Forward packets over multiple paths\n"
1599 "Match the cluster length\n")
1601 return bgp_maxpaths_config_vty(vty
, BGP_PEER_IBGP
, NULL
, 0, 0);
1604 ALIAS_HIDDEN (no_bgp_maxpaths_ibgp
,
1605 no_bgp_maxpaths_ibgp_hidden_cmd
,
1606 "no maximum-paths ibgp [(1-255) [equal-cluster-length]]",
1608 "Forward packets over multiple paths\n"
1611 "Match the cluster length\n")
1614 bgp_config_write_maxpaths (struct vty
*vty
, struct bgp
*bgp
, afi_t afi
,
1615 safi_t safi
, int *write
)
1617 if (bgp
->maxpaths
[afi
][safi
].maxpaths_ebgp
!= MULTIPATH_NUM
)
1619 bgp_config_write_family_header (vty
, afi
, safi
, write
);
1620 vty_out (vty
, " maximum-paths %d%s",
1621 bgp
->maxpaths
[afi
][safi
].maxpaths_ebgp
, VTY_NEWLINE
);
1624 if (bgp
->maxpaths
[afi
][safi
].maxpaths_ibgp
!= MULTIPATH_NUM
)
1626 bgp_config_write_family_header (vty
, afi
, safi
, write
);
1627 vty_out (vty
, " maximum-paths ibgp %d",
1628 bgp
->maxpaths
[afi
][safi
].maxpaths_ibgp
);
1629 if (CHECK_FLAG (bgp
->maxpaths
[afi
][safi
].ibgp_flags
,
1630 BGP_FLAG_IBGP_MULTIPATH_SAME_CLUSTERLEN
))
1631 vty_out (vty
, " equal-cluster-length");
1632 vty_out (vty
, "%s", VTY_NEWLINE
);
1642 "timers bgp (0-65535) (0-65535)",
1643 "Adjust routing timers\n"
1645 "Keepalive interval\n"
1648 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1650 int idx_number_2
= 3;
1651 unsigned long keepalive
= 0;
1652 unsigned long holdtime
= 0;
1654 VTY_GET_INTEGER ("keepalive", keepalive
, argv
[idx_number
]->arg
);
1655 VTY_GET_INTEGER ("holdtime", holdtime
, argv
[idx_number_2
]->arg
);
1657 /* Holdtime value check. */
1658 if (holdtime
< 3 && holdtime
!= 0)
1660 vty_out (vty
, "%% hold time value must be either 0 or greater than 3%s",
1665 bgp_timers_set (bgp
, keepalive
, holdtime
);
1670 DEFUN (no_bgp_timers
,
1672 "no timers bgp [(0-65535) (0-65535)]",
1674 "Adjust routing timers\n"
1676 "Keepalive interval\n"
1679 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1680 bgp_timers_unset (bgp
);
1686 DEFUN (bgp_client_to_client_reflection
,
1687 bgp_client_to_client_reflection_cmd
,
1688 "bgp client-to-client reflection",
1689 "BGP specific commands\n"
1690 "Configure client to client route reflection\n"
1691 "reflection of routes allowed\n")
1693 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1694 bgp_flag_unset (bgp
, BGP_FLAG_NO_CLIENT_TO_CLIENT
);
1695 bgp_clear_star_soft_out (vty
, bgp
->name
);
1700 DEFUN (no_bgp_client_to_client_reflection
,
1701 no_bgp_client_to_client_reflection_cmd
,
1702 "no bgp client-to-client reflection",
1704 "BGP specific commands\n"
1705 "Configure client to client route reflection\n"
1706 "reflection of routes allowed\n")
1708 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1709 bgp_flag_set (bgp
, BGP_FLAG_NO_CLIENT_TO_CLIENT
);
1710 bgp_clear_star_soft_out (vty
, bgp
->name
);
1715 /* "bgp always-compare-med" configuration. */
1716 DEFUN (bgp_always_compare_med
,
1717 bgp_always_compare_med_cmd
,
1718 "bgp always-compare-med",
1719 "BGP specific commands\n"
1720 "Allow comparing MED from different neighbors\n")
1722 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1723 bgp_flag_set (bgp
, BGP_FLAG_ALWAYS_COMPARE_MED
);
1724 bgp_recalculate_all_bestpaths (bgp
);
1729 DEFUN (no_bgp_always_compare_med
,
1730 no_bgp_always_compare_med_cmd
,
1731 "no bgp always-compare-med",
1733 "BGP specific commands\n"
1734 "Allow comparing MED from different neighbors\n")
1736 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1737 bgp_flag_unset (bgp
, BGP_FLAG_ALWAYS_COMPARE_MED
);
1738 bgp_recalculate_all_bestpaths (bgp
);
1743 /* "bgp deterministic-med" configuration. */
1744 DEFUN (bgp_deterministic_med
,
1745 bgp_deterministic_med_cmd
,
1746 "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
);
1752 if (!bgp_flag_check(bgp
, BGP_FLAG_DETERMINISTIC_MED
))
1754 bgp_flag_set (bgp
, BGP_FLAG_DETERMINISTIC_MED
);
1755 bgp_recalculate_all_bestpaths (bgp
);
1761 DEFUN (no_bgp_deterministic_med
,
1762 no_bgp_deterministic_med_cmd
,
1763 "no bgp deterministic-med",
1765 "BGP specific commands\n"
1766 "Pick the best-MED path among paths advertised from the neighboring AS\n")
1768 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1769 int bestpath_per_as_used
;
1773 struct listnode
*node
, *nnode
;
1775 if (bgp_flag_check(bgp
, BGP_FLAG_DETERMINISTIC_MED
))
1777 bestpath_per_as_used
= 0;
1779 for (ALL_LIST_ELEMENTS (bgp
->peer
, node
, nnode
, peer
))
1781 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
1782 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
1783 if (CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_ADDPATH_TX_BESTPATH_PER_AS
))
1785 bestpath_per_as_used
= 1;
1789 if (bestpath_per_as_used
)
1793 if (bestpath_per_as_used
)
1795 vty_out (vty
, "bgp deterministic-med cannot be disabled while addpath-tx-bestpath-per-AS is in use%s",
1801 bgp_flag_unset (bgp
, BGP_FLAG_DETERMINISTIC_MED
);
1802 bgp_recalculate_all_bestpaths (bgp
);
1809 /* "bgp graceful-restart" configuration. */
1810 DEFUN (bgp_graceful_restart
,
1811 bgp_graceful_restart_cmd
,
1812 "bgp graceful-restart",
1813 "BGP specific commands\n"
1814 "Graceful restart capability parameters\n")
1816 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1817 bgp_flag_set (bgp
, BGP_FLAG_GRACEFUL_RESTART
);
1821 DEFUN (no_bgp_graceful_restart
,
1822 no_bgp_graceful_restart_cmd
,
1823 "no bgp graceful-restart",
1825 "BGP specific commands\n"
1826 "Graceful restart capability parameters\n")
1828 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1829 bgp_flag_unset (bgp
, BGP_FLAG_GRACEFUL_RESTART
);
1833 DEFUN (bgp_graceful_restart_stalepath_time
,
1834 bgp_graceful_restart_stalepath_time_cmd
,
1835 "bgp graceful-restart stalepath-time (1-3600)",
1836 "BGP specific commands\n"
1837 "Graceful restart capability parameters\n"
1838 "Set the max time to hold onto restarting peer's stale paths\n"
1839 "Delay value (seconds)\n")
1841 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1843 u_int32_t stalepath
;
1845 VTY_GET_INTEGER_RANGE ("stalepath-time", stalepath
, argv
[idx_number
]->arg
, 1, 3600);
1846 bgp
->stalepath_time
= stalepath
;
1850 DEFUN (bgp_graceful_restart_restart_time
,
1851 bgp_graceful_restart_restart_time_cmd
,
1852 "bgp graceful-restart restart-time (1-3600)",
1853 "BGP specific commands\n"
1854 "Graceful restart capability parameters\n"
1855 "Set the time to wait to delete stale routes before a BGP open message is received\n"
1856 "Delay value (seconds)\n")
1858 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1862 VTY_GET_INTEGER_RANGE ("restart-time", restart
, argv
[idx_number
]->arg
, 1, 3600);
1863 bgp
->restart_time
= restart
;
1867 DEFUN (no_bgp_graceful_restart_stalepath_time
,
1868 no_bgp_graceful_restart_stalepath_time_cmd
,
1869 "no bgp graceful-restart stalepath-time [(1-3600)]",
1871 "BGP specific commands\n"
1872 "Graceful restart capability parameters\n"
1873 "Set the max time to hold onto restarting peer's stale paths\n"
1874 "Delay value (seconds)\n")
1876 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1878 bgp
->stalepath_time
= BGP_DEFAULT_STALEPATH_TIME
;
1882 DEFUN (no_bgp_graceful_restart_restart_time
,
1883 no_bgp_graceful_restart_restart_time_cmd
,
1884 "no bgp graceful-restart restart-time [(1-3600)]",
1886 "BGP specific commands\n"
1887 "Graceful restart capability parameters\n"
1888 "Set the time to wait to delete stale routes before a BGP open message is received\n"
1889 "Delay value (seconds)\n")
1891 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1893 bgp
->restart_time
= BGP_DEFAULT_RESTART_TIME
;
1897 DEFUN (bgp_graceful_restart_preserve_fw
,
1898 bgp_graceful_restart_preserve_fw_cmd
,
1899 "bgp graceful-restart preserve-fw-state",
1900 "BGP specific commands\n"
1901 "Graceful restart capability parameters\n"
1902 "Sets F-bit indication that fib is preserved while doing Graceful Restart\n")
1904 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1905 bgp_flag_set(bgp
, BGP_FLAG_GR_PRESERVE_FWD
);
1909 DEFUN (no_bgp_graceful_restart_preserve_fw
,
1910 no_bgp_graceful_restart_preserve_fw_cmd
,
1911 "no bgp graceful-restart preserve-fw-state",
1913 "BGP specific commands\n"
1914 "Graceful restart capability parameters\n"
1915 "Unsets F-bit indication that fib is preserved while doing Graceful Restart\n")
1917 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1918 bgp_flag_unset(bgp
, BGP_FLAG_GR_PRESERVE_FWD
);
1922 /* "bgp fast-external-failover" configuration. */
1923 DEFUN (bgp_fast_external_failover
,
1924 bgp_fast_external_failover_cmd
,
1925 "bgp fast-external-failover",
1927 "Immediately reset session if a link to a directly connected external peer goes down\n")
1929 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1930 bgp_flag_unset (bgp
, BGP_FLAG_NO_FAST_EXT_FAILOVER
);
1934 DEFUN (no_bgp_fast_external_failover
,
1935 no_bgp_fast_external_failover_cmd
,
1936 "no bgp fast-external-failover",
1939 "Immediately reset session if a link to a directly connected external peer goes down\n")
1941 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1942 bgp_flag_set (bgp
, BGP_FLAG_NO_FAST_EXT_FAILOVER
);
1946 /* "bgp enforce-first-as" configuration. */
1947 DEFUN (bgp_enforce_first_as
,
1948 bgp_enforce_first_as_cmd
,
1949 "bgp enforce-first-as",
1951 "Enforce the first AS for EBGP routes\n")
1953 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1954 bgp_flag_set (bgp
, BGP_FLAG_ENFORCE_FIRST_AS
);
1955 bgp_clear_star_soft_in (vty
, bgp
->name
);
1960 DEFUN (no_bgp_enforce_first_as
,
1961 no_bgp_enforce_first_as_cmd
,
1962 "no bgp enforce-first-as",
1965 "Enforce the first AS for EBGP routes\n")
1967 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1968 bgp_flag_unset (bgp
, BGP_FLAG_ENFORCE_FIRST_AS
);
1969 bgp_clear_star_soft_in (vty
, bgp
->name
);
1974 /* "bgp bestpath compare-routerid" configuration. */
1975 DEFUN (bgp_bestpath_compare_router_id
,
1976 bgp_bestpath_compare_router_id_cmd
,
1977 "bgp bestpath compare-routerid",
1978 "BGP specific commands\n"
1979 "Change the default bestpath selection\n"
1980 "Compare router-id for identical EBGP paths\n")
1982 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1983 bgp_flag_set (bgp
, BGP_FLAG_COMPARE_ROUTER_ID
);
1984 bgp_recalculate_all_bestpaths (bgp
);
1989 DEFUN (no_bgp_bestpath_compare_router_id
,
1990 no_bgp_bestpath_compare_router_id_cmd
,
1991 "no bgp bestpath compare-routerid",
1993 "BGP specific commands\n"
1994 "Change the default bestpath selection\n"
1995 "Compare router-id for identical EBGP paths\n")
1997 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1998 bgp_flag_unset (bgp
, BGP_FLAG_COMPARE_ROUTER_ID
);
1999 bgp_recalculate_all_bestpaths (bgp
);
2004 /* "bgp bestpath as-path ignore" configuration. */
2005 DEFUN (bgp_bestpath_aspath_ignore
,
2006 bgp_bestpath_aspath_ignore_cmd
,
2007 "bgp bestpath as-path ignore",
2008 "BGP specific commands\n"
2009 "Change the default bestpath selection\n"
2010 "AS-path attribute\n"
2011 "Ignore as-path length in selecting a route\n")
2013 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2014 bgp_flag_set (bgp
, BGP_FLAG_ASPATH_IGNORE
);
2015 bgp_recalculate_all_bestpaths (bgp
);
2020 DEFUN (no_bgp_bestpath_aspath_ignore
,
2021 no_bgp_bestpath_aspath_ignore_cmd
,
2022 "no bgp bestpath as-path ignore",
2024 "BGP specific commands\n"
2025 "Change the default bestpath selection\n"
2026 "AS-path attribute\n"
2027 "Ignore as-path length in selecting a route\n")
2029 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2030 bgp_flag_unset (bgp
, BGP_FLAG_ASPATH_IGNORE
);
2031 bgp_recalculate_all_bestpaths (bgp
);
2036 /* "bgp bestpath as-path confed" configuration. */
2037 DEFUN (bgp_bestpath_aspath_confed
,
2038 bgp_bestpath_aspath_confed_cmd
,
2039 "bgp bestpath as-path confed",
2040 "BGP specific commands\n"
2041 "Change the default bestpath selection\n"
2042 "AS-path attribute\n"
2043 "Compare path lengths including confederation sets & sequences in selecting a route\n")
2045 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2046 bgp_flag_set (bgp
, BGP_FLAG_ASPATH_CONFED
);
2047 bgp_recalculate_all_bestpaths (bgp
);
2052 DEFUN (no_bgp_bestpath_aspath_confed
,
2053 no_bgp_bestpath_aspath_confed_cmd
,
2054 "no bgp bestpath as-path confed",
2056 "BGP specific commands\n"
2057 "Change the default bestpath selection\n"
2058 "AS-path attribute\n"
2059 "Compare path lengths including confederation sets & sequences in selecting a route\n")
2061 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2062 bgp_flag_unset (bgp
, BGP_FLAG_ASPATH_CONFED
);
2063 bgp_recalculate_all_bestpaths (bgp
);
2068 /* "bgp bestpath as-path multipath-relax" configuration. */
2069 DEFUN (bgp_bestpath_aspath_multipath_relax
,
2070 bgp_bestpath_aspath_multipath_relax_cmd
,
2071 "bgp bestpath as-path multipath-relax [<as-set|no-as-set>]",
2072 "BGP specific commands\n"
2073 "Change the default bestpath selection\n"
2074 "AS-path attribute\n"
2075 "Allow load sharing across routes that have different AS paths (but same length)\n"
2076 "Generate an AS_SET\n"
2077 "Do not generate an AS_SET\n")
2079 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2081 bgp_flag_set (bgp
, BGP_FLAG_ASPATH_MULTIPATH_RELAX
);
2083 /* no-as-set is now the default behavior so we can silently
2085 if (argv_find (argv
, argc
, "as-set", &idx
))
2086 bgp_flag_set (bgp
, BGP_FLAG_MULTIPATH_RELAX_AS_SET
);
2088 bgp_flag_unset (bgp
, BGP_FLAG_MULTIPATH_RELAX_AS_SET
) ;
2090 bgp_recalculate_all_bestpaths (bgp
);
2095 DEFUN (no_bgp_bestpath_aspath_multipath_relax
,
2096 no_bgp_bestpath_aspath_multipath_relax_cmd
,
2097 "no bgp bestpath as-path multipath-relax [<as-set|no-as-set>]",
2099 "BGP specific commands\n"
2100 "Change the default bestpath selection\n"
2101 "AS-path attribute\n"
2102 "Allow load sharing across routes that have different AS paths (but same length)\n"
2103 "Generate an AS_SET\n"
2104 "Do not generate an AS_SET\n")
2106 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2107 bgp_flag_unset (bgp
, BGP_FLAG_ASPATH_MULTIPATH_RELAX
);
2108 bgp_flag_unset (bgp
, BGP_FLAG_MULTIPATH_RELAX_AS_SET
);
2109 bgp_recalculate_all_bestpaths (bgp
);
2114 /* "bgp log-neighbor-changes" configuration. */
2115 DEFUN (bgp_log_neighbor_changes
,
2116 bgp_log_neighbor_changes_cmd
,
2117 "bgp log-neighbor-changes",
2118 "BGP specific commands\n"
2119 "Log neighbor up/down and reset reason\n")
2121 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2122 bgp_flag_set (bgp
, BGP_FLAG_LOG_NEIGHBOR_CHANGES
);
2126 DEFUN (no_bgp_log_neighbor_changes
,
2127 no_bgp_log_neighbor_changes_cmd
,
2128 "no bgp log-neighbor-changes",
2130 "BGP specific commands\n"
2131 "Log neighbor up/down and reset reason\n")
2133 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2134 bgp_flag_unset (bgp
, BGP_FLAG_LOG_NEIGHBOR_CHANGES
);
2138 /* "bgp bestpath med" configuration. */
2139 DEFUN (bgp_bestpath_med
,
2140 bgp_bestpath_med_cmd
,
2141 "bgp bestpath med <confed [missing-as-worst]|missing-as-worst [confed]>",
2142 "BGP specific commands\n"
2143 "Change the default bestpath selection\n"
2145 "Compare MED among confederation paths\n"
2146 "Treat missing MED as the least preferred one\n"
2147 "Treat missing MED as the least preferred one\n"
2148 "Compare MED among confederation paths\n")
2150 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2153 if (argv_find (argv
, argc
, "confed", &idx
))
2154 bgp_flag_set (bgp
, BGP_FLAG_MED_CONFED
);
2156 if (argv_find (argv
, argc
, "missing-as-worst", &idx
))
2157 bgp_flag_set (bgp
, BGP_FLAG_MED_MISSING_AS_WORST
);
2159 bgp_recalculate_all_bestpaths (bgp
);
2164 DEFUN (no_bgp_bestpath_med
,
2165 no_bgp_bestpath_med_cmd
,
2166 "no bgp bestpath med <confed [missing-as-worst]|missing-as-worst [confed]>",
2168 "BGP specific commands\n"
2169 "Change the default bestpath selection\n"
2171 "Compare MED among confederation paths\n"
2172 "Treat missing MED as the least preferred one\n"
2173 "Treat missing MED as the least preferred one\n"
2174 "Compare MED among confederation paths\n")
2176 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2179 if (argv_find (argv
, argc
, "confed", &idx
))
2180 bgp_flag_unset (bgp
, BGP_FLAG_MED_CONFED
);
2182 if (argv_find (argv
, argc
, "missing-as-worst", &idx
))
2183 bgp_flag_unset (bgp
, BGP_FLAG_MED_MISSING_AS_WORST
);
2185 bgp_recalculate_all_bestpaths (bgp
);
2190 /* "no bgp default ipv4-unicast". */
2191 DEFUN (no_bgp_default_ipv4_unicast
,
2192 no_bgp_default_ipv4_unicast_cmd
,
2193 "no bgp default ipv4-unicast",
2195 "BGP specific commands\n"
2196 "Configure BGP defaults\n"
2197 "Activate ipv4-unicast for a peer by default\n")
2199 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2200 bgp_flag_set (bgp
, BGP_FLAG_NO_DEFAULT_IPV4
);
2204 DEFUN (bgp_default_ipv4_unicast
,
2205 bgp_default_ipv4_unicast_cmd
,
2206 "bgp default ipv4-unicast",
2207 "BGP specific commands\n"
2208 "Configure BGP defaults\n"
2209 "Activate ipv4-unicast for a peer by default\n")
2211 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2212 bgp_flag_unset (bgp
, BGP_FLAG_NO_DEFAULT_IPV4
);
2216 /* Display hostname in certain command outputs */
2217 DEFUN (bgp_default_show_hostname
,
2218 bgp_default_show_hostname_cmd
,
2219 "bgp default show-hostname",
2220 "BGP specific commands\n"
2221 "Configure BGP defaults\n"
2222 "Show hostname in certain command ouputs\n")
2224 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2225 bgp_flag_set (bgp
, BGP_FLAG_SHOW_HOSTNAME
);
2229 DEFUN (no_bgp_default_show_hostname
,
2230 no_bgp_default_show_hostname_cmd
,
2231 "no bgp default show-hostname",
2233 "BGP specific commands\n"
2234 "Configure BGP defaults\n"
2235 "Show hostname in certain command ouputs\n")
2237 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2238 bgp_flag_unset (bgp
, BGP_FLAG_SHOW_HOSTNAME
);
2242 /* "bgp network import-check" configuration. */
2243 DEFUN (bgp_network_import_check
,
2244 bgp_network_import_check_cmd
,
2245 "bgp network import-check",
2246 "BGP specific commands\n"
2247 "BGP network command\n"
2248 "Check BGP network route exists in IGP\n")
2250 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2251 if (!bgp_flag_check(bgp
, BGP_FLAG_IMPORT_CHECK
))
2253 bgp_flag_set (bgp
, BGP_FLAG_IMPORT_CHECK
);
2254 bgp_static_redo_import_check(bgp
);
2260 ALIAS_HIDDEN (bgp_network_import_check
,
2261 bgp_network_import_check_exact_cmd
,
2262 "bgp network import-check exact",
2263 "BGP specific commands\n"
2264 "BGP network command\n"
2265 "Check BGP network route exists in IGP\n"
2266 "Match route precisely\n")
2268 DEFUN (no_bgp_network_import_check
,
2269 no_bgp_network_import_check_cmd
,
2270 "no bgp network import-check",
2272 "BGP specific commands\n"
2273 "BGP network command\n"
2274 "Check BGP network route exists in IGP\n")
2276 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2277 if (bgp_flag_check(bgp
, BGP_FLAG_IMPORT_CHECK
))
2279 bgp_flag_unset (bgp
, BGP_FLAG_IMPORT_CHECK
);
2280 bgp_static_redo_import_check(bgp
);
2286 DEFUN (bgp_default_local_preference
,
2287 bgp_default_local_preference_cmd
,
2288 "bgp default local-preference (0-4294967295)",
2289 "BGP specific commands\n"
2290 "Configure BGP defaults\n"
2291 "local preference (higher=more preferred)\n"
2292 "Configure default local preference value\n")
2294 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2296 u_int32_t local_pref
;
2298 VTY_GET_INTEGER ("local preference", local_pref
, argv
[idx_number
]->arg
);
2300 bgp_default_local_preference_set (bgp
, local_pref
);
2301 bgp_clear_star_soft_in (vty
, bgp
->name
);
2306 DEFUN (no_bgp_default_local_preference
,
2307 no_bgp_default_local_preference_cmd
,
2308 "no bgp default local-preference [(0-4294967295)]",
2310 "BGP specific commands\n"
2311 "Configure BGP defaults\n"
2312 "local preference (higher=more preferred)\n"
2313 "Configure default local preference value\n")
2315 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2316 bgp_default_local_preference_unset (bgp
);
2317 bgp_clear_star_soft_in (vty
, bgp
->name
);
2323 DEFUN (bgp_default_subgroup_pkt_queue_max
,
2324 bgp_default_subgroup_pkt_queue_max_cmd
,
2325 "bgp default subgroup-pkt-queue-max (20-100)",
2326 "BGP specific commands\n"
2327 "Configure BGP defaults\n"
2328 "subgroup-pkt-queue-max\n"
2329 "Configure subgroup packet queue max\n")
2331 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2335 VTY_GET_INTEGER ("subgroup packet queue max", max_size
, argv
[idx_number
]->arg
);
2337 bgp_default_subgroup_pkt_queue_max_set (bgp
, max_size
);
2342 DEFUN (no_bgp_default_subgroup_pkt_queue_max
,
2343 no_bgp_default_subgroup_pkt_queue_max_cmd
,
2344 "no bgp default subgroup-pkt-queue-max [(20-100)]",
2346 "BGP specific commands\n"
2347 "Configure BGP defaults\n"
2348 "subgroup-pkt-queue-max\n"
2349 "Configure subgroup packet queue max\n")
2351 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2352 bgp_default_subgroup_pkt_queue_max_unset (bgp
);
2357 DEFUN (bgp_rr_allow_outbound_policy
,
2358 bgp_rr_allow_outbound_policy_cmd
,
2359 "bgp route-reflector allow-outbound-policy",
2360 "BGP specific commands\n"
2361 "Allow modifications made by out route-map\n"
2362 "on ibgp neighbors\n")
2364 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2366 if (!bgp_flag_check(bgp
, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY
))
2368 bgp_flag_set(bgp
, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY
);
2369 update_group_announce_rrclients(bgp
);
2370 bgp_clear_star_soft_out (vty
, bgp
->name
);
2376 DEFUN (no_bgp_rr_allow_outbound_policy
,
2377 no_bgp_rr_allow_outbound_policy_cmd
,
2378 "no bgp route-reflector allow-outbound-policy",
2380 "BGP specific commands\n"
2381 "Allow modifications made by out route-map\n"
2382 "on ibgp neighbors\n")
2384 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2386 if (bgp_flag_check(bgp
, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY
))
2388 bgp_flag_unset(bgp
, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY
);
2389 update_group_announce_rrclients(bgp
);
2390 bgp_clear_star_soft_out (vty
, bgp
->name
);
2396 DEFUN (bgp_listen_limit
,
2397 bgp_listen_limit_cmd
,
2398 "bgp listen limit (1-5000)",
2399 "BGP specific commands\n"
2400 "Configure BGP defaults\n"
2401 "maximum number of BGP Dynamic Neighbors that can be created\n"
2402 "Configure Dynamic Neighbors listen limit value\n")
2404 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2408 VTY_GET_INTEGER_RANGE ("listen limit", listen_limit
, argv
[idx_number
]->arg
,
2409 BGP_DYNAMIC_NEIGHBORS_LIMIT_MIN
,
2410 BGP_DYNAMIC_NEIGHBORS_LIMIT_MAX
);
2412 bgp_listen_limit_set (bgp
, listen_limit
);
2417 DEFUN (no_bgp_listen_limit
,
2418 no_bgp_listen_limit_cmd
,
2419 "no bgp listen limit [(1-5000)]",
2420 "BGP specific commands\n"
2421 "Configure BGP defaults\n"
2422 "unset maximum number of BGP Dynamic Neighbors that can be created\n"
2423 "Configure Dynamic Neighbors listen limit value to default\n"
2424 "Configure Dynamic Neighbors listen limit value\n")
2426 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2427 bgp_listen_limit_unset (bgp
);
2433 * Check if this listen range is already configured. Check for exact
2434 * match or overlap based on input.
2436 static struct peer_group
*
2437 listen_range_exists (struct bgp
*bgp
, struct prefix
*range
, int exact
)
2439 struct listnode
*node
, *nnode
;
2440 struct listnode
*node1
, *nnode1
;
2441 struct peer_group
*group
;
2446 afi
= family2afi(range
->family
);
2447 for (ALL_LIST_ELEMENTS (bgp
->group
, node
, nnode
, group
))
2449 for (ALL_LIST_ELEMENTS (group
->listen_range
[afi
], node1
,
2453 match
= prefix_same (range
, lr
);
2455 match
= (prefix_match (range
, lr
) || prefix_match (lr
, range
));
2464 DEFUN (bgp_listen_range
,
2465 bgp_listen_range_cmd
,
2466 "bgp listen range <A.B.C.D/M|X:X::X:X/M> peer-group WORD",
2467 "BGP specific commands\n"
2468 "Configure BGP dynamic neighbors listen range\n"
2469 "Configure BGP dynamic neighbors listen range\n"
2471 "Member of the peer-group\n"
2472 "Peer-group name\n")
2474 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2475 struct prefix range
;
2476 struct peer_group
*group
, *existing_group
;
2481 argv_find (argv
, argc
, "A.B.C.D/M", &idx
);
2482 argv_find (argv
, argc
, "X:X::X:X/M", &idx
);
2483 char *prefix
= argv
[idx
]->arg
;
2484 argv_find (argv
, argc
, "WORD", &idx
);
2485 char *peergroup
= argv
[idx
]->arg
;
2487 /* Convert IP prefix string to struct prefix. */
2488 ret
= str2prefix (prefix
, &range
);
2491 vty_out (vty
, "%% Malformed listen range%s", VTY_NEWLINE
);
2495 afi
= family2afi(range
.family
);
2497 if (afi
== AFI_IP6
&& IN6_IS_ADDR_LINKLOCAL (&range
.u
.prefix6
))
2499 vty_out (vty
, "%% Malformed listen range (link-local address)%s",
2504 apply_mask (&range
);
2506 /* Check if same listen range is already configured. */
2507 existing_group
= listen_range_exists (bgp
, &range
, 1);
2510 if (strcmp (existing_group
->name
, peergroup
) == 0)
2514 vty_out (vty
, "%% Same listen range is attached to peer-group %s%s",
2515 existing_group
->name
, VTY_NEWLINE
);
2520 /* Check if an overlapping listen range exists. */
2521 if (listen_range_exists (bgp
, &range
, 0))
2523 vty_out (vty
, "%% Listen range overlaps with existing listen range%s",
2528 group
= peer_group_lookup (bgp
, peergroup
);
2531 vty_out (vty
, "%% Configure the peer-group first%s", VTY_NEWLINE
);
2535 ret
= peer_group_listen_range_add(group
, &range
);
2536 return bgp_vty_return (vty
, ret
);
2539 DEFUN (no_bgp_listen_range
,
2540 no_bgp_listen_range_cmd
,
2541 "no bgp listen range <A.B.C.D/M|X:X::X:X/M> peer-group WORD",
2543 "BGP specific commands\n"
2544 "Unconfigure BGP dynamic neighbors listen range\n"
2545 "Unconfigure BGP dynamic neighbors listen range\n"
2547 "Member of the peer-group\n"
2548 "Peer-group name\n")
2550 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2551 struct prefix range
;
2552 struct peer_group
*group
;
2557 argv_find (argv
, argc
, "A.B.C.D/M", &idx
);
2558 argv_find (argv
, argc
, "X:X::X:X/M", &idx
);
2559 char *prefix
= argv
[idx
]->arg
;
2560 argv_find (argv
, argc
, "WORD", &idx
);
2561 char *peergroup
= argv
[idx
]->arg
;
2563 // VTY_GET_IPV4_PREFIX ("listen range", range, argv[idx_ipv4_prefixlen]->arg);
2565 /* Convert IP prefix string to struct prefix. */
2566 ret
= str2prefix (prefix
, &range
);
2569 vty_out (vty
, "%% Malformed listen range%s", VTY_NEWLINE
);
2573 afi
= family2afi(range
.family
);
2575 if (afi
== AFI_IP6
&& IN6_IS_ADDR_LINKLOCAL (&range
.u
.prefix6
))
2577 vty_out (vty
, "%% Malformed listen range (link-local address)%s",
2582 apply_mask (&range
);
2584 group
= peer_group_lookup (bgp
, peergroup
);
2587 vty_out (vty
, "%% Peer-group does not exist%s", VTY_NEWLINE
);
2591 ret
= peer_group_listen_range_del(group
, &range
);
2592 return bgp_vty_return (vty
, ret
);
2596 bgp_config_write_listen (struct vty
*vty
, struct bgp
*bgp
)
2598 struct peer_group
*group
;
2599 struct listnode
*node
, *nnode
, *rnode
, *nrnode
;
2600 struct prefix
*range
;
2602 char buf
[PREFIX2STR_BUFFER
];
2604 if (bgp
->dynamic_neighbors_limit
!= BGP_DYNAMIC_NEIGHBORS_LIMIT_DEFAULT
)
2605 vty_out (vty
, " bgp listen limit %d%s",
2606 bgp
->dynamic_neighbors_limit
, VTY_NEWLINE
);
2608 for (ALL_LIST_ELEMENTS (bgp
->group
, node
, nnode
, group
))
2610 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
2612 for (ALL_LIST_ELEMENTS (group
->listen_range
[afi
], rnode
, nrnode
, range
))
2614 prefix2str(range
, buf
, sizeof(buf
));
2615 vty_out(vty
, " bgp listen range %s peer-group %s%s",
2616 buf
, group
->name
, VTY_NEWLINE
);
2625 DEFUN (bgp_disable_connected_route_check
,
2626 bgp_disable_connected_route_check_cmd
,
2627 "bgp disable-ebgp-connected-route-check",
2628 "BGP specific commands\n"
2629 "Disable checking if nexthop is connected on ebgp sessions\n")
2631 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2632 bgp_flag_set (bgp
, BGP_FLAG_DISABLE_NH_CONNECTED_CHK
);
2633 bgp_clear_star_soft_in (vty
, bgp
->name
);
2638 DEFUN (no_bgp_disable_connected_route_check
,
2639 no_bgp_disable_connected_route_check_cmd
,
2640 "no bgp disable-ebgp-connected-route-check",
2642 "BGP specific commands\n"
2643 "Disable checking if nexthop is connected on ebgp sessions\n")
2645 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2646 bgp_flag_unset (bgp
, BGP_FLAG_DISABLE_NH_CONNECTED_CHK
);
2647 bgp_clear_star_soft_in (vty
, bgp
->name
);
2654 peer_remote_as_vty (struct vty
*vty
, const char *peer_str
,
2655 const char *as_str
, afi_t afi
, safi_t safi
)
2657 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2660 int as_type
= AS_SPECIFIED
;
2663 if (as_str
[0] == 'i')
2666 as_type
= AS_INTERNAL
;
2668 else if (as_str
[0] == 'e')
2671 as_type
= AS_EXTERNAL
;
2675 /* Get AS number. */
2676 VTY_GET_INTEGER_RANGE ("AS", as
, as_str
, 1, BGP_AS4_MAX
);
2679 /* If peer is peer group, call proper function. */
2680 ret
= str2sockunion (peer_str
, &su
);
2683 /* Check for peer by interface */
2684 ret
= peer_remote_as (bgp
, NULL
, peer_str
, &as
, as_type
, afi
, safi
);
2687 ret
= peer_group_remote_as (bgp
, peer_str
, &as
, as_type
);
2690 vty_out (vty
, "%% Create the peer-group or interface first%s",
2699 if (peer_address_self_check (bgp
, &su
))
2701 vty_out (vty
, "%% Can not configure the local system as neighbor%s",
2705 ret
= peer_remote_as (bgp
, &su
, NULL
, &as
, as_type
, afi
, safi
);
2708 /* This peer belongs to peer group. */
2711 case BGP_ERR_PEER_GROUP_MEMBER
:
2712 vty_out (vty
, "%% Peer-group AS %u. Cannot configure remote-as for member%s", as
, VTY_NEWLINE
);
2714 case BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT
:
2715 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
);
2718 return bgp_vty_return (vty
, ret
);
2721 DEFUN (neighbor_remote_as
,
2722 neighbor_remote_as_cmd
,
2723 "neighbor <A.B.C.D|X:X::X:X|WORD> remote-as <(1-4294967295)|internal|external>",
2726 "Specify a BGP neighbor\n"
2728 "Internal BGP peer\n"
2729 "External BGP peer\n")
2732 int idx_remote_as
= 3;
2733 return peer_remote_as_vty (vty
, argv
[idx_peer
]->arg
, argv
[idx_remote_as
]->arg
, AFI_IP
, SAFI_UNICAST
);
2737 peer_conf_interface_get (struct vty
*vty
, const char *conf_if
, afi_t afi
,
2738 safi_t safi
, int v6only
, const char *peer_group_name
,
2741 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2743 int as_type
= AS_UNSPECIFIED
;
2745 struct peer_group
*group
;
2749 group
= peer_group_lookup (bgp
, conf_if
);
2753 vty_out (vty
, "%% Name conflict with peer-group %s", VTY_NEWLINE
);
2759 if (as_str
[0] == 'i')
2761 as_type
= AS_INTERNAL
;
2763 else if (as_str
[0] == 'e')
2765 as_type
= AS_EXTERNAL
;
2769 /* Get AS number. */
2770 VTY_GET_INTEGER_RANGE ("AS", as
, as_str
, 1, BGP_AS4_MAX
);
2771 as_type
= AS_SPECIFIED
;
2775 peer
= peer_lookup_by_conf_if (bgp
, conf_if
);
2779 ret
= peer_remote_as (bgp
, &su
, conf_if
, &as
, as_type
, afi
, safi
);
2783 if (bgp_flag_check (bgp
, BGP_FLAG_NO_DEFAULT_IPV4
)
2784 && afi
== AFI_IP
&& safi
== SAFI_UNICAST
)
2785 peer
= peer_create (NULL
, conf_if
, bgp
, bgp
->as
, as
, as_type
, 0, 0,
2788 peer
= peer_create (NULL
, conf_if
, bgp
, bgp
->as
, as
, as_type
, afi
, safi
,
2795 SET_FLAG(peer
->flags
, PEER_FLAG_IFPEER_V6ONLY
);
2797 /* Request zebra to initiate IPv6 RAs on this interface. We do this
2798 * any unnumbered peer in order to not worry about run-time transitions
2799 * (e.g., peering is initially IPv4, but the IPv4 /30 or /31 address
2800 * gets deleted later etc.)
2803 bgp_zebra_initiate_radv (bgp
, peer
);
2806 if ((v6only
&& !CHECK_FLAG(peer
->flags
, PEER_FLAG_IFPEER_V6ONLY
)) ||
2807 (!v6only
&& CHECK_FLAG(peer
->flags
, PEER_FLAG_IFPEER_V6ONLY
)))
2810 SET_FLAG(peer
->flags
, PEER_FLAG_IFPEER_V6ONLY
);
2812 UNSET_FLAG(peer
->flags
, PEER_FLAG_IFPEER_V6ONLY
);
2814 /* v6only flag changed. Reset bgp seesion */
2815 if (BGP_IS_VALID_STATE_FOR_NOTIF(peer
->status
))
2817 peer
->last_reset
= PEER_DOWN_V6ONLY_CHANGE
;
2818 bgp_notify_send (peer
, BGP_NOTIFY_CEASE
,
2819 BGP_NOTIFY_CEASE_CONFIG_CHANGE
);
2822 bgp_session_reset(peer
);
2825 if (!CHECK_FLAG (peer
->flags
, PEER_FLAG_CAPABILITY_ENHE
))
2826 peer_flag_set (peer
, PEER_FLAG_CAPABILITY_ENHE
);
2828 if (peer_group_name
)
2830 group
= peer_group_lookup (bgp
, peer_group_name
);
2833 vty_out (vty
, "%% Configure the peer-group first%s", VTY_NEWLINE
);
2837 ret
= peer_group_bind (bgp
, &su
, peer
, group
, &as
);
2840 return bgp_vty_return (vty
, ret
);
2843 DEFUN (neighbor_interface_config
,
2844 neighbor_interface_config_cmd
,
2845 "neighbor WORD interface [peer-group WORD]",
2847 "Interface name or neighbor tag\n"
2848 "Enable BGP on interface\n"
2849 "Member of the peer-group\n"
2850 "Peer-group name\n")
2853 int idx_peer_group_word
= 4;
2855 if (argc
> idx_peer_group_word
)
2856 return peer_conf_interface_get (vty
, argv
[idx_word
]->arg
, AFI_IP
, SAFI_UNICAST
, 0,
2857 argv
[idx_peer_group_word
]->arg
, NULL
);
2859 return peer_conf_interface_get (vty
, argv
[idx_word
]->arg
, AFI_IP
, SAFI_UNICAST
, 0,
2863 DEFUN (neighbor_interface_config_v6only
,
2864 neighbor_interface_config_v6only_cmd
,
2865 "neighbor WORD interface v6only [peer-group WORD]",
2867 "Interface name or neighbor tag\n"
2868 "Enable BGP on interface\n"
2869 "Enable BGP with v6 link-local only\n"
2870 "Member of the peer-group\n"
2871 "Peer-group name\n")
2874 int idx_peer_group_word
= 5;
2876 if (argc
> idx_peer_group_word
)
2877 return peer_conf_interface_get (vty
, argv
[idx_word
]->arg
, AFI_IP
, SAFI_UNICAST
, 1,
2878 argv
[idx_peer_group_word
]->arg
, NULL
);
2880 return peer_conf_interface_get (vty
, argv
[idx_word
]->arg
, AFI_IP
, SAFI_UNICAST
, 1,
2885 DEFUN (neighbor_interface_config_remote_as
,
2886 neighbor_interface_config_remote_as_cmd
,
2887 "neighbor WORD interface remote-as <(1-4294967295)|internal|external>",
2889 "Interface name or neighbor tag\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
= 4;
2898 return peer_conf_interface_get (vty
, argv
[idx_word
]->arg
, AFI_IP
, SAFI_UNICAST
, 0,
2899 NULL
, argv
[idx_remote_as
]->arg
);
2902 DEFUN (neighbor_interface_v6only_config_remote_as
,
2903 neighbor_interface_v6only_config_remote_as_cmd
,
2904 "neighbor WORD interface v6only remote-as <(1-4294967295)|internal|external>",
2906 "Interface name or neighbor tag\n"
2907 "Enable BGP with v6 link-local only\n"
2908 "Enable BGP on interface\n"
2909 "Specify a BGP neighbor\n"
2911 "Internal BGP peer\n"
2912 "External BGP peer\n")
2915 int idx_remote_as
= 5;
2916 return peer_conf_interface_get (vty
, argv
[idx_word
]->arg
, AFI_IP
, SAFI_UNICAST
, 1,
2917 NULL
, argv
[idx_remote_as
]->arg
);
2920 DEFUN (neighbor_peer_group
,
2921 neighbor_peer_group_cmd
,
2922 "neighbor WORD peer-group",
2924 "Interface name or neighbor tag\n"
2925 "Configure peer-group\n")
2927 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2930 struct peer_group
*group
;
2932 peer
= peer_lookup_by_conf_if (bgp
, argv
[idx_word
]->arg
);
2935 vty_out (vty
, "%% Name conflict with interface: %s", VTY_NEWLINE
);
2939 group
= peer_group_get (bgp
, argv
[idx_word
]->arg
);
2948 "no neighbor <WORD|<A.B.C.D|X:X::X:X> [remote-as <(1-4294967295)|internal|external>]>",
2952 "Specify a BGP neighbor\n"
2954 "Internal BGP peer\n"
2955 "External BGP peer\n")
2957 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2961 struct peer_group
*group
;
2965 ret
= str2sockunion (argv
[idx_peer
]->arg
, &su
);
2968 /* look up for neighbor by interface name config. */
2969 peer
= peer_lookup_by_conf_if (bgp
, argv
[idx_peer
]->arg
);
2972 /* Request zebra to terminate IPv6 RAs on this interface. */
2974 bgp_zebra_terminate_radv (peer
->bgp
, peer
);
2979 group
= peer_group_lookup (bgp
, argv
[idx_peer
]->arg
);
2981 peer_group_delete (group
);
2984 vty_out (vty
, "%% Create the peer-group first%s", VTY_NEWLINE
);
2990 peer
= peer_lookup (bgp
, &su
);
2993 if (peer_dynamic_neighbor (peer
))
2995 vty_out (vty
, "%% Operation not allowed on a dynamic neighbor%s",
3000 other
= peer
->doppelganger
;
3002 if (other
&& other
->status
!= Deleted
)
3010 DEFUN (no_neighbor_interface_config
,
3011 no_neighbor_interface_config_cmd
,
3012 "no neighbor WORD interface [v6only] [peer-group WORD] [remote-as <(1-4294967295)|internal|external>]",
3016 "Configure BGP on interface\n"
3017 "Enable BGP with v6 link-local only\n"
3018 "Member of the peer-group\n"
3020 "Specify a BGP neighbor\n"
3022 "Internal BGP peer\n"
3023 "External BGP peer\n")
3025 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
3029 /* look up for neighbor by interface name config. */
3030 peer
= peer_lookup_by_conf_if (bgp
, argv
[idx_word
]->arg
);
3033 /* Request zebra to terminate IPv6 RAs on this interface. */
3035 bgp_zebra_terminate_radv (peer
->bgp
, peer
);
3040 vty_out (vty
, "%% Create the bgp interface first%s", VTY_NEWLINE
);
3046 DEFUN (no_neighbor_peer_group
,
3047 no_neighbor_peer_group_cmd
,
3048 "no neighbor WORD peer-group",
3052 "Configure peer-group\n")
3054 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
3056 struct peer_group
*group
;
3058 group
= peer_group_lookup (bgp
, argv
[idx_word
]->arg
);
3060 peer_group_delete (group
);
3063 vty_out (vty
, "%% Create the peer-group first%s", VTY_NEWLINE
);
3069 DEFUN (no_neighbor_interface_peer_group_remote_as
,
3070 no_neighbor_interface_peer_group_remote_as_cmd
,
3071 "no neighbor WORD remote-as <(1-4294967295)|internal|external>",
3074 "Interface name or neighbor tag\n"
3075 "Specify a BGP neighbor\n"
3077 "Internal BGP peer\n"
3078 "External BGP peer\n")
3080 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
3082 struct peer_group
*group
;
3085 /* look up for neighbor by interface name config. */
3086 peer
= peer_lookup_by_conf_if (bgp
, argv
[idx_word
]->arg
);
3089 peer_as_change (peer
, 0, AS_SPECIFIED
);
3093 group
= peer_group_lookup (bgp
, argv
[idx_word
]->arg
);
3095 peer_group_remote_as_delete (group
);
3098 vty_out (vty
, "%% Create the peer-group or interface first%s", VTY_NEWLINE
);
3104 DEFUN (neighbor_local_as
,
3105 neighbor_local_as_cmd
,
3106 "neighbor <A.B.C.D|X:X::X:X|WORD> local-as (1-4294967295)",
3109 "Specify a local-as number\n"
3110 "AS number used as local AS\n")
3118 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
3122 VTY_GET_INTEGER_RANGE ("Local AS", as
, argv
[idx_number
]->arg
, 1, BGP_AS4_MAX
);
3123 ret
= peer_local_as_set (peer
, as
, 0, 0);
3124 return bgp_vty_return (vty
, ret
);
3127 DEFUN (neighbor_local_as_no_prepend
,
3128 neighbor_local_as_no_prepend_cmd
,
3129 "neighbor <A.B.C.D|X:X::X:X|WORD> local-as (1-4294967295) no-prepend",
3132 "Specify a local-as number\n"
3133 "AS number used as local AS\n"
3134 "Do not prepend local-as to updates from ebgp peers\n")
3142 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
3146 VTY_GET_INTEGER_RANGE ("Local AS", as
, argv
[idx_number
]->arg
, 1, BGP_AS4_MAX
);
3147 ret
= peer_local_as_set (peer
, as
, 1, 0);
3148 return bgp_vty_return (vty
, ret
);
3151 DEFUN (neighbor_local_as_no_prepend_replace_as
,
3152 neighbor_local_as_no_prepend_replace_as_cmd
,
3153 "neighbor <A.B.C.D|X:X::X:X|WORD> local-as (1-4294967295) no-prepend replace-as",
3156 "Specify a local-as number\n"
3157 "AS number used as local AS\n"
3158 "Do not prepend local-as to updates from ebgp peers\n"
3159 "Do not prepend local-as to updates from ibgp peers\n")
3167 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
3171 VTY_GET_INTEGER_RANGE ("Local AS", as
, argv
[idx_number
]->arg
, 1, BGP_AS4_MAX
);
3172 ret
= peer_local_as_set (peer
, as
, 1, 1);
3173 return bgp_vty_return (vty
, ret
);
3176 DEFUN (no_neighbor_local_as
,
3177 no_neighbor_local_as_cmd
,
3178 "no neighbor <A.B.C.D|X:X::X:X|WORD> local-as [(1-4294967295) [no-prepend [replace-as]]]",
3182 "Specify a local-as number\n"
3183 "AS number used as local AS\n"
3184 "Do not prepend local-as to updates from ebgp peers\n"
3185 "Do not prepend local-as to updates from ibgp peers\n")
3191 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
3195 ret
= peer_local_as_unset (peer
);
3196 return bgp_vty_return (vty
, ret
);
3202 DEFUN (neighbor_solo
,
3204 "neighbor <A.B.C.D|X:X::X:X|WORD> solo",
3207 "Solo peer - part of its own update group\n")
3213 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
3217 ret
= update_group_adjust_soloness(peer
, 1);
3218 return bgp_vty_return (vty
, ret
);
3221 DEFUN (no_neighbor_solo
,
3222 no_neighbor_solo_cmd
,
3223 "no neighbor <A.B.C.D|X:X::X:X|WORD> solo",
3227 "Solo peer - part of its own update group\n")
3233 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
3237 ret
= update_group_adjust_soloness(peer
, 0);
3238 return bgp_vty_return (vty
, ret
);
3241 DEFUN (neighbor_password
,
3242 neighbor_password_cmd
,
3243 "neighbor <A.B.C.D|X:X::X:X|WORD> password LINE",
3254 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
3258 ret
= peer_password_set (peer
, argv
[idx_line
]->arg
);
3259 return bgp_vty_return (vty
, ret
);
3262 DEFUN (no_neighbor_password
,
3263 no_neighbor_password_cmd
,
3264 "no neighbor <A.B.C.D|X:X::X:X|WORD> password [LINE]",
3275 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
3279 ret
= peer_password_unset (peer
);
3280 return bgp_vty_return (vty
, ret
);
3284 DEFUN (neighbor_activate
,
3285 neighbor_activate_cmd
,
3286 "neighbor <A.B.C.D|X:X::X:X|WORD> activate",
3289 "Enable the Address Family for this Neighbor\n")
3295 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
3299 ret
= peer_activate (peer
, bgp_node_afi (vty
), bgp_node_safi (vty
));
3306 ALIAS_HIDDEN (neighbor_activate
,
3307 neighbor_activate_hidden_cmd
,
3308 "neighbor <A.B.C.D|X:X::X:X|WORD> activate",
3311 "Enable the Address Family for this Neighbor\n")
3313 DEFUN (no_neighbor_activate
,
3314 no_neighbor_activate_cmd
,
3315 "no neighbor <A.B.C.D|X:X::X:X|WORD> activate",
3319 "Enable the Address Family for this Neighbor\n")
3326 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
3330 ret
= peer_deactivate (peer
, bgp_node_afi (vty
), bgp_node_safi (vty
));
3337 ALIAS_HIDDEN (no_neighbor_activate
,
3338 no_neighbor_activate_hidden_cmd
,
3339 "no neighbor <A.B.C.D|X:X::X:X|WORD> activate",
3343 "Enable the Address Family for this Neighbor\n")
3345 DEFUN (neighbor_set_peer_group
,
3346 neighbor_set_peer_group_cmd
,
3347 "neighbor <A.B.C.D|X:X::X:X|WORD> peer-group WORD",
3350 "Member of the peer-group\n"
3351 "Peer-group name\n")
3353 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
3360 struct peer_group
*group
;
3364 ret
= str2sockunion (argv
[idx_peer
]->arg
, &su
);
3367 peer
= peer_lookup_by_conf_if (bgp
, argv
[idx_peer
]->arg
);
3370 vty_out (vty
, "%% Malformed address or name: %s%s", argv
[idx_peer
]->arg
, VTY_NEWLINE
);
3376 if (peer_address_self_check (bgp
, &su
))
3378 vty_out (vty
, "%% Can not configure the local system as neighbor%s",
3383 /* Disallow for dynamic neighbor. */
3384 peer
= peer_lookup (bgp
, &su
);
3385 if (peer
&& peer_dynamic_neighbor (peer
))
3387 vty_out (vty
, "%% Operation not allowed on a dynamic neighbor%s",
3393 group
= peer_group_lookup (bgp
, argv
[idx_word
]->arg
);
3396 vty_out (vty
, "%% Configure the peer-group first%s", VTY_NEWLINE
);
3400 ret
= peer_group_bind (bgp
, &su
, peer
, group
, &as
);
3402 if (ret
== BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT
)
3404 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
);
3408 return bgp_vty_return (vty
, ret
);
3411 ALIAS_HIDDEN (neighbor_set_peer_group
,
3412 neighbor_set_peer_group_hidden_cmd
,
3413 "neighbor <A.B.C.D|X:X::X:X|WORD> peer-group WORD",
3416 "Member of the peer-group\n"
3417 "Peer-group name\n")
3419 DEFUN (no_neighbor_set_peer_group
,
3420 no_neighbor_set_peer_group_cmd
,
3421 "no neighbor <A.B.C.D|X:X::X:X|WORD> peer-group WORD",
3425 "Member of the peer-group\n"
3426 "Peer-group name\n")
3428 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
3433 struct peer_group
*group
;
3435 peer
= peer_lookup_vty (vty
, argv
[idx_peer
]->arg
);
3439 group
= peer_group_lookup (bgp
, argv
[idx_word
]->arg
);
3442 vty_out (vty
, "%% Configure the peer-group first%s", VTY_NEWLINE
);
3446 ret
= peer_group_unbind (bgp
, peer
, group
);
3448 return bgp_vty_return (vty
, ret
);
3451 ALIAS_HIDDEN (no_neighbor_set_peer_group
,
3452 no_neighbor_set_peer_group_hidden_cmd
,
3453 "no neighbor <A.B.C.D|X:X::X:X|WORD> peer-group WORD",
3457 "Member of the peer-group\n"
3458 "Peer-group name\n")
3461 peer_flag_modify_vty (struct vty
*vty
, const char *ip_str
,
3462 u_int16_t flag
, int set
)
3467 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
3472 * If 'neighbor <interface>', then this is for directly connected peers,
3473 * we should not accept disable-connected-check.
3475 if (peer
->conf_if
&& (flag
== PEER_FLAG_DISABLE_CONNECTED_CHECK
)) {
3476 vty_out (vty
, "%s is directly connected peer, cannot accept disable-"
3477 "connected-check%s", ip_str
, VTY_NEWLINE
);
3481 if (!set
&& flag
== PEER_FLAG_SHUTDOWN
)
3482 peer_tx_shutdown_message_unset (peer
);
3485 ret
= peer_flag_set (peer
, flag
);
3487 ret
= peer_flag_unset (peer
, flag
);
3489 return bgp_vty_return (vty
, ret
);
3493 peer_flag_set_vty (struct vty
*vty
, const char *ip_str
, u_int16_t flag
)
3495 return peer_flag_modify_vty (vty
, ip_str
, flag
, 1);
3499 peer_flag_unset_vty (struct vty
*vty
, const char *ip_str
, u_int16_t flag
)
3501 return peer_flag_modify_vty (vty
, ip_str
, flag
, 0);
3504 /* neighbor passive. */
3505 DEFUN (neighbor_passive
,
3506 neighbor_passive_cmd
,
3507 "neighbor <A.B.C.D|X:X::X:X|WORD> passive",
3510 "Don't send open messages to this neighbor\n")
3513 return peer_flag_set_vty (vty
, argv
[idx_peer
]->arg
, PEER_FLAG_PASSIVE
);
3516 DEFUN (no_neighbor_passive
,
3517 no_neighbor_passive_cmd
,
3518 "no neighbor <A.B.C.D|X:X::X:X|WORD> passive",
3522 "Don't send open messages to this neighbor\n")
3525 return peer_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, PEER_FLAG_PASSIVE
);
3528 /* neighbor shutdown. */
3529 DEFUN (neighbor_shutdown_msg
,
3530 neighbor_shutdown_msg_cmd
,
3531 "neighbor <A.B.C.D|X:X::X:X|WORD> shutdown message MSG...",
3534 "Administratively shut down this neighbor\n"
3535 "Add a shutdown message (draft-ietf-idr-shutdown-06)\n"
3536 "Shutdown message\n")
3542 struct peer
*peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
3547 message
= argv_concat (argv
, argc
, 4);
3548 peer_tx_shutdown_message_set (peer
, message
);
3549 XFREE (MTYPE_TMP
, message
);
3552 return peer_flag_set_vty (vty
, argv
[idx_peer
]->arg
, PEER_FLAG_SHUTDOWN
);
3555 ALIAS (neighbor_shutdown_msg
,
3556 neighbor_shutdown_cmd
,
3557 "neighbor <A.B.C.D|X:X::X:X|WORD> shutdown",
3560 "Administratively shut down this neighbor\n")
3562 DEFUN (no_neighbor_shutdown_msg
,
3563 no_neighbor_shutdown_msg_cmd
,
3564 "no neighbor <A.B.C.D|X:X::X:X|WORD> shutdown message MSG...",
3568 "Administratively shut down this neighbor\n"
3569 "Remove a shutdown message (draft-ietf-idr-shutdown-06)\n"
3570 "Shutdown message\n")
3574 return peer_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, PEER_FLAG_SHUTDOWN
);
3577 ALIAS (no_neighbor_shutdown_msg
,
3578 no_neighbor_shutdown_cmd
,
3579 "no neighbor <A.B.C.D|X:X::X:X|WORD> shutdown",
3583 "Administratively shut down this neighbor\n")
3585 /* neighbor capability dynamic. */
3586 DEFUN (neighbor_capability_dynamic
,
3587 neighbor_capability_dynamic_cmd
,
3588 "neighbor <A.B.C.D|X:X::X:X|WORD> capability dynamic",
3591 "Advertise capability to the peer\n"
3592 "Advertise dynamic capability to this neighbor\n")
3595 return peer_flag_set_vty (vty
, argv
[idx_peer
]->arg
, PEER_FLAG_DYNAMIC_CAPABILITY
);
3598 DEFUN (no_neighbor_capability_dynamic
,
3599 no_neighbor_capability_dynamic_cmd
,
3600 "no neighbor <A.B.C.D|X:X::X:X|WORD> capability dynamic",
3604 "Advertise capability to the peer\n"
3605 "Advertise dynamic capability to this neighbor\n")
3608 return peer_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, PEER_FLAG_DYNAMIC_CAPABILITY
);
3611 /* neighbor dont-capability-negotiate */
3612 DEFUN (neighbor_dont_capability_negotiate
,
3613 neighbor_dont_capability_negotiate_cmd
,
3614 "neighbor <A.B.C.D|X:X::X:X|WORD> dont-capability-negotiate",
3617 "Do not perform capability negotiation\n")
3620 return peer_flag_set_vty (vty
, argv
[idx_peer
]->arg
, PEER_FLAG_DONT_CAPABILITY
);
3623 DEFUN (no_neighbor_dont_capability_negotiate
,
3624 no_neighbor_dont_capability_negotiate_cmd
,
3625 "no neighbor <A.B.C.D|X:X::X:X|WORD> dont-capability-negotiate",
3629 "Do not perform capability negotiation\n")
3632 return peer_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, PEER_FLAG_DONT_CAPABILITY
);
3635 /* neighbor capability extended next hop encoding */
3636 DEFUN (neighbor_capability_enhe
,
3637 neighbor_capability_enhe_cmd
,
3638 "neighbor <A.B.C.D|X:X::X:X|WORD> capability extended-nexthop",
3641 "Advertise capability to the peer\n"
3642 "Advertise extended next-hop capability to the peer\n")
3645 return peer_flag_set_vty (vty
, argv
[idx_peer
]->arg
, PEER_FLAG_CAPABILITY_ENHE
);
3648 DEFUN (no_neighbor_capability_enhe
,
3649 no_neighbor_capability_enhe_cmd
,
3650 "no neighbor <A.B.C.D|X:X::X:X|WORD> capability extended-nexthop",
3654 "Advertise capability to the peer\n"
3655 "Advertise extended next-hop capability to the peer\n")
3658 return peer_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, PEER_FLAG_CAPABILITY_ENHE
);
3662 peer_af_flag_modify_vty (struct vty
*vty
, const char *peer_str
, afi_t afi
,
3663 safi_t safi
, u_int32_t flag
, int set
)
3668 peer
= peer_and_group_lookup_vty (vty
, peer_str
);
3673 ret
= peer_af_flag_set (peer
, afi
, safi
, flag
);
3675 ret
= peer_af_flag_unset (peer
, afi
, safi
, flag
);
3677 return bgp_vty_return (vty
, ret
);
3681 peer_af_flag_set_vty (struct vty
*vty
, const char *peer_str
, afi_t afi
,
3682 safi_t safi
, u_int32_t flag
)
3684 return peer_af_flag_modify_vty (vty
, peer_str
, afi
, safi
, flag
, 1);
3688 peer_af_flag_unset_vty (struct vty
*vty
, const char *peer_str
, afi_t afi
,
3689 safi_t safi
, u_int32_t flag
)
3691 return peer_af_flag_modify_vty (vty
, peer_str
, afi
, safi
, flag
, 0);
3694 /* neighbor capability orf prefix-list. */
3695 DEFUN (neighbor_capability_orf_prefix
,
3696 neighbor_capability_orf_prefix_cmd
,
3697 "neighbor <A.B.C.D|X:X::X:X|WORD> capability orf prefix-list <both|send|receive>",
3700 "Advertise capability to the peer\n"
3701 "Advertise ORF capability to the peer\n"
3702 "Advertise prefixlist ORF capability to this neighbor\n"
3703 "Capability to SEND and RECEIVE the ORF to/from this neighbor\n"
3704 "Capability to RECEIVE the ORF from this neighbor\n"
3705 "Capability to SEND the ORF to this neighbor\n")
3708 int idx_send_recv
= 5;
3711 if (strncmp (argv
[idx_send_recv
]->arg
, "s", 1) == 0)
3712 flag
= PEER_FLAG_ORF_PREFIX_SM
;
3713 else if (strncmp (argv
[idx_send_recv
]->arg
, "r", 1) == 0)
3714 flag
= PEER_FLAG_ORF_PREFIX_RM
;
3715 else if (strncmp (argv
[idx_send_recv
]->arg
, "b", 1) == 0)
3716 flag
= PEER_FLAG_ORF_PREFIX_SM
|PEER_FLAG_ORF_PREFIX_RM
;
3720 return peer_af_flag_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
3721 bgp_node_safi (vty
), flag
);
3724 ALIAS_HIDDEN (neighbor_capability_orf_prefix
,
3725 neighbor_capability_orf_prefix_hidden_cmd
,
3726 "neighbor <A.B.C.D|X:X::X:X|WORD> capability orf prefix-list <both|send|receive>",
3729 "Advertise capability to the peer\n"
3730 "Advertise ORF capability to the peer\n"
3731 "Advertise prefixlist ORF capability to this neighbor\n"
3732 "Capability to SEND and RECEIVE the ORF to/from this neighbor\n"
3733 "Capability to RECEIVE the ORF from this neighbor\n"
3734 "Capability to SEND the ORF to this neighbor\n")
3736 DEFUN (no_neighbor_capability_orf_prefix
,
3737 no_neighbor_capability_orf_prefix_cmd
,
3738 "no neighbor <A.B.C.D|X:X::X:X|WORD> capability orf prefix-list <both|send|receive>",
3742 "Advertise capability to the peer\n"
3743 "Advertise ORF capability to the peer\n"
3744 "Advertise prefixlist ORF capability to this neighbor\n"
3745 "Capability to SEND and RECEIVE the ORF to/from this neighbor\n"
3746 "Capability to RECEIVE the ORF from this neighbor\n"
3747 "Capability to SEND the ORF to this neighbor\n")
3750 int idx_send_recv
= 6;
3753 if (strncmp (argv
[idx_send_recv
]->arg
, "s", 1) == 0)
3754 flag
= PEER_FLAG_ORF_PREFIX_SM
;
3755 else if (strncmp (argv
[idx_send_recv
]->arg
, "r", 1) == 0)
3756 flag
= PEER_FLAG_ORF_PREFIX_RM
;
3757 else if (strncmp (argv
[idx_send_recv
]->arg
, "b", 1) == 0)
3758 flag
= PEER_FLAG_ORF_PREFIX_SM
|PEER_FLAG_ORF_PREFIX_RM
;
3762 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
3763 bgp_node_safi (vty
), flag
);
3766 ALIAS_HIDDEN (no_neighbor_capability_orf_prefix
,
3767 no_neighbor_capability_orf_prefix_hidden_cmd
,
3768 "no neighbor <A.B.C.D|X:X::X:X|WORD> capability orf prefix-list <both|send|receive>",
3772 "Advertise capability to the peer\n"
3773 "Advertise ORF capability to the peer\n"
3774 "Advertise prefixlist ORF capability to this neighbor\n"
3775 "Capability to SEND and RECEIVE the ORF to/from this neighbor\n"
3776 "Capability to RECEIVE the ORF from this neighbor\n"
3777 "Capability to SEND the ORF to this neighbor\n")
3779 /* neighbor next-hop-self. */
3780 DEFUN (neighbor_nexthop_self
,
3781 neighbor_nexthop_self_cmd
,
3782 "neighbor <A.B.C.D|X:X::X:X|WORD> next-hop-self",
3785 "Disable the next hop calculation for this neighbor\n")
3788 return peer_af_flag_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
3789 bgp_node_safi (vty
), PEER_FLAG_NEXTHOP_SELF
);
3792 ALIAS_HIDDEN (neighbor_nexthop_self
,
3793 neighbor_nexthop_self_hidden_cmd
,
3794 "neighbor <A.B.C.D|X:X::X:X|WORD> next-hop-self",
3797 "Disable the next hop calculation for this neighbor\n")
3799 /* neighbor next-hop-self. */
3800 DEFUN (neighbor_nexthop_self_force
,
3801 neighbor_nexthop_self_force_cmd
,
3802 "neighbor <A.B.C.D|X:X::X:X|WORD> next-hop-self force",
3805 "Disable the next hop calculation for this neighbor\n"
3806 "Set the next hop to self for reflected routes\n")
3809 return peer_af_flag_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
3810 bgp_node_safi (vty
),
3811 PEER_FLAG_FORCE_NEXTHOP_SELF
);
3814 ALIAS_HIDDEN (neighbor_nexthop_self_force
,
3815 neighbor_nexthop_self_force_hidden_cmd
,
3816 "neighbor <A.B.C.D|X:X::X:X|WORD> next-hop-self force",
3819 "Disable the next hop calculation for this neighbor\n"
3820 "Set the next hop to self for reflected routes\n")
3822 DEFUN (no_neighbor_nexthop_self
,
3823 no_neighbor_nexthop_self_cmd
,
3824 "no neighbor <A.B.C.D|X:X::X:X|WORD> next-hop-self",
3828 "Disable the next hop calculation for this neighbor\n")
3831 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
3832 bgp_node_safi (vty
),
3833 PEER_FLAG_NEXTHOP_SELF
);
3836 ALIAS_HIDDEN (no_neighbor_nexthop_self
,
3837 no_neighbor_nexthop_self_hidden_cmd
,
3838 "no neighbor <A.B.C.D|X:X::X:X|WORD> next-hop-self",
3842 "Disable the next hop calculation for this neighbor\n")
3844 DEFUN (no_neighbor_nexthop_self_force
,
3845 no_neighbor_nexthop_self_force_cmd
,
3846 "no neighbor <A.B.C.D|X:X::X:X|WORD> next-hop-self force",
3850 "Disable the next hop calculation for this neighbor\n"
3851 "Set the next hop to self for reflected routes\n")
3854 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
3855 bgp_node_safi (vty
),
3856 PEER_FLAG_FORCE_NEXTHOP_SELF
);
3859 ALIAS_HIDDEN (no_neighbor_nexthop_self_force
,
3860 no_neighbor_nexthop_self_force_hidden_cmd
,
3861 "no neighbor <A.B.C.D|X:X::X:X|WORD> next-hop-self force",
3865 "Disable the next hop calculation for this neighbor\n"
3866 "Set the next hop to self for reflected routes\n")
3868 /* neighbor as-override */
3869 DEFUN (neighbor_as_override
,
3870 neighbor_as_override_cmd
,
3871 "neighbor <A.B.C.D|X:X::X:X|WORD> as-override",
3874 "Override ASNs in outbound updates if aspath equals remote-as\n")
3877 return peer_af_flag_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
3878 bgp_node_safi (vty
),
3879 PEER_FLAG_AS_OVERRIDE
);
3882 ALIAS_HIDDEN (neighbor_as_override
,
3883 neighbor_as_override_hidden_cmd
,
3884 "neighbor <A.B.C.D|X:X::X:X|WORD> as-override",
3887 "Override ASNs in outbound updates if aspath equals remote-as\n")
3889 DEFUN (no_neighbor_as_override
,
3890 no_neighbor_as_override_cmd
,
3891 "no neighbor <A.B.C.D|X:X::X:X|WORD> as-override",
3895 "Override ASNs in outbound updates if aspath equals remote-as\n")
3898 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
3899 bgp_node_safi (vty
),
3900 PEER_FLAG_AS_OVERRIDE
);
3903 ALIAS_HIDDEN (no_neighbor_as_override
,
3904 no_neighbor_as_override_hidden_cmd
,
3905 "no neighbor <A.B.C.D|X:X::X:X|WORD> as-override",
3909 "Override ASNs in outbound updates if aspath equals remote-as\n")
3911 /* neighbor remove-private-AS. */
3912 DEFUN (neighbor_remove_private_as
,
3913 neighbor_remove_private_as_cmd
,
3914 "neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS",
3917 "Remove private ASNs in outbound updates\n")
3920 return peer_af_flag_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
3921 bgp_node_safi (vty
),
3922 PEER_FLAG_REMOVE_PRIVATE_AS
);
3925 ALIAS_HIDDEN (neighbor_remove_private_as
,
3926 neighbor_remove_private_as_hidden_cmd
,
3927 "neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS",
3930 "Remove private ASNs in outbound updates\n")
3932 DEFUN (neighbor_remove_private_as_all
,
3933 neighbor_remove_private_as_all_cmd
,
3934 "neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS all",
3937 "Remove private ASNs in outbound updates\n"
3938 "Apply to all AS numbers")
3941 return peer_af_flag_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
3942 bgp_node_safi (vty
),
3943 PEER_FLAG_REMOVE_PRIVATE_AS_ALL
);
3946 ALIAS_HIDDEN (neighbor_remove_private_as_all
,
3947 neighbor_remove_private_as_all_hidden_cmd
,
3948 "neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS all",
3951 "Remove private ASNs in outbound updates\n"
3952 "Apply to all AS numbers")
3954 DEFUN (neighbor_remove_private_as_replace_as
,
3955 neighbor_remove_private_as_replace_as_cmd
,
3956 "neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS replace-AS",
3959 "Remove private ASNs in outbound updates\n"
3960 "Replace private ASNs with our ASN in outbound updates\n")
3963 return peer_af_flag_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
3964 bgp_node_safi (vty
),
3965 PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE
);
3968 ALIAS_HIDDEN (neighbor_remove_private_as_replace_as
,
3969 neighbor_remove_private_as_replace_as_hidden_cmd
,
3970 "neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS replace-AS",
3973 "Remove private ASNs in outbound updates\n"
3974 "Replace private ASNs with our ASN in outbound updates\n")
3976 DEFUN (neighbor_remove_private_as_all_replace_as
,
3977 neighbor_remove_private_as_all_replace_as_cmd
,
3978 "neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS all replace-AS",
3981 "Remove private ASNs in outbound updates\n"
3982 "Apply to all AS numbers\n"
3983 "Replace private ASNs with our ASN in outbound updates\n")
3986 return peer_af_flag_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
3987 bgp_node_safi (vty
),
3988 PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE
);
3991 ALIAS_HIDDEN (neighbor_remove_private_as_all_replace_as
,
3992 neighbor_remove_private_as_all_replace_as_hidden_cmd
,
3993 "neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS all replace-AS",
3996 "Remove private ASNs in outbound updates\n"
3997 "Apply to all AS numbers\n"
3998 "Replace private ASNs with our ASN in outbound updates\n")
4000 DEFUN (no_neighbor_remove_private_as
,
4001 no_neighbor_remove_private_as_cmd
,
4002 "no neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS",
4006 "Remove private ASNs in outbound updates\n")
4009 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4010 bgp_node_safi (vty
),
4011 PEER_FLAG_REMOVE_PRIVATE_AS
);
4014 ALIAS_HIDDEN (no_neighbor_remove_private_as
,
4015 no_neighbor_remove_private_as_hidden_cmd
,
4016 "no neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS",
4020 "Remove private ASNs in outbound updates\n")
4022 DEFUN (no_neighbor_remove_private_as_all
,
4023 no_neighbor_remove_private_as_all_cmd
,
4024 "no neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS all",
4028 "Remove private ASNs in outbound updates\n"
4029 "Apply to all AS numbers\n")
4032 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4033 bgp_node_safi (vty
),
4034 PEER_FLAG_REMOVE_PRIVATE_AS_ALL
);
4037 ALIAS_HIDDEN (no_neighbor_remove_private_as_all
,
4038 no_neighbor_remove_private_as_all_hidden_cmd
,
4039 "no neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS all",
4043 "Remove private ASNs in outbound updates\n"
4044 "Apply to all AS numbers\n")
4046 DEFUN (no_neighbor_remove_private_as_replace_as
,
4047 no_neighbor_remove_private_as_replace_as_cmd
,
4048 "no neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS replace-AS",
4052 "Remove private ASNs in outbound updates\n"
4053 "Replace private ASNs with our ASN in outbound updates\n")
4056 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4057 bgp_node_safi (vty
),
4058 PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE
);
4061 ALIAS_HIDDEN (no_neighbor_remove_private_as_replace_as
,
4062 no_neighbor_remove_private_as_replace_as_hidden_cmd
,
4063 "no neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS replace-AS",
4067 "Remove private ASNs in outbound updates\n"
4068 "Replace private ASNs with our ASN in outbound updates\n")
4070 DEFUN (no_neighbor_remove_private_as_all_replace_as
,
4071 no_neighbor_remove_private_as_all_replace_as_cmd
,
4072 "no neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS all replace-AS",
4076 "Remove private ASNs in outbound updates\n"
4077 "Apply to all AS numbers\n"
4078 "Replace private ASNs with our ASN in outbound updates\n")
4081 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4082 bgp_node_safi (vty
),
4083 PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE
);
4086 ALIAS_HIDDEN (no_neighbor_remove_private_as_all_replace_as
,
4087 no_neighbor_remove_private_as_all_replace_as_hidden_cmd
,
4088 "no neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS all replace-AS",
4092 "Remove private ASNs in outbound updates\n"
4093 "Apply to all AS numbers\n"
4094 "Replace private ASNs with our ASN in outbound updates\n")
4097 /* neighbor send-community. */
4098 DEFUN (neighbor_send_community
,
4099 neighbor_send_community_cmd
,
4100 "neighbor <A.B.C.D|X:X::X:X|WORD> send-community",
4103 "Send Community attribute to this neighbor\n")
4106 return peer_af_flag_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4107 bgp_node_safi (vty
),
4108 PEER_FLAG_SEND_COMMUNITY
);
4111 ALIAS_HIDDEN (neighbor_send_community
,
4112 neighbor_send_community_hidden_cmd
,
4113 "neighbor <A.B.C.D|X:X::X:X|WORD> send-community",
4116 "Send Community attribute to this neighbor\n")
4118 DEFUN (no_neighbor_send_community
,
4119 no_neighbor_send_community_cmd
,
4120 "no neighbor <A.B.C.D|X:X::X:X|WORD> send-community",
4124 "Send Community attribute to this neighbor\n")
4127 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4128 bgp_node_safi (vty
),
4129 PEER_FLAG_SEND_COMMUNITY
);
4132 ALIAS_HIDDEN (no_neighbor_send_community
,
4133 no_neighbor_send_community_hidden_cmd
,
4134 "no neighbor <A.B.C.D|X:X::X:X|WORD> send-community",
4138 "Send Community attribute to this neighbor\n")
4140 /* neighbor send-community extended. */
4141 DEFUN (neighbor_send_community_type
,
4142 neighbor_send_community_type_cmd
,
4143 "neighbor <A.B.C.D|X:X::X:X|WORD> send-community <both|all|extended|standard|large>",
4146 "Send Community attribute to this neighbor\n"
4147 "Send Standard and Extended Community attributes\n"
4148 "Send Standard, Large and Extended Community attributes\n"
4149 "Send Extended Community attributes\n"
4150 "Send Standard Community attributes\n"
4151 "Send Large Community attributes\n")
4156 char *peer
= argv
[1]->arg
;
4158 if (argv_find (argv
, argc
, "standard", &idx
))
4159 SET_FLAG (flag
, PEER_FLAG_SEND_COMMUNITY
);
4160 else if (argv_find (argv
, argc
, "extended", &idx
))
4161 SET_FLAG (flag
, PEER_FLAG_SEND_EXT_COMMUNITY
);
4162 else if (argv_find (argv
, argc
, "large", &idx
))
4163 SET_FLAG (flag
, PEER_FLAG_SEND_LARGE_COMMUNITY
);
4164 else if (argv_find (argv
, argc
, "both", &idx
))
4166 SET_FLAG (flag
, PEER_FLAG_SEND_COMMUNITY
);
4167 SET_FLAG (flag
, PEER_FLAG_SEND_EXT_COMMUNITY
);
4171 SET_FLAG (flag
, PEER_FLAG_SEND_COMMUNITY
);
4172 SET_FLAG (flag
, PEER_FLAG_SEND_EXT_COMMUNITY
);
4173 SET_FLAG (flag
, PEER_FLAG_SEND_LARGE_COMMUNITY
);
4176 return peer_af_flag_set_vty (vty
, peer
, bgp_node_afi (vty
), bgp_node_safi (vty
), flag
);
4179 ALIAS_HIDDEN (neighbor_send_community_type
,
4180 neighbor_send_community_type_hidden_cmd
,
4181 "neighbor <A.B.C.D|X:X::X:X|WORD> send-community <both|all|extended|standard|large>",
4184 "Send Community attribute to this neighbor\n"
4185 "Send Standard and Extended Community attributes\n"
4186 "Send Standard, Large and Extended Community attributes\n"
4187 "Send Extended Community attributes\n"
4188 "Send Standard Community attributes\n"
4189 "Send Large Community attributes\n")
4191 DEFUN (no_neighbor_send_community_type
,
4192 no_neighbor_send_community_type_cmd
,
4193 "no neighbor <A.B.C.D|X:X::X:X|WORD> send-community <both|all|extended|standard|large>",
4197 "Send Community attribute to this neighbor\n"
4198 "Send Standard and Extended Community attributes\n"
4199 "Send Standard, Large and Extended Community attributes\n"
4200 "Send Extended Community attributes\n"
4201 "Send Standard Community attributes\n"
4202 "Send Large Community attributes\n")
4206 if (strncmp (argv
[idx_type
]->arg
, "s", 1) == 0)
4207 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4208 bgp_node_safi (vty
),
4209 PEER_FLAG_SEND_COMMUNITY
);
4210 if (strncmp (argv
[idx_type
]->arg
, "e", 1) == 0)
4211 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4212 bgp_node_safi (vty
),
4213 PEER_FLAG_SEND_EXT_COMMUNITY
);
4214 if (strncmp (argv
[idx_type
]->arg
, "l", 1) == 0)
4215 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4216 bgp_node_safi (vty
),
4217 PEER_FLAG_SEND_LARGE_COMMUNITY
);
4218 if (strncmp (argv
[idx_type
]->arg
, "b", 1) == 0)
4219 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4220 bgp_node_safi (vty
),
4221 PEER_FLAG_SEND_COMMUNITY
|
4222 PEER_FLAG_SEND_EXT_COMMUNITY
);
4224 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4225 bgp_node_safi (vty
),
4226 (PEER_FLAG_SEND_COMMUNITY
|
4227 PEER_FLAG_SEND_EXT_COMMUNITY
|
4228 PEER_FLAG_SEND_LARGE_COMMUNITY
));
4231 ALIAS_HIDDEN (no_neighbor_send_community_type
,
4232 no_neighbor_send_community_type_hidden_cmd
,
4233 "no neighbor <A.B.C.D|X:X::X:X|WORD> send-community <both|all|extended|standard|large>",
4237 "Send Community attribute to this neighbor\n"
4238 "Send Standard and Extended Community attributes\n"
4239 "Send Standard, Large and Extended Community attributes\n"
4240 "Send Extended Community attributes\n"
4241 "Send Standard Community attributes\n"
4242 "Send Large Community attributes\n")
4244 /* neighbor soft-reconfig. */
4245 DEFUN (neighbor_soft_reconfiguration
,
4246 neighbor_soft_reconfiguration_cmd
,
4247 "neighbor <A.B.C.D|X:X::X:X|WORD> soft-reconfiguration inbound",
4250 "Per neighbor soft reconfiguration\n"
4251 "Allow inbound soft reconfiguration for this neighbor\n")
4254 return peer_af_flag_set_vty (vty
, argv
[idx_peer
]->arg
,
4255 bgp_node_afi (vty
), bgp_node_safi (vty
),
4256 PEER_FLAG_SOFT_RECONFIG
);
4259 ALIAS_HIDDEN (neighbor_soft_reconfiguration
,
4260 neighbor_soft_reconfiguration_hidden_cmd
,
4261 "neighbor <A.B.C.D|X:X::X:X|WORD> soft-reconfiguration inbound",
4264 "Per neighbor soft reconfiguration\n"
4265 "Allow inbound soft reconfiguration for this neighbor\n")
4267 DEFUN (no_neighbor_soft_reconfiguration
,
4268 no_neighbor_soft_reconfiguration_cmd
,
4269 "no neighbor <A.B.C.D|X:X::X:X|WORD> soft-reconfiguration inbound",
4273 "Per neighbor soft reconfiguration\n"
4274 "Allow inbound soft reconfiguration for this neighbor\n")
4277 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
,
4278 bgp_node_afi (vty
), bgp_node_safi (vty
),
4279 PEER_FLAG_SOFT_RECONFIG
);
4282 ALIAS_HIDDEN (no_neighbor_soft_reconfiguration
,
4283 no_neighbor_soft_reconfiguration_hidden_cmd
,
4284 "no neighbor <A.B.C.D|X:X::X:X|WORD> soft-reconfiguration inbound",
4288 "Per neighbor soft reconfiguration\n"
4289 "Allow inbound soft reconfiguration for this neighbor\n")
4291 DEFUN (neighbor_route_reflector_client
,
4292 neighbor_route_reflector_client_cmd
,
4293 "neighbor <A.B.C.D|X:X::X:X|WORD> route-reflector-client",
4296 "Configure a neighbor as Route Reflector client\n")
4302 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
4306 return peer_af_flag_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4307 bgp_node_safi (vty
),
4308 PEER_FLAG_REFLECTOR_CLIENT
);
4311 ALIAS_HIDDEN (neighbor_route_reflector_client
,
4312 neighbor_route_reflector_client_hidden_cmd
,
4313 "neighbor <A.B.C.D|X:X::X:X|WORD> route-reflector-client",
4316 "Configure a neighbor as Route Reflector client\n")
4318 DEFUN (no_neighbor_route_reflector_client
,
4319 no_neighbor_route_reflector_client_cmd
,
4320 "no neighbor <A.B.C.D|X:X::X:X|WORD> route-reflector-client",
4324 "Configure a neighbor as Route Reflector client\n")
4327 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4328 bgp_node_safi (vty
),
4329 PEER_FLAG_REFLECTOR_CLIENT
);
4332 ALIAS_HIDDEN (no_neighbor_route_reflector_client
,
4333 no_neighbor_route_reflector_client_hidden_cmd
,
4334 "no neighbor <A.B.C.D|X:X::X:X|WORD> route-reflector-client",
4338 "Configure a neighbor as Route Reflector client\n")
4340 /* neighbor route-server-client. */
4341 DEFUN (neighbor_route_server_client
,
4342 neighbor_route_server_client_cmd
,
4343 "neighbor <A.B.C.D|X:X::X:X|WORD> route-server-client",
4346 "Configure a neighbor as Route Server client\n")
4351 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
4354 return peer_af_flag_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4355 bgp_node_safi (vty
),
4356 PEER_FLAG_RSERVER_CLIENT
);
4359 ALIAS_HIDDEN (neighbor_route_server_client
,
4360 neighbor_route_server_client_hidden_cmd
,
4361 "neighbor <A.B.C.D|X:X::X:X|WORD> route-server-client",
4364 "Configure a neighbor as Route Server client\n")
4366 DEFUN (no_neighbor_route_server_client
,
4367 no_neighbor_route_server_client_cmd
,
4368 "no neighbor <A.B.C.D|X:X::X:X|WORD> route-server-client",
4372 "Configure a neighbor as Route Server client\n")
4375 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4376 bgp_node_safi (vty
),
4377 PEER_FLAG_RSERVER_CLIENT
);
4380 ALIAS_HIDDEN (no_neighbor_route_server_client
,
4381 no_neighbor_route_server_client_hidden_cmd
,
4382 "no neighbor <A.B.C.D|X:X::X:X|WORD> route-server-client",
4386 "Configure a neighbor as Route Server client\n")
4388 DEFUN (neighbor_nexthop_local_unchanged
,
4389 neighbor_nexthop_local_unchanged_cmd
,
4390 "neighbor <A.B.C.D|X:X::X:X|WORD> nexthop-local unchanged",
4393 "Configure treatment of outgoing link-local nexthop attribute\n"
4394 "Leave link-local nexthop unchanged for this peer\n")
4397 return peer_af_flag_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4398 bgp_node_safi (vty
),
4399 PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED
);
4402 DEFUN (no_neighbor_nexthop_local_unchanged
,
4403 no_neighbor_nexthop_local_unchanged_cmd
,
4404 "no neighbor <A.B.C.D|X:X::X:X|WORD> nexthop-local unchanged",
4408 "Configure treatment of outgoing link-local-nexthop attribute\n"
4409 "Leave link-local nexthop unchanged for this peer\n")
4412 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4413 bgp_node_safi (vty
),
4414 PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED
);
4417 DEFUN (neighbor_attr_unchanged
,
4418 neighbor_attr_unchanged_cmd
,
4419 "neighbor <A.B.C.D|X:X::X:X|WORD> attribute-unchanged\
4421 as-path [<next-hop [med]|med [next-hop]>]|\
4422 next-hop [<as-path [med]|med [as-path]>]|\
4423 med [<as-path [next-hop]|next-hop [as-path]>]\
4427 "BGP attribute is propagated unchanged to this neighbor\n"
4428 "As-path attribute\n"
4429 "Nexthop attribute\n"
4432 "Nexthop attribute\n"
4433 "Nexthop attribute\n"
4434 "As-path attribute\n"
4437 "As-path attribute\n"
4439 "As-path attribute\n"
4440 "Nexthop attribute\n"
4441 "Nexthop attribute\n"
4442 "As-path attribute\n")
4445 char *peer
= argv
[1]->arg
;
4446 u_int16_t flags
= 0;
4448 if (argv_find (argv
, argc
, "as-path", &idx
))
4449 SET_FLAG (flags
, PEER_FLAG_AS_PATH_UNCHANGED
);
4451 if (argv_find (argv
, argc
, "next-hop", &idx
))
4452 SET_FLAG (flags
, PEER_FLAG_NEXTHOP_UNCHANGED
);
4454 if (argv_find (argv
, argc
, "med", &idx
))
4455 SET_FLAG (flags
, PEER_FLAG_MED_UNCHANGED
);
4457 if (!flags
) // no flags means all of them!
4459 SET_FLAG (flags
, PEER_FLAG_AS_PATH_UNCHANGED
);
4460 SET_FLAG (flags
, PEER_FLAG_NEXTHOP_UNCHANGED
);
4461 SET_FLAG (flags
, PEER_FLAG_MED_UNCHANGED
);
4464 return peer_af_flag_set_vty (vty
, peer
, bgp_node_afi (vty
), bgp_node_safi (vty
), flags
);
4467 ALIAS_HIDDEN (neighbor_attr_unchanged
,
4468 neighbor_attr_unchanged_hidden_cmd
,
4469 "neighbor <A.B.C.D|X:X::X:X|WORD> attribute-unchanged\
4471 as-path [<next-hop [med]|med [next-hop]>]|\
4472 next-hop [<as-path [med]|med [as-path]>]|\
4473 med [<as-path [next-hop]|next-hop [as-path]>]\
4477 "BGP attribute is propagated unchanged to this neighbor\n"
4478 "As-path attribute\n"
4479 "Nexthop attribute\n"
4482 "Nexthop attribute\n"
4483 "Nexthop attribute\n"
4484 "As-path attribute\n"
4487 "As-path attribute\n"
4489 "As-path attribute\n"
4490 "Nexthop attribute\n"
4491 "Nexthop attribute\n"
4492 "As-path attribute\n")
4494 DEFUN (no_neighbor_attr_unchanged
,
4495 no_neighbor_attr_unchanged_cmd
,
4496 "no neighbor <A.B.C.D|X:X::X:X|WORD> attribute-unchanged\
4498 as-path [<next-hop [med]|med [next-hop]>]|\
4499 next-hop [<as-path [med]|med [as-path]>]|\
4500 med [<as-path [next-hop]|next-hop [as-path]>]\
4505 "BGP attribute is propagated unchanged to this neighbor\n"
4506 "As-path attribute\n"
4507 "Nexthop attribute\n"
4510 "Nexthop attribute\n"
4511 "Nexthop attribute\n"
4512 "As-path attribute\n"
4515 "As-path attribute\n"
4517 "As-path attribute\n"
4518 "Nexthop attribute\n"
4519 "Nexthop attribute\n"
4520 "As-path attribute\n")
4523 char *peer
= argv
[2]->arg
;
4524 u_int16_t flags
= 0;
4526 if (argv_find (argv
, argc
, "as-path", &idx
))
4527 SET_FLAG (flags
, PEER_FLAG_AS_PATH_UNCHANGED
);
4529 if (argv_find (argv
, argc
, "next-hop", &idx
))
4530 SET_FLAG (flags
, PEER_FLAG_NEXTHOP_UNCHANGED
);
4532 if (argv_find (argv
, argc
, "med", &idx
))
4533 SET_FLAG (flags
, PEER_FLAG_MED_UNCHANGED
);
4535 if (!flags
) // no flags means all of them!
4537 SET_FLAG (flags
, PEER_FLAG_AS_PATH_UNCHANGED
);
4538 SET_FLAG (flags
, PEER_FLAG_NEXTHOP_UNCHANGED
);
4539 SET_FLAG (flags
, PEER_FLAG_MED_UNCHANGED
);
4542 return peer_af_flag_unset_vty (vty
, peer
, bgp_node_afi (vty
), bgp_node_safi (vty
), flags
);
4545 ALIAS_HIDDEN (no_neighbor_attr_unchanged
,
4546 no_neighbor_attr_unchanged_hidden_cmd
,
4547 "no neighbor <A.B.C.D|X:X::X:X|WORD> attribute-unchanged\
4549 as-path [<next-hop [med]|med [next-hop]>]|\
4550 next-hop [<as-path [med]|med [as-path]>]|\
4551 med [<as-path [next-hop]|next-hop [as-path]>]\
4556 "BGP attribute is propagated unchanged to this neighbor\n"
4557 "As-path attribute\n"
4558 "Nexthop attribute\n"
4561 "Nexthop attribute\n"
4562 "Nexthop attribute\n"
4563 "As-path attribute\n"
4566 "As-path attribute\n"
4568 "As-path attribute\n"
4569 "Nexthop attribute\n"
4570 "Nexthop attribute\n"
4571 "As-path attribute\n")
4574 /* EBGP multihop configuration. */
4576 peer_ebgp_multihop_set_vty (struct vty
*vty
, const char *ip_str
,
4577 const char *ttl_str
)
4582 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
4587 return bgp_vty_return (vty
, BGP_ERR_INVALID_FOR_DIRECT_PEER
);
4592 VTY_GET_INTEGER_RANGE ("TTL", ttl
, ttl_str
, 1, MAXTTL
);
4594 return bgp_vty_return (vty
, peer_ebgp_multihop_set (peer
, ttl
));
4598 peer_ebgp_multihop_unset_vty (struct vty
*vty
, const char *ip_str
)
4602 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
4606 return bgp_vty_return (vty
, peer_ebgp_multihop_unset (peer
));
4609 /* neighbor ebgp-multihop. */
4610 DEFUN (neighbor_ebgp_multihop
,
4611 neighbor_ebgp_multihop_cmd
,
4612 "neighbor <A.B.C.D|X:X::X:X|WORD> ebgp-multihop",
4615 "Allow EBGP neighbors not on directly connected networks\n")
4618 return peer_ebgp_multihop_set_vty (vty
, argv
[idx_peer
]->arg
, NULL
);
4621 DEFUN (neighbor_ebgp_multihop_ttl
,
4622 neighbor_ebgp_multihop_ttl_cmd
,
4623 "neighbor <A.B.C.D|X:X::X:X|WORD> ebgp-multihop (1-255)",
4626 "Allow EBGP neighbors not on directly connected networks\n"
4627 "maximum hop count\n")
4631 return peer_ebgp_multihop_set_vty (vty
, argv
[idx_peer
]->arg
, argv
[idx_number
]->arg
);
4634 DEFUN (no_neighbor_ebgp_multihop
,
4635 no_neighbor_ebgp_multihop_cmd
,
4636 "no neighbor <A.B.C.D|X:X::X:X|WORD> ebgp-multihop [(1-255)]",
4640 "Allow EBGP neighbors not on directly connected networks\n"
4641 "maximum hop count\n")
4644 return peer_ebgp_multihop_unset_vty (vty
, argv
[idx_peer
]->arg
);
4648 /* disable-connected-check */
4649 DEFUN (neighbor_disable_connected_check
,
4650 neighbor_disable_connected_check_cmd
,
4651 "neighbor <A.B.C.D|X:X::X:X|WORD> <disable-connected-check|enforce-multihop>",
4654 "one-hop away EBGP peer using loopback address\n"
4655 "Enforce EBGP neighbors perform multihop\n")
4658 return peer_flag_set_vty (vty
, argv
[idx_peer
]->arg
, PEER_FLAG_DISABLE_CONNECTED_CHECK
);
4661 DEFUN (no_neighbor_disable_connected_check
,
4662 no_neighbor_disable_connected_check_cmd
,
4663 "no neighbor <A.B.C.D|X:X::X:X|WORD> <disable-connected-check|enforce-multihop>",
4667 "one-hop away EBGP peer using loopback address\n"
4668 "Enforce EBGP neighbors perform multihop\n")
4671 return peer_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, PEER_FLAG_DISABLE_CONNECTED_CHECK
);
4674 DEFUN (neighbor_description
,
4675 neighbor_description_cmd
,
4676 "neighbor <A.B.C.D|X:X::X:X|WORD> description LINE...",
4679 "Neighbor specific description\n"
4680 "Up to 80 characters describing this neighbor\n")
4687 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
4691 str
= argv_concat(argv
, argc
, idx_line
);
4693 peer_description_set (peer
, str
);
4695 XFREE (MTYPE_TMP
, str
);
4700 DEFUN (no_neighbor_description
,
4701 no_neighbor_description_cmd
,
4702 "no neighbor <A.B.C.D|X:X::X:X|WORD> description [LINE]",
4706 "Neighbor specific description\n"
4707 "Up to 80 characters describing this neighbor\n")
4712 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
4716 peer_description_unset (peer
);
4722 /* Neighbor update-source. */
4724 peer_update_source_vty (struct vty
*vty
, const char *peer_str
,
4725 const char *source_str
)
4730 peer
= peer_and_group_lookup_vty (vty
, peer_str
);
4740 int ret
= str2sockunion (source_str
, &su
);
4743 peer_update_source_addr_set (peer
, &su
);
4746 if (str2prefix (source_str
, &p
))
4748 vty_out (vty
, "%% Invalid update-source, remove prefix length %s",
4753 peer_update_source_if_set (peer
, source_str
);
4757 peer_update_source_unset (peer
);
4762 #define BGP_UPDATE_SOURCE_HELP_STR \
4765 "Interface name (requires zebra to be running)\n"
4767 DEFUN (neighbor_update_source
,
4768 neighbor_update_source_cmd
,
4769 "neighbor <A.B.C.D|X:X::X:X|WORD> update-source <A.B.C.D|X:X::X:X|WORD>",
4772 "Source of routing updates\n"
4773 BGP_UPDATE_SOURCE_HELP_STR
)
4777 return peer_update_source_vty (vty
, argv
[idx_peer
]->arg
, argv
[idx_peer_2
]->arg
);
4780 DEFUN (no_neighbor_update_source
,
4781 no_neighbor_update_source_cmd
,
4782 "no neighbor <A.B.C.D|X:X::X:X|WORD> update-source [<A.B.C.D|X:X::X:X|WORD>]",
4786 "Source of routing updates\n"
4787 BGP_UPDATE_SOURCE_HELP_STR
)
4790 return peer_update_source_vty (vty
, argv
[idx_peer
]->arg
, NULL
);
4794 peer_default_originate_set_vty (struct vty
*vty
, const char *peer_str
,
4795 afi_t afi
, safi_t safi
,
4796 const char *rmap
, int set
)
4801 peer
= peer_and_group_lookup_vty (vty
, peer_str
);
4806 ret
= peer_default_originate_set (peer
, afi
, safi
, rmap
);
4808 ret
= peer_default_originate_unset (peer
, afi
, safi
);
4810 return bgp_vty_return (vty
, ret
);
4813 /* neighbor default-originate. */
4814 DEFUN (neighbor_default_originate
,
4815 neighbor_default_originate_cmd
,
4816 "neighbor <A.B.C.D|X:X::X:X|WORD> default-originate",
4819 "Originate default route to this neighbor\n")
4822 return peer_default_originate_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4823 bgp_node_safi (vty
), NULL
, 1);
4826 ALIAS_HIDDEN (neighbor_default_originate
,
4827 neighbor_default_originate_hidden_cmd
,
4828 "neighbor <A.B.C.D|X:X::X:X|WORD> default-originate",
4831 "Originate default route to this neighbor\n")
4833 DEFUN (neighbor_default_originate_rmap
,
4834 neighbor_default_originate_rmap_cmd
,
4835 "neighbor <A.B.C.D|X:X::X:X|WORD> default-originate route-map WORD",
4838 "Originate default route to this neighbor\n"
4839 "Route-map to specify criteria to originate default\n"
4844 return peer_default_originate_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4845 bgp_node_safi (vty
), argv
[idx_word
]->arg
, 1);
4848 ALIAS_HIDDEN (neighbor_default_originate_rmap
,
4849 neighbor_default_originate_rmap_hidden_cmd
,
4850 "neighbor <A.B.C.D|X:X::X:X|WORD> default-originate route-map WORD",
4853 "Originate default route to this neighbor\n"
4854 "Route-map to specify criteria to originate default\n"
4857 DEFUN (no_neighbor_default_originate
,
4858 no_neighbor_default_originate_cmd
,
4859 "no neighbor <A.B.C.D|X:X::X:X|WORD> default-originate [route-map WORD]",
4863 "Originate default route to this neighbor\n"
4864 "Route-map to specify criteria to originate default\n"
4868 return peer_default_originate_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4869 bgp_node_safi (vty
), NULL
, 0);
4872 ALIAS_HIDDEN (no_neighbor_default_originate
,
4873 no_neighbor_default_originate_hidden_cmd
,
4874 "no neighbor <A.B.C.D|X:X::X:X|WORD> default-originate [route-map WORD]",
4878 "Originate default route to this neighbor\n"
4879 "Route-map to specify criteria to originate default\n"
4883 /* Set neighbor's BGP port. */
4885 peer_port_vty (struct vty
*vty
, const char *ip_str
, int afi
,
4886 const char *port_str
)
4892 peer
= peer_lookup_vty (vty
, ip_str
);
4898 sp
= getservbyname ("bgp", "tcp");
4899 port
= (sp
== NULL
) ? BGP_PORT_DEFAULT
: ntohs (sp
->s_port
);
4903 VTY_GET_INTEGER("port", port
, port_str
);
4906 peer_port_set (peer
, port
);
4911 /* Set specified peer's BGP port. */
4912 DEFUN (neighbor_port
,
4914 "neighbor <A.B.C.D|X:X::X:X> port (0-65535)",
4917 "Neighbor's BGP port\n"
4918 "TCP port number\n")
4922 return peer_port_vty (vty
, argv
[idx_ip
]->arg
, AFI_IP
, argv
[idx_number
]->arg
);
4925 DEFUN (no_neighbor_port
,
4926 no_neighbor_port_cmd
,
4927 "no neighbor <A.B.C.D|X:X::X:X> port [(0-65535)]",
4931 "Neighbor's BGP port\n"
4932 "TCP port number\n")
4935 return peer_port_vty (vty
, argv
[idx_ip
]->arg
, AFI_IP
, NULL
);
4939 /* neighbor weight. */
4941 peer_weight_set_vty (struct vty
*vty
, const char *ip_str
,
4942 afi_t afi
, safi_t safi
,
4943 const char *weight_str
)
4947 unsigned long weight
;
4949 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
4953 VTY_GET_INTEGER_RANGE("weight", weight
, weight_str
, 0, 65535);
4955 ret
= peer_weight_set (peer
, afi
, safi
, weight
);
4956 return bgp_vty_return (vty
, ret
);
4960 peer_weight_unset_vty (struct vty
*vty
, const char *ip_str
,
4961 afi_t afi
, safi_t safi
)
4966 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
4970 ret
= peer_weight_unset (peer
, afi
, safi
);
4971 return bgp_vty_return (vty
, ret
);
4974 DEFUN (neighbor_weight
,
4975 neighbor_weight_cmd
,
4976 "neighbor <A.B.C.D|X:X::X:X|WORD> weight (0-65535)",
4979 "Set default weight for routes from this neighbor\n"
4984 return peer_weight_set_vty (vty
,
4985 argv
[idx_peer
]->arg
,
4987 bgp_node_safi (vty
),
4988 argv
[idx_number
]->arg
);
4991 ALIAS_HIDDEN (neighbor_weight
,
4992 neighbor_weight_hidden_cmd
,
4993 "neighbor <A.B.C.D|X:X::X:X|WORD> weight (0-65535)",
4996 "Set default weight for routes from this neighbor\n"
4999 DEFUN (no_neighbor_weight
,
5000 no_neighbor_weight_cmd
,
5001 "no neighbor <A.B.C.D|X:X::X:X|WORD> weight [(0-65535)]",
5005 "Set default weight for routes from this neighbor\n"
5009 return peer_weight_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
), bgp_node_safi (vty
));
5012 ALIAS_HIDDEN (no_neighbor_weight
,
5013 no_neighbor_weight_hidden_cmd
,
5014 "no neighbor <A.B.C.D|X:X::X:X|WORD> weight [(0-65535)]",
5018 "Set default weight for routes from this neighbor\n"
5022 /* Override capability negotiation. */
5023 DEFUN (neighbor_override_capability
,
5024 neighbor_override_capability_cmd
,
5025 "neighbor <A.B.C.D|X:X::X:X|WORD> override-capability",
5028 "Override capability negotiation result\n")
5031 return peer_flag_set_vty (vty
, argv
[idx_peer
]->arg
, PEER_FLAG_OVERRIDE_CAPABILITY
);
5034 DEFUN (no_neighbor_override_capability
,
5035 no_neighbor_override_capability_cmd
,
5036 "no neighbor <A.B.C.D|X:X::X:X|WORD> override-capability",
5040 "Override capability negotiation result\n")
5043 return peer_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, PEER_FLAG_OVERRIDE_CAPABILITY
);
5046 DEFUN (neighbor_strict_capability
,
5047 neighbor_strict_capability_cmd
,
5048 "neighbor <A.B.C.D|X:X::X:X> strict-capability-match",
5051 "Strict capability negotiation match\n")
5054 return peer_flag_set_vty (vty
, argv
[idx_ip
]->arg
, PEER_FLAG_STRICT_CAP_MATCH
);
5057 DEFUN (no_neighbor_strict_capability
,
5058 no_neighbor_strict_capability_cmd
,
5059 "no neighbor <A.B.C.D|X:X::X:X> strict-capability-match",
5063 "Strict capability negotiation match\n")
5066 return peer_flag_unset_vty (vty
, argv
[idx_ip
]->arg
, PEER_FLAG_STRICT_CAP_MATCH
);
5070 peer_timers_set_vty (struct vty
*vty
, const char *ip_str
,
5071 const char *keep_str
, const char *hold_str
)
5075 u_int32_t keepalive
;
5078 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
5082 VTY_GET_INTEGER_RANGE ("Keepalive", keepalive
, keep_str
, 0, 65535);
5083 VTY_GET_INTEGER_RANGE ("Holdtime", holdtime
, hold_str
, 0, 65535);
5085 ret
= peer_timers_set (peer
, keepalive
, holdtime
);
5087 return bgp_vty_return (vty
, ret
);
5091 peer_timers_unset_vty (struct vty
*vty
, const char *ip_str
)
5096 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
5100 ret
= peer_timers_unset (peer
);
5102 return bgp_vty_return (vty
, ret
);
5105 DEFUN (neighbor_timers
,
5106 neighbor_timers_cmd
,
5107 "neighbor <A.B.C.D|X:X::X:X|WORD> timers (0-65535) (0-65535)",
5110 "BGP per neighbor timers\n"
5111 "Keepalive interval\n"
5116 int idx_number_2
= 4;
5117 return peer_timers_set_vty (vty
, argv
[idx_peer
]->arg
, argv
[idx_number
]->arg
, argv
[idx_number_2
]->arg
);
5120 DEFUN (no_neighbor_timers
,
5121 no_neighbor_timers_cmd
,
5122 "no neighbor <A.B.C.D|X:X::X:X|WORD> timers [(0-65535) (0-65535)]",
5126 "BGP per neighbor timers\n"
5127 "Keepalive interval\n"
5131 return peer_timers_unset_vty (vty
, argv
[idx_peer
]->arg
);
5136 peer_timers_connect_set_vty (struct vty
*vty
, const char *ip_str
,
5137 const char *time_str
)
5143 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
5147 VTY_GET_INTEGER_RANGE ("Connect time", connect
, time_str
, 0, 65535);
5149 ret
= peer_timers_connect_set (peer
, connect
);
5151 return bgp_vty_return (vty
, ret
);
5155 peer_timers_connect_unset_vty (struct vty
*vty
, const char *ip_str
)
5160 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
5164 ret
= peer_timers_connect_unset (peer
);
5166 return bgp_vty_return (vty
, ret
);
5169 DEFUN (neighbor_timers_connect
,
5170 neighbor_timers_connect_cmd
,
5171 "neighbor <A.B.C.D|X:X::X:X|WORD> timers connect (1-65535)",
5174 "BGP per neighbor timers\n"
5175 "BGP connect timer\n"
5180 return peer_timers_connect_set_vty (vty
, argv
[idx_peer
]->arg
, argv
[idx_number
]->arg
);
5183 DEFUN (no_neighbor_timers_connect
,
5184 no_neighbor_timers_connect_cmd
,
5185 "no neighbor <A.B.C.D|X:X::X:X|WORD> timers connect [(1-65535)]",
5189 "BGP per neighbor timers\n"
5190 "BGP connect timer\n"
5194 return peer_timers_connect_unset_vty (vty
, argv
[idx_peer
]->arg
);
5199 peer_advertise_interval_vty (struct vty
*vty
, const char *ip_str
,
5200 const char *time_str
, int set
)
5204 u_int32_t routeadv
= 0;
5206 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
5211 VTY_GET_INTEGER_RANGE ("advertise interval", routeadv
, time_str
, 0, 600);
5214 ret
= peer_advertise_interval_set (peer
, routeadv
);
5216 ret
= peer_advertise_interval_unset (peer
);
5218 return bgp_vty_return (vty
, ret
);
5221 DEFUN (neighbor_advertise_interval
,
5222 neighbor_advertise_interval_cmd
,
5223 "neighbor <A.B.C.D|X:X::X:X|WORD> advertisement-interval (0-600)",
5226 "Minimum interval between sending BGP routing updates\n"
5227 "time in seconds\n")
5231 return peer_advertise_interval_vty (vty
, argv
[idx_peer
]->arg
, argv
[idx_number
]->arg
, 1);
5234 DEFUN (no_neighbor_advertise_interval
,
5235 no_neighbor_advertise_interval_cmd
,
5236 "no neighbor <A.B.C.D|X:X::X:X|WORD> advertisement-interval [(0-600)]",
5240 "Minimum interval between sending BGP routing updates\n"
5241 "time in seconds\n")
5244 return peer_advertise_interval_vty (vty
, argv
[idx_peer
]->arg
, NULL
, 0);
5248 /* Time to wait before processing route-map updates */
5249 DEFUN (bgp_set_route_map_delay_timer
,
5250 bgp_set_route_map_delay_timer_cmd
,
5251 "bgp route-map delay-timer (0-600)",
5253 "BGP route-map delay timer\n"
5254 "Time in secs to wait before processing route-map changes\n"
5255 "0 disables the timer, no route updates happen when route-maps change\n")
5258 u_int32_t rmap_delay_timer
;
5260 if (argv
[idx_number
]->arg
)
5262 VTY_GET_INTEGER_RANGE ("delay-timer", rmap_delay_timer
, argv
[idx_number
]->arg
, 0, 600);
5263 bm
->rmap_update_timer
= rmap_delay_timer
;
5265 /* if the dynamic update handling is being disabled, and a timer is
5266 * running, stop the timer and act as if the timer has already fired.
5268 if (!rmap_delay_timer
&& bm
->t_rmap_update
)
5270 BGP_TIMER_OFF(bm
->t_rmap_update
);
5271 thread_execute (bm
->master
, bgp_route_map_update_timer
, NULL
, 0);
5279 DEFUN (no_bgp_set_route_map_delay_timer
,
5280 no_bgp_set_route_map_delay_timer_cmd
,
5281 "no bgp route-map delay-timer [(0-600)]",
5284 "Default BGP route-map delay timer\n"
5285 "Reset to default time to wait for processing route-map changes\n"
5286 "0 disables the timer, no route updates happen when route-maps change\n")
5289 bm
->rmap_update_timer
= RMAP_DEFAULT_UPDATE_TIMER
;
5295 /* neighbor interface */
5297 peer_interface_vty (struct vty
*vty
, const char *ip_str
, const char *str
)
5301 peer
= peer_lookup_vty (vty
, ip_str
);
5302 if (! peer
|| peer
->conf_if
)
5306 peer_interface_set (peer
, str
);
5308 peer_interface_unset (peer
);
5313 DEFUN (neighbor_interface
,
5314 neighbor_interface_cmd
,
5315 "neighbor <A.B.C.D|X:X::X:X> interface WORD",
5323 return peer_interface_vty (vty
, argv
[idx_ip
]->arg
, argv
[idx_word
]->arg
);
5326 DEFUN (no_neighbor_interface
,
5327 no_neighbor_interface_cmd
,
5328 "no neighbor <A.B.C.D|X:X::X:X|WORD> interface WORD",
5336 return peer_interface_vty (vty
, argv
[idx_peer
]->arg
, NULL
);
5339 /* Set distribute list to the peer. */
5341 peer_distribute_set_vty (struct vty
*vty
, const char *ip_str
,
5342 afi_t afi
, safi_t safi
,
5343 const char *name_str
, const char *direct_str
)
5347 int direct
= FILTER_IN
;
5349 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
5353 /* Check filter direction. */
5354 if (strncmp (direct_str
, "i", 1) == 0)
5356 else if (strncmp (direct_str
, "o", 1) == 0)
5357 direct
= FILTER_OUT
;
5359 ret
= peer_distribute_set (peer
, afi
, safi
, direct
, name_str
);
5361 return bgp_vty_return (vty
, ret
);
5365 peer_distribute_unset_vty (struct vty
*vty
, const char *ip_str
, afi_t afi
,
5366 safi_t safi
, const char *direct_str
)
5370 int direct
= FILTER_IN
;
5372 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
5376 /* Check filter direction. */
5377 if (strncmp (direct_str
, "i", 1) == 0)
5379 else if (strncmp (direct_str
, "o", 1) == 0)
5380 direct
= FILTER_OUT
;
5382 ret
= peer_distribute_unset (peer
, afi
, safi
, direct
);
5384 return bgp_vty_return (vty
, ret
);
5387 DEFUN (neighbor_distribute_list
,
5388 neighbor_distribute_list_cmd
,
5389 "neighbor <A.B.C.D|X:X::X:X|WORD> distribute-list <(1-199)|(1300-2699)|WORD> <in|out>",
5392 "Filter updates to/from this neighbor\n"
5393 "IP access-list number\n"
5394 "IP access-list number (expanded range)\n"
5395 "IP Access-list name\n"
5396 "Filter incoming updates\n"
5397 "Filter outgoing updates\n")
5402 return peer_distribute_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
5403 bgp_node_safi (vty
), argv
[idx_acl
]->arg
, argv
[idx_in_out
]->arg
);
5406 ALIAS_HIDDEN (neighbor_distribute_list
,
5407 neighbor_distribute_list_hidden_cmd
,
5408 "neighbor <A.B.C.D|X:X::X:X|WORD> distribute-list <(1-199)|(1300-2699)|WORD> <in|out>",
5411 "Filter updates to/from this neighbor\n"
5412 "IP access-list number\n"
5413 "IP access-list number (expanded range)\n"
5414 "IP Access-list name\n"
5415 "Filter incoming updates\n"
5416 "Filter outgoing updates\n")
5418 DEFUN (no_neighbor_distribute_list
,
5419 no_neighbor_distribute_list_cmd
,
5420 "no neighbor <A.B.C.D|X:X::X:X|WORD> distribute-list <(1-199)|(1300-2699)|WORD> <in|out>",
5424 "Filter updates to/from this neighbor\n"
5425 "IP access-list number\n"
5426 "IP access-list number (expanded range)\n"
5427 "IP Access-list name\n"
5428 "Filter incoming updates\n"
5429 "Filter outgoing updates\n")
5433 return peer_distribute_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
5434 bgp_node_safi (vty
), argv
[idx_in_out
]->arg
);
5437 ALIAS_HIDDEN (no_neighbor_distribute_list
,
5438 no_neighbor_distribute_list_hidden_cmd
,
5439 "no neighbor <A.B.C.D|X:X::X:X|WORD> distribute-list <(1-199)|(1300-2699)|WORD> <in|out>",
5443 "Filter updates to/from this neighbor\n"
5444 "IP access-list number\n"
5445 "IP access-list number (expanded range)\n"
5446 "IP Access-list name\n"
5447 "Filter incoming updates\n"
5448 "Filter outgoing updates\n")
5450 /* Set prefix list to the peer. */
5452 peer_prefix_list_set_vty (struct vty
*vty
, const char *ip_str
, afi_t afi
,
5453 safi_t safi
, const char *name_str
,
5454 const char *direct_str
)
5458 int direct
= FILTER_IN
;
5460 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
5464 /* Check filter direction. */
5465 if (strncmp (direct_str
, "i", 1) == 0)
5467 else if (strncmp (direct_str
, "o", 1) == 0)
5468 direct
= FILTER_OUT
;
5470 ret
= peer_prefix_list_set (peer
, afi
, safi
, direct
, name_str
);
5472 return bgp_vty_return (vty
, ret
);
5476 peer_prefix_list_unset_vty (struct vty
*vty
, const char *ip_str
, afi_t afi
,
5477 safi_t safi
, const char *direct_str
)
5481 int direct
= FILTER_IN
;
5483 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
5487 /* Check filter direction. */
5488 if (strncmp (direct_str
, "i", 1) == 0)
5490 else if (strncmp (direct_str
, "o", 1) == 0)
5491 direct
= FILTER_OUT
;
5493 ret
= peer_prefix_list_unset (peer
, afi
, safi
, direct
);
5495 return bgp_vty_return (vty
, ret
);
5498 DEFUN (neighbor_prefix_list
,
5499 neighbor_prefix_list_cmd
,
5500 "neighbor <A.B.C.D|X:X::X:X|WORD> prefix-list WORD <in|out>",
5503 "Filter updates to/from this neighbor\n"
5504 "Name of a prefix list\n"
5505 "Filter incoming updates\n"
5506 "Filter outgoing updates\n")
5511 return peer_prefix_list_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
5512 bgp_node_safi (vty
), argv
[idx_word
]->arg
, argv
[idx_in_out
]->arg
);
5515 ALIAS_HIDDEN (neighbor_prefix_list
,
5516 neighbor_prefix_list_hidden_cmd
,
5517 "neighbor <A.B.C.D|X:X::X:X|WORD> prefix-list WORD <in|out>",
5520 "Filter updates to/from this neighbor\n"
5521 "Name of a prefix list\n"
5522 "Filter incoming updates\n"
5523 "Filter outgoing updates\n")
5525 DEFUN (no_neighbor_prefix_list
,
5526 no_neighbor_prefix_list_cmd
,
5527 "no neighbor <A.B.C.D|X:X::X:X|WORD> prefix-list WORD <in|out>",
5531 "Filter updates to/from this neighbor\n"
5532 "Name of a prefix list\n"
5533 "Filter incoming updates\n"
5534 "Filter outgoing updates\n")
5538 return peer_prefix_list_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
5539 bgp_node_safi (vty
), argv
[idx_in_out
]->arg
);
5542 ALIAS_HIDDEN (no_neighbor_prefix_list
,
5543 no_neighbor_prefix_list_hidden_cmd
,
5544 "no neighbor <A.B.C.D|X:X::X:X|WORD> prefix-list WORD <in|out>",
5548 "Filter updates to/from this neighbor\n"
5549 "Name of a prefix list\n"
5550 "Filter incoming updates\n"
5551 "Filter outgoing updates\n")
5554 peer_aslist_set_vty (struct vty
*vty
, const char *ip_str
,
5555 afi_t afi
, safi_t safi
,
5556 const char *name_str
, const char *direct_str
)
5560 int direct
= FILTER_IN
;
5562 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
5566 /* Check filter direction. */
5567 if (strncmp (direct_str
, "i", 1) == 0)
5569 else if (strncmp (direct_str
, "o", 1) == 0)
5570 direct
= FILTER_OUT
;
5572 ret
= peer_aslist_set (peer
, afi
, safi
, direct
, name_str
);
5574 return bgp_vty_return (vty
, ret
);
5578 peer_aslist_unset_vty (struct vty
*vty
, const char *ip_str
,
5579 afi_t afi
, safi_t safi
,
5580 const char *direct_str
)
5584 int direct
= FILTER_IN
;
5586 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
5590 /* Check filter direction. */
5591 if (strncmp (direct_str
, "i", 1) == 0)
5593 else if (strncmp (direct_str
, "o", 1) == 0)
5594 direct
= FILTER_OUT
;
5596 ret
= peer_aslist_unset (peer
, afi
, safi
, direct
);
5598 return bgp_vty_return (vty
, ret
);
5601 DEFUN (neighbor_filter_list
,
5602 neighbor_filter_list_cmd
,
5603 "neighbor <A.B.C.D|X:X::X:X|WORD> filter-list WORD <in|out>",
5606 "Establish BGP filters\n"
5607 "AS path access-list name\n"
5608 "Filter incoming routes\n"
5609 "Filter outgoing routes\n")
5614 return peer_aslist_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
5615 bgp_node_safi (vty
), argv
[idx_word
]->arg
, argv
[idx_in_out
]->arg
);
5618 ALIAS_HIDDEN (neighbor_filter_list
,
5619 neighbor_filter_list_hidden_cmd
,
5620 "neighbor <A.B.C.D|X:X::X:X|WORD> filter-list WORD <in|out>",
5623 "Establish BGP filters\n"
5624 "AS path access-list name\n"
5625 "Filter incoming routes\n"
5626 "Filter outgoing routes\n")
5628 DEFUN (no_neighbor_filter_list
,
5629 no_neighbor_filter_list_cmd
,
5630 "no neighbor <A.B.C.D|X:X::X:X|WORD> filter-list WORD <in|out>",
5634 "Establish BGP filters\n"
5635 "AS path access-list name\n"
5636 "Filter incoming routes\n"
5637 "Filter outgoing routes\n")
5641 return peer_aslist_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
5642 bgp_node_safi (vty
), argv
[idx_in_out
]->arg
);
5645 ALIAS_HIDDEN (no_neighbor_filter_list
,
5646 no_neighbor_filter_list_hidden_cmd
,
5647 "no neighbor <A.B.C.D|X:X::X:X|WORD> filter-list WORD <in|out>",
5651 "Establish BGP filters\n"
5652 "AS path access-list name\n"
5653 "Filter incoming routes\n"
5654 "Filter outgoing routes\n")
5656 /* Set route-map to the peer. */
5658 peer_route_map_set_vty (struct vty
*vty
, const char *ip_str
,
5659 afi_t afi
, safi_t safi
,
5660 const char *name_str
, const char *direct_str
)
5664 int direct
= RMAP_IN
;
5666 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
5670 /* Check filter direction. */
5671 if (strncmp (direct_str
, "in", 2) == 0)
5673 else if (strncmp (direct_str
, "o", 1) == 0)
5676 ret
= peer_route_map_set (peer
, afi
, safi
, direct
, name_str
);
5678 return bgp_vty_return (vty
, ret
);
5682 peer_route_map_unset_vty (struct vty
*vty
, const char *ip_str
, afi_t afi
,
5683 safi_t safi
, const char *direct_str
)
5687 int direct
= RMAP_IN
;
5689 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
5693 /* Check filter direction. */
5694 if (strncmp (direct_str
, "in", 2) == 0)
5696 else if (strncmp (direct_str
, "o", 1) == 0)
5699 ret
= peer_route_map_unset (peer
, afi
, safi
, direct
);
5701 return bgp_vty_return (vty
, ret
);
5704 DEFUN (neighbor_route_map
,
5705 neighbor_route_map_cmd
,
5706 "neighbor <A.B.C.D|X:X::X:X|WORD> route-map WORD <in|out>",
5709 "Apply route map to neighbor\n"
5710 "Name of route map\n"
5711 "Apply map to incoming routes\n"
5712 "Apply map to outbound routes\n")
5717 return peer_route_map_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
5718 bgp_node_safi (vty
), argv
[idx_word
]->arg
, argv
[idx_in_out
]->arg
);
5721 ALIAS_HIDDEN (neighbor_route_map
,
5722 neighbor_route_map_hidden_cmd
,
5723 "neighbor <A.B.C.D|X:X::X:X|WORD> route-map WORD <in|out>",
5726 "Apply route map to neighbor\n"
5727 "Name of route map\n"
5728 "Apply map to incoming routes\n"
5729 "Apply map to outbound routes\n")
5731 DEFUN (no_neighbor_route_map
,
5732 no_neighbor_route_map_cmd
,
5733 "no neighbor <A.B.C.D|X:X::X:X|WORD> route-map WORD <in|out>",
5737 "Apply route map to neighbor\n"
5738 "Name of route map\n"
5739 "Apply map to incoming routes\n"
5740 "Apply map to outbound routes\n")
5744 return peer_route_map_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
5745 bgp_node_safi (vty
), argv
[idx_in_out
]->arg
);
5748 ALIAS_HIDDEN (no_neighbor_route_map
,
5749 no_neighbor_route_map_hidden_cmd
,
5750 "no neighbor <A.B.C.D|X:X::X:X|WORD> route-map WORD <in|out>",
5754 "Apply route map to neighbor\n"
5755 "Name of route map\n"
5756 "Apply map to incoming routes\n"
5757 "Apply map to outbound routes\n")
5759 /* Set unsuppress-map to the peer. */
5761 peer_unsuppress_map_set_vty (struct vty
*vty
, const char *ip_str
, afi_t afi
,
5762 safi_t safi
, const char *name_str
)
5767 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
5771 ret
= peer_unsuppress_map_set (peer
, afi
, safi
, name_str
);
5773 return bgp_vty_return (vty
, ret
);
5776 /* Unset route-map from the peer. */
5778 peer_unsuppress_map_unset_vty (struct vty
*vty
, const char *ip_str
, afi_t afi
,
5784 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
5788 ret
= peer_unsuppress_map_unset (peer
, afi
, safi
);
5790 return bgp_vty_return (vty
, ret
);
5793 DEFUN (neighbor_unsuppress_map
,
5794 neighbor_unsuppress_map_cmd
,
5795 "neighbor <A.B.C.D|X:X::X:X|WORD> unsuppress-map WORD",
5798 "Route-map to selectively unsuppress suppressed routes\n"
5799 "Name of route map\n")
5803 return peer_unsuppress_map_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
5804 bgp_node_safi (vty
), argv
[idx_word
]->arg
);
5807 ALIAS_HIDDEN (neighbor_unsuppress_map
,
5808 neighbor_unsuppress_map_hidden_cmd
,
5809 "neighbor <A.B.C.D|X:X::X:X|WORD> unsuppress-map WORD",
5812 "Route-map to selectively unsuppress suppressed routes\n"
5813 "Name of route map\n")
5815 DEFUN (no_neighbor_unsuppress_map
,
5816 no_neighbor_unsuppress_map_cmd
,
5817 "no neighbor <A.B.C.D|X:X::X:X|WORD> unsuppress-map WORD",
5821 "Route-map to selectively unsuppress suppressed routes\n"
5822 "Name of route map\n")
5825 return peer_unsuppress_map_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
5826 bgp_node_safi (vty
));
5829 ALIAS_HIDDEN (no_neighbor_unsuppress_map
,
5830 no_neighbor_unsuppress_map_hidden_cmd
,
5831 "no neighbor <A.B.C.D|X:X::X:X|WORD> unsuppress-map WORD",
5835 "Route-map to selectively unsuppress suppressed routes\n"
5836 "Name of route map\n")
5839 peer_maximum_prefix_set_vty (struct vty
*vty
, const char *ip_str
, afi_t afi
,
5840 safi_t safi
, const char *num_str
,
5841 const char *threshold_str
, int warning
,
5842 const char *restart_str
)
5850 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
5854 VTY_GET_INTEGER ("maximum number", max
, num_str
);
5856 threshold
= atoi (threshold_str
);
5858 threshold
= MAXIMUM_PREFIX_THRESHOLD_DEFAULT
;
5861 restart
= atoi (restart_str
);
5865 ret
= peer_maximum_prefix_set (peer
, afi
, safi
, max
, threshold
, warning
, restart
);
5867 return bgp_vty_return (vty
, ret
);
5871 peer_maximum_prefix_unset_vty (struct vty
*vty
, const char *ip_str
, afi_t afi
,
5877 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
5881 ret
= peer_maximum_prefix_unset (peer
, afi
, safi
);
5883 return bgp_vty_return (vty
, ret
);
5886 /* Maximum number of prefix configuration. prefix count is different
5887 for each peer configuration. So this configuration can be set for
5888 each peer configuration. */
5889 DEFUN (neighbor_maximum_prefix
,
5890 neighbor_maximum_prefix_cmd
,
5891 "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295)",
5894 "Maximum number of prefix accept from this peer\n"
5895 "maximum no. of prefix limit\n")
5899 return peer_maximum_prefix_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
5900 bgp_node_safi (vty
), argv
[idx_number
]->arg
, NULL
, 0,
5904 ALIAS_HIDDEN (neighbor_maximum_prefix
,
5905 neighbor_maximum_prefix_hidden_cmd
,
5906 "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295)",
5909 "Maximum number of prefix accept from this peer\n"
5910 "maximum no. of prefix limit\n")
5912 DEFUN (neighbor_maximum_prefix_threshold
,
5913 neighbor_maximum_prefix_threshold_cmd
,
5914 "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295) (1-100)",
5917 "Maximum number of prefix accept from this peer\n"
5918 "maximum no. of prefix limit\n"
5919 "Threshold value (%) at which to generate a warning msg\n")
5923 int idx_number_2
= 4;
5924 return peer_maximum_prefix_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
5925 bgp_node_safi (vty
), argv
[idx_number
]->arg
, argv
[idx_number_2
]->arg
, 0,
5929 ALIAS_HIDDEN (neighbor_maximum_prefix_threshold
,
5930 neighbor_maximum_prefix_threshold_hidden_cmd
,
5931 "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295) (1-100)",
5934 "Maximum number of prefix accept from this peer\n"
5935 "maximum no. of prefix limit\n"
5936 "Threshold value (%) at which to generate a warning msg\n")
5938 DEFUN (neighbor_maximum_prefix_warning
,
5939 neighbor_maximum_prefix_warning_cmd
,
5940 "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295) warning-only",
5943 "Maximum number of prefix accept from this peer\n"
5944 "maximum no. of prefix limit\n"
5945 "Only give warning message when limit is exceeded\n")
5949 return peer_maximum_prefix_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
5950 bgp_node_safi (vty
), argv
[idx_number
]->arg
, NULL
, 1,
5954 ALIAS_HIDDEN (neighbor_maximum_prefix_warning
,
5955 neighbor_maximum_prefix_warning_hidden_cmd
,
5956 "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295) warning-only",
5959 "Maximum number of prefix accept from this peer\n"
5960 "maximum no. of prefix limit\n"
5961 "Only give warning message when limit is exceeded\n")
5963 DEFUN (neighbor_maximum_prefix_threshold_warning
,
5964 neighbor_maximum_prefix_threshold_warning_cmd
,
5965 "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295) (1-100) warning-only",
5968 "Maximum number of prefix accept from this peer\n"
5969 "maximum no. of prefix limit\n"
5970 "Threshold value (%) at which to generate a warning msg\n"
5971 "Only give warning message when limit is exceeded\n")
5975 int idx_number_2
= 4;
5976 return peer_maximum_prefix_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
5977 bgp_node_safi (vty
), argv
[idx_number
]->arg
, argv
[idx_number_2
]->arg
, 1, NULL
);
5980 ALIAS_HIDDEN (neighbor_maximum_prefix_threshold_warning
,
5981 neighbor_maximum_prefix_threshold_warning_hidden_cmd
,
5982 "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295) (1-100) warning-only",
5985 "Maximum number of prefix accept from this peer\n"
5986 "maximum no. of prefix limit\n"
5987 "Threshold value (%) at which to generate a warning msg\n"
5988 "Only give warning message when limit is exceeded\n")
5990 DEFUN (neighbor_maximum_prefix_restart
,
5991 neighbor_maximum_prefix_restart_cmd
,
5992 "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295) restart (1-65535)",
5995 "Maximum number of prefix accept from this peer\n"
5996 "maximum no. of prefix limit\n"
5997 "Restart bgp connection after limit is exceeded\n"
5998 "Restart interval in minutes")
6002 int idx_number_2
= 5;
6003 return peer_maximum_prefix_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
6004 bgp_node_safi (vty
), argv
[idx_number
]->arg
, NULL
, 0, argv
[idx_number_2
]->arg
);
6007 ALIAS_HIDDEN (neighbor_maximum_prefix_restart
,
6008 neighbor_maximum_prefix_restart_hidden_cmd
,
6009 "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295) restart (1-65535)",
6012 "Maximum number of prefix accept from this peer\n"
6013 "maximum no. of prefix limit\n"
6014 "Restart bgp connection after limit is exceeded\n"
6015 "Restart interval in minutes")
6017 DEFUN (neighbor_maximum_prefix_threshold_restart
,
6018 neighbor_maximum_prefix_threshold_restart_cmd
,
6019 "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295) (1-100) restart (1-65535)",
6022 "Maximum number of prefixes to accept from this peer\n"
6023 "maximum no. of prefix limit\n"
6024 "Threshold value (%) at which to generate a warning msg\n"
6025 "Restart bgp connection after limit is exceeded\n"
6026 "Restart interval in minutes\n")
6030 int idx_number_2
= 4;
6031 int idx_number_3
= 6;
6032 return peer_maximum_prefix_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
6033 bgp_node_safi (vty
), argv
[idx_number
]->arg
, argv
[idx_number_2
]->arg
, 0, argv
[idx_number_3
]->arg
);
6036 ALIAS_HIDDEN (neighbor_maximum_prefix_threshold_restart
,
6037 neighbor_maximum_prefix_threshold_restart_hidden_cmd
,
6038 "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295) (1-100) restart (1-65535)",
6041 "Maximum number of prefixes to accept from this peer\n"
6042 "maximum no. of prefix limit\n"
6043 "Threshold value (%) at which to generate a warning msg\n"
6044 "Restart bgp connection after limit is exceeded\n"
6045 "Restart interval in minutes\n")
6047 DEFUN (no_neighbor_maximum_prefix
,
6048 no_neighbor_maximum_prefix_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 return peer_maximum_prefix_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
6062 bgp_node_safi (vty
));
6065 ALIAS_HIDDEN (no_neighbor_maximum_prefix
,
6066 no_neighbor_maximum_prefix_hidden_cmd
,
6067 "no neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix [(1-4294967295) [(1-100)] [restart (1-65535)] [warning-only]]",
6071 "Maximum number of prefixes to accept from this peer\n"
6072 "maximum no. of prefix limit\n"
6073 "Threshold value (%) at which to generate a warning msg\n"
6074 "Restart bgp connection after limit is exceeded\n"
6075 "Restart interval in minutes\n"
6076 "Only give warning message when limit is exceeded\n")
6079 /* "neighbor allowas-in" */
6080 DEFUN (neighbor_allowas_in
,
6081 neighbor_allowas_in_cmd
,
6082 "neighbor <A.B.C.D|X:X::X:X|WORD> allowas-in [<(1-10)|origin>]",
6085 "Accept as-path with my AS present in it\n"
6086 "Number of occurances of AS number\n"
6087 "Only accept my AS in the as-path if the route was originated in my AS\n")
6090 int idx_number_origin
= 3;
6096 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
6100 if (argc
<= idx_number_origin
)
6104 if (argv
[idx_number_origin
]->type
== WORD_TKN
)
6107 allow_num
= atoi (argv
[idx_number_origin
]->arg
);
6110 ret
= peer_allowas_in_set (peer
, bgp_node_afi (vty
), bgp_node_safi (vty
),
6113 return bgp_vty_return (vty
, ret
);
6116 ALIAS_HIDDEN (neighbor_allowas_in
,
6117 neighbor_allowas_in_hidden_cmd
,
6118 "neighbor <A.B.C.D|X:X::X:X|WORD> allowas-in [<(1-10)|origin>]",
6121 "Accept as-path with my AS present in it\n"
6122 "Number of occurances of AS number\n"
6123 "Only accept my AS in the as-path if the route was originated in my AS\n")
6125 DEFUN (no_neighbor_allowas_in
,
6126 no_neighbor_allowas_in_cmd
,
6127 "no neighbor <A.B.C.D|X:X::X:X|WORD> allowas-in [<(1-10)|origin>]",
6131 "allow local ASN appears in aspath attribute\n"
6132 "Number of occurances of AS number\n"
6133 "Only accept my AS in the as-path if the route was originated in my AS\n")
6139 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
6143 ret
= peer_allowas_in_unset (peer
, bgp_node_afi (vty
), bgp_node_safi (vty
));
6145 return bgp_vty_return (vty
, ret
);
6148 ALIAS_HIDDEN (no_neighbor_allowas_in
,
6149 no_neighbor_allowas_in_hidden_cmd
,
6150 "no neighbor <A.B.C.D|X:X::X:X|WORD> allowas-in [<(1-10)|origin>]",
6154 "allow local ASN appears in aspath attribute\n"
6155 "Number of occurances of AS number\n"
6156 "Only accept my AS in the as-path if the route was originated in my AS\n")
6158 DEFUN (neighbor_ttl_security
,
6159 neighbor_ttl_security_cmd
,
6160 "neighbor <A.B.C.D|X:X::X:X|WORD> ttl-security hops (1-254)",
6163 "BGP ttl-security parameters\n"
6164 "Specify the maximum number of hops to the BGP peer\n"
6165 "Number of hops to BGP peer\n")
6172 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
6176 VTY_GET_INTEGER_RANGE ("", gtsm_hops
, argv
[idx_number
]->arg
, 1, 254);
6179 * If 'neighbor swpX', then this is for directly connected peers,
6180 * we should not accept a ttl-security hops value greater than 1.
6182 if (peer
->conf_if
&& (gtsm_hops
> 1)) {
6183 vty_out (vty
, "%s is directly connected peer, hops cannot exceed 1%s",
6184 argv
[idx_peer
]->arg
, VTY_NEWLINE
);
6188 return bgp_vty_return (vty
, peer_ttl_security_hops_set (peer
, gtsm_hops
));
6191 DEFUN (no_neighbor_ttl_security
,
6192 no_neighbor_ttl_security_cmd
,
6193 "no neighbor <A.B.C.D|X:X::X:X|WORD> ttl-security hops (1-254)",
6197 "BGP ttl-security parameters\n"
6198 "Specify the maximum number of hops to the BGP peer\n"
6199 "Number of hops to BGP peer\n")
6204 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
6208 return bgp_vty_return (vty
, peer_ttl_security_hops_unset (peer
));
6211 DEFUN (neighbor_addpath_tx_all_paths
,
6212 neighbor_addpath_tx_all_paths_cmd
,
6213 "neighbor <A.B.C.D|X:X::X:X|WORD> addpath-tx-all-paths",
6216 "Use addpath to advertise all paths to a neighbor\n")
6221 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
6225 return peer_af_flag_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
6226 bgp_node_safi (vty
),
6227 PEER_FLAG_ADDPATH_TX_ALL_PATHS
);
6230 ALIAS_HIDDEN (neighbor_addpath_tx_all_paths
,
6231 neighbor_addpath_tx_all_paths_hidden_cmd
,
6232 "neighbor <A.B.C.D|X:X::X:X|WORD> addpath-tx-all-paths",
6235 "Use addpath to advertise all paths to a neighbor\n")
6237 DEFUN (no_neighbor_addpath_tx_all_paths
,
6238 no_neighbor_addpath_tx_all_paths_cmd
,
6239 "no neighbor <A.B.C.D|X:X::X:X|WORD> addpath-tx-all-paths",
6243 "Use addpath to advertise all paths to a neighbor\n")
6246 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
6247 bgp_node_safi (vty
),
6248 PEER_FLAG_ADDPATH_TX_ALL_PATHS
);
6251 ALIAS_HIDDEN (no_neighbor_addpath_tx_all_paths
,
6252 no_neighbor_addpath_tx_all_paths_hidden_cmd
,
6253 "no neighbor <A.B.C.D|X:X::X:X|WORD> addpath-tx-all-paths",
6257 "Use addpath to advertise all paths to a neighbor\n")
6259 DEFUN (neighbor_addpath_tx_bestpath_per_as
,
6260 neighbor_addpath_tx_bestpath_per_as_cmd
,
6261 "neighbor <A.B.C.D|X:X::X:X|WORD> addpath-tx-bestpath-per-AS",
6264 "Use addpath to advertise the bestpath per each neighboring AS\n")
6269 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
6273 return peer_af_flag_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
6274 bgp_node_safi (vty
),
6275 PEER_FLAG_ADDPATH_TX_BESTPATH_PER_AS
);
6278 ALIAS_HIDDEN (neighbor_addpath_tx_bestpath_per_as
,
6279 neighbor_addpath_tx_bestpath_per_as_hidden_cmd
,
6280 "neighbor <A.B.C.D|X:X::X:X|WORD> addpath-tx-bestpath-per-AS",
6283 "Use addpath to advertise the bestpath per each neighboring AS\n")
6285 DEFUN (no_neighbor_addpath_tx_bestpath_per_as
,
6286 no_neighbor_addpath_tx_bestpath_per_as_cmd
,
6287 "no neighbor <A.B.C.D|X:X::X:X|WORD> addpath-tx-bestpath-per-AS",
6291 "Use addpath to advertise the bestpath per each neighboring AS\n")
6294 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
6295 bgp_node_safi (vty
),
6296 PEER_FLAG_ADDPATH_TX_BESTPATH_PER_AS
);
6299 ALIAS_HIDDEN (no_neighbor_addpath_tx_bestpath_per_as
,
6300 no_neighbor_addpath_tx_bestpath_per_as_hidden_cmd
,
6301 "no neighbor <A.B.C.D|X:X::X:X|WORD> addpath-tx-bestpath-per-AS",
6305 "Use addpath to advertise the bestpath per each neighboring AS\n")
6307 DEFUN_NOSH (address_family_ipv4_safi
,
6308 address_family_ipv4_safi_cmd
,
6309 "address-family ipv4 [<unicast|multicast|vpn|labeled-unicast>]",
6310 "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_IP
, safi
);
6321 vty
->node
= BGP_IPV4_NODE
;
6326 DEFUN_NOSH (address_family_ipv6_safi
,
6327 address_family_ipv6_safi_cmd
,
6328 "address-family ipv6 [<unicast|multicast|vpn|labeled-unicast>]",
6329 "Enter Address Family command mode\n"
6335 safi_t safi
= bgp_vty_safi_from_arg(argv
[2]->arg
);
6336 vty
->node
= bgp_node_type(AFI_IP6
, safi
);
6339 vty
->node
= BGP_IPV6_NODE
;
6344 #ifdef KEEP_OLD_VPN_COMMANDS
6345 DEFUN_NOSH (address_family_vpnv4
,
6346 address_family_vpnv4_cmd
,
6347 "address-family vpnv4 [unicast]",
6348 "Enter Address Family command mode\n"
6350 "Address Family modifier\n")
6352 vty
->node
= BGP_VPNV4_NODE
;
6356 DEFUN_NOSH (address_family_vpnv6
,
6357 address_family_vpnv6_cmd
,
6358 "address-family vpnv6 [unicast]",
6359 "Enter Address Family command mode\n"
6361 "Address Family modifier\n")
6363 vty
->node
= BGP_VPNV6_NODE
;
6368 DEFUN_NOSH (address_family_evpn
,
6369 address_family_evpn_cmd
,
6370 "address-family <l2vpn evpn>",
6371 "Enter Address Family command mode\n"
6372 "EVPN Address family\n"
6373 "Layer2 VPN Address family\n"
6374 "Ethernet Virtual Private Network Subsequent Address Family\n")
6376 vty
->node
= BGP_EVPN_NODE
;
6380 DEFUN_NOSH (exit_address_family
,
6381 exit_address_family_cmd
,
6382 "exit-address-family",
6383 "Exit from Address Family configuration mode\n")
6385 if (vty
->node
== BGP_IPV4_NODE
6386 || vty
->node
== BGP_IPV4M_NODE
6387 || vty
->node
== BGP_IPV4L_NODE
6388 || vty
->node
== BGP_VPNV4_NODE
6389 || vty
->node
== BGP_IPV6_NODE
6390 || vty
->node
== BGP_IPV6M_NODE
6391 || vty
->node
== BGP_IPV6L_NODE
6392 || vty
->node
== BGP_VPNV6_NODE
6393 || vty
->node
== BGP_EVPN_NODE
)
6394 vty
->node
= BGP_NODE
;
6398 /* Recalculate bestpath and re-advertise a prefix */
6400 bgp_clear_prefix (struct vty
*vty
, const char *view_name
, const char *ip_str
,
6401 afi_t afi
, safi_t safi
, struct prefix_rd
*prd
)
6404 struct prefix match
;
6405 struct bgp_node
*rn
;
6406 struct bgp_node
*rm
;
6408 struct bgp_table
*table
;
6409 struct bgp_table
*rib
;
6411 /* BGP structure lookup. */
6414 bgp
= bgp_lookup_by_name (view_name
);
6417 vty_out (vty
, "%% Can't find BGP instance %s%s", view_name
, VTY_NEWLINE
);
6423 bgp
= bgp_get_default ();
6426 vty_out (vty
, "%% No BGP process is configured%s", VTY_NEWLINE
);
6431 /* Check IP address argument. */
6432 ret
= str2prefix (ip_str
, &match
);
6435 vty_out (vty
, "%% address is malformed%s", VTY_NEWLINE
);
6439 match
.family
= afi2family (afi
);
6440 rib
= bgp
->rib
[afi
][safi
];
6442 if (safi
== SAFI_MPLS_VPN
)
6444 for (rn
= bgp_table_top (rib
); rn
; rn
= bgp_route_next (rn
))
6446 if (prd
&& memcmp (rn
->p
.u
.val
, prd
->val
, 8) != 0)
6449 if ((table
= rn
->info
) != NULL
)
6451 if ((rm
= bgp_node_match (table
, &match
)) != NULL
)
6453 if (rm
->p
.prefixlen
== match
.prefixlen
)
6455 SET_FLAG (rn
->flags
, BGP_NODE_USER_CLEAR
);
6456 bgp_process (bgp
, rm
, afi
, safi
);
6458 bgp_unlock_node (rm
);
6465 if ((rn
= bgp_node_match (rib
, &match
)) != NULL
)
6467 if (rn
->p
.prefixlen
== match
.prefixlen
)
6469 SET_FLAG (rn
->flags
, BGP_NODE_USER_CLEAR
);
6470 bgp_process (bgp
, rn
, afi
, safi
);
6472 bgp_unlock_node (rn
);
6479 /* one clear bgp command to rule them all */
6480 DEFUN (clear_ip_bgp_all
,
6481 clear_ip_bgp_all_cmd
,
6482 "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>]",
6486 BGP_INSTANCE_HELP_STR
6488 "BGP neighbor address to clear\n"
6489 "BGP IPv6 neighbor to clear\n"
6490 "BGP neighbor on interface to clear\n"
6491 "Clear peers with the AS number\n"
6492 "Clear all external peers\n"
6493 "Clear all members of peer-group\n"
6494 "BGP peer-group name\n"
6501 "Push out prefix-list ORF and do inbound soft reconfig\n"
6506 afi_t afi
= AFI_IP6
;
6507 safi_t safi
= SAFI_UNICAST
;
6508 enum clear_sort clr_sort
= clear_peer
;
6509 enum bgp_clear_type clr_type
;
6510 char *clr_arg
= NULL
;
6514 /* clear [ip] bgp */
6515 if (argv_find (argv
, argc
, "ip", &idx
))
6517 /* [<view|vrf> VIEWVRFNAME] */
6518 if (argv_find (argv
, argc
, "view", &idx
) || argv_find (argv
, argc
, "vrf", &idx
))
6520 vrf
= argv
[idx
+ 1]->arg
;
6523 /* <*|A.B.C.D|X:X::X:X|WORD|(1-4294967295)|external|peer-group WORD> */
6524 if (argv_find (argv
, argc
, "*", &idx
))
6526 clr_sort
= clear_all
;
6528 else if (argv_find (argv
, argc
, "A.B.C.D", &idx
))
6530 clr_sort
= clear_peer
;
6531 clr_arg
= argv
[idx
]->arg
;
6533 else if (argv_find (argv
, argc
, "X:X::X:X", &idx
))
6535 clr_sort
= clear_peer
;
6536 clr_arg
= argv
[idx
]->arg
;
6538 else if (argv_find (argv
, argc
, "peer-group", &idx
))
6540 clr_sort
= clear_group
;
6542 clr_arg
= argv
[idx
]->arg
;
6544 else if (argv_find (argv
, argc
, "WORD", &idx
))
6546 clr_sort
= clear_peer
;
6547 clr_arg
= argv
[idx
]->arg
;
6549 else if (argv_find (argv
, argc
, "(1-4294967295)", &idx
))
6551 clr_sort
= clear_as
;
6552 clr_arg
= argv
[idx
]->arg
;
6554 else if (argv_find (argv
, argc
, "external", &idx
))
6556 clr_sort
= clear_external
;
6558 /* ["BGP_AFI_CMD_STR" ["BGP_SAFI_CMD_STR"]] */
6559 if (argv_find_and_parse_afi (argv
, argc
, &idx
, &afi
))
6561 argv_find_and_parse_safi (argv
, argc
, &idx
, &safi
);
6563 /* [<soft [<in|out>]|in [prefix-filter]|out>] */
6564 if (argv_find (argv
, argc
, "soft", &idx
))
6566 if (argv_find (argv
, argc
, "in", &idx
) || argv_find (argv
, argc
, "out", &idx
))
6567 clr_type
= strmatch (argv
[idx
]->text
, "in") ? BGP_CLEAR_SOFT_IN
: BGP_CLEAR_SOFT_OUT
;
6569 clr_type
= BGP_CLEAR_SOFT_BOTH
;
6571 else if (argv_find (argv
, argc
, "in", &idx
))
6573 clr_type
= argv_find (argv
, argc
, "prefix-filter", &idx
) ? BGP_CLEAR_SOFT_IN_ORF_PREFIX
: BGP_CLEAR_SOFT_IN
;
6575 else if (argv_find (argv
, argc
, "out", &idx
))
6577 clr_type
= BGP_CLEAR_SOFT_OUT
;
6580 clr_type
= BGP_CLEAR_SOFT_NONE
;
6582 return bgp_clear_vty (vty
, vrf
, afi
, safi
, clr_sort
, clr_type
, clr_arg
);
6585 DEFUN (clear_ip_bgp_prefix
,
6586 clear_ip_bgp_prefix_cmd
,
6587 "clear [ip] bgp [<view|vrf> VIEWVRFNAME] prefix A.B.C.D/M",
6591 BGP_INSTANCE_HELP_STR
6592 "Clear bestpath and re-advertise\n"
6596 char *prefix
= NULL
;
6600 /* [<view|vrf> VIEWVRFNAME] */
6601 if (argv_find (argv
, argc
, "WORD", &idx
))
6602 vrf
= argv
[idx
]->arg
;
6604 prefix
= argv
[argc
-1]->arg
;
6606 return bgp_clear_prefix (vty
, vrf
, prefix
, AFI_IP
, SAFI_UNICAST
, NULL
);
6609 DEFUN (clear_bgp_ipv6_safi_prefix
,
6610 clear_bgp_ipv6_safi_prefix_cmd
,
6611 "clear [ip] bgp ipv6 "BGP_SAFI_CMD_STR
" prefix X:X::X:X/M",
6617 "Clear bestpath and re-advertise\n"
6621 int idx_ipv6_prefixlen
= 5;
6622 return bgp_clear_prefix (vty
, NULL
, argv
[idx_ipv6_prefixlen
]->arg
, AFI_IP6
,
6623 bgp_vty_safi_from_arg(argv
[idx_safi
]->arg
), NULL
);
6626 DEFUN (clear_bgp_instance_ipv6_safi_prefix
,
6627 clear_bgp_instance_ipv6_safi_prefix_cmd
,
6628 "clear [ip] bgp <view|vrf> VIEWVRFNAME ipv6 "BGP_SAFI_CMD_STR
" prefix X:X::X:X/M",
6632 BGP_INSTANCE_HELP_STR
6635 "Clear bestpath and re-advertise\n"
6640 int idx_ipv6_prefixlen
= 7;
6641 return bgp_clear_prefix (vty
, argv
[idx_word
]->arg
, argv
[idx_ipv6_prefixlen
]->arg
, AFI_IP6
,
6642 bgp_vty_safi_from_arg(argv
[idx_safi
]->arg
), NULL
);
6645 DEFUN (show_bgp_views
,
6647 "show [ip] bgp views",
6651 "Show the defined BGP views\n")
6653 struct list
*inst
= bm
->bgp
;
6654 struct listnode
*node
;
6657 if (!bgp_option_check (BGP_OPT_MULTIPLE_INSTANCE
))
6659 vty_out (vty
, "BGP Multiple Instance is not enabled%s", VTY_NEWLINE
);
6663 vty_out (vty
, "Defined BGP views:%s", VTY_NEWLINE
);
6664 for (ALL_LIST_ELEMENTS_RO(inst
, node
, bgp
))
6667 if (bgp
->inst_type
== BGP_INSTANCE_TYPE_VRF
)
6669 vty_out (vty
, "\t%s (AS%u)%s",
6670 bgp
->name
? bgp
->name
: "(null)",
6671 bgp
->as
, VTY_NEWLINE
);
6677 DEFUN (show_bgp_vrfs
,
6679 "show [ip] bgp vrfs [json]",
6686 struct list
*inst
= bm
->bgp
;
6687 struct listnode
*node
;
6689 u_char uj
= use_json(argc
, argv
);
6690 json_object
*json
= NULL
;
6691 json_object
*json_vrfs
= NULL
;
6693 static char header
[] = "Type Id RouterId #PeersCfg #PeersEstb Name";
6695 if (!bgp_option_check (BGP_OPT_MULTIPLE_INSTANCE
))
6697 vty_out (vty
, "BGP Multiple Instance is not enabled%s", VTY_NEWLINE
);
6703 json
= json_object_new_object();
6704 json_vrfs
= json_object_new_object();
6707 for (ALL_LIST_ELEMENTS_RO(inst
, node
, bgp
))
6709 const char *name
, *type
;
6711 struct listnode
*node
, *nnode
;
6712 int peers_cfg
, peers_estb
;
6713 json_object
*json_vrf
= NULL
;
6717 if (bgp
->inst_type
== BGP_INSTANCE_TYPE_VIEW
)
6721 if (!uj
&& count
== 1)
6722 vty_out (vty
, "%s%s", header
, VTY_NEWLINE
);
6724 peers_cfg
= peers_estb
= 0;
6726 json_vrf
= json_object_new_object();
6729 for (ALL_LIST_ELEMENTS (bgp
->peer
, node
, nnode
, peer
))
6731 if (!CHECK_FLAG(peer
->flags
, PEER_FLAG_CONFIG_NODE
))
6734 if (peer
->status
== Established
)
6738 if (bgp
->inst_type
== BGP_INSTANCE_TYPE_DEFAULT
)
6749 vrf_id_ui
= (bgp
->vrf_id
== VRF_UNKNOWN
) ? -1 : bgp
->vrf_id
;
6752 json_object_string_add(json_vrf
, "type", type
);
6753 json_object_int_add(json_vrf
, "vrfId", vrf_id_ui
);
6754 json_object_string_add(json_vrf
, "routerId", inet_ntoa (bgp
->router_id
));
6755 json_object_int_add(json_vrf
, "numConfiguredPeers", peers_cfg
);
6756 json_object_int_add(json_vrf
, "numEstablishedPeers", peers_estb
);
6758 json_object_object_add(json_vrfs
, name
, json_vrf
);
6761 vty_out (vty
, "%4s %-5d %-16s %9u %10u %s%s",
6762 type
, vrf_id_ui
, inet_ntoa (bgp
->router_id
),
6763 peers_cfg
, peers_estb
, name
,
6769 json_object_object_add(json
, "vrfs", json_vrfs
);
6771 json_object_int_add(json
, "totalVrfs", count
);
6773 vty_out (vty
, "%s%s", json_object_to_json_string_ext(json
, JSON_C_TO_STRING_PRETTY
), VTY_NEWLINE
);
6774 json_object_free(json
);
6779 vty_out (vty
, "%sTotal number of VRFs (including default): %d%s",
6780 VTY_NEWLINE
, count
, VTY_NEWLINE
);
6786 DEFUN (show_bgp_memory
,
6787 show_bgp_memory_cmd
,
6788 "show [ip] bgp memory",
6792 "Global BGP memory statistics\n")
6794 char memstrbuf
[MTYPE_MEMSTR_LEN
];
6795 unsigned long count
;
6797 /* RIB related usage stats */
6798 count
= mtype_stats_alloc (MTYPE_BGP_NODE
);
6799 vty_out (vty
, "%ld RIB nodes, using %s of memory%s", count
,
6800 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6801 count
* sizeof (struct bgp_node
)),
6804 count
= mtype_stats_alloc (MTYPE_BGP_ROUTE
);
6805 vty_out (vty
, "%ld BGP routes, using %s of memory%s", count
,
6806 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6807 count
* sizeof (struct bgp_info
)),
6809 if ((count
= mtype_stats_alloc (MTYPE_BGP_ROUTE_EXTRA
)))
6810 vty_out (vty
, "%ld BGP route ancillaries, using %s of memory%s", count
,
6811 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6812 count
* sizeof (struct bgp_info_extra
)),
6815 if ((count
= mtype_stats_alloc (MTYPE_BGP_STATIC
)))
6816 vty_out (vty
, "%ld Static routes, using %s of memory%s", count
,
6817 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6818 count
* sizeof (struct bgp_static
)),
6821 if ((count
= mtype_stats_alloc (MTYPE_BGP_PACKET
)))
6822 vty_out (vty
, "%ld Packets, using %s of memory%s", count
,
6823 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6824 count
* sizeof (struct bpacket
)),
6828 if ((count
= mtype_stats_alloc (MTYPE_BGP_ADJ_IN
)))
6829 vty_out (vty
, "%ld Adj-In entries, using %s of memory%s", count
,
6830 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6831 count
* sizeof (struct bgp_adj_in
)),
6833 if ((count
= mtype_stats_alloc (MTYPE_BGP_ADJ_OUT
)))
6834 vty_out (vty
, "%ld Adj-Out entries, using %s of memory%s", count
,
6835 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6836 count
* sizeof (struct bgp_adj_out
)),
6839 if ((count
= mtype_stats_alloc (MTYPE_BGP_NEXTHOP_CACHE
)))
6840 vty_out (vty
, "%ld Nexthop cache entries, using %s of memory%s", count
,
6841 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6842 count
* sizeof (struct bgp_nexthop_cache
)),
6845 if ((count
= mtype_stats_alloc (MTYPE_BGP_DAMP_INFO
)))
6846 vty_out (vty
, "%ld Dampening entries, using %s of memory%s", count
,
6847 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6848 count
* sizeof (struct bgp_damp_info
)),
6852 count
= attr_count();
6853 vty_out (vty
, "%ld BGP attributes, using %s of memory%s", count
,
6854 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6855 count
* sizeof(struct attr
)),
6857 if ((count
= mtype_stats_alloc (MTYPE_ATTR_EXTRA
)))
6858 vty_out (vty
, "%ld BGP extra attributes, using %s of memory%s", count
,
6859 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6860 count
* sizeof(struct attr_extra
)),
6863 if ((count
= attr_unknown_count()))
6864 vty_out (vty
, "%ld unknown attributes%s", count
, VTY_NEWLINE
);
6866 /* AS_PATH attributes */
6867 count
= aspath_count ();
6868 vty_out (vty
, "%ld BGP AS-PATH entries, using %s of memory%s", count
,
6869 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6870 count
* sizeof (struct aspath
)),
6873 count
= mtype_stats_alloc (MTYPE_AS_SEG
);
6874 vty_out (vty
, "%ld BGP AS-PATH segments, using %s of memory%s", count
,
6875 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6876 count
* sizeof (struct assegment
)),
6879 /* Other attributes */
6880 if ((count
= community_count ()))
6881 vty_out (vty
, "%ld BGP community entries, using %s of memory%s", count
,
6882 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6883 count
* sizeof (struct community
)),
6885 if ((count
= mtype_stats_alloc (MTYPE_ECOMMUNITY
)))
6886 vty_out (vty
, "%ld BGP community entries, using %s of memory%s", count
,
6887 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6888 count
* sizeof (struct ecommunity
)),
6890 if ((count
= mtype_stats_alloc (MTYPE_LCOMMUNITY
)))
6891 vty_out (vty
, "%ld BGP large-community entries, using %s of memory%s",
6893 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6894 count
* sizeof (struct lcommunity
)),
6897 if ((count
= mtype_stats_alloc (MTYPE_CLUSTER
)))
6898 vty_out (vty
, "%ld Cluster lists, using %s of memory%s", count
,
6899 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6900 count
* sizeof (struct cluster_list
)),
6903 /* Peer related usage */
6904 count
= mtype_stats_alloc (MTYPE_BGP_PEER
);
6905 vty_out (vty
, "%ld peers, using %s of memory%s", count
,
6906 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6907 count
* sizeof (struct peer
)),
6910 if ((count
= mtype_stats_alloc (MTYPE_PEER_GROUP
)))
6911 vty_out (vty
, "%ld peer groups, using %s of memory%s", count
,
6912 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6913 count
* sizeof (struct peer_group
)),
6917 if ((count
= mtype_stats_alloc (MTYPE_HASH
)))
6918 vty_out (vty
, "%ld hash tables, using %s of memory%s", count
,
6919 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6920 count
* sizeof (struct hash
)),
6922 if ((count
= mtype_stats_alloc (MTYPE_HASH_BACKET
)))
6923 vty_out (vty
, "%ld hash buckets, using %s of memory%s", count
,
6924 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6925 count
* sizeof (struct hash_backet
)),
6927 if ((count
= mtype_stats_alloc (MTYPE_BGP_REGEXP
)))
6928 vty_out (vty
, "%ld compiled regexes, using %s of memory%s", count
,
6929 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6930 count
* sizeof (regex_t
)),
6935 /* Show BGP peer's summary information. */
6937 bgp_show_summary (struct vty
*vty
, struct bgp
*bgp
, int afi
, int safi
,
6938 u_char use_json
, json_object
*json
)
6941 struct listnode
*node
, *nnode
;
6942 unsigned int count
= 0, dn_count
= 0;
6943 char timebuf
[BGP_UPTIME_LEN
], dn_flag
[2];
6944 char neighbor_buf
[VTY_BUFSIZ
];
6945 int neighbor_col_default_width
= 16;
6947 int max_neighbor_width
= 0;
6948 json_object
*json_peer
= NULL
;
6949 json_object
*json_peers
= NULL
;
6954 json
= json_object_new_object();
6956 json_peers
= json_object_new_object();
6960 /* Loop over all neighbors that will be displayed to determine how many
6961 * characters are needed for the Neighbor column
6963 for (ALL_LIST_ELEMENTS (bgp
->peer
, node
, nnode
, peer
))
6965 if (!CHECK_FLAG(peer
->flags
, PEER_FLAG_CONFIG_NODE
))
6968 if (peer
->afc
[afi
][safi
])
6970 memset(dn_flag
, '\0', sizeof(dn_flag
));
6971 if (peer_dynamic_neighbor(peer
))
6974 if (peer
->hostname
&& bgp_flag_check(bgp
, BGP_FLAG_SHOW_HOSTNAME
))
6975 sprintf(neighbor_buf
, "%s%s(%s) ", dn_flag
, peer
->hostname
, peer
->host
);
6977 sprintf(neighbor_buf
, "%s%s ", dn_flag
, peer
->host
);
6979 len
= strlen(neighbor_buf
);
6981 if (len
> max_neighbor_width
)
6982 max_neighbor_width
= len
;
6986 /* Originally we displayed the Neighbor column as 16
6987 * characters wide so make that the default
6989 if (max_neighbor_width
< neighbor_col_default_width
)
6990 max_neighbor_width
= neighbor_col_default_width
;
6993 for (ALL_LIST_ELEMENTS (bgp
->peer
, node
, nnode
, peer
))
6995 if (!CHECK_FLAG(peer
->flags
, PEER_FLAG_CONFIG_NODE
))
6998 if (peer
->afc
[afi
][safi
])
7003 char memstrbuf
[MTYPE_MEMSTR_LEN
];
7006 vrf_id_ui
= (bgp
->vrf_id
== VRF_UNKNOWN
) ? -1 : bgp
->vrf_id
;
7008 /* Usage summary and header */
7011 json_object_string_add(json
, "routerId", inet_ntoa (bgp
->router_id
));
7012 json_object_int_add(json
, "as", bgp
->as
);
7013 json_object_int_add(json
, "vrfId", vrf_id_ui
);
7014 json_object_string_add(json
, "vrfName",
7015 (bgp
->inst_type
== BGP_INSTANCE_TYPE_DEFAULT
)
7016 ? "Default" : bgp
->name
);
7021 "BGP router identifier %s, local AS number %u vrf-id %d",
7022 inet_ntoa (bgp
->router_id
), bgp
->as
, vrf_id_ui
);
7023 vty_out (vty
, "%s", VTY_NEWLINE
);
7026 if (bgp_update_delay_configured(bgp
))
7030 json_object_int_add(json
, "updateDelayLimit", bgp
->v_update_delay
);
7032 if (bgp
->v_update_delay
!= bgp
->v_establish_wait
)
7033 json_object_int_add(json
, "updateDelayEstablishWait", bgp
->v_establish_wait
);
7035 if (bgp_update_delay_active(bgp
))
7037 json_object_string_add(json
, "updateDelayFirstNeighbor", bgp
->update_delay_begin_time
);
7038 json_object_boolean_true_add(json
, "updateDelayInProgress");
7042 if (bgp
->update_delay_over
)
7044 json_object_string_add(json
, "updateDelayFirstNeighbor",
7045 bgp
->update_delay_begin_time
);
7046 json_object_string_add(json
, "updateDelayBestpathResumed",
7047 bgp
->update_delay_end_time
);
7048 json_object_string_add(json
, "updateDelayZebraUpdateResume",
7049 bgp
->update_delay_zebra_resume_time
);
7050 json_object_string_add(json
, "updateDelayPeerUpdateResume",
7051 bgp
->update_delay_peers_resume_time
);
7057 vty_out (vty
, "Read-only mode update-delay limit: %d seconds%s",
7058 bgp
->v_update_delay
, VTY_NEWLINE
);
7059 if (bgp
->v_update_delay
!= bgp
->v_establish_wait
)
7060 vty_out (vty
, " Establish wait: %d seconds%s",
7061 bgp
->v_establish_wait
, VTY_NEWLINE
);
7063 if (bgp_update_delay_active(bgp
))
7065 vty_out (vty
, " First neighbor established: %s%s",
7066 bgp
->update_delay_begin_time
, VTY_NEWLINE
);
7067 vty_out (vty
, " Delay in progress%s", VTY_NEWLINE
);
7071 if (bgp
->update_delay_over
)
7073 vty_out (vty
, " First neighbor established: %s%s",
7074 bgp
->update_delay_begin_time
, VTY_NEWLINE
);
7075 vty_out (vty
, " Best-paths resumed: %s%s",
7076 bgp
->update_delay_end_time
, VTY_NEWLINE
);
7077 vty_out (vty
, " zebra update resumed: %s%s",
7078 bgp
->update_delay_zebra_resume_time
, VTY_NEWLINE
);
7079 vty_out (vty
, " peers update resumed: %s%s",
7080 bgp
->update_delay_peers_resume_time
, VTY_NEWLINE
);
7088 if (bgp_maxmed_onstartup_configured(bgp
) && bgp
->maxmed_active
)
7089 json_object_boolean_true_add(json
, "maxMedOnStartup");
7090 if (bgp
->v_maxmed_admin
)
7091 json_object_boolean_true_add(json
, "maxMedAdministrative");
7093 json_object_int_add(json
, "tableVersion", bgp_table_version(bgp
->rib
[afi
][safi
]));
7095 ents
= bgp_table_count (bgp
->rib
[afi
][safi
]);
7096 json_object_int_add(json
, "ribCount", ents
);
7097 json_object_int_add(json
, "ribMemory", ents
* sizeof (struct bgp_node
));
7099 ents
= listcount (bgp
->peer
);
7100 json_object_int_add(json
, "peerCount", ents
);
7101 json_object_int_add(json
, "peerMemory", ents
* sizeof (struct peer
));
7103 if ((ents
= listcount (bgp
->group
)))
7105 json_object_int_add(json
, "peerGroupCount", ents
);
7106 json_object_int_add(json
, "peerGroupMemory", ents
* sizeof (struct peer_group
));
7109 if (CHECK_FLAG (bgp
->af_flags
[afi
][safi
], BGP_CONFIG_DAMPENING
))
7110 json_object_boolean_true_add(json
, "dampeningEnabled");
7114 if (bgp_maxmed_onstartup_configured(bgp
) && bgp
->maxmed_active
)
7115 vty_out (vty
, "Max-med on-startup active%s", VTY_NEWLINE
);
7116 if (bgp
->v_maxmed_admin
)
7117 vty_out (vty
, "Max-med administrative active%s", VTY_NEWLINE
);
7119 vty_out(vty
, "BGP table version %" PRIu64
"%s",
7120 bgp_table_version(bgp
->rib
[afi
][safi
]), VTY_NEWLINE
);
7122 ents
= bgp_table_count (bgp
->rib
[afi
][safi
]);
7123 vty_out (vty
, "RIB entries %ld, using %s of memory%s", ents
,
7124 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
7125 ents
* sizeof (struct bgp_node
)),
7128 /* Peer related usage */
7129 ents
= listcount (bgp
->peer
);
7130 vty_out (vty
, "Peers %ld, using %s of memory%s",
7132 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
7133 ents
* sizeof (struct peer
)),
7136 if ((ents
= listcount (bgp
->group
)))
7137 vty_out (vty
, "Peer groups %ld, using %s of memory%s", ents
,
7138 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
7139 ents
* sizeof (struct peer_group
)),
7142 if (CHECK_FLAG (bgp
->af_flags
[afi
][safi
], BGP_CONFIG_DAMPENING
))
7143 vty_out (vty
, "Dampening enabled.%s", VTY_NEWLINE
);
7144 vty_out (vty
, "%s", VTY_NEWLINE
);
7146 /* Subtract 8 here because 'Neighbor' is 8 characters */
7147 vty_out (vty
, "Neighbor");
7148 vty_out (vty
, "%*s", max_neighbor_width
- 8, " ");
7149 vty_out (vty
, "V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd%s", VTY_NEWLINE
);
7157 json_peer
= json_object_new_object();
7159 if (peer_dynamic_neighbor(peer
))
7160 json_object_boolean_true_add(json_peer
, "dynamicPeer");
7163 json_object_string_add(json_peer
, "hostname", peer
->hostname
);
7165 if (peer
->domainname
)
7166 json_object_string_add(json_peer
, "domainname", peer
->domainname
);
7168 json_object_int_add(json_peer
, "remoteAs", peer
->as
);
7169 json_object_int_add(json_peer
, "version", 4);
7170 json_object_int_add(json_peer
, "msgRcvd",
7171 peer
->open_in
+ peer
->update_in
+ peer
->keepalive_in
7172 + peer
->notify_in
+ peer
->refresh_in
7173 + peer
->dynamic_cap_in
);
7174 json_object_int_add(json_peer
, "msgSent",
7175 peer
->open_out
+ peer
->update_out
+ peer
->keepalive_out
7176 + peer
->notify_out
+ peer
->refresh_out
7177 + peer
->dynamic_cap_out
);
7179 json_object_int_add(json_peer
, "tableVersion", peer
->version
[afi
][safi
]);
7180 json_object_int_add(json_peer
, "outq", peer
->obuf
->count
);
7181 json_object_int_add(json_peer
, "inq", 0);
7182 peer_uptime (peer
->uptime
, timebuf
, BGP_UPTIME_LEN
, use_json
, json_peer
);
7183 json_object_int_add(json_peer
, "prefixReceivedCount", peer
->pcount
[afi
][safi
]);
7185 if (CHECK_FLAG (peer
->flags
, PEER_FLAG_SHUTDOWN
))
7186 json_object_string_add(json_peer
, "state", "Idle (Admin)");
7187 else if (CHECK_FLAG (peer
->sflags
, PEER_STATUS_PREFIX_OVERFLOW
))
7188 json_object_string_add(json_peer
, "state", "Idle (PfxCt)");
7190 json_object_string_add(json_peer
, "state", lookup_msg(bgp_status_msg
, peer
->status
, NULL
));
7193 json_object_string_add(json_peer
, "idType", "interface");
7194 else if (peer
->su
.sa
.sa_family
== AF_INET
)
7195 json_object_string_add(json_peer
, "idType", "ipv4");
7196 else if (peer
->su
.sa
.sa_family
== AF_INET6
)
7197 json_object_string_add(json_peer
, "idType", "ipv6");
7199 json_object_object_add(json_peers
, peer
->host
, json_peer
);
7203 memset(dn_flag
, '\0', sizeof(dn_flag
));
7204 if (peer_dynamic_neighbor(peer
))
7210 if (peer
->hostname
&& bgp_flag_check(bgp
, BGP_FLAG_SHOW_HOSTNAME
))
7211 len
= vty_out (vty
, "%s%s(%s)", dn_flag
, peer
->hostname
,
7214 len
= vty_out (vty
, "%s%s", dn_flag
, peer
->host
);
7216 /* pad the neighbor column with spaces */
7217 if (len
< max_neighbor_width
)
7218 vty_out (vty
, "%*s", max_neighbor_width
- len
, " ");
7220 vty_out (vty
, "4 %10u %7d %7d %8" PRIu64
" %4d %4zd %8s",
7222 peer
->open_in
+ peer
->update_in
+ peer
->keepalive_in
7223 + peer
->notify_in
+ peer
->refresh_in
7224 + peer
->dynamic_cap_in
,
7225 peer
->open_out
+ peer
->update_out
+ peer
->keepalive_out
7226 + peer
->notify_out
+ peer
->refresh_out
7227 + peer
->dynamic_cap_out
,
7228 peer
->version
[afi
][safi
],
7231 peer_uptime (peer
->uptime
, timebuf
, BGP_UPTIME_LEN
, 0, NULL
));
7233 if (peer
->status
== Established
)
7234 vty_out (vty
, " %12ld", peer
->pcount
[afi
][safi
]);
7237 if (CHECK_FLAG (peer
->flags
, PEER_FLAG_SHUTDOWN
))
7238 vty_out (vty
, " Idle (Admin)");
7239 else if (CHECK_FLAG (peer
->sflags
, PEER_STATUS_PREFIX_OVERFLOW
))
7240 vty_out (vty
, " Idle (PfxCt)");
7242 vty_out (vty
, " %12s", lookup_msg(bgp_status_msg
, peer
->status
, NULL
));
7244 vty_out (vty
, "%s", VTY_NEWLINE
);
7251 json_object_object_add(json
, "peers", json_peers
);
7253 json_object_int_add(json
, "totalPeers", count
);
7254 json_object_int_add(json
, "dynamicPeers", dn_count
);
7256 vty_out (vty
, "%s%s", json_object_to_json_string_ext(json
, JSON_C_TO_STRING_PRETTY
), VTY_NEWLINE
);
7257 json_object_free(json
);
7262 vty_out (vty
, "%sTotal number of neighbors %d%s", VTY_NEWLINE
,
7263 count
, VTY_NEWLINE
);
7267 vty_out(vty
, "{\"error\": {\"message\": \"No %s neighbor configured\"}}%s",
7268 afi_safi_print(afi
, safi
), VTY_NEWLINE
);
7270 vty_out (vty
, "No %s neighbor is configured%s",
7271 afi_safi_print(afi
, safi
), VTY_NEWLINE
);
7274 if (dn_count
&& ! use_json
)
7276 vty_out(vty
, "* - dynamic neighbor%s", VTY_NEWLINE
);
7278 "%d dynamic neighbor(s), limit %d%s",
7279 dn_count
, bgp
->dynamic_neighbors_limit
, VTY_NEWLINE
);
7287 * Return if we have a peer configured to use this afi/safi
7290 bgp_show_summary_afi_safi_peer_exists (struct bgp
*bgp
, int afi
, int safi
)
7292 struct listnode
*node
;
7295 for (ALL_LIST_ELEMENTS_RO (bgp
->peer
, node
, peer
))
7297 if (!CHECK_FLAG (peer
->flags
, PEER_FLAG_CONFIG_NODE
))
7300 if (peer
->afc
[afi
][safi
])
7308 bgp_show_summary_afi_safi (struct vty
*vty
, struct bgp
*bgp
, int afi
, int safi
,
7309 u_char use_json
, json_object
*json
)
7312 int afi_wildcard
= (afi
== AFI_MAX
);
7313 int safi_wildcard
= (safi
== SAFI_MAX
);
7314 int is_wildcard
= (afi_wildcard
|| safi_wildcard
);
7315 bool json_output
= false;
7317 if (use_json
&& is_wildcard
)
7318 vty_out (vty
, "{%s", VTY_NEWLINE
);
7320 afi
= 1; /* AFI_IP */
7321 while (afi
< AFI_MAX
)
7324 safi
= 1; /* SAFI_UNICAST */
7325 while (safi
< SAFI_MAX
)
7327 if (bgp_show_summary_afi_safi_peer_exists (bgp
, afi
, safi
))
7333 * So limit output to those afi/safi pairs that
7334 * actualy have something interesting in them
7338 json
= json_object_new_object();
7341 vty_out (vty
, ",%s", VTY_NEWLINE
);
7345 vty_out(vty
, "\"%s\":", afi_safi_json(afi
, safi
));
7349 vty_out (vty
, "%s%s Summary:%s",
7350 VTY_NEWLINE
, afi_safi_print(afi
, safi
), VTY_NEWLINE
);
7353 bgp_show_summary (vty
, bgp
, afi
, safi
, use_json
, json
);
7356 if (safi
== SAFI_RESERVED_4
||
7357 safi
== SAFI_RESERVED_5
) /* handle special cases to match zebra.h */
7359 if (! safi_wildcard
)
7363 if (! afi_wildcard
||
7364 afi
== AFI_L2VPN
) /* special case, not handled yet */
7368 if (use_json
&& is_wildcard
)
7369 vty_out (vty
, "}%s", VTY_NEWLINE
);
7370 else if (use_json
&& !json_output
)
7371 vty_out (vty
, "{}%s", VTY_NEWLINE
);
7375 bgp_show_all_instances_summary_vty (struct vty
*vty
, afi_t afi
, safi_t safi
,
7378 struct listnode
*node
, *nnode
;
7380 json_object
*json
= NULL
;
7384 vty_out (vty
, "{%s", VTY_NEWLINE
);
7386 for (ALL_LIST_ELEMENTS (bm
->bgp
, node
, nnode
, bgp
))
7390 json
= json_object_new_object();
7393 vty_out (vty
, ",%s", VTY_NEWLINE
);
7397 vty_out(vty
, "\"%s\":", (bgp
->inst_type
== BGP_INSTANCE_TYPE_DEFAULT
)
7398 ? "Default" : bgp
->name
);
7402 vty_out (vty
, "%sInstance %s:%s",
7404 (bgp
->inst_type
== BGP_INSTANCE_TYPE_DEFAULT
)
7405 ? "Default" : bgp
->name
, VTY_NEWLINE
);
7407 bgp_show_summary_afi_safi (vty
, bgp
, afi
, safi
, use_json
, json
);
7411 vty_out (vty
, "}%s", VTY_NEWLINE
);
7416 bgp_show_summary_vty (struct vty
*vty
, const char *name
,
7417 afi_t afi
, safi_t safi
, u_char use_json
)
7423 if (strmatch(name
, "all"))
7425 bgp_show_all_instances_summary_vty (vty
, afi
, safi
, use_json
);
7430 bgp
= bgp_lookup_by_name (name
);
7435 vty_out (vty
, "{}%s", VTY_NEWLINE
);
7437 vty_out (vty
, "%% No such BGP instance exist%s", VTY_NEWLINE
);
7441 bgp_show_summary_afi_safi (vty
, bgp
, afi
, safi
, use_json
, NULL
);
7446 bgp
= bgp_get_default ();
7449 bgp_show_summary_afi_safi (vty
, bgp
, afi
, safi
, use_json
, NULL
);
7454 /* `show [ip] bgp summary' commands. */
7455 DEFUN (show_ip_bgp_summary
,
7456 show_ip_bgp_summary_cmd
,
7457 "show [ip] bgp [<view|vrf> VIEWVRFNAME] ["BGP_AFI_CMD_STR
" ["BGP_SAFI_CMD_STR
"]] summary [json]",
7461 BGP_INSTANCE_HELP_STR
7464 "Summary of BGP neighbor status\n"
7468 afi_t afi
= AFI_MAX
;
7469 safi_t safi
= SAFI_MAX
;
7474 if (argv_find (argv
, argc
, "ip", &idx
))
7476 /* [<view|vrf> VIEWVRFNAME] */
7477 if (argv_find (argv
, argc
, "view", &idx
) || argv_find (argv
, argc
, "vrf", &idx
))
7478 vrf
= argv
[++idx
]->arg
;
7479 /* ["BGP_AFI_CMD_STR" ["BGP_SAFI_CMD_STR"]] */
7480 if (argv_find_and_parse_afi (argv
, argc
, &idx
, &afi
))
7482 argv_find_and_parse_safi (argv
, argc
, &idx
, &safi
);
7485 int uj
= use_json (argc
, argv
);
7487 return bgp_show_summary_vty (vty
, vrf
, afi
, safi
, uj
);
7491 afi_safi_print (afi_t afi
, safi_t safi
)
7493 if (afi
== AFI_IP
&& safi
== SAFI_UNICAST
)
7494 return "IPv4 Unicast";
7495 else if (afi
== AFI_IP
&& safi
== SAFI_MULTICAST
)
7496 return "IPv4 Multicast";
7497 else if (afi
== AFI_IP
&& safi
== SAFI_LABELED_UNICAST
)
7498 return "IPv4 labeled-unicast";
7499 else if (afi
== AFI_IP
&& safi
== SAFI_MPLS_VPN
)
7501 else if (afi
== AFI_IP
&& safi
== SAFI_ENCAP
)
7502 return "IPv4 Encap";
7503 else if (afi
== AFI_IP6
&& safi
== SAFI_UNICAST
)
7504 return "IPv6 Unicast";
7505 else if (afi
== AFI_IP6
&& safi
== SAFI_MULTICAST
)
7506 return "IPv6 Multicast";
7507 else if (afi
== AFI_IP6
&& safi
== SAFI_LABELED_UNICAST
)
7508 return "IPv6 labeled-unicast";
7509 else if (afi
== AFI_IP6
&& safi
== SAFI_MPLS_VPN
)
7511 else if (afi
== AFI_IP6
&& safi
== SAFI_ENCAP
)
7512 return "IPv6 Encap";
7513 else if (afi
== AFI_L2VPN
&& safi
== SAFI_EVPN
)
7514 return "L2VPN EVPN";
7520 * Please note that we have intentionally camelCased
7521 * the return strings here. So if you want
7522 * to use this function, please ensure you
7523 * are doing this within json output
7526 afi_safi_json (afi_t afi
, safi_t safi
)
7528 if (afi
== AFI_IP
&& safi
== SAFI_UNICAST
)
7529 return "ipv4Unicast";
7530 else if (afi
== AFI_IP
&& safi
== SAFI_MULTICAST
)
7531 return "ipv4Multicast";
7532 else if (afi
== AFI_IP
&& safi
== SAFI_LABELED_UNICAST
)
7533 return "ipv4LabeledUnicast";
7534 else if (afi
== AFI_IP
&& safi
== SAFI_MPLS_VPN
)
7536 else if (afi
== AFI_IP
&& safi
== SAFI_ENCAP
)
7538 else if (afi
== AFI_IP6
&& safi
== SAFI_UNICAST
)
7539 return "ipv6Unicast";
7540 else if (afi
== AFI_IP6
&& safi
== SAFI_MULTICAST
)
7541 return "ipv6Multicast";
7542 else if (afi
== AFI_IP6
&& safi
== SAFI_LABELED_UNICAST
)
7543 return "ipv6LabeledUnicast";
7544 else if (afi
== AFI_IP6
&& safi
== SAFI_MPLS_VPN
)
7546 else if (afi
== AFI_IP6
&& safi
== SAFI_ENCAP
)
7548 else if (afi
== AFI_L2VPN
&& safi
== SAFI_EVPN
)
7554 /* Show BGP peer's information. */
7562 bgp_show_peer_afi_orf_cap (struct vty
*vty
, struct peer
*p
, afi_t afi
, safi_t safi
,
7563 u_int16_t adv_smcap
, u_int16_t adv_rmcap
, u_int16_t rcv_smcap
,
7564 u_int16_t rcv_rmcap
, u_char use_json
, json_object
*json_pref
)
7567 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], adv_smcap
)
7568 || CHECK_FLAG (p
->af_cap
[afi
][safi
], rcv_smcap
))
7572 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], adv_smcap
) && CHECK_FLAG (p
->af_cap
[afi
][safi
], rcv_smcap
))
7573 json_object_string_add(json_pref
, "sendMode", "advertisedAndReceived");
7574 else if (CHECK_FLAG (p
->af_cap
[afi
][safi
], adv_smcap
))
7575 json_object_string_add(json_pref
, "sendMode", "advertised");
7576 else if (CHECK_FLAG (p
->af_cap
[afi
][safi
], rcv_smcap
))
7577 json_object_string_add(json_pref
, "sendMode", "received");
7581 vty_out (vty
, " Send-mode: ");
7582 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], adv_smcap
))
7583 vty_out (vty
, "advertised");
7584 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], rcv_smcap
))
7585 vty_out (vty
, "%sreceived",
7586 CHECK_FLAG (p
->af_cap
[afi
][safi
], adv_smcap
) ?
7588 vty_out (vty
, "%s", VTY_NEWLINE
);
7593 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], adv_rmcap
)
7594 || CHECK_FLAG (p
->af_cap
[afi
][safi
], rcv_rmcap
))
7598 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], adv_rmcap
) && CHECK_FLAG (p
->af_cap
[afi
][safi
], rcv_rmcap
))
7599 json_object_string_add(json_pref
, "recvMode", "advertisedAndReceived");
7600 else if (CHECK_FLAG (p
->af_cap
[afi
][safi
], adv_rmcap
))
7601 json_object_string_add(json_pref
, "recvMode", "advertised");
7602 else if (CHECK_FLAG (p
->af_cap
[afi
][safi
], rcv_rmcap
))
7603 json_object_string_add(json_pref
, "recvMode", "received");
7607 vty_out (vty
, " Receive-mode: ");
7608 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], adv_rmcap
))
7609 vty_out (vty
, "advertised");
7610 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], rcv_rmcap
))
7611 vty_out (vty
, "%sreceived",
7612 CHECK_FLAG (p
->af_cap
[afi
][safi
], adv_rmcap
) ?
7614 vty_out (vty
, "%s", VTY_NEWLINE
);
7620 bgp_show_peer_afi (struct vty
*vty
, struct peer
*p
, afi_t afi
, safi_t safi
,
7621 u_char use_json
, json_object
*json_neigh
)
7623 struct bgp_filter
*filter
;
7624 struct peer_af
*paf
;
7625 char orf_pfx_name
[BUFSIZ
];
7627 json_object
*json_af
= NULL
;
7628 json_object
*json_prefA
= NULL
;
7629 json_object
*json_prefB
= NULL
;
7630 json_object
*json_addr
= NULL
;
7634 json_addr
= json_object_new_object();
7635 json_af
= json_object_new_object();
7636 filter
= &p
->filter
[afi
][safi
];
7638 if (peer_group_active(p
))
7639 json_object_string_add(json_addr
, "peerGroupMember", p
->group
->name
);
7641 paf
= peer_af_find(p
, afi
, safi
);
7642 if (paf
&& PAF_SUBGRP(paf
))
7644 json_object_int_add(json_addr
, "updateGroupId", PAF_UPDGRP(paf
)->id
);
7645 json_object_int_add(json_addr
, "subGroupId", PAF_SUBGRP(paf
)->id
);
7646 json_object_int_add(json_addr
, "packetQueueLength", bpacket_queue_virtual_length(paf
));
7649 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_ADV
)
7650 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_RCV
)
7651 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_ADV
)
7652 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_RCV
))
7654 json_object_int_add(json_af
, "orfType", ORF_TYPE_PREFIX
);
7655 json_prefA
= json_object_new_object();
7656 bgp_show_peer_afi_orf_cap (vty
, p
, afi
, safi
,
7657 PEER_CAP_ORF_PREFIX_SM_ADV
,
7658 PEER_CAP_ORF_PREFIX_RM_ADV
,
7659 PEER_CAP_ORF_PREFIX_SM_RCV
,
7660 PEER_CAP_ORF_PREFIX_RM_RCV
, use_json
, json_prefA
);
7661 json_object_object_add(json_af
, "orfPrefixList", json_prefA
);
7664 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_ADV
)
7665 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_OLD_RCV
)
7666 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_ADV
)
7667 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_OLD_RCV
))
7669 json_object_int_add(json_af
, "orfOldType", ORF_TYPE_PREFIX_OLD
);
7670 json_prefB
= json_object_new_object();
7671 bgp_show_peer_afi_orf_cap (vty
, p
, afi
, safi
,
7672 PEER_CAP_ORF_PREFIX_SM_ADV
,
7673 PEER_CAP_ORF_PREFIX_RM_ADV
,
7674 PEER_CAP_ORF_PREFIX_SM_OLD_RCV
,
7675 PEER_CAP_ORF_PREFIX_RM_OLD_RCV
, use_json
, json_prefB
);
7676 json_object_object_add(json_af
, "orfOldPrefixList", json_prefB
);
7679 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_ADV
)
7680 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_RCV
)
7681 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_OLD_RCV
)
7682 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_ADV
)
7683 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_RCV
)
7684 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_OLD_RCV
))
7685 json_object_object_add(json_addr
, "afDependentCap", json_af
);
7687 json_object_free(json_af
);
7689 sprintf (orf_pfx_name
, "%s.%d.%d", p
->host
, afi
, safi
);
7690 orf_pfx_count
= prefix_bgp_show_prefix_list (NULL
, afi
, orf_pfx_name
, use_json
);
7692 if (CHECK_FLAG (p
->af_sflags
[afi
][safi
], PEER_STATUS_ORF_PREFIX_SEND
)
7695 if (CHECK_FLAG (p
->af_sflags
[afi
][safi
], PEER_STATUS_ORF_PREFIX_SEND
))
7696 json_object_boolean_true_add(json_neigh
, "orfSent");
7698 json_object_int_add(json_addr
, "orfRecvCounter", orf_pfx_count
);
7700 if (CHECK_FLAG (p
->af_sflags
[afi
][safi
], PEER_STATUS_ORF_WAIT_REFRESH
))
7701 json_object_string_add(json_addr
, "orfFirstUpdate", "deferredUntilORFOrRouteRefreshRecvd");
7703 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_REFLECTOR_CLIENT
))
7704 json_object_boolean_true_add(json_addr
, "routeReflectorClient");
7705 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_RSERVER_CLIENT
))
7706 json_object_boolean_true_add(json_addr
, "routeServerClient");
7707 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_SOFT_RECONFIG
))
7708 json_object_boolean_true_add(json_addr
, "inboundSoftConfigPermit");
7710 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE
))
7711 json_object_boolean_true_add(json_addr
, "privateAsNumsAllReplacedInUpdatesToNbr");
7712 else if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE
))
7713 json_object_boolean_true_add(json_addr
, "privateAsNumsReplacedInUpdatesToNbr");
7714 else if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_REMOVE_PRIVATE_AS_ALL
))
7715 json_object_boolean_true_add(json_addr
, "privateAsNumsAllRemovedInUpdatesToNbr");
7716 else if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_REMOVE_PRIVATE_AS
))
7717 json_object_boolean_true_add(json_addr
, "privateAsNumsRemovedInUpdatesToNbr");
7719 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_ADDPATH_TX_ALL_PATHS
))
7720 json_object_boolean_true_add(json_addr
, "addpathTxAllPaths");
7722 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_ADDPATH_TX_BESTPATH_PER_AS
))
7723 json_object_boolean_true_add(json_addr
, "addpathTxBestpathPerAS");
7725 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_AS_OVERRIDE
))
7726 json_object_string_add(json_addr
, "overrideASNsInOutboundUpdates", "ifAspathEqualRemoteAs");
7728 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_NEXTHOP_SELF
) ||
7729 CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_FORCE_NEXTHOP_SELF
))
7730 json_object_boolean_true_add(json_addr
, "routerAlwaysNextHop");
7731 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_AS_PATH_UNCHANGED
))
7732 json_object_boolean_true_add(json_addr
, "unchangedAsPathPropogatedToNbr");
7733 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_NEXTHOP_UNCHANGED
))
7734 json_object_boolean_true_add(json_addr
, "unchangedNextHopPropogatedToNbr");
7735 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_MED_UNCHANGED
))
7736 json_object_boolean_true_add(json_addr
, "unchangedMedPropogatedToNbr");
7737 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_SEND_COMMUNITY
)
7738 || CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_SEND_EXT_COMMUNITY
))
7740 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_SEND_COMMUNITY
)
7741 && CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_SEND_EXT_COMMUNITY
))
7742 json_object_string_add(json_addr
, "commAttriSentToNbr", "extendedAndStandard");
7743 else if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_SEND_EXT_COMMUNITY
))
7744 json_object_string_add(json_addr
, "commAttriSentToNbr", "extended");
7746 json_object_string_add(json_addr
, "commAttriSentToNbr", "standard");
7748 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_DEFAULT_ORIGINATE
))
7750 if (p
->default_rmap
[afi
][safi
].name
)
7751 json_object_string_add(json_addr
, "defaultRouteMap", p
->default_rmap
[afi
][safi
].name
);
7753 if (paf
&& PAF_SUBGRP(paf
) && CHECK_FLAG(PAF_SUBGRP(paf
)->sflags
, SUBGRP_STATUS_DEFAULT_ORIGINATE
))
7754 json_object_boolean_true_add(json_addr
, "defaultSent");
7756 json_object_boolean_true_add(json_addr
, "defaultNotSent");
7759 if (filter
->plist
[FILTER_IN
].name
7760 || filter
->dlist
[FILTER_IN
].name
7761 || filter
->aslist
[FILTER_IN
].name
7762 || filter
->map
[RMAP_IN
].name
)
7763 json_object_boolean_true_add(json_addr
, "inboundPathPolicyConfig");
7764 if (filter
->plist
[FILTER_OUT
].name
7765 || filter
->dlist
[FILTER_OUT
].name
7766 || filter
->aslist
[FILTER_OUT
].name
7767 || filter
->map
[RMAP_OUT
].name
7768 || filter
->usmap
.name
)
7769 json_object_boolean_true_add(json_addr
, "outboundPathPolicyConfig");
7772 if (filter
->plist
[FILTER_IN
].name
)
7773 json_object_string_add(json_addr
, "incomingUpdatePrefixFilterList", filter
->plist
[FILTER_IN
].name
);
7774 if (filter
->plist
[FILTER_OUT
].name
)
7775 json_object_string_add(json_addr
, "outgoingUpdatePrefixFilterList", filter
->plist
[FILTER_OUT
].name
);
7777 /* distribute-list */
7778 if (filter
->dlist
[FILTER_IN
].name
)
7779 json_object_string_add(json_addr
, "incomingUpdateNetworkFilterList", filter
->dlist
[FILTER_IN
].name
);
7780 if (filter
->dlist
[FILTER_OUT
].name
)
7781 json_object_string_add(json_addr
, "outgoingUpdateNetworkFilterList", filter
->dlist
[FILTER_OUT
].name
);
7784 if (filter
->aslist
[FILTER_IN
].name
)
7785 json_object_string_add(json_addr
, "incomingUpdateAsPathFilterList", filter
->aslist
[FILTER_IN
].name
);
7786 if (filter
->aslist
[FILTER_OUT
].name
)
7787 json_object_string_add(json_addr
, "outgoingUpdateAsPathFilterList", filter
->aslist
[FILTER_OUT
].name
);
7790 if (filter
->map
[RMAP_IN
].name
)
7791 json_object_string_add(json_addr
, "routeMapForIncomingAdvertisements", filter
->map
[RMAP_IN
].name
);
7792 if (filter
->map
[RMAP_OUT
].name
)
7793 json_object_string_add(json_addr
, "routeMapForOutgoingAdvertisements", filter
->map
[RMAP_OUT
].name
);
7795 /* unsuppress-map */
7796 if (filter
->usmap
.name
)
7797 json_object_string_add(json_addr
, "selectiveUnsuppressRouteMap", filter
->usmap
.name
);
7799 /* Receive prefix count */
7800 json_object_int_add(json_addr
, "acceptedPrefixCounter", p
->pcount
[afi
][safi
]);
7802 /* Maximum prefix */
7803 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_MAX_PREFIX
))
7805 json_object_int_add(json_addr
, "prefixAllowedMax", p
->pmax
[afi
][safi
]);
7806 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_MAX_PREFIX_WARNING
))
7807 json_object_boolean_true_add(json_addr
, "prefixAllowedMaxWarning");
7808 json_object_int_add(json_addr
, "prefixAllowedWarningThresh", p
->pmax_threshold
[afi
][safi
]);
7809 if (p
->pmax_restart
[afi
][safi
])
7810 json_object_int_add(json_addr
, "prefixAllowedRestartIntervalMsecs", p
->pmax_restart
[afi
][safi
] * 60000);
7812 json_object_object_add(json_neigh
, afi_safi_print (afi
, safi
), json_addr
);
7817 filter
= &p
->filter
[afi
][safi
];
7819 vty_out (vty
, " For address family: %s%s", afi_safi_print (afi
, safi
),
7822 if (peer_group_active(p
))
7823 vty_out (vty
, " %s peer-group member%s", p
->group
->name
, VTY_NEWLINE
);
7825 paf
= peer_af_find(p
, afi
, safi
);
7826 if (paf
&& PAF_SUBGRP(paf
))
7828 vty_out (vty
, " Update group %" PRIu64
", subgroup %" PRIu64
"%s",
7829 PAF_UPDGRP(paf
)->id
, PAF_SUBGRP(paf
)->id
, VTY_NEWLINE
);
7830 vty_out (vty
, " Packet Queue length %d%s",
7831 bpacket_queue_virtual_length(paf
), VTY_NEWLINE
);
7835 vty_out(vty
, " Not part of any update group%s", VTY_NEWLINE
);
7837 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_ADV
)
7838 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_RCV
)
7839 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_OLD_RCV
)
7840 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_ADV
)
7841 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_RCV
)
7842 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_OLD_RCV
))
7843 vty_out (vty
, " AF-dependant capabilities:%s", VTY_NEWLINE
);
7845 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_ADV
)
7846 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_RCV
)
7847 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_ADV
)
7848 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_RCV
))
7850 vty_out (vty
, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s",
7851 ORF_TYPE_PREFIX
, VTY_NEWLINE
);
7852 bgp_show_peer_afi_orf_cap (vty
, p
, afi
, safi
,
7853 PEER_CAP_ORF_PREFIX_SM_ADV
,
7854 PEER_CAP_ORF_PREFIX_RM_ADV
,
7855 PEER_CAP_ORF_PREFIX_SM_RCV
,
7856 PEER_CAP_ORF_PREFIX_RM_RCV
, use_json
, NULL
);
7858 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_ADV
)
7859 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_OLD_RCV
)
7860 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_ADV
)
7861 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_OLD_RCV
))
7863 vty_out (vty
, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s",
7864 ORF_TYPE_PREFIX_OLD
, VTY_NEWLINE
);
7865 bgp_show_peer_afi_orf_cap (vty
, p
, afi
, safi
,
7866 PEER_CAP_ORF_PREFIX_SM_ADV
,
7867 PEER_CAP_ORF_PREFIX_RM_ADV
,
7868 PEER_CAP_ORF_PREFIX_SM_OLD_RCV
,
7869 PEER_CAP_ORF_PREFIX_RM_OLD_RCV
, use_json
, NULL
);
7872 sprintf (orf_pfx_name
, "%s.%d.%d", p
->host
, afi
, safi
);
7873 orf_pfx_count
= prefix_bgp_show_prefix_list (NULL
, afi
, orf_pfx_name
, use_json
);
7875 if (CHECK_FLAG (p
->af_sflags
[afi
][safi
], PEER_STATUS_ORF_PREFIX_SEND
)
7878 vty_out (vty
, " Outbound Route Filter (ORF):");
7879 if (CHECK_FLAG (p
->af_sflags
[afi
][safi
], PEER_STATUS_ORF_PREFIX_SEND
))
7880 vty_out (vty
, " sent;");
7882 vty_out (vty
, " received (%d entries)", orf_pfx_count
);
7883 vty_out (vty
, "%s", VTY_NEWLINE
);
7885 if (CHECK_FLAG (p
->af_sflags
[afi
][safi
], PEER_STATUS_ORF_WAIT_REFRESH
))
7886 vty_out (vty
, " First update is deferred until ORF or ROUTE-REFRESH is received%s", VTY_NEWLINE
);
7888 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_REFLECTOR_CLIENT
))
7889 vty_out (vty
, " Route-Reflector Client%s", VTY_NEWLINE
);
7890 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_RSERVER_CLIENT
))
7891 vty_out (vty
, " Route-Server Client%s", VTY_NEWLINE
);
7892 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_SOFT_RECONFIG
))
7893 vty_out (vty
, " Inbound soft reconfiguration allowed%s", VTY_NEWLINE
);
7895 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE
))
7896 vty_out (vty
, " Private AS numbers (all) replaced in updates to this neighbor%s", VTY_NEWLINE
);
7897 else if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE
))
7898 vty_out (vty
, " Private AS numbers replaced in updates to this neighbor%s", VTY_NEWLINE
);
7899 else if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_REMOVE_PRIVATE_AS_ALL
))
7900 vty_out (vty
, " Private AS numbers (all) removed in updates to this neighbor%s", VTY_NEWLINE
);
7901 else if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_REMOVE_PRIVATE_AS
))
7902 vty_out (vty
, " Private AS numbers removed in updates to this neighbor%s", VTY_NEWLINE
);
7904 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_ADDPATH_TX_ALL_PATHS
))
7905 vty_out (vty
, " Advertise all paths via addpath%s", VTY_NEWLINE
);
7907 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_ADDPATH_TX_BESTPATH_PER_AS
))
7908 vty_out (vty
, " Advertise bestpath per AS via addpath%s", VTY_NEWLINE
);
7910 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_AS_OVERRIDE
))
7911 vty_out (vty
, " Override ASNs in outbound updates if aspath equals remote-as%s", VTY_NEWLINE
);
7913 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_NEXTHOP_SELF
) ||
7914 CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_FORCE_NEXTHOP_SELF
))
7915 vty_out (vty
, " NEXT_HOP is always this router%s", VTY_NEWLINE
);
7916 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_AS_PATH_UNCHANGED
))
7917 vty_out (vty
, " AS_PATH is propagated unchanged to this neighbor%s", VTY_NEWLINE
);
7918 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_NEXTHOP_UNCHANGED
))
7919 vty_out (vty
, " NEXT_HOP is propagated unchanged to this neighbor%s", VTY_NEWLINE
);
7920 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_MED_UNCHANGED
))
7921 vty_out (vty
, " MED is propagated unchanged to this neighbor%s", VTY_NEWLINE
);
7922 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_SEND_COMMUNITY
)
7923 || CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_SEND_EXT_COMMUNITY
)
7924 || CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_SEND_LARGE_COMMUNITY
))
7926 vty_out (vty
, " Community attribute sent to this neighbor");
7927 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_SEND_COMMUNITY
)
7928 && CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_SEND_EXT_COMMUNITY
)
7929 && CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_SEND_LARGE_COMMUNITY
))
7930 vty_out (vty
, "(all)%s", VTY_NEWLINE
);
7931 else if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_SEND_LARGE_COMMUNITY
))
7932 vty_out (vty
, "(large)%s", VTY_NEWLINE
);
7933 else if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_SEND_EXT_COMMUNITY
))
7934 vty_out (vty
, "(extended)%s", VTY_NEWLINE
);
7936 vty_out (vty
, "(standard)%s", VTY_NEWLINE
);
7938 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_DEFAULT_ORIGINATE
))
7940 vty_out (vty
, " Default information originate,");
7942 if (p
->default_rmap
[afi
][safi
].name
)
7943 vty_out (vty
, " default route-map %s%s,",
7944 p
->default_rmap
[afi
][safi
].map
? "*" : "",
7945 p
->default_rmap
[afi
][safi
].name
);
7946 if (paf
&& PAF_SUBGRP(paf
) && CHECK_FLAG(PAF_SUBGRP(paf
)->sflags
, SUBGRP_STATUS_DEFAULT_ORIGINATE
))
7947 vty_out (vty
, " default sent%s", VTY_NEWLINE
);
7949 vty_out (vty
, " default not sent%s", VTY_NEWLINE
);
7952 if (filter
->plist
[FILTER_IN
].name
7953 || filter
->dlist
[FILTER_IN
].name
7954 || filter
->aslist
[FILTER_IN
].name
7955 || filter
->map
[RMAP_IN
].name
)
7956 vty_out (vty
, " Inbound path policy configured%s", VTY_NEWLINE
);
7957 if (filter
->plist
[FILTER_OUT
].name
7958 || filter
->dlist
[FILTER_OUT
].name
7959 || filter
->aslist
[FILTER_OUT
].name
7960 || filter
->map
[RMAP_OUT
].name
7961 || filter
->usmap
.name
)
7962 vty_out (vty
, " Outbound path policy configured%s", VTY_NEWLINE
);
7965 if (filter
->plist
[FILTER_IN
].name
)
7966 vty_out (vty
, " Incoming update prefix filter list is %s%s%s",
7967 filter
->plist
[FILTER_IN
].plist
? "*" : "",
7968 filter
->plist
[FILTER_IN
].name
,
7970 if (filter
->plist
[FILTER_OUT
].name
)
7971 vty_out (vty
, " Outgoing update prefix filter list is %s%s%s",
7972 filter
->plist
[FILTER_OUT
].plist
? "*" : "",
7973 filter
->plist
[FILTER_OUT
].name
,
7976 /* distribute-list */
7977 if (filter
->dlist
[FILTER_IN
].name
)
7978 vty_out (vty
, " Incoming update network filter list is %s%s%s",
7979 filter
->dlist
[FILTER_IN
].alist
? "*" : "",
7980 filter
->dlist
[FILTER_IN
].name
,
7982 if (filter
->dlist
[FILTER_OUT
].name
)
7983 vty_out (vty
, " Outgoing update network filter list is %s%s%s",
7984 filter
->dlist
[FILTER_OUT
].alist
? "*" : "",
7985 filter
->dlist
[FILTER_OUT
].name
,
7989 if (filter
->aslist
[FILTER_IN
].name
)
7990 vty_out (vty
, " Incoming update AS path filter list is %s%s%s",
7991 filter
->aslist
[FILTER_IN
].aslist
? "*" : "",
7992 filter
->aslist
[FILTER_IN
].name
,
7994 if (filter
->aslist
[FILTER_OUT
].name
)
7995 vty_out (vty
, " Outgoing update AS path filter list is %s%s%s",
7996 filter
->aslist
[FILTER_OUT
].aslist
? "*" : "",
7997 filter
->aslist
[FILTER_OUT
].name
,
8001 if (filter
->map
[RMAP_IN
].name
)
8002 vty_out (vty
, " Route map for incoming advertisements is %s%s%s",
8003 filter
->map
[RMAP_IN
].map
? "*" : "",
8004 filter
->map
[RMAP_IN
].name
,
8006 if (filter
->map
[RMAP_OUT
].name
)
8007 vty_out (vty
, " Route map for outgoing advertisements is %s%s%s",
8008 filter
->map
[RMAP_OUT
].map
? "*" : "",
8009 filter
->map
[RMAP_OUT
].name
,
8012 /* unsuppress-map */
8013 if (filter
->usmap
.name
)
8014 vty_out (vty
, " Route map for selective unsuppress is %s%s%s",
8015 filter
->usmap
.map
? "*" : "",
8016 filter
->usmap
.name
, VTY_NEWLINE
);
8018 /* Receive prefix count */
8019 vty_out (vty
, " %ld accepted prefixes%s", p
->pcount
[afi
][safi
], VTY_NEWLINE
);
8021 /* Maximum prefix */
8022 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_MAX_PREFIX
))
8024 vty_out (vty
, " Maximum prefixes allowed %ld%s%s", p
->pmax
[afi
][safi
],
8025 CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_MAX_PREFIX_WARNING
)
8026 ? " (warning-only)" : "", VTY_NEWLINE
);
8027 vty_out (vty
, " Threshold for warning message %d%%",
8028 p
->pmax_threshold
[afi
][safi
]);
8029 if (p
->pmax_restart
[afi
][safi
])
8030 vty_out (vty
, ", restart interval %d min", p
->pmax_restart
[afi
][safi
]);
8031 vty_out (vty
, "%s", VTY_NEWLINE
);
8034 vty_out (vty
, "%s", VTY_NEWLINE
);
8039 bgp_show_peer (struct vty
*vty
, struct peer
*p
, u_char use_json
, json_object
*json
)
8042 char buf1
[PREFIX2STR_BUFFER
], buf
[SU_ADDRSTRLEN
];
8043 char timebuf
[BGP_UPTIME_LEN
];
8045 const char *subcode_str
;
8046 const char *code_str
;
8051 json_object
*json_neigh
= NULL
;
8057 json_neigh
= json_object_new_object();
8059 memset (dn_flag
, '\0', sizeof (dn_flag
));
8060 if (!p
->conf_if
&& peer_dynamic_neighbor (p
))
8065 if (p
->conf_if
) /* Configured interface name. */
8066 vty_out (vty
, "BGP neighbor on %s: %s, ", p
->conf_if
,
8067 BGP_PEER_SU_UNSPEC(p
) ? "None" :
8068 sockunion2str (&p
->su
, buf
, SU_ADDRSTRLEN
));
8069 else /* Configured IP address. */
8070 vty_out (vty
, "BGP neighbor is %s%s, ", dn_flag
, p
->host
);
8075 if (p
->conf_if
&& BGP_PEER_SU_UNSPEC(p
))
8076 json_object_string_add(json_neigh
, "bgpNeighborAddr", "none");
8077 else if (p
->conf_if
&& !BGP_PEER_SU_UNSPEC(p
))
8078 json_object_string_add(json_neigh
, "bgpNeighborAddr", sockunion2str (&p
->su
, buf
, SU_ADDRSTRLEN
));
8080 json_object_int_add(json_neigh
, "remoteAs", p
->as
);
8082 if (p
->change_local_as
)
8083 json_object_int_add(json_neigh
, "localAs", p
->change_local_as
);
8085 json_object_int_add(json_neigh
, "localAs", p
->local_as
);
8087 if (CHECK_FLAG (p
->flags
, PEER_FLAG_LOCAL_AS_NO_PREPEND
))
8088 json_object_boolean_true_add(json_neigh
, "localAsNoPrepend");
8090 if (CHECK_FLAG (p
->flags
, PEER_FLAG_LOCAL_AS_REPLACE_AS
))
8091 json_object_boolean_true_add(json_neigh
, "localAsReplaceAs");
8095 if ((p
->as_type
== AS_SPECIFIED
) ||
8096 (p
->as_type
== AS_EXTERNAL
) ||
8097 (p
->as_type
== AS_INTERNAL
))
8098 vty_out (vty
, "remote AS %u, ", p
->as
);
8100 vty_out (vty
, "remote AS Unspecified, ");
8101 vty_out (vty
, "local AS %u%s%s, ",
8102 p
->change_local_as
? p
->change_local_as
: p
->local_as
,
8103 CHECK_FLAG (p
->flags
, PEER_FLAG_LOCAL_AS_NO_PREPEND
) ?
8105 CHECK_FLAG (p
->flags
, PEER_FLAG_LOCAL_AS_REPLACE_AS
) ?
8106 " replace-as" : "");
8108 /* peer type internal, external, confed-internal or confed-external */
8109 if (p
->as
== p
->local_as
)
8113 if (CHECK_FLAG(bgp
->config
, BGP_CONFIG_CONFEDERATION
))
8114 json_object_boolean_true_add(json_neigh
, "nbrConfedInternalLink");
8116 json_object_boolean_true_add(json_neigh
, "nbrInternalLink");
8120 if (CHECK_FLAG(bgp
->config
, BGP_CONFIG_CONFEDERATION
))
8121 vty_out (vty
, "confed-internal link%s", VTY_NEWLINE
);
8123 vty_out (vty
, "internal link%s", VTY_NEWLINE
);
8130 if (CHECK_FLAG(bgp
->config
, BGP_CONFIG_CONFEDERATION
))
8131 json_object_boolean_true_add(json_neigh
, "nbrConfedExternalLink");
8133 json_object_boolean_true_add(json_neigh
, "nbrExternalLink");
8137 if (bgp_confederation_peers_check(bgp
, p
->as
))
8138 vty_out (vty
, "confed-external link%s", VTY_NEWLINE
);
8140 vty_out (vty
, "external link%s", VTY_NEWLINE
);
8148 json_object_string_add(json_neigh
, "nbrDesc", p
->desc
);
8150 vty_out (vty
, " Description: %s%s", p
->desc
, VTY_NEWLINE
);
8158 json_object_string_add(json_neigh
, "hostname", p
->hostname
);
8161 json_object_string_add(json_neigh
, "domainname", p
->domainname
);
8165 if (p
->domainname
&& (p
->domainname
[0] != '\0'))
8166 vty_out(vty
, "Hostname: %s.%s%s", p
->hostname
, p
->domainname
,
8169 vty_out(vty
, "Hostname: %s%s", p
->hostname
, VTY_NEWLINE
);
8179 json_object_string_add(json_neigh
, "peerGroup", p
->group
->name
);
8183 struct prefix prefix
, *range
= NULL
;
8185 sockunion2hostprefix(&(p
->su
), &prefix
);
8186 range
= peer_group_lookup_dynamic_neighbor_range (p
->group
, &prefix
);
8190 prefix2str(range
, buf1
, sizeof(buf1
));
8191 json_object_string_add(json_neigh
, "peerSubnetRangeGroup", buf1
);
8197 vty_out (vty
, " Member of peer-group %s for session parameters%s",
8198 p
->group
->name
, VTY_NEWLINE
);
8202 struct prefix prefix
, *range
= NULL
;
8204 sockunion2hostprefix(&(p
->su
), &prefix
);
8205 range
= peer_group_lookup_dynamic_neighbor_range (p
->group
, &prefix
);
8209 prefix2str(range
, buf1
, sizeof(buf1
));
8210 vty_out (vty
, " Belongs to the subnet range group: %s%s", buf1
, VTY_NEWLINE
);
8218 /* Administrative shutdown. */
8219 if (CHECK_FLAG (p
->flags
, PEER_FLAG_SHUTDOWN
))
8220 json_object_boolean_true_add(json_neigh
, "adminShutDown");
8223 json_object_int_add(json_neigh
, "bgpVersion", 4);
8224 json_object_string_add(json_neigh
, "remoteRouterId",
8225 inet_ntop (AF_INET
, &p
->remote_id
, buf1
, sizeof(buf1
)));
8228 if (CHECK_FLAG (bgp
->config
, BGP_CONFIG_CONFEDERATION
) && bgp_confederation_peers_check (bgp
, p
->as
))
8229 json_object_boolean_true_add(json_neigh
, "nbrCommonAdmin");
8232 json_object_string_add(json_neigh
, "bgpState", lookup_msg(bgp_status_msg
, p
->status
, NULL
));
8234 if (p
->status
== Established
)
8239 uptime
= bgp_clock();
8240 uptime
-= p
->uptime
;
8241 tm
= gmtime(&uptime
);
8242 epoch_tbuf
= time(NULL
) - uptime
;
8244 json_object_int_add(json_neigh
, "bgpTimerUp", (tm
->tm_sec
* 1000) + (tm
->tm_min
* 60000) + (tm
->tm_hour
* 3600000));
8245 json_object_string_add(json_neigh
, "bgpTimerUpString", peer_uptime (p
->uptime
, timebuf
, BGP_UPTIME_LEN
, 0, NULL
));
8246 json_object_int_add(json_neigh
, "bgpTimerUpEstablishedEpoch", epoch_tbuf
);
8249 else if (p
->status
== Active
)
8251 if (CHECK_FLAG (p
->flags
, PEER_FLAG_PASSIVE
))
8252 json_object_string_add(json_neigh
, "bgpStateIs", "passive");
8253 else if (CHECK_FLAG (p
->sflags
, PEER_STATUS_NSF_WAIT
))
8254 json_object_string_add(json_neigh
, "bgpStateIs", "passiveNSF");
8261 uptime
= bgp_clock();
8262 uptime
-= p
->readtime
;
8263 tm
= gmtime(&uptime
);
8264 json_object_int_add(json_neigh
, "bgpTimerLastRead", (tm
->tm_sec
* 1000) + (tm
->tm_min
* 60000) + (tm
->tm_hour
* 3600000));
8266 uptime
= bgp_clock();
8267 uptime
-= p
->last_write
;
8268 tm
= gmtime(&uptime
);
8269 json_object_int_add(json_neigh
, "bgpTimerLastWrite", (tm
->tm_sec
* 1000) + (tm
->tm_min
* 60000) + (tm
->tm_hour
* 3600000));
8271 uptime
= bgp_clock();
8272 uptime
-= p
->update_time
;
8273 tm
= gmtime(&uptime
);
8274 json_object_int_add(json_neigh
, "bgpInUpdateElapsedTimeMsecs",
8275 (tm
->tm_sec
* 1000) + (tm
->tm_min
* 60000) + (tm
->tm_hour
* 3600000));
8277 /* Configured timer values. */
8278 json_object_int_add(json_neigh
, "bgpTimerHoldTimeMsecs", p
->v_holdtime
* 1000);
8279 json_object_int_add(json_neigh
, "bgpTimerKeepAliveIntervalMsecs", p
->v_keepalive
* 1000);
8281 if (CHECK_FLAG (p
->config
, PEER_CONFIG_TIMER
))
8283 json_object_int_add(json_neigh
, "bgpTimerConfiguredHoldTimeMsecs", p
->holdtime
* 1000);
8284 json_object_int_add(json_neigh
, "bgpTimerConfiguredKeepAliveIntervalMsecs", p
->keepalive
* 1000);
8289 /* Administrative shutdown. */
8290 if (CHECK_FLAG (p
->flags
, PEER_FLAG_SHUTDOWN
))
8291 vty_out (vty
, " Administratively shut down%s", VTY_NEWLINE
);
8294 vty_out (vty
, " BGP version 4");
8295 vty_out (vty
, ", remote router ID %s%s",
8296 inet_ntop (AF_INET
, &p
->remote_id
, buf1
, sizeof(buf1
)),
8300 if (CHECK_FLAG (bgp
->config
, BGP_CONFIG_CONFEDERATION
)
8301 && bgp_confederation_peers_check (bgp
, p
->as
))
8302 vty_out (vty
, " Neighbor under common administration%s", VTY_NEWLINE
);
8305 vty_out (vty
, " BGP state = %s", lookup_msg(bgp_status_msg
, p
->status
, NULL
));
8307 if (p
->status
== Established
)
8308 vty_out (vty
, ", up for %8s", peer_uptime (p
->uptime
, timebuf
, BGP_UPTIME_LEN
, 0, NULL
));
8310 else if (p
->status
== Active
)
8312 if (CHECK_FLAG (p
->flags
, PEER_FLAG_PASSIVE
))
8313 vty_out (vty
, " (passive)");
8314 else if (CHECK_FLAG (p
->sflags
, PEER_STATUS_NSF_WAIT
))
8315 vty_out (vty
, " (NSF passive)");
8317 vty_out (vty
, "%s", VTY_NEWLINE
);
8320 vty_out (vty
, " Last read %s", peer_uptime (p
->readtime
, timebuf
, BGP_UPTIME_LEN
, 0, NULL
));
8321 vty_out (vty
, ", Last write %s%s",
8322 peer_uptime (p
->last_write
, timebuf
, BGP_UPTIME_LEN
, 0, NULL
), VTY_NEWLINE
);
8324 /* Configured timer values. */
8325 vty_out (vty
, " Hold time is %d, keepalive interval is %d seconds%s",
8326 p
->v_holdtime
, p
->v_keepalive
, VTY_NEWLINE
);
8327 if (CHECK_FLAG (p
->config
, PEER_CONFIG_TIMER
))
8329 vty_out (vty
, " Configured hold time is %d", p
->holdtime
);
8330 vty_out (vty
, ", keepalive interval is %d seconds%s",
8331 p
->keepalive
, VTY_NEWLINE
);
8335 if (p
->status
== Established
)
8338 || p
->afc_adv
[AFI_IP
][SAFI_UNICAST
]
8339 || p
->afc_recv
[AFI_IP
][SAFI_UNICAST
]
8340 || p
->afc_adv
[AFI_IP
][SAFI_MULTICAST
]
8341 || p
->afc_recv
[AFI_IP
][SAFI_MULTICAST
]
8342 || p
->afc_adv
[AFI_IP6
][SAFI_UNICAST
]
8343 || p
->afc_recv
[AFI_IP6
][SAFI_UNICAST
]
8344 || p
->afc_adv
[AFI_IP6
][SAFI_MULTICAST
]
8345 || p
->afc_recv
[AFI_IP6
][SAFI_MULTICAST
]
8346 || p
->afc_adv
[AFI_IP6
][SAFI_MPLS_VPN
]
8347 || p
->afc_recv
[AFI_IP6
][SAFI_MPLS_VPN
]
8348 || p
->afc_adv
[AFI_IP6
][SAFI_ENCAP
]
8349 || p
->afc_recv
[AFI_IP6
][SAFI_ENCAP
]
8350 || p
->afc_adv
[AFI_IP
][SAFI_ENCAP
]
8351 || p
->afc_recv
[AFI_IP
][SAFI_ENCAP
]
8352 || p
->afc_adv
[AFI_IP
][SAFI_MPLS_VPN
]
8353 || p
->afc_recv
[AFI_IP
][SAFI_MPLS_VPN
])
8357 json_object
*json_cap
= NULL
;
8359 json_cap
= json_object_new_object();
8362 if (CHECK_FLAG (p
->cap
, PEER_CAP_AS4_RCV
)
8363 || CHECK_FLAG (p
->cap
, PEER_CAP_AS4_ADV
))
8365 if (CHECK_FLAG (p
->cap
, PEER_CAP_AS4_ADV
) && CHECK_FLAG (p
->cap
, PEER_CAP_AS4_RCV
))
8366 json_object_string_add(json_cap
, "4byteAs", "advertisedAndReceived");
8367 else if (CHECK_FLAG (p
->cap
, PEER_CAP_AS4_ADV
))
8368 json_object_string_add(json_cap
, "4byteAs", "advertised");
8369 else if (CHECK_FLAG (p
->cap
, PEER_CAP_AS4_RCV
))
8370 json_object_string_add(json_cap
, "4byteAs", "received");
8374 if (CHECK_FLAG (p
->cap
, PEER_CAP_ADDPATH_RCV
)
8375 || CHECK_FLAG (p
->cap
, PEER_CAP_ADDPATH_ADV
))
8377 json_object
*json_add
= NULL
;
8378 const char *print_store
;
8380 json_add
= json_object_new_object();
8382 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
8383 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
8385 json_object
*json_sub
= NULL
;
8386 json_sub
= json_object_new_object();
8387 print_store
= afi_safi_print (afi
, safi
);
8389 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_TX_ADV
) ||
8390 CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_TX_RCV
))
8392 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
))
8393 json_object_boolean_true_add(json_sub
, "txAdvertisedAndReceived");
8394 else if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_TX_ADV
))
8395 json_object_boolean_true_add(json_sub
, "txAdvertised");
8396 else if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_TX_RCV
))
8397 json_object_boolean_true_add(json_sub
, "txReceived");
8400 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_RX_ADV
) ||
8401 CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_RX_RCV
))
8403 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
))
8404 json_object_boolean_true_add(json_sub
, "rxAdvertisedAndReceived");
8405 else if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_RX_ADV
))
8406 json_object_boolean_true_add(json_sub
, "rxAdvertised");
8407 else if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_RX_RCV
))
8408 json_object_boolean_true_add(json_sub
, "rxReceived");
8411 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_TX_ADV
) ||
8412 CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_TX_RCV
) ||
8413 CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_RX_ADV
) ||
8414 CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_RX_RCV
))
8415 json_object_object_add(json_add
, print_store
, json_sub
);
8417 json_object_free(json_sub
);
8420 json_object_object_add(json_cap
, "addPath", json_add
);
8424 if (CHECK_FLAG (p
->cap
, PEER_CAP_DYNAMIC_RCV
)
8425 || CHECK_FLAG (p
->cap
, PEER_CAP_DYNAMIC_ADV
))
8427 if (CHECK_FLAG (p
->cap
, PEER_CAP_DYNAMIC_ADV
) && CHECK_FLAG (p
->cap
, PEER_CAP_DYNAMIC_RCV
))
8428 json_object_string_add(json_cap
, "dynamic", "advertisedAndReceived");
8429 else if (CHECK_FLAG (p
->cap
, PEER_CAP_DYNAMIC_ADV
))
8430 json_object_string_add(json_cap
, "dynamic", "advertised");
8431 else if (CHECK_FLAG (p
->cap
, PEER_CAP_DYNAMIC_RCV
))
8432 json_object_string_add(json_cap
, "dynamic", "received");
8435 /* Extended nexthop */
8436 if (CHECK_FLAG (p
->cap
, PEER_CAP_ENHE_RCV
)
8437 || CHECK_FLAG (p
->cap
, PEER_CAP_ENHE_ADV
))
8439 json_object
*json_nxt
= NULL
;
8440 const char *print_store
;
8443 if (CHECK_FLAG (p
->cap
, PEER_CAP_ENHE_ADV
) && CHECK_FLAG (p
->cap
, PEER_CAP_ENHE_RCV
))
8444 json_object_string_add(json_cap
, "extendedNexthop", "advertisedAndReceived");
8445 else if (CHECK_FLAG (p
->cap
, PEER_CAP_ENHE_ADV
))
8446 json_object_string_add(json_cap
, "extendedNexthop", "advertised");
8447 else if (CHECK_FLAG (p
->cap
, PEER_CAP_ENHE_RCV
))
8448 json_object_string_add(json_cap
, "extendedNexthop", "received");
8450 if (CHECK_FLAG (p
->cap
, PEER_CAP_ENHE_RCV
))
8452 json_nxt
= json_object_new_object();
8454 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
8456 if (CHECK_FLAG (p
->af_cap
[AFI_IP
][safi
], PEER_CAP_ENHE_AF_RCV
))
8458 print_store
= afi_safi_print (AFI_IP
, safi
);
8459 json_object_string_add(json_nxt
, print_store
, "recieved");
8462 json_object_object_add(json_cap
, "extendedNexthopFamililesByPeer", json_nxt
);
8467 if (CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_ADV
)
8468 || CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_NEW_RCV
)
8469 || CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_OLD_RCV
))
8471 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
)))
8473 if (CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_OLD_RCV
) && CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_NEW_RCV
))
8474 json_object_string_add(json_cap
, "routeRefresh", "advertisedAndReceivedOldNew");
8477 if (CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_OLD_RCV
))
8478 json_object_string_add(json_cap
, "routeRefresh", "advertisedAndReceivedOld");
8480 json_object_string_add(json_cap
, "routeRefresh", "advertisedAndReceivedNew");
8483 else if (CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_ADV
))
8484 json_object_string_add(json_cap
, "routeRefresh", "advertised");
8485 else if (CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_NEW_RCV
) || CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_OLD_RCV
))
8486 json_object_string_add(json_cap
, "routeRefresh", "received");
8489 /* Multiprotocol Extensions */
8490 json_object
*json_multi
= NULL
;
8491 json_multi
= json_object_new_object();
8493 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
8495 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
8497 if (p
->afc_adv
[afi
][safi
] || p
->afc_recv
[afi
][safi
])
8499 json_object
*json_exten
= NULL
;
8500 json_exten
= json_object_new_object();
8502 if (p
->afc_adv
[afi
][safi
] && p
->afc_recv
[afi
][safi
])
8503 json_object_boolean_true_add(json_exten
, "advertisedAndReceived");
8504 else if (p
->afc_adv
[afi
][safi
])
8505 json_object_boolean_true_add(json_exten
, "advertised");
8506 else if (p
->afc_recv
[afi
][safi
])
8507 json_object_boolean_true_add(json_exten
, "received");
8509 json_object_object_add(json_multi
, afi_safi_print (afi
, safi
), json_exten
);
8513 json_object_object_add(json_cap
, "multiprotocolExtensions", json_multi
);
8515 /* Gracefull Restart */
8516 if (CHECK_FLAG (p
->cap
, PEER_CAP_RESTART_RCV
)
8517 || CHECK_FLAG (p
->cap
, PEER_CAP_RESTART_ADV
))
8519 if (CHECK_FLAG (p
->cap
, PEER_CAP_RESTART_ADV
) && CHECK_FLAG (p
->cap
, PEER_CAP_RESTART_RCV
))
8520 json_object_string_add(json_cap
, "gracefulRestart", "advertisedAndReceived");
8521 else if (CHECK_FLAG (p
->cap
, PEER_CAP_RESTART_ADV
))
8522 json_object_string_add(json_cap
, "gracefulRestartCapability", "advertised");
8523 else if (CHECK_FLAG (p
->cap
, PEER_CAP_RESTART_RCV
))
8524 json_object_string_add(json_cap
, "gracefulRestartCapability", "received");
8526 if (CHECK_FLAG (p
->cap
, PEER_CAP_RESTART_RCV
))
8528 int restart_af_count
= 0;
8529 json_object
*json_restart
= NULL
;
8530 json_restart
= json_object_new_object();
8532 json_object_int_add(json_cap
, "gracefulRestartRemoteTimerMsecs", p
->v_gr_restart
* 1000);
8534 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
8536 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
8538 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_RESTART_AF_RCV
))
8540 json_object
*json_sub
= NULL
;
8541 json_sub
= json_object_new_object();
8543 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_RESTART_AF_PRESERVE_RCV
))
8544 json_object_boolean_true_add(json_sub
, "preserved");
8546 json_object_object_add(json_restart
, afi_safi_print (afi
, safi
), json_sub
);
8550 if (! restart_af_count
)
8552 json_object_string_add(json_cap
, "addressFamiliesByPeer", "none");
8553 json_object_free(json_restart
);
8556 json_object_object_add(json_cap
, "addressFamiliesByPeer", json_restart
);
8559 json_object_object_add(json_neigh
, "neighborCapabilities", json_cap
);
8563 vty_out (vty
, " Neighbor capabilities:%s", VTY_NEWLINE
);
8566 if (CHECK_FLAG (p
->cap
, PEER_CAP_AS4_RCV
)
8567 || CHECK_FLAG (p
->cap
, PEER_CAP_AS4_ADV
))
8569 vty_out (vty
, " 4 Byte AS:");
8570 if (CHECK_FLAG (p
->cap
, PEER_CAP_AS4_ADV
))
8571 vty_out (vty
, " advertised");
8572 if (CHECK_FLAG (p
->cap
, PEER_CAP_AS4_RCV
))
8573 vty_out (vty
, " %sreceived",
8574 CHECK_FLAG (p
->cap
, PEER_CAP_AS4_ADV
) ? "and " : "");
8575 vty_out (vty
, "%s", VTY_NEWLINE
);
8579 if (CHECK_FLAG (p
->cap
, PEER_CAP_ADDPATH_RCV
)
8580 || CHECK_FLAG (p
->cap
, PEER_CAP_ADDPATH_ADV
))
8582 vty_out (vty
, " AddPath:%s", VTY_NEWLINE
);
8584 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
8585 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
8587 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_TX_ADV
) ||
8588 CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_TX_RCV
))
8590 vty_out (vty
, " %s: TX ", afi_safi_print (afi
, safi
));
8592 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_TX_ADV
))
8593 vty_out (vty
, "advertised %s", afi_safi_print (afi
, safi
));
8595 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_TX_RCV
))
8596 vty_out (vty
, "%sreceived", CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_TX_ADV
) ? " and " : "" );
8598 vty_out (vty
, "%s", VTY_NEWLINE
);
8601 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_RX_ADV
) ||
8602 CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_RX_RCV
))
8604 vty_out (vty
, " %s: RX ", afi_safi_print (afi
, safi
));
8606 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_RX_ADV
))
8607 vty_out (vty
, "advertised %s", afi_safi_print (afi
, safi
));
8609 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_RX_RCV
))
8610 vty_out (vty
, "%sreceived", CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_RX_ADV
) ? " and " : "" );
8612 vty_out (vty
, "%s", VTY_NEWLINE
);
8618 if (CHECK_FLAG (p
->cap
, PEER_CAP_DYNAMIC_RCV
)
8619 || CHECK_FLAG (p
->cap
, PEER_CAP_DYNAMIC_ADV
))
8621 vty_out (vty
, " Dynamic:");
8622 if (CHECK_FLAG (p
->cap
, PEER_CAP_DYNAMIC_ADV
))
8623 vty_out (vty
, " advertised");
8624 if (CHECK_FLAG (p
->cap
, PEER_CAP_DYNAMIC_RCV
))
8625 vty_out (vty
, " %sreceived",
8626 CHECK_FLAG (p
->cap
, PEER_CAP_DYNAMIC_ADV
) ? "and " : "");
8627 vty_out (vty
, "%s", VTY_NEWLINE
);
8630 /* Extended nexthop */
8631 if (CHECK_FLAG (p
->cap
, PEER_CAP_ENHE_RCV
)
8632 || CHECK_FLAG (p
->cap
, PEER_CAP_ENHE_ADV
))
8634 vty_out (vty
, " Extended nexthop:");
8635 if (CHECK_FLAG (p
->cap
, PEER_CAP_ENHE_ADV
))
8636 vty_out (vty
, " advertised");
8637 if (CHECK_FLAG (p
->cap
, PEER_CAP_ENHE_RCV
))
8638 vty_out (vty
, " %sreceived",
8639 CHECK_FLAG (p
->cap
, PEER_CAP_ENHE_ADV
) ? "and " : "");
8640 vty_out (vty
, "%s", VTY_NEWLINE
);
8642 if (CHECK_FLAG (p
->cap
, PEER_CAP_ENHE_RCV
))
8644 vty_out (vty
, " Address families by peer:%s ", VTY_NEWLINE
);
8645 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
8646 if (CHECK_FLAG (p
->af_cap
[AFI_IP
][safi
], PEER_CAP_ENHE_AF_RCV
))
8647 vty_out (vty
, " %s%s",
8648 afi_safi_print (AFI_IP
, safi
), VTY_NEWLINE
);
8653 if (CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_ADV
)
8654 || CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_NEW_RCV
)
8655 || CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_OLD_RCV
))
8657 vty_out (vty
, " Route refresh:");
8658 if (CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_ADV
))
8659 vty_out (vty
, " advertised");
8660 if (CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_NEW_RCV
)
8661 || CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_OLD_RCV
))
8662 vty_out (vty
, " %sreceived(%s)",
8663 CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_ADV
) ? "and " : "",
8664 (CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_OLD_RCV
)
8665 && CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_NEW_RCV
)) ?
8666 "old & new" : CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_OLD_RCV
) ? "old" : "new");
8668 vty_out (vty
, "%s", VTY_NEWLINE
);
8671 /* Multiprotocol Extensions */
8672 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
8673 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
8674 if (p
->afc_adv
[afi
][safi
] || p
->afc_recv
[afi
][safi
])
8676 vty_out (vty
, " Address Family %s:", afi_safi_print (afi
, safi
));
8677 if (p
->afc_adv
[afi
][safi
])
8678 vty_out (vty
, " advertised");
8679 if (p
->afc_recv
[afi
][safi
])
8680 vty_out (vty
, " %sreceived", p
->afc_adv
[afi
][safi
] ? "and " : "");
8681 vty_out (vty
, "%s", VTY_NEWLINE
);
8684 /* Hostname capability */
8685 if (CHECK_FLAG(p
->cap
, PEER_CAP_HOSTNAME_ADV
) ||
8686 CHECK_FLAG(p
->cap
, PEER_CAP_HOSTNAME_RCV
))
8688 vty_out (vty
, " Hostname Capability:");
8689 if (CHECK_FLAG (p
->cap
, PEER_CAP_HOSTNAME_ADV
))
8690 vty_out (vty
, " advertised");
8691 if (CHECK_FLAG (p
->cap
, PEER_CAP_HOSTNAME_RCV
))
8692 vty_out (vty
, " %sreceived",
8693 CHECK_FLAG (p
->cap
, PEER_CAP_HOSTNAME_ADV
) ? "and " : "");
8694 vty_out (vty
, "%s", VTY_NEWLINE
);
8697 /* Gracefull Restart */
8698 if (CHECK_FLAG (p
->cap
, PEER_CAP_RESTART_RCV
)
8699 || CHECK_FLAG (p
->cap
, PEER_CAP_RESTART_ADV
))
8701 vty_out (vty
, " Graceful Restart Capabilty:");
8702 if (CHECK_FLAG (p
->cap
, PEER_CAP_RESTART_ADV
))
8703 vty_out (vty
, " advertised");
8704 if (CHECK_FLAG (p
->cap
, PEER_CAP_RESTART_RCV
))
8705 vty_out (vty
, " %sreceived",
8706 CHECK_FLAG (p
->cap
, PEER_CAP_RESTART_ADV
) ? "and " : "");
8707 vty_out (vty
, "%s", VTY_NEWLINE
);
8709 if (CHECK_FLAG (p
->cap
, PEER_CAP_RESTART_RCV
))
8711 int restart_af_count
= 0;
8713 vty_out (vty
, " Remote Restart timer is %d seconds%s",
8714 p
->v_gr_restart
, VTY_NEWLINE
);
8715 vty_out (vty
, " Address families by peer:%s ", VTY_NEWLINE
);
8717 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
8718 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
8719 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_RESTART_AF_RCV
))
8721 vty_out (vty
, "%s%s(%s)", restart_af_count
? ", " : "",
8722 afi_safi_print (afi
, safi
),
8723 CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_RESTART_AF_PRESERVE_RCV
) ?
8724 "preserved" : "not preserved");
8727 if (! restart_af_count
)
8728 vty_out (vty
, "none");
8729 vty_out (vty
, "%s", VTY_NEWLINE
);
8736 /* graceful restart information */
8737 if (CHECK_FLAG (p
->cap
, PEER_CAP_RESTART_RCV
)
8741 json_object
*json_grace
= NULL
;
8742 json_object
*json_grace_send
= NULL
;
8743 json_object
*json_grace_recv
= NULL
;
8744 int eor_send_af_count
= 0;
8745 int eor_receive_af_count
= 0;
8749 json_grace
= json_object_new_object();
8750 json_grace_send
= json_object_new_object();
8751 json_grace_recv
= json_object_new_object();
8753 if (p
->status
== Established
)
8755 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
8757 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
8759 if (CHECK_FLAG (p
->af_sflags
[afi
][safi
], PEER_STATUS_EOR_SEND
))
8761 json_object_boolean_true_add(json_grace_send
, afi_safi_print (afi
, safi
));
8762 eor_send_af_count
++;
8766 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
8768 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
8770 if (CHECK_FLAG (p
->af_sflags
[afi
][safi
], PEER_STATUS_EOR_RECEIVED
))
8772 json_object_boolean_true_add(json_grace_recv
, afi_safi_print (afi
, safi
));
8773 eor_receive_af_count
++;
8779 json_object_object_add(json_grace
, "endOfRibSend", json_grace_send
);
8780 json_object_object_add(json_grace
, "endOfRibRecv", json_grace_recv
);
8782 if (p
->t_gr_restart
)
8783 json_object_int_add(json_grace
, "gracefulRestartTimerMsecs", thread_timer_remain_second (p
->t_gr_restart
) * 1000);
8786 json_object_int_add(json_grace
, "gracefulStalepathTimerMsecs", thread_timer_remain_second (p
->t_gr_stale
) * 1000);
8788 json_object_object_add(json_neigh
, "gracefulRestartInfo", json_grace
);
8792 vty_out (vty
, " Graceful restart informations:%s", VTY_NEWLINE
);
8793 if (p
->status
== Established
)
8795 vty_out (vty
, " End-of-RIB send: ");
8796 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
8798 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
8800 if (CHECK_FLAG (p
->af_sflags
[afi
][safi
], PEER_STATUS_EOR_SEND
))
8802 vty_out (vty
, "%s%s", eor_send_af_count
? ", " : "",
8803 afi_safi_print (afi
, safi
));
8804 eor_send_af_count
++;
8808 vty_out (vty
, "%s", VTY_NEWLINE
);
8809 vty_out (vty
, " End-of-RIB received: ");
8810 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
8812 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
8814 if (CHECK_FLAG (p
->af_sflags
[afi
][safi
], PEER_STATUS_EOR_RECEIVED
))
8816 vty_out (vty
, "%s%s", eor_receive_af_count
? ", " : "",
8817 afi_safi_print (afi
, safi
));
8818 eor_receive_af_count
++;
8822 vty_out (vty
, "%s", VTY_NEWLINE
);
8825 if (p
->t_gr_restart
)
8826 vty_out (vty
, " The remaining time of restart timer is %ld%s",
8827 thread_timer_remain_second (p
->t_gr_restart
), VTY_NEWLINE
);
8830 vty_out (vty
, " The remaining time of stalepath timer is %ld%s",
8831 thread_timer_remain_second (p
->t_gr_stale
), VTY_NEWLINE
);
8836 json_object
*json_stat
= NULL
;
8837 json_stat
= json_object_new_object();
8838 /* Packet counts. */
8839 json_object_int_add(json_stat
, "depthInq", 0);
8840 json_object_int_add(json_stat
, "depthOutq", (unsigned long) p
->obuf
->count
);
8841 json_object_int_add(json_stat
, "opensSent", p
->open_out
);
8842 json_object_int_add(json_stat
, "opensRecv", p
->open_in
);
8843 json_object_int_add(json_stat
, "notificationsSent", p
->notify_out
);
8844 json_object_int_add(json_stat
, "notificationsRecv", p
->notify_in
);
8845 json_object_int_add(json_stat
, "updatesSent", p
->update_out
);
8846 json_object_int_add(json_stat
, "updatesRecv", p
->update_in
);
8847 json_object_int_add(json_stat
, "keepalivesSent", p
->keepalive_out
);
8848 json_object_int_add(json_stat
, "keepalivesRecv", p
->keepalive_in
);
8849 json_object_int_add(json_stat
, "routeRefreshSent", p
->refresh_out
);
8850 json_object_int_add(json_stat
, "routeRefreshRecv", p
->refresh_in
);
8851 json_object_int_add(json_stat
, "capabilitySent", p
->dynamic_cap_out
);
8852 json_object_int_add(json_stat
, "capabilityRecv", p
->dynamic_cap_in
);
8853 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
);
8854 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
);
8855 json_object_object_add(json_neigh
, "messageStats", json_stat
);
8859 /* Packet counts. */
8860 vty_out (vty
, " Message statistics:%s", VTY_NEWLINE
);
8861 vty_out (vty
, " Inq depth is 0%s", VTY_NEWLINE
);
8862 vty_out (vty
, " Outq depth is %lu%s", (unsigned long) p
->obuf
->count
, VTY_NEWLINE
);
8863 vty_out (vty
, " Sent Rcvd%s", VTY_NEWLINE
);
8864 vty_out (vty
, " Opens: %10d %10d%s", p
->open_out
, p
->open_in
, VTY_NEWLINE
);
8865 vty_out (vty
, " Notifications: %10d %10d%s", p
->notify_out
, p
->notify_in
, VTY_NEWLINE
);
8866 vty_out (vty
, " Updates: %10d %10d%s", p
->update_out
, p
->update_in
, VTY_NEWLINE
);
8867 vty_out (vty
, " Keepalives: %10d %10d%s", p
->keepalive_out
, p
->keepalive_in
, VTY_NEWLINE
);
8868 vty_out (vty
, " Route Refresh: %10d %10d%s", p
->refresh_out
, p
->refresh_in
, VTY_NEWLINE
);
8869 vty_out (vty
, " Capability: %10d %10d%s", p
->dynamic_cap_out
, p
->dynamic_cap_in
, VTY_NEWLINE
);
8870 vty_out (vty
, " Total: %10d %10d%s", p
->open_out
+ p
->notify_out
+
8871 p
->update_out
+ p
->keepalive_out
+ p
->refresh_out
+ p
->dynamic_cap_out
,
8872 p
->open_in
+ p
->notify_in
+ p
->update_in
+ p
->keepalive_in
+ p
->refresh_in
+
8873 p
->dynamic_cap_in
, VTY_NEWLINE
);
8878 /* advertisement-interval */
8879 json_object_int_add(json_neigh
, "minBtwnAdvertisementRunsTimerMsecs", p
->v_routeadv
* 1000);
8881 /* Update-source. */
8882 if (p
->update_if
|| p
->update_source
)
8885 json_object_string_add(json_neigh
, "updateSource", p
->update_if
);
8886 else if (p
->update_source
)
8887 json_object_string_add(json_neigh
, "updateSource", sockunion2str (p
->update_source
, buf1
, SU_ADDRSTRLEN
));
8892 /* advertisement-interval */
8893 vty_out (vty
, " Minimum time between advertisement runs is %d seconds%s",
8894 p
->v_routeadv
, VTY_NEWLINE
);
8896 /* Update-source. */
8897 if (p
->update_if
|| p
->update_source
)
8899 vty_out (vty
, " Update source is ");
8901 vty_out (vty
, "%s", p
->update_if
);
8902 else if (p
->update_source
)
8903 vty_out (vty
, "%s", sockunion2str (p
->update_source
, buf1
, SU_ADDRSTRLEN
));
8904 vty_out (vty
, "%s", VTY_NEWLINE
);
8907 vty_out (vty
, "%s", VTY_NEWLINE
);
8910 /* Address Family Information */
8911 json_object
*json_hold
= NULL
;
8914 json_hold
= json_object_new_object();
8916 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
8917 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
8918 if (p
->afc
[afi
][safi
])
8919 bgp_show_peer_afi (vty
, p
, afi
, safi
, use_json
, json_hold
);
8923 json_object_object_add(json_neigh
, "addressFamilyInfo", json_hold
);
8924 json_object_int_add(json_neigh
, "connectionsEstablished", p
->established
);
8925 json_object_int_add(json_neigh
, "connectionsDropped", p
->dropped
);
8928 vty_out (vty
, " Connections established %d; dropped %d%s", p
->established
, p
->dropped
,
8931 if (! p
->last_reset
)
8934 json_object_string_add(json_neigh
, "lastReset", "never");
8936 vty_out (vty
, " Last reset never%s", VTY_NEWLINE
);
8945 uptime
= bgp_clock();
8946 uptime
-= p
->resettime
;
8947 tm
= gmtime(&uptime
);
8948 json_object_int_add(json_neigh
, "lastResetTimerMsecs", (tm
->tm_sec
* 1000) + (tm
->tm_min
* 60000) + (tm
->tm_hour
* 3600000));
8949 json_object_string_add(json_neigh
, "lastResetDueTo", peer_down_str
[(int) p
->last_reset
]);
8950 if (p
->last_reset
== PEER_DOWN_NOTIFY_SEND
||
8951 p
->last_reset
== PEER_DOWN_NOTIFY_RECEIVED
)
8953 char errorcodesubcode_hexstr
[5];
8954 char errorcodesubcode_str
[256];
8956 code_str
= bgp_notify_code_str(p
->notify
.code
);
8957 subcode_str
= bgp_notify_subcode_str(p
->notify
.code
, p
->notify
.subcode
);
8959 sprintf(errorcodesubcode_hexstr
, "%02X%02X", p
->notify
.code
, p
->notify
.subcode
);
8960 json_object_string_add(json_neigh
, "lastErrorCodeSubcode", errorcodesubcode_hexstr
);
8961 snprintf(errorcodesubcode_str
, 255, "%s%s", code_str
, subcode_str
);
8962 json_object_string_add(json_neigh
, "lastNotificationReason", errorcodesubcode_str
);
8963 if (p
->last_reset
== PEER_DOWN_NOTIFY_RECEIVED
8964 && p
->notify
.code
== BGP_NOTIFY_CEASE
8965 && (p
->notify
.subcode
== BGP_NOTIFY_CEASE_ADMIN_SHUTDOWN
8966 || p
->notify
.subcode
== BGP_NOTIFY_CEASE_ADMIN_RESET
)
8967 && p
->notify
.length
)
8970 const char *msg_str
;
8972 msg_str
= bgp_notify_admin_message(msgbuf
, sizeof(msgbuf
),
8973 (u_char
*)p
->notify
.data
, p
->notify
.length
);
8975 json_object_string_add(json_neigh
, "lastShutdownDescription", msg_str
);
8981 vty_out (vty
, " Last reset %s, ",
8982 peer_uptime (p
->resettime
, timebuf
, BGP_UPTIME_LEN
, 0, NULL
));
8984 if (p
->last_reset
== PEER_DOWN_NOTIFY_SEND
||
8985 p
->last_reset
== PEER_DOWN_NOTIFY_RECEIVED
)
8987 code_str
= bgp_notify_code_str(p
->notify
.code
);
8988 subcode_str
= bgp_notify_subcode_str(p
->notify
.code
, p
->notify
.subcode
);
8989 vty_out (vty
, "due to NOTIFICATION %s (%s%s)%s",
8990 p
->last_reset
== PEER_DOWN_NOTIFY_SEND
? "sent" : "received",
8991 code_str
, subcode_str
, VTY_NEWLINE
);
8992 if (p
->last_reset
== PEER_DOWN_NOTIFY_RECEIVED
8993 && p
->notify
.code
== BGP_NOTIFY_CEASE
8994 && (p
->notify
.subcode
== BGP_NOTIFY_CEASE_ADMIN_SHUTDOWN
8995 || p
->notify
.subcode
== BGP_NOTIFY_CEASE_ADMIN_RESET
)
8996 && p
->notify
.length
)
8999 const char *msg_str
;
9001 msg_str
= bgp_notify_admin_message(msgbuf
, sizeof(msgbuf
),
9002 (u_char
*)p
->notify
.data
, p
->notify
.length
);
9004 vty_out (vty
, " Message: \"%s\"%s", msg_str
, VTY_NEWLINE
);
9009 vty_out (vty
, "due to %s%s",
9010 peer_down_str
[(int) p
->last_reset
], VTY_NEWLINE
);
9013 if (p
->last_reset_cause_size
)
9015 msg
= p
->last_reset_cause
;
9016 vty_out(vty
, " Message received that caused BGP to send a NOTIFICATION:%s ", VTY_NEWLINE
);
9017 for (i
= 1; i
<= p
->last_reset_cause_size
; i
++)
9019 vty_out(vty
, "%02X", *msg
++);
9021 if (i
!= p
->last_reset_cause_size
)
9025 vty_out(vty
, "%s ", VTY_NEWLINE
);
9027 else if (i
% 4 == 0)
9033 vty_out(vty
, "%s", VTY_NEWLINE
);
9038 if (CHECK_FLAG (p
->sflags
, PEER_STATUS_PREFIX_OVERFLOW
))
9041 json_object_boolean_true_add(json_neigh
, "prefixesConfigExceedMax");
9043 vty_out (vty
, " Peer had exceeded the max. no. of prefixes configured.%s", VTY_NEWLINE
);
9045 if (p
->t_pmax_restart
)
9049 json_object_boolean_true_add(json_neigh
, "reducePrefixNumFrom");
9050 json_object_int_add(json_neigh
, "restartInTimerMsec", thread_timer_remain_second (p
->t_pmax_restart
) * 1000);
9053 vty_out (vty
, " Reduce the no. of prefix from %s, will restart in %ld seconds%s",
9054 p
->host
, thread_timer_remain_second (p
->t_pmax_restart
),
9060 json_object_boolean_true_add(json_neigh
, "reducePrefixNumAndClearIpBgp");
9062 vty_out (vty
, " Reduce the no. of prefix and clear ip bgp %s to restore peering%s",
9063 p
->host
, VTY_NEWLINE
);
9067 /* EBGP Multihop and GTSM */
9068 if (p
->sort
!= BGP_PEER_IBGP
)
9072 if (p
->gtsm_hops
> 0)
9073 json_object_int_add(json_neigh
, "externalBgpNbrMaxHopsAway", p
->gtsm_hops
);
9074 else if (p
->ttl
> 1)
9075 json_object_int_add(json_neigh
, "externalBgpNbrMaxHopsAway", p
->ttl
);
9079 if (p
->gtsm_hops
> 0)
9080 vty_out (vty
, " External BGP neighbor may be up to %d hops away.%s",
9081 p
->gtsm_hops
, VTY_NEWLINE
);
9082 else if (p
->ttl
> 1)
9083 vty_out (vty
, " External BGP neighbor may be up to %d hops away.%s",
9084 p
->ttl
, VTY_NEWLINE
);
9089 if (p
->gtsm_hops
> 0)
9092 json_object_int_add(json_neigh
, "internalBgpNbrMaxHopsAway", p
->gtsm_hops
);
9094 vty_out (vty
, " Internal BGP neighbor may be up to %d hops away.%s",
9095 p
->gtsm_hops
, VTY_NEWLINE
);
9099 /* Local address. */
9104 json_object_string_add(json_neigh
, "hostLocal", sockunion2str (p
->su_local
, buf1
, SU_ADDRSTRLEN
));
9105 json_object_int_add(json_neigh
, "portLocal", ntohs (p
->su_local
->sin
.sin_port
));
9108 vty_out (vty
, "Local host: %s, Local port: %d%s",
9109 sockunion2str (p
->su_local
, buf1
, SU_ADDRSTRLEN
),
9110 ntohs (p
->su_local
->sin
.sin_port
),
9114 /* Remote address. */
9119 json_object_string_add(json_neigh
, "hostForeign", sockunion2str (p
->su_remote
, buf1
, SU_ADDRSTRLEN
));
9120 json_object_int_add(json_neigh
, "portForeign", ntohs (p
->su_remote
->sin
.sin_port
));
9123 vty_out (vty
, "Foreign host: %s, Foreign port: %d%s",
9124 sockunion2str (p
->su_remote
, buf1
, SU_ADDRSTRLEN
),
9125 ntohs (p
->su_remote
->sin
.sin_port
),
9129 /* Nexthop display. */
9134 json_object_string_add(json_neigh
, "nexthop",
9135 inet_ntop (AF_INET
, &p
->nexthop
.v4
, buf1
, sizeof(buf1
)));
9136 json_object_string_add(json_neigh
, "nexthopGlobal",
9137 inet_ntop (AF_INET6
, &p
->nexthop
.v6_global
, buf1
, sizeof(buf1
)));
9138 json_object_string_add(json_neigh
, "nexthopLocal",
9139 inet_ntop (AF_INET6
, &p
->nexthop
.v6_local
, buf1
, sizeof(buf1
)));
9140 if (p
->shared_network
)
9141 json_object_string_add(json_neigh
, "bgpConnection", "sharedNetwork");
9143 json_object_string_add(json_neigh
, "bgpConnection", "nonSharedNetwork");
9147 vty_out (vty
, "Nexthop: %s%s",
9148 inet_ntop (AF_INET
, &p
->nexthop
.v4
, buf1
, sizeof(buf1
)),
9150 vty_out (vty
, "Nexthop global: %s%s",
9151 inet_ntop (AF_INET6
, &p
->nexthop
.v6_global
, buf1
, sizeof(buf1
)),
9153 vty_out (vty
, "Nexthop local: %s%s",
9154 inet_ntop (AF_INET6
, &p
->nexthop
.v6_local
, buf1
, sizeof(buf1
)),
9156 vty_out (vty
, "BGP connection: %s%s",
9157 p
->shared_network
? "shared network" : "non shared network",
9162 /* Timer information. */
9165 json_object_int_add(json_neigh
, "connectRetryTimer", p
->v_connect
);
9166 if (p
->status
== Established
&& p
->rtt
)
9167 json_object_int_add(json_neigh
, "estimatedRttInMsecs", p
->rtt
);
9169 json_object_int_add(json_neigh
, "nextStartTimerDueInMsecs", thread_timer_remain_second (p
->t_start
) * 1000);
9171 json_object_int_add(json_neigh
, "nextConnectTimerDueInMsecs", thread_timer_remain_second (p
->t_connect
) * 1000);
9174 json_object_int_add(json_neigh
, "mraiInterval", p
->v_routeadv
);
9175 json_object_int_add(json_neigh
, "mraiTimerExpireInMsecs", thread_timer_remain_second (p
->t_routeadv
) * 1000);
9178 json_object_int_add(json_neigh
, "authenticationEnabled", 1);
9181 json_object_string_add(json_neigh
, "readThread", "on");
9183 json_object_string_add(json_neigh
, "readThread", "off");
9185 json_object_string_add(json_neigh
, "writeThread", "on");
9187 json_object_string_add(json_neigh
, "writeThread", "off");
9191 vty_out (vty
, "BGP Connect Retry Timer in Seconds: %d%s",
9192 p
->v_connect
, VTY_NEWLINE
);
9193 if (p
->status
== Established
&& p
->rtt
)
9194 vty_out (vty
, "Estimated round trip time: %d ms%s",
9195 p
->rtt
, VTY_NEWLINE
);
9197 vty_out (vty
, "Next start timer due in %ld seconds%s",
9198 thread_timer_remain_second (p
->t_start
), VTY_NEWLINE
);
9200 vty_out (vty
, "Next connect timer due in %ld seconds%s",
9201 thread_timer_remain_second (p
->t_connect
), VTY_NEWLINE
);
9203 vty_out (vty
, "MRAI (interval %u) timer expires in %ld seconds%s",
9204 p
->v_routeadv
, thread_timer_remain_second (p
->t_routeadv
),
9207 vty_out (vty
, "Peer Authentication Enabled%s", VTY_NEWLINE
);
9209 vty_out (vty
, "Read thread: %s Write thread: %s%s",
9210 p
->t_read
? "on" : "off",
9211 p
->t_write
? "on" : "off",
9215 if (p
->notify
.code
== BGP_NOTIFY_OPEN_ERR
9216 && p
->notify
.subcode
== BGP_NOTIFY_OPEN_UNSUP_CAPBL
)
9217 bgp_capability_vty_out (vty
, p
, use_json
, json_neigh
);
9220 vty_out (vty
, "%s", VTY_NEWLINE
);
9222 /* BFD information. */
9223 bgp_bfd_show_info(vty
, p
, use_json
, json_neigh
);
9227 if (p
->conf_if
) /* Configured interface name. */
9228 json_object_object_add(json
, p
->conf_if
, json_neigh
);
9229 else /* Configured IP address. */
9230 json_object_object_add(json
, p
->host
, json_neigh
);
9235 bgp_show_neighbor (struct vty
*vty
, struct bgp
*bgp
, enum show_type type
,
9236 union sockunion
*su
, const char *conf_if
, u_char use_json
, json_object
*json
)
9238 struct listnode
*node
, *nnode
;
9242 for (ALL_LIST_ELEMENTS (bgp
->peer
, node
, nnode
, peer
))
9244 if (!CHECK_FLAG(peer
->flags
, PEER_FLAG_CONFIG_NODE
))
9250 bgp_show_peer (vty
, peer
, use_json
, json
);
9255 if ((peer
->conf_if
&& !strcmp(peer
->conf_if
, conf_if
)) ||
9256 (peer
->hostname
&& !strcmp(peer
->hostname
, conf_if
)))
9259 bgp_show_peer (vty
, peer
, use_json
, json
);
9264 if (sockunion_same (&peer
->su
, su
))
9267 bgp_show_peer (vty
, peer
, use_json
, json
);
9274 if (type
== show_peer
&& ! find
)
9277 json_object_boolean_true_add(json
, "bgpNoSuchNeighbor");
9279 vty_out (vty
, "%% No such neighbor%s", VTY_NEWLINE
);
9284 vty_out (vty
, "%s%s", json_object_to_json_string_ext(json
, JSON_C_TO_STRING_PRETTY
), VTY_NEWLINE
);
9285 json_object_free(json
);
9289 vty_out (vty
, "%s", VTY_NEWLINE
);
9296 bgp_show_all_instances_neighbors_vty (struct vty
*vty
, u_char use_json
)
9298 struct listnode
*node
, *nnode
;
9300 json_object
*json
= NULL
;
9304 vty_out (vty
, "{%s", VTY_NEWLINE
);
9306 for (ALL_LIST_ELEMENTS (bm
->bgp
, node
, nnode
, bgp
))
9310 if (!(json
= json_object_new_object()))
9312 zlog_err("Unable to allocate memory for JSON object");
9314 "{\"error\": {\"message:\": \"Unable to allocate memory for JSON object\"}}}%s",
9319 json_object_int_add(json
, "vrfId",
9320 (bgp
->vrf_id
== VRF_UNKNOWN
)
9321 ? -1 : bgp
->vrf_id
);
9322 json_object_string_add(json
, "vrfName",
9323 (bgp
->inst_type
== BGP_INSTANCE_TYPE_DEFAULT
)
9324 ? "Default" : bgp
->name
);
9327 vty_out (vty
, ",%s", VTY_NEWLINE
);
9331 vty_out(vty
, "\"%s\":", (bgp
->inst_type
== BGP_INSTANCE_TYPE_DEFAULT
)
9332 ? "Default" : bgp
->name
);
9336 vty_out (vty
, "%sInstance %s:%s",
9338 (bgp
->inst_type
== BGP_INSTANCE_TYPE_DEFAULT
)
9339 ? "Default" : bgp
->name
,
9342 bgp_show_neighbor (vty
, bgp
, show_all
, NULL
, NULL
, use_json
, json
);
9346 vty_out (vty
, "}%s", VTY_NEWLINE
);
9350 bgp_show_neighbor_vty (struct vty
*vty
, const char *name
,
9351 enum show_type type
, const char *ip_str
, u_char use_json
)
9356 json_object
*json
= NULL
;
9360 if (strmatch(name
, "all"))
9362 bgp_show_all_instances_neighbors_vty (vty
, use_json
);
9367 bgp
= bgp_lookup_by_name (name
);
9372 json
= json_object_new_object();
9373 json_object_boolean_true_add(json
, "bgpNoSuchInstance");
9374 vty_out (vty
, "%s%s", json_object_to_json_string_ext(json
, JSON_C_TO_STRING_PRETTY
), VTY_NEWLINE
);
9375 json_object_free(json
);
9378 vty_out (vty
, "%% No such BGP instance exist%s", VTY_NEWLINE
);
9386 bgp
= bgp_get_default ();
9391 json
= json_object_new_object();
9394 ret
= str2sockunion (ip_str
, &su
);
9396 bgp_show_neighbor (vty
, bgp
, type
, NULL
, ip_str
, use_json
, json
);
9398 bgp_show_neighbor (vty
, bgp
, type
, &su
, NULL
, use_json
, json
);
9402 bgp_show_neighbor (vty
, bgp
, type
, NULL
, NULL
, use_json
, json
);
9404 json_object_free (json
);
9410 /* "show [ip] bgp neighbors" commands. */
9411 DEFUN (show_ip_bgp_neighbors
,
9412 show_ip_bgp_neighbors_cmd
,
9413 "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]",
9417 BGP_INSTANCE_HELP_STR
9421 "Display information about all VPNv4 NLRIs\n"
9422 "Display information for a route distinguisher\n"
9423 "VPN Route Distinguisher\n"
9424 "Detailed information on TCP and BGP neighbor connections\n"
9425 "Neighbor to display information about\n"
9426 "Neighbor to display information about\n"
9427 "Neighbor on BGP configured interface\n"
9431 char *sh_arg
= NULL
;
9432 enum show_type sh_type
;
9434 u_char uj
= use_json(argc
, argv
);
9438 if (argv_find (argv
, argc
, "view", &idx
) ||
9439 argv_find (argv
, argc
, "vrf", &idx
))
9440 vrf
= argv
[idx
+1]->arg
;
9443 if (argv_find (argv
, argc
, "A.B.C.D", &idx
) ||
9444 argv_find (argv
, argc
, "X:X::X:X", &idx
) ||
9445 argv_find (argv
, argc
, "WORD", &idx
))
9447 sh_type
= show_peer
;
9448 sh_arg
= argv
[idx
]->arg
;
9453 return bgp_show_neighbor_vty (vty
, vrf
, sh_type
, sh_arg
, uj
);
9456 /* Show BGP's AS paths internal data. There are both `show [ip] bgp
9457 paths' and `show ip mbgp paths'. Those functions results are the
9459 DEFUN (show_ip_bgp_paths
,
9460 show_ip_bgp_paths_cmd
,
9461 "show [ip] bgp ["BGP_SAFI_CMD_STR
"] paths",
9466 "Path information\n")
9468 vty_out (vty
, "Address Refcnt Path%s", VTY_NEWLINE
);
9469 aspath_print_all_vty (vty
);
9476 community_show_all_iterator (struct hash_backet
*backet
, struct vty
*vty
)
9478 struct community
*com
;
9480 com
= (struct community
*) backet
->data
;
9481 vty_out (vty
, "[%p] (%ld) %s%s", (void *)backet
, com
->refcnt
,
9482 community_str (com
), VTY_NEWLINE
);
9485 /* Show BGP's community internal data. */
9486 DEFUN (show_ip_bgp_community_info
,
9487 show_ip_bgp_community_info_cmd
,
9488 "show [ip] bgp community-info",
9492 "List all bgp community information\n")
9494 vty_out (vty
, "Address Refcnt Community%s", VTY_NEWLINE
);
9496 hash_iterate (community_hash (),
9497 (void (*) (struct hash_backet
*, void *))
9498 community_show_all_iterator
,
9505 lcommunity_show_all_iterator (struct hash_backet
*backet
, struct vty
*vty
)
9507 struct lcommunity
*lcom
;
9509 lcom
= (struct lcommunity
*) backet
->data
;
9510 vty_out (vty
, "[%p] (%ld) %s%s", (void *)backet
, lcom
->refcnt
,
9511 lcommunity_str (lcom
), VTY_NEWLINE
);
9514 /* Show BGP's community internal data. */
9515 DEFUN (show_ip_bgp_lcommunity_info
,
9516 show_ip_bgp_lcommunity_info_cmd
,
9517 "show ip bgp large-community-info",
9521 "List all bgp large-community information\n")
9523 vty_out (vty
, "Address Refcnt Large-community%s", VTY_NEWLINE
);
9525 hash_iterate (lcommunity_hash (),
9526 (void (*) (struct hash_backet
*, void *))
9527 lcommunity_show_all_iterator
,
9534 DEFUN (show_ip_bgp_attr_info
,
9535 show_ip_bgp_attr_info_cmd
,
9536 "show [ip] bgp attribute-info",
9540 "List all bgp attribute information\n")
9542 attr_show_all (vty
);
9547 bgp_show_all_instances_updgrps_vty (struct vty
*vty
, afi_t afi
, safi_t safi
)
9549 struct listnode
*node
, *nnode
;
9552 for (ALL_LIST_ELEMENTS (bm
->bgp
, node
, nnode
, bgp
))
9554 vty_out (vty
, "%sInstance %s:%s",
9556 (bgp
->inst_type
== BGP_INSTANCE_TYPE_DEFAULT
) ? "Default" : bgp
->name
,
9558 update_group_show(bgp
, afi
, safi
, vty
, 0);
9563 bgp_show_update_groups(struct vty
*vty
, const char *name
,
9571 if (strmatch (name
, "all"))
9573 bgp_show_all_instances_updgrps_vty (vty
, afi
, safi
);
9578 bgp
= bgp_lookup_by_name (name
);
9583 bgp
= bgp_get_default ();
9587 update_group_show(bgp
, afi
, safi
, vty
, subgrp_id
);
9591 DEFUN (show_ip_bgp_updgrps
,
9592 show_ip_bgp_updgrps_cmd
,
9593 "show [ip] bgp [<view|vrf> VIEWVRFNAME] ["BGP_AFI_CMD_STR
" ["BGP_SAFI_CMD_STR
"]] update-groups [SUBGROUP-ID]",
9597 BGP_INSTANCE_HELP_STR
9600 "Detailed info about dynamic update groups\n"
9601 "Specific subgroup to display detailed info for\n")
9604 afi_t afi
= AFI_IP6
;
9605 safi_t safi
= SAFI_UNICAST
;
9606 uint64_t subgrp_id
= 0;
9611 if (argv_find (argv
, argc
, "ip", &idx
))
9613 /* [<view|vrf> VIEWVRFNAME] */
9614 if (argv_find (argv
, argc
, "view", &idx
) || argv_find (argv
, argc
, "vrf", &idx
))
9615 vrf
= argv
[++idx
]->arg
;
9616 /* ["BGP_AFI_CMD_STR" ["BGP_SAFI_CMD_STR"]] */
9617 if (argv_find_and_parse_afi (argv
, argc
, &idx
, &afi
))
9619 argv_find_and_parse_safi (argv
, argc
, &idx
, &safi
);
9622 /* get subgroup id, if provided */
9624 if (argv
[idx
]->type
== VARIABLE_TKN
)
9625 VTY_GET_ULL("subgroup-id", subgrp_id
, argv
[idx
]->arg
);
9627 return (bgp_show_update_groups(vty
, vrf
, afi
, safi
, subgrp_id
));
9630 DEFUN (show_bgp_instance_all_ipv6_updgrps
,
9631 show_bgp_instance_all_ipv6_updgrps_cmd
,
9632 "show [ip] bgp <view|vrf> all update-groups",
9636 BGP_INSTANCE_ALL_HELP_STR
9637 "Detailed info about dynamic update groups\n")
9639 bgp_show_all_instances_updgrps_vty (vty
, AFI_IP6
, SAFI_UNICAST
);
9643 DEFUN (show_bgp_updgrps_stats
,
9644 show_bgp_updgrps_stats_cmd
,
9645 "show [ip] bgp update-groups statistics",
9649 "Detailed info about dynamic update groups\n"
9654 bgp
= bgp_get_default();
9656 update_group_show_stats(bgp
, vty
);
9661 DEFUN (show_bgp_instance_updgrps_stats
,
9662 show_bgp_instance_updgrps_stats_cmd
,
9663 "show [ip] bgp <view|vrf> VIEWVRFNAME update-groups statistics",
9667 BGP_INSTANCE_HELP_STR
9668 "Detailed info about dynamic update groups\n"
9674 bgp
= bgp_lookup_by_name (argv
[idx_word
]->arg
);
9676 update_group_show_stats(bgp
, vty
);
9682 show_bgp_updgrps_adj_info_aux (struct vty
*vty
, const char *name
,
9683 afi_t afi
, safi_t safi
,
9684 const char *what
, uint64_t subgrp_id
)
9689 bgp
= bgp_lookup_by_name (name
);
9691 bgp
= bgp_get_default ();
9695 if (!strcmp(what
, "advertise-queue"))
9696 update_group_show_adj_queue(bgp
, afi
, safi
, vty
, subgrp_id
);
9697 else if (!strcmp(what
, "advertised-routes"))
9698 update_group_show_advertised(bgp
, afi
, safi
, vty
, subgrp_id
);
9699 else if (!strcmp(what
, "packet-queue"))
9700 update_group_show_packet_queue(bgp
, afi
, safi
, vty
, subgrp_id
);
9704 DEFUN (show_ip_bgp_updgrps_adj
,
9705 show_ip_bgp_updgrps_adj_cmd
,
9706 "show [ip] bgp update-groups <advertise-queue|advertised-routes|packet-queue>",
9710 "Detailed info about dynamic update groups\n"
9711 "Advertisement queue\n"
9712 "Announced routes\n"
9717 show_bgp_updgrps_adj_info_aux(vty
, NULL
, AFI_IP
, SAFI_UNICAST
, argv
[idx_type
]->arg
, 0);
9721 DEFUN (show_ip_bgp_instance_updgrps_adj
,
9722 show_ip_bgp_instance_updgrps_adj_cmd
,
9723 "show [ip] bgp <view|vrf> VIEWVRFNAME update-groups <advertise-queue|advertised-routes|packet-queue>",
9727 BGP_INSTANCE_HELP_STR
9728 "Detailed info about dynamic update groups\n"
9729 "Advertisement queue\n"
9730 "Announced routes\n"
9736 show_bgp_updgrps_adj_info_aux(vty
, argv
[idx_word
]->arg
, AFI_IP
, SAFI_UNICAST
, argv
[idx_type
]->arg
, 0);
9740 DEFUN (show_bgp_updgrps_afi_adj
,
9741 show_bgp_updgrps_afi_adj_cmd
,
9742 "show [ip] bgp "BGP_AFI_SAFI_CMD_STR
" update-groups <advertise-queue|advertised-routes|packet-queue>",
9746 BGP_AFI_SAFI_HELP_STR
9747 "Detailed info about dynamic update groups\n"
9748 "Advertisement queue\n"
9749 "Announced routes\n"
9751 "Specific subgroup info wanted for\n")
9756 show_bgp_updgrps_adj_info_aux(vty
, NULL
,
9757 bgp_vty_afi_from_arg(argv
[idx_afi
]->arg
),
9758 bgp_vty_safi_from_arg(argv
[idx_safi
]->arg
),
9759 argv
[idx_type
]->arg
, 0);
9763 DEFUN (show_bgp_updgrps_adj
,
9764 show_bgp_updgrps_adj_cmd
,
9765 "show [ip] bgp update-groups <advertise-queue|advertised-routes|packet-queue>",
9769 "Detailed info about dynamic update groups\n"
9770 "Advertisement queue\n"
9771 "Announced routes\n"
9775 show_bgp_updgrps_adj_info_aux(vty
, NULL
, AFI_IP6
, SAFI_UNICAST
, argv
[idx_type
]->arg
, 0);
9779 DEFUN (show_bgp_instance_updgrps_adj
,
9780 show_bgp_instance_updgrps_adj_cmd
,
9781 "show [ip] bgp <view|vrf> VIEWVRFNAME update-groups <advertise-queue|advertised-routes|packet-queue>",
9785 BGP_INSTANCE_HELP_STR
9786 "Detailed info about dynamic update groups\n"
9787 "Advertisement queue\n"
9788 "Announced routes\n"
9793 show_bgp_updgrps_adj_info_aux(vty
, argv
[idx_word
]->arg
, AFI_IP6
, SAFI_UNICAST
, argv
[idx_type
]->arg
, 0);
9797 DEFUN (show_ip_bgp_updgrps_adj_s
,
9798 show_ip_bgp_updgrps_adj_s_cmd
,
9799 "show [ip] bgp update-groups SUBGROUP-ID <advertise-queue|advertised-routes|packet-queue>",
9803 "Detailed info about dynamic update groups\n"
9804 "Specific subgroup to display info for\n"
9805 "Advertisement queue\n"
9806 "Announced routes\n"
9810 int idx_subgroup_id
= 4;
9814 VTY_GET_ULL("subgroup-id", subgrp_id
, argv
[idx_subgroup_id
]->arg
);
9816 show_bgp_updgrps_adj_info_aux(vty
, NULL
, AFI_IP
, SAFI_UNICAST
, argv
[idx_type
]->arg
, subgrp_id
);
9820 DEFUN (show_ip_bgp_instance_updgrps_adj_s
,
9821 show_ip_bgp_instance_updgrps_adj_s_cmd
,
9822 "show [ip] bgp <view|vrf> VIEWVRFNAME update-groups SUBGROUP-ID <advertise-queue|advertised-routes|packet-queue>",
9826 BGP_INSTANCE_HELP_STR
9827 "Detailed info about dynamic update groups\n"
9828 "Specific subgroup to display info for\n"
9829 "Advertisement queue\n"
9830 "Announced routes\n"
9835 int idx_subgroup_id
= 6;
9839 VTY_GET_ULL("subgroup-id", subgrp_id
, argv
[idx_subgroup_id
]->arg
);
9841 show_bgp_updgrps_adj_info_aux(vty
, argv
[idx_vrf
]->arg
, AFI_IP
, SAFI_UNICAST
, argv
[idx_type
]->arg
, subgrp_id
);
9845 DEFUN (show_bgp_updgrps_afi_adj_s
,
9846 show_bgp_updgrps_afi_adj_s_cmd
,
9847 "show [ip] bgp "BGP_AFI_SAFI_CMD_STR
" update-groups SUBGROUP-ID <advertise-queue|advertised-routes|packet-queue>",
9851 BGP_AFI_SAFI_HELP_STR
9852 "Detailed info about dynamic update groups\n"
9853 "Specific subgroup to display info for\n"
9854 "Advertisement queue\n"
9855 "Announced routes\n"
9857 "Specific subgroup info wanted for\n")
9861 int idx_subgroup_id
= 5;
9865 VTY_GET_ULL("subgroup-id", subgrp_id
, argv
[idx_subgroup_id
]->arg
);
9867 show_bgp_updgrps_adj_info_aux(vty
, NULL
,
9868 bgp_vty_afi_from_arg(argv
[idx_afi
]->arg
),
9869 bgp_vty_safi_from_arg(argv
[idx_safi
]->arg
),
9870 argv
[idx_type
]->arg
, subgrp_id
);
9874 DEFUN (show_bgp_updgrps_adj_s
,
9875 show_bgp_updgrps_adj_s_cmd
,
9876 "show [ip] bgp update-groups SUBGROUP-ID <advertise-queue|advertised-routes|packet-queue>",
9880 "Detailed info about dynamic update groups\n"
9881 "Specific subgroup to display info for\n"
9882 "Advertisement queue\n"
9883 "Announced routes\n"
9886 int idx_subgroup_id
= 3;
9890 VTY_GET_ULL("subgroup-id", subgrp_id
, argv
[idx_subgroup_id
]->arg
);
9892 show_bgp_updgrps_adj_info_aux(vty
, NULL
, AFI_IP6
, SAFI_UNICAST
, argv
[idx_type
]->arg
, subgrp_id
);
9896 DEFUN (show_bgp_instance_updgrps_adj_s
,
9897 show_bgp_instance_updgrps_adj_s_cmd
,
9898 "show [ip] bgp <view|vrf> VIEWVRFNAME update-groups SUBGROUP-ID <advertise-queue|advertised-routes|packet-queue>",
9902 BGP_INSTANCE_HELP_STR
9903 "Detailed info about dynamic update groups\n"
9904 "Specific subgroup to display info for\n"
9905 "Advertisement queue\n"
9906 "Announced routes\n"
9910 int idx_subgroup_id
= 5;
9914 VTY_GET_ULL("subgroup-id", subgrp_id
, argv
[idx_subgroup_id
]->arg
);
9916 show_bgp_updgrps_adj_info_aux(vty
, argv
[idx_vrf
]->arg
, AFI_IP6
, SAFI_UNICAST
, argv
[idx_type
]->arg
, subgrp_id
);
9923 bgp_show_one_peer_group (struct vty
*vty
, struct peer_group
*group
)
9925 struct listnode
*node
, *nnode
;
9926 struct prefix
*range
;
9929 char buf
[PREFIX2STR_BUFFER
];
9932 const char *peer_status
;
9940 if (conf
->as_type
== AS_SPECIFIED
||
9941 conf
->as_type
== AS_EXTERNAL
) {
9942 vty_out (vty
, "%sBGP peer-group %s, remote AS %d%s",
9943 VTY_NEWLINE
, group
->name
, conf
->as
, VTY_NEWLINE
);
9944 } else if (conf
->as_type
== AS_INTERNAL
) {
9945 vty_out (vty
, "%sBGP peer-group %s, remote AS %d%s",
9946 VTY_NEWLINE
, group
->name
, group
->bgp
->as
, VTY_NEWLINE
);
9948 vty_out (vty
, "%sBGP peer-group %s%s",
9949 VTY_NEWLINE
, group
->name
, VTY_NEWLINE
);
9952 if ((group
->bgp
->as
== conf
->as
) || (conf
->as_type
== AS_INTERNAL
))
9953 vty_out (vty
, " Peer-group type is internal%s", VTY_NEWLINE
);
9955 vty_out (vty
, " Peer-group type is external%s", VTY_NEWLINE
);
9957 /* Display AFs configured. */
9958 vty_out (vty
, " Configured address-families:");
9959 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
9960 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
9962 if (conf
->afc
[afi
][safi
])
9965 vty_out (vty
, " %s;", afi_safi_print(afi
, safi
));
9969 vty_out (vty
, " none%s", VTY_NEWLINE
);
9971 vty_out (vty
, "%s", VTY_NEWLINE
);
9973 /* Display listen ranges (for dynamic neighbors), if any */
9974 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
9978 else if (afi
== AFI_IP6
)
9982 lr_count
= listcount(group
->listen_range
[afi
]);
9986 " %d %s listen range(s)%s",
9987 lr_count
, af_str
, VTY_NEWLINE
);
9990 for (ALL_LIST_ELEMENTS (group
->listen_range
[afi
], node
,
9993 prefix2str(range
, buf
, sizeof(buf
));
9994 vty_out(vty
, " %s%s", buf
, VTY_NEWLINE
);
9999 /* Display group members and their status */
10000 if (listcount(group
->peer
))
10002 vty_out (vty
, " Peer-group members:%s", VTY_NEWLINE
);
10003 for (ALL_LIST_ELEMENTS (group
->peer
, node
, nnode
, peer
))
10005 if (CHECK_FLAG (peer
->flags
, PEER_FLAG_SHUTDOWN
))
10006 peer_status
= "Idle (Admin)";
10007 else if (CHECK_FLAG (peer
->sflags
, PEER_STATUS_PREFIX_OVERFLOW
))
10008 peer_status
= "Idle (PfxCt)";
10010 peer_status
= lookup_msg(bgp_status_msg
, peer
->status
, NULL
);
10012 dynamic
= peer_dynamic_neighbor(peer
);
10013 vty_out (vty
, " %s %s %s %s",
10014 peer
->host
, dynamic
? "(dynamic)" : "",
10015 peer_status
, VTY_NEWLINE
);
10019 return CMD_SUCCESS
;
10022 /* Show BGP peer group's information. */
10023 enum show_group_type
10030 bgp_show_peer_group (struct vty
*vty
, struct bgp
*bgp
,
10031 enum show_group_type type
, const char *group_name
)
10033 struct listnode
*node
, *nnode
;
10034 struct peer_group
*group
;
10037 for (ALL_LIST_ELEMENTS (bgp
->group
, node
, nnode
, group
))
10041 case show_all_groups
:
10042 bgp_show_one_peer_group (vty
, group
);
10044 case show_peer_group
:
10045 if (group_name
&& (strcmp(group
->name
, group_name
) == 0))
10048 bgp_show_one_peer_group (vty
, group
);
10054 if (type
== show_peer_group
&& ! find
)
10055 vty_out (vty
, "%% No such peer-group%s", VTY_NEWLINE
);
10057 return CMD_SUCCESS
;
10061 bgp_show_peer_group_vty (struct vty
*vty
, const char *name
,
10062 enum show_group_type type
, const char *group_name
)
10065 int ret
= CMD_SUCCESS
;
10068 bgp
= bgp_lookup_by_name (name
);
10070 bgp
= bgp_get_default ();
10074 vty_out (vty
, "%% No such BGP instance exist%s", VTY_NEWLINE
);
10075 return CMD_WARNING
;
10078 ret
= bgp_show_peer_group (vty
, bgp
, type
, group_name
);
10083 DEFUN (show_ip_bgp_peer_groups
,
10084 show_ip_bgp_peer_groups_cmd
,
10085 "show [ip] bgp [<view|vrf> VIEWVRFNAME] peer-group [PGNAME]",
10089 BGP_INSTANCE_HELP_STR
10090 "Detailed information on BGP peer groups\n"
10091 "Peer group name\n")
10097 vrf
= argv_find (argv
, argc
, "WORD", &idx
) ? argv
[idx
]->arg
: NULL
;
10098 pg
= argv_find (argv
, argc
, "PGNAME", &idx
) ? argv
[idx
]->arg
: NULL
;
10100 return bgp_show_peer_group_vty (vty
, vrf
, show_all_groups
, pg
);
10104 /* Redistribute VTY commands. */
10106 DEFUN (bgp_redistribute_ipv4
,
10107 bgp_redistribute_ipv4_cmd
,
10108 "redistribute " FRR_IP_REDIST_STR_BGPD
,
10109 "Redistribute information from another routing protocol\n"
10110 FRR_IP_REDIST_HELP_STR_BGPD
)
10112 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
10113 int idx_protocol
= 1;
10116 type
= proto_redistnum (AFI_IP
, argv
[idx_protocol
]->text
);
10119 vty_out (vty
, "%% Invalid route type%s", VTY_NEWLINE
);
10120 return CMD_WARNING
;
10122 bgp_redist_add(bgp
, AFI_IP
, type
, 0);
10123 return bgp_redistribute_set (bgp
, AFI_IP
, type
, 0);
10126 ALIAS_HIDDEN (bgp_redistribute_ipv4
,
10127 bgp_redistribute_ipv4_hidden_cmd
,
10128 "redistribute " FRR_IP_REDIST_STR_BGPD
,
10129 "Redistribute information from another routing protocol\n"
10130 FRR_IP_REDIST_HELP_STR_BGPD
)
10132 DEFUN (bgp_redistribute_ipv4_rmap
,
10133 bgp_redistribute_ipv4_rmap_cmd
,
10134 "redistribute " FRR_IP_REDIST_STR_BGPD
" route-map WORD",
10135 "Redistribute information from another routing protocol\n"
10136 FRR_IP_REDIST_HELP_STR_BGPD
10137 "Route map reference\n"
10138 "Pointer to route-map entries\n")
10140 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
10141 int idx_protocol
= 1;
10144 struct bgp_redist
*red
;
10146 type
= proto_redistnum (AFI_IP
, argv
[idx_protocol
]->text
);
10149 vty_out (vty
, "%% Invalid route type%s", VTY_NEWLINE
);
10150 return CMD_WARNING
;
10153 red
= bgp_redist_add(bgp
, AFI_IP
, type
, 0);
10154 bgp_redistribute_rmap_set (red
, argv
[idx_word
]->arg
);
10155 return bgp_redistribute_set (bgp
, AFI_IP
, type
, 0);
10158 ALIAS_HIDDEN (bgp_redistribute_ipv4_rmap
,
10159 bgp_redistribute_ipv4_rmap_hidden_cmd
,
10160 "redistribute " FRR_IP_REDIST_STR_BGPD
" route-map WORD",
10161 "Redistribute information from another routing protocol\n"
10162 FRR_IP_REDIST_HELP_STR_BGPD
10163 "Route map reference\n"
10164 "Pointer to route-map entries\n")
10166 DEFUN (bgp_redistribute_ipv4_metric
,
10167 bgp_redistribute_ipv4_metric_cmd
,
10168 "redistribute " FRR_IP_REDIST_STR_BGPD
" metric (0-4294967295)",
10169 "Redistribute information from another routing protocol\n"
10170 FRR_IP_REDIST_HELP_STR_BGPD
10171 "Metric for redistributed routes\n"
10172 "Default metric\n")
10174 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
10175 int idx_protocol
= 1;
10176 int idx_number
= 3;
10179 struct bgp_redist
*red
;
10181 type
= proto_redistnum (AFI_IP
, argv
[idx_protocol
]->text
);
10184 vty_out (vty
, "%% Invalid route type%s", VTY_NEWLINE
);
10185 return CMD_WARNING
;
10187 VTY_GET_INTEGER ("metric", metric
, argv
[idx_number
]->arg
);
10189 red
= bgp_redist_add(bgp
, AFI_IP
, type
, 0);
10190 bgp_redistribute_metric_set(bgp
, red
, AFI_IP
, type
, metric
);
10191 return bgp_redistribute_set (bgp
, AFI_IP
, type
, 0);
10194 ALIAS_HIDDEN (bgp_redistribute_ipv4_metric
,
10195 bgp_redistribute_ipv4_metric_hidden_cmd
,
10196 "redistribute " FRR_IP_REDIST_STR_BGPD
" metric (0-4294967295)",
10197 "Redistribute information from another routing protocol\n"
10198 FRR_IP_REDIST_HELP_STR_BGPD
10199 "Metric for redistributed routes\n"
10200 "Default metric\n")
10202 DEFUN (bgp_redistribute_ipv4_rmap_metric
,
10203 bgp_redistribute_ipv4_rmap_metric_cmd
,
10204 "redistribute " FRR_IP_REDIST_STR_BGPD
" route-map WORD metric (0-4294967295)",
10205 "Redistribute information from another routing protocol\n"
10206 FRR_IP_REDIST_HELP_STR_BGPD
10207 "Route map reference\n"
10208 "Pointer to route-map entries\n"
10209 "Metric for redistributed routes\n"
10210 "Default metric\n")
10212 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
10213 int idx_protocol
= 1;
10215 int idx_number
= 5;
10218 struct bgp_redist
*red
;
10220 type
= proto_redistnum (AFI_IP
, argv
[idx_protocol
]->text
);
10223 vty_out (vty
, "%% Invalid route type%s", VTY_NEWLINE
);
10224 return CMD_WARNING
;
10226 VTY_GET_INTEGER ("metric", metric
, argv
[idx_number
]->arg
);
10228 red
= bgp_redist_add(bgp
, AFI_IP
, type
, 0);
10229 bgp_redistribute_rmap_set (red
, argv
[idx_word
]->arg
);
10230 bgp_redistribute_metric_set(bgp
, red
, AFI_IP
, type
, metric
);
10231 return bgp_redistribute_set (bgp
, AFI_IP
, type
, 0);
10234 ALIAS_HIDDEN (bgp_redistribute_ipv4_rmap_metric
,
10235 bgp_redistribute_ipv4_rmap_metric_hidden_cmd
,
10236 "redistribute " FRR_IP_REDIST_STR_BGPD
" route-map WORD metric (0-4294967295)",
10237 "Redistribute information from another routing protocol\n"
10238 FRR_IP_REDIST_HELP_STR_BGPD
10239 "Route map reference\n"
10240 "Pointer to route-map entries\n"
10241 "Metric for redistributed routes\n"
10242 "Default metric\n")
10244 DEFUN (bgp_redistribute_ipv4_metric_rmap
,
10245 bgp_redistribute_ipv4_metric_rmap_cmd
,
10246 "redistribute " FRR_IP_REDIST_STR_BGPD
" metric (0-4294967295) route-map WORD",
10247 "Redistribute information from another routing protocol\n"
10248 FRR_IP_REDIST_HELP_STR_BGPD
10249 "Metric for redistributed routes\n"
10251 "Route map reference\n"
10252 "Pointer to route-map entries\n")
10254 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
10255 int idx_protocol
= 1;
10256 int idx_number
= 3;
10260 struct bgp_redist
*red
;
10262 type
= proto_redistnum (AFI_IP
, argv
[idx_protocol
]->text
);
10265 vty_out (vty
, "%% Invalid route type%s", VTY_NEWLINE
);
10266 return CMD_WARNING
;
10268 VTY_GET_INTEGER ("metric", metric
, argv
[idx_number
]->arg
);
10270 red
= bgp_redist_add(bgp
, AFI_IP
, type
, 0);
10271 bgp_redistribute_metric_set(bgp
, red
, AFI_IP
, type
, metric
);
10272 bgp_redistribute_rmap_set (red
, argv
[idx_word
]->arg
);
10273 return bgp_redistribute_set (bgp
, AFI_IP
, type
, 0);
10276 ALIAS_HIDDEN (bgp_redistribute_ipv4_metric_rmap
,
10277 bgp_redistribute_ipv4_metric_rmap_hidden_cmd
,
10278 "redistribute " FRR_IP_REDIST_STR_BGPD
" metric (0-4294967295) route-map WORD",
10279 "Redistribute information from another routing protocol\n"
10280 FRR_IP_REDIST_HELP_STR_BGPD
10281 "Metric for redistributed routes\n"
10283 "Route map reference\n"
10284 "Pointer to route-map entries\n")
10286 DEFUN (bgp_redistribute_ipv4_ospf
,
10287 bgp_redistribute_ipv4_ospf_cmd
,
10288 "redistribute <ospf|table> (1-65535)",
10289 "Redistribute information from another routing protocol\n"
10290 "Open Shortest Path First (OSPFv2)\n"
10291 "Non-main Kernel Routing Table\n"
10292 "Instance ID/Table ID\n")
10294 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
10295 int idx_ospf_table
= 1;
10296 int idx_number
= 2;
10300 VTY_GET_INTEGER ("Instance ID", instance
, argv
[idx_number
]->arg
);
10302 if (strncmp(argv
[idx_ospf_table
]->arg
, "o", 1) == 0)
10303 protocol
= ZEBRA_ROUTE_OSPF
;
10305 protocol
= ZEBRA_ROUTE_TABLE
;
10307 bgp_redist_add(bgp
, AFI_IP
, protocol
, instance
);
10308 return bgp_redistribute_set (bgp
, AFI_IP
, protocol
, instance
);
10311 ALIAS_HIDDEN (bgp_redistribute_ipv4_ospf
,
10312 bgp_redistribute_ipv4_ospf_hidden_cmd
,
10313 "redistribute <ospf|table> (1-65535)",
10314 "Redistribute information from another routing protocol\n"
10315 "Open Shortest Path First (OSPFv2)\n"
10316 "Non-main Kernel Routing Table\n"
10317 "Instance ID/Table ID\n")
10319 DEFUN (bgp_redistribute_ipv4_ospf_rmap
,
10320 bgp_redistribute_ipv4_ospf_rmap_cmd
,
10321 "redistribute <ospf|table> (1-65535) route-map WORD",
10322 "Redistribute information from another routing protocol\n"
10323 "Open Shortest Path First (OSPFv2)\n"
10324 "Non-main Kernel Routing Table\n"
10325 "Instance ID/Table ID\n"
10326 "Route map reference\n"
10327 "Pointer to route-map entries\n")
10329 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
10330 int idx_ospf_table
= 1;
10331 int idx_number
= 2;
10333 struct bgp_redist
*red
;
10337 if (strncmp(argv
[idx_ospf_table
]->arg
, "o", 1) == 0)
10338 protocol
= ZEBRA_ROUTE_OSPF
;
10340 protocol
= ZEBRA_ROUTE_TABLE
;
10342 VTY_GET_INTEGER ("Instance ID", instance
, argv
[idx_number
]->arg
);
10343 red
= bgp_redist_add(bgp
, AFI_IP
, protocol
, instance
);
10344 bgp_redistribute_rmap_set (red
, argv
[idx_word
]->arg
);
10345 return bgp_redistribute_set (bgp
, AFI_IP
, protocol
, instance
);
10348 ALIAS_HIDDEN (bgp_redistribute_ipv4_ospf_rmap
,
10349 bgp_redistribute_ipv4_ospf_rmap_hidden_cmd
,
10350 "redistribute <ospf|table> (1-65535) route-map WORD",
10351 "Redistribute information from another routing protocol\n"
10352 "Open Shortest Path First (OSPFv2)\n"
10353 "Non-main Kernel Routing Table\n"
10354 "Instance ID/Table ID\n"
10355 "Route map reference\n"
10356 "Pointer to route-map entries\n")
10358 DEFUN (bgp_redistribute_ipv4_ospf_metric
,
10359 bgp_redistribute_ipv4_ospf_metric_cmd
,
10360 "redistribute <ospf|table> (1-65535) metric (0-4294967295)",
10361 "Redistribute information from another routing protocol\n"
10362 "Open Shortest Path First (OSPFv2)\n"
10363 "Non-main Kernel Routing Table\n"
10364 "Instance ID/Table ID\n"
10365 "Metric for redistributed routes\n"
10366 "Default metric\n")
10368 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
10369 int idx_ospf_table
= 1;
10370 int idx_number
= 2;
10371 int idx_number_2
= 4;
10373 struct bgp_redist
*red
;
10377 if (strncmp(argv
[idx_ospf_table
]->arg
, "o", 1) == 0)
10378 protocol
= ZEBRA_ROUTE_OSPF
;
10380 protocol
= ZEBRA_ROUTE_TABLE
;
10382 VTY_GET_INTEGER ("Instance ID", instance
, argv
[idx_number
]->arg
);
10383 VTY_GET_INTEGER ("metric", metric
, argv
[idx_number_2
]->arg
);
10385 red
= bgp_redist_add(bgp
, AFI_IP
, protocol
, instance
);
10386 bgp_redistribute_metric_set(bgp
, red
, AFI_IP
, protocol
, metric
);
10387 return bgp_redistribute_set (bgp
, AFI_IP
, protocol
, instance
);
10390 ALIAS_HIDDEN (bgp_redistribute_ipv4_ospf_metric
,
10391 bgp_redistribute_ipv4_ospf_metric_hidden_cmd
,
10392 "redistribute <ospf|table> (1-65535) metric (0-4294967295)",
10393 "Redistribute information from another routing protocol\n"
10394 "Open Shortest Path First (OSPFv2)\n"
10395 "Non-main Kernel Routing Table\n"
10396 "Instance ID/Table ID\n"
10397 "Metric for redistributed routes\n"
10398 "Default metric\n")
10400 DEFUN (bgp_redistribute_ipv4_ospf_rmap_metric
,
10401 bgp_redistribute_ipv4_ospf_rmap_metric_cmd
,
10402 "redistribute <ospf|table> (1-65535) route-map WORD metric (0-4294967295)",
10403 "Redistribute information from another routing protocol\n"
10404 "Open Shortest Path First (OSPFv2)\n"
10405 "Non-main Kernel Routing Table\n"
10406 "Instance ID/Table ID\n"
10407 "Route map reference\n"
10408 "Pointer to route-map entries\n"
10409 "Metric for redistributed routes\n"
10410 "Default metric\n")
10412 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
10413 int idx_ospf_table
= 1;
10414 int idx_number
= 2;
10416 int idx_number_2
= 6;
10418 struct bgp_redist
*red
;
10422 if (strncmp(argv
[idx_ospf_table
]->arg
, "o", 1) == 0)
10423 protocol
= ZEBRA_ROUTE_OSPF
;
10425 protocol
= ZEBRA_ROUTE_TABLE
;
10427 VTY_GET_INTEGER ("Instance ID", instance
, argv
[idx_number
]->arg
);
10428 VTY_GET_INTEGER ("metric", metric
, argv
[idx_number_2
]->arg
);
10430 red
= bgp_redist_add(bgp
, AFI_IP
, protocol
, instance
);
10431 bgp_redistribute_rmap_set (red
, argv
[idx_word
]->arg
);
10432 bgp_redistribute_metric_set(bgp
, red
, AFI_IP
, protocol
, metric
);
10433 return bgp_redistribute_set (bgp
, AFI_IP
, protocol
, instance
);
10436 ALIAS_HIDDEN (bgp_redistribute_ipv4_ospf_rmap_metric
,
10437 bgp_redistribute_ipv4_ospf_rmap_metric_hidden_cmd
,
10438 "redistribute <ospf|table> (1-65535) route-map WORD metric (0-4294967295)",
10439 "Redistribute information from another routing protocol\n"
10440 "Open Shortest Path First (OSPFv2)\n"
10441 "Non-main Kernel Routing Table\n"
10442 "Instance ID/Table ID\n"
10443 "Route map reference\n"
10444 "Pointer to route-map entries\n"
10445 "Metric for redistributed routes\n"
10446 "Default metric\n")
10448 DEFUN (bgp_redistribute_ipv4_ospf_metric_rmap
,
10449 bgp_redistribute_ipv4_ospf_metric_rmap_cmd
,
10450 "redistribute <ospf|table> (1-65535) metric (0-4294967295) route-map WORD",
10451 "Redistribute information from another routing protocol\n"
10452 "Open Shortest Path First (OSPFv2)\n"
10453 "Non-main Kernel Routing Table\n"
10454 "Instance ID/Table ID\n"
10455 "Metric for redistributed routes\n"
10457 "Route map reference\n"
10458 "Pointer to route-map entries\n")
10460 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
10461 int idx_ospf_table
= 1;
10462 int idx_number
= 2;
10463 int idx_number_2
= 4;
10466 struct bgp_redist
*red
;
10470 if (strncmp(argv
[idx_ospf_table
]->arg
, "o", 1) == 0)
10471 protocol
= ZEBRA_ROUTE_OSPF
;
10473 protocol
= ZEBRA_ROUTE_TABLE
;
10475 VTY_GET_INTEGER ("Instance ID", instance
, argv
[idx_number
]->arg
);
10476 VTY_GET_INTEGER ("metric", metric
, argv
[idx_number_2
]->arg
);
10478 red
= bgp_redist_add(bgp
, AFI_IP
, protocol
, instance
);
10479 bgp_redistribute_metric_set(bgp
, red
, AFI_IP
, protocol
, metric
);
10480 bgp_redistribute_rmap_set (red
, argv
[idx_word
]->arg
);
10481 return bgp_redistribute_set (bgp
, AFI_IP
, protocol
, instance
);
10484 ALIAS_HIDDEN (bgp_redistribute_ipv4_ospf_metric_rmap
,
10485 bgp_redistribute_ipv4_ospf_metric_rmap_hidden_cmd
,
10486 "redistribute <ospf|table> (1-65535) metric (0-4294967295) route-map WORD",
10487 "Redistribute information from another routing protocol\n"
10488 "Open Shortest Path First (OSPFv2)\n"
10489 "Non-main Kernel Routing Table\n"
10490 "Instance ID/Table ID\n"
10491 "Metric for redistributed routes\n"
10493 "Route map reference\n"
10494 "Pointer to route-map entries\n")
10496 DEFUN (no_bgp_redistribute_ipv4_ospf
,
10497 no_bgp_redistribute_ipv4_ospf_cmd
,
10498 "no redistribute <ospf|table> (1-65535) [metric (0-4294967295)] [route-map WORD]",
10500 "Redistribute information from another routing protocol\n"
10501 "Open Shortest Path First (OSPFv2)\n"
10502 "Non-main Kernel Routing Table\n"
10503 "Instance ID/Table ID\n"
10504 "Metric for redistributed routes\n"
10506 "Route map reference\n"
10507 "Pointer to route-map entries\n")
10509 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
10510 int idx_ospf_table
= 2;
10511 int idx_number
= 3;
10515 if (strncmp(argv
[idx_ospf_table
]->arg
, "o", 1) == 0)
10516 protocol
= ZEBRA_ROUTE_OSPF
;
10518 protocol
= ZEBRA_ROUTE_TABLE
;
10520 VTY_GET_INTEGER ("Instance ID", instance
, argv
[idx_number
]->arg
);
10521 return bgp_redistribute_unset (bgp
, AFI_IP
, protocol
, instance
);
10524 ALIAS_HIDDEN (no_bgp_redistribute_ipv4_ospf
,
10525 no_bgp_redistribute_ipv4_ospf_hidden_cmd
,
10526 "no redistribute <ospf|table> (1-65535) [metric (0-4294967295)] [route-map WORD]",
10528 "Redistribute information from another routing protocol\n"
10529 "Open Shortest Path First (OSPFv2)\n"
10530 "Non-main Kernel Routing Table\n"
10531 "Instance ID/Table ID\n"
10532 "Metric for redistributed routes\n"
10534 "Route map reference\n"
10535 "Pointer to route-map entries\n")
10537 DEFUN (no_bgp_redistribute_ipv4
,
10538 no_bgp_redistribute_ipv4_cmd
,
10539 "no redistribute " FRR_IP_REDIST_STR_BGPD
" [metric (0-4294967295)] [route-map WORD]",
10541 "Redistribute information from another routing protocol\n"
10542 FRR_IP_REDIST_HELP_STR_BGPD
10543 "Metric for redistributed routes\n"
10545 "Route map reference\n"
10546 "Pointer to route-map entries\n")
10548 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
10549 int idx_protocol
= 2;
10552 type
= proto_redistnum (AFI_IP
, argv
[idx_protocol
]->text
);
10555 vty_out (vty
, "%% Invalid route type%s", VTY_NEWLINE
);
10556 return CMD_WARNING
;
10558 return bgp_redistribute_unset (bgp
, AFI_IP
, type
, 0);
10561 ALIAS_HIDDEN (no_bgp_redistribute_ipv4
,
10562 no_bgp_redistribute_ipv4_hidden_cmd
,
10563 "no redistribute " FRR_IP_REDIST_STR_BGPD
" [metric (0-4294967295)] [route-map WORD]",
10565 "Redistribute information from another routing protocol\n"
10566 FRR_IP_REDIST_HELP_STR_BGPD
10567 "Metric for redistributed routes\n"
10569 "Route map reference\n"
10570 "Pointer to route-map entries\n")
10572 DEFUN (bgp_redistribute_ipv6
,
10573 bgp_redistribute_ipv6_cmd
,
10574 "redistribute " FRR_IP6_REDIST_STR_BGPD
,
10575 "Redistribute information from another routing protocol\n"
10576 FRR_IP6_REDIST_HELP_STR_BGPD
)
10578 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
10579 int idx_protocol
= 1;
10582 type
= proto_redistnum (AFI_IP6
, argv
[idx_protocol
]->text
);
10585 vty_out (vty
, "%% Invalid route type%s", VTY_NEWLINE
);
10586 return CMD_WARNING
;
10589 bgp_redist_add(bgp
, AFI_IP6
, type
, 0);
10590 return bgp_redistribute_set (bgp
, AFI_IP6
, type
, 0);
10593 DEFUN (bgp_redistribute_ipv6_rmap
,
10594 bgp_redistribute_ipv6_rmap_cmd
,
10595 "redistribute " FRR_IP6_REDIST_STR_BGPD
" route-map WORD",
10596 "Redistribute information from another routing protocol\n"
10597 FRR_IP6_REDIST_HELP_STR_BGPD
10598 "Route map reference\n"
10599 "Pointer to route-map entries\n")
10601 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
10602 int idx_protocol
= 1;
10605 struct bgp_redist
*red
;
10607 type
= proto_redistnum (AFI_IP6
, argv
[idx_protocol
]->text
);
10610 vty_out (vty
, "%% Invalid route type%s", VTY_NEWLINE
);
10611 return CMD_WARNING
;
10614 red
= bgp_redist_add(bgp
, AFI_IP6
, type
, 0);
10615 bgp_redistribute_rmap_set (red
, argv
[idx_word
]->arg
);
10616 return bgp_redistribute_set (bgp
, AFI_IP6
, type
, 0);
10619 DEFUN (bgp_redistribute_ipv6_metric
,
10620 bgp_redistribute_ipv6_metric_cmd
,
10621 "redistribute " FRR_IP6_REDIST_STR_BGPD
" metric (0-4294967295)",
10622 "Redistribute information from another routing protocol\n"
10623 FRR_IP6_REDIST_HELP_STR_BGPD
10624 "Metric for redistributed routes\n"
10625 "Default metric\n")
10627 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
10628 int idx_protocol
= 1;
10629 int idx_number
= 3;
10632 struct bgp_redist
*red
;
10634 type
= proto_redistnum (AFI_IP6
, argv
[idx_protocol
]->text
);
10637 vty_out (vty
, "%% Invalid route type%s", VTY_NEWLINE
);
10638 return CMD_WARNING
;
10640 VTY_GET_INTEGER ("metric", metric
, argv
[idx_number
]->arg
);
10642 red
= bgp_redist_add(bgp
, AFI_IP6
, type
, 0);
10643 bgp_redistribute_metric_set(bgp
, red
, AFI_IP6
, type
, metric
);
10644 return bgp_redistribute_set (bgp
, AFI_IP6
, type
, 0);
10647 DEFUN (bgp_redistribute_ipv6_rmap_metric
,
10648 bgp_redistribute_ipv6_rmap_metric_cmd
,
10649 "redistribute " FRR_IP6_REDIST_STR_BGPD
" route-map WORD metric (0-4294967295)",
10650 "Redistribute information from another routing protocol\n"
10651 FRR_IP6_REDIST_HELP_STR_BGPD
10652 "Route map reference\n"
10653 "Pointer to route-map entries\n"
10654 "Metric for redistributed routes\n"
10655 "Default metric\n")
10657 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
10658 int idx_protocol
= 1;
10660 int idx_number
= 5;
10663 struct bgp_redist
*red
;
10665 type
= proto_redistnum (AFI_IP6
, argv
[idx_protocol
]->text
);
10668 vty_out (vty
, "%% Invalid route type%s", VTY_NEWLINE
);
10669 return CMD_WARNING
;
10671 VTY_GET_INTEGER ("metric", metric
, argv
[idx_number
]->arg
);
10673 red
= bgp_redist_add(bgp
, AFI_IP6
, type
, 0);
10674 bgp_redistribute_rmap_set (red
, argv
[idx_word
]->arg
);
10675 bgp_redistribute_metric_set(bgp
, red
, AFI_IP6
, type
, metric
);
10676 return bgp_redistribute_set (bgp
, AFI_IP6
, type
, 0);
10679 DEFUN (bgp_redistribute_ipv6_metric_rmap
,
10680 bgp_redistribute_ipv6_metric_rmap_cmd
,
10681 "redistribute " FRR_IP6_REDIST_STR_BGPD
" metric (0-4294967295) route-map WORD",
10682 "Redistribute information from another routing protocol\n"
10683 FRR_IP6_REDIST_HELP_STR_BGPD
10684 "Metric for redistributed routes\n"
10686 "Route map reference\n"
10687 "Pointer to route-map entries\n")
10689 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
10690 int idx_protocol
= 1;
10691 int idx_number
= 3;
10695 struct bgp_redist
*red
;
10697 type
= proto_redistnum (AFI_IP6
, argv
[idx_protocol
]->text
);
10700 vty_out (vty
, "%% Invalid route type%s", VTY_NEWLINE
);
10701 return CMD_WARNING
;
10703 VTY_GET_INTEGER ("metric", metric
, argv
[idx_number
]->arg
);
10705 red
= bgp_redist_add(bgp
, AFI_IP6
, type
, 0);
10706 bgp_redistribute_metric_set(bgp
, red
, AFI_IP6
, SAFI_UNICAST
, metric
);
10707 bgp_redistribute_rmap_set (red
, argv
[idx_word
]->arg
);
10708 return bgp_redistribute_set (bgp
, AFI_IP6
, type
, 0);
10711 DEFUN (no_bgp_redistribute_ipv6
,
10712 no_bgp_redistribute_ipv6_cmd
,
10713 "no redistribute " FRR_IP6_REDIST_STR_BGPD
" [metric (0-4294967295)] [route-map WORD]",
10715 "Redistribute information from another routing protocol\n"
10716 FRR_IP6_REDIST_HELP_STR_BGPD
10717 "Metric for redistributed routes\n"
10719 "Route map reference\n"
10720 "Pointer to route-map entries\n")
10722 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
10723 int idx_protocol
= 2;
10726 type
= proto_redistnum (AFI_IP6
, argv
[idx_protocol
]->text
);
10729 vty_out (vty
, "%% Invalid route type%s", VTY_NEWLINE
);
10730 return CMD_WARNING
;
10733 return bgp_redistribute_unset (bgp
, AFI_IP6
, type
, 0);
10737 bgp_config_write_redistribute (struct vty
*vty
, struct bgp
*bgp
, afi_t afi
,
10738 safi_t safi
, int *write
)
10742 /* Unicast redistribution only. */
10743 if (safi
!= SAFI_UNICAST
)
10746 for (i
= 0; i
< ZEBRA_ROUTE_MAX
; i
++)
10748 /* Redistribute BGP does not make sense. */
10749 if (i
!= ZEBRA_ROUTE_BGP
)
10751 struct list
*red_list
;
10752 struct listnode
*node
;
10753 struct bgp_redist
*red
;
10755 red_list
= bgp
->redist
[afi
][i
];
10759 for (ALL_LIST_ELEMENTS_RO(red_list
, node
, red
))
10761 /* Display "address-family" when it is not yet diplayed. */
10762 bgp_config_write_family_header (vty
, afi
, safi
, write
);
10764 /* "redistribute" configuration. */
10765 vty_out (vty
, " redistribute %s", zebra_route_string(i
));
10767 vty_out (vty
, " %d", red
->instance
);
10768 if (red
->redist_metric_flag
)
10769 vty_out (vty
, " metric %u", red
->redist_metric
);
10770 if (red
->rmap
.name
)
10771 vty_out (vty
, " route-map %s", red
->rmap
.name
);
10772 vty_out (vty
, "%s", VTY_NEWLINE
);
10779 /* BGP node structure. */
10780 static struct cmd_node bgp_node
=
10783 "%s(config-router)# ",
10787 static struct cmd_node bgp_ipv4_unicast_node
=
10790 "%s(config-router-af)# ",
10794 static struct cmd_node bgp_ipv4_multicast_node
=
10797 "%s(config-router-af)# ",
10801 static struct cmd_node bgp_ipv4_labeled_unicast_node
=
10804 "%s(config-router-af)# ",
10808 static struct cmd_node bgp_ipv6_unicast_node
=
10811 "%s(config-router-af)# ",
10815 static struct cmd_node bgp_ipv6_multicast_node
=
10818 "%s(config-router-af)# ",
10822 static struct cmd_node bgp_ipv6_labeled_unicast_node
=
10825 "%s(config-router-af)# ",
10829 static struct cmd_node bgp_vpnv4_node
=
10832 "%s(config-router-af)# ",
10836 static struct cmd_node bgp_vpnv6_node
=
10839 "%s(config-router-af-vpnv6)# ",
10843 static struct cmd_node bgp_evpn_node
=
10846 "%s(config-router-evpn)# ",
10850 static void community_list_vty (void);
10853 bgp_ac_neighbor (vector comps
, struct cmd_token
*token
)
10857 struct peer_group
*group
;
10858 struct listnode
*lnbgp
, *lnpeer
;
10860 for (ALL_LIST_ELEMENTS_RO (bm
->bgp
, lnbgp
, bgp
))
10862 for (ALL_LIST_ELEMENTS_RO (bgp
->peer
, lnpeer
, peer
))
10864 /* only provide suggestions on the appropriate input token type,
10865 * they'll otherwise show up multiple times */
10866 enum cmd_token_type match_type
;
10867 char *name
= peer
->host
;
10871 match_type
= VARIABLE_TKN
;
10872 name
= peer
->conf_if
;
10874 else if (strchr(peer
->host
, ':'))
10875 match_type
= IPV6_TKN
;
10877 match_type
= IPV4_TKN
;
10879 if (token
->type
!= match_type
)
10882 vector_set(comps
, XSTRDUP(MTYPE_COMPLETION
, name
));
10885 if (token
->type
== VARIABLE_TKN
)
10886 for (ALL_LIST_ELEMENTS_RO (bgp
->group
, lnpeer
, group
))
10887 vector_set(comps
, XSTRDUP(MTYPE_COMPLETION
, group
->name
));
10891 static const struct cmd_variable_handler bgp_var_neighbor
[] = {
10893 .varname
= "neighbor",
10894 .completions
= bgp_ac_neighbor
10896 .varname
= "neighbors",
10897 .completions
= bgp_ac_neighbor
10899 .completions
= NULL
10904 bgp_vty_init (void)
10906 cmd_variable_handler_register(bgp_var_neighbor
);
10908 /* Install bgp top node. */
10909 install_node (&bgp_node
, bgp_config_write
);
10910 install_node (&bgp_ipv4_unicast_node
, NULL
);
10911 install_node (&bgp_ipv4_multicast_node
, NULL
);
10912 install_node (&bgp_ipv4_labeled_unicast_node
, NULL
);
10913 install_node (&bgp_ipv6_unicast_node
, NULL
);
10914 install_node (&bgp_ipv6_multicast_node
, NULL
);
10915 install_node (&bgp_ipv6_labeled_unicast_node
, NULL
);
10916 install_node (&bgp_vpnv4_node
, NULL
);
10917 install_node (&bgp_vpnv6_node
, NULL
);
10918 install_node (&bgp_evpn_node
, NULL
);
10920 /* Install default VTY commands to new nodes. */
10921 install_default (BGP_NODE
);
10922 install_default (BGP_IPV4_NODE
);
10923 install_default (BGP_IPV4M_NODE
);
10924 install_default (BGP_IPV4L_NODE
);
10925 install_default (BGP_IPV6_NODE
);
10926 install_default (BGP_IPV6M_NODE
);
10927 install_default (BGP_IPV6L_NODE
);
10928 install_default (BGP_VPNV4_NODE
);
10929 install_default (BGP_VPNV6_NODE
);
10930 install_default (BGP_EVPN_NODE
);
10932 /* "bgp multiple-instance" commands. */
10933 install_element (CONFIG_NODE
, &bgp_multiple_instance_cmd
);
10934 install_element (CONFIG_NODE
, &no_bgp_multiple_instance_cmd
);
10936 /* "bgp config-type" commands. */
10937 install_element (CONFIG_NODE
, &bgp_config_type_cmd
);
10938 install_element (CONFIG_NODE
, &no_bgp_config_type_cmd
);
10940 /* bgp route-map delay-timer commands. */
10941 install_element (CONFIG_NODE
, &bgp_set_route_map_delay_timer_cmd
);
10942 install_element (CONFIG_NODE
, &no_bgp_set_route_map_delay_timer_cmd
);
10944 /* Dummy commands (Currently not supported) */
10945 install_element (BGP_NODE
, &no_synchronization_cmd
);
10946 install_element (BGP_NODE
, &no_auto_summary_cmd
);
10948 /* "router bgp" commands. */
10949 install_element (CONFIG_NODE
, &router_bgp_cmd
);
10951 /* "no router bgp" commands. */
10952 install_element (CONFIG_NODE
, &no_router_bgp_cmd
);
10954 /* "bgp router-id" commands. */
10955 install_element (BGP_NODE
, &bgp_router_id_cmd
);
10956 install_element (BGP_NODE
, &no_bgp_router_id_cmd
);
10958 /* "bgp cluster-id" commands. */
10959 install_element (BGP_NODE
, &bgp_cluster_id_cmd
);
10960 install_element (BGP_NODE
, &no_bgp_cluster_id_cmd
);
10962 /* "bgp confederation" commands. */
10963 install_element (BGP_NODE
, &bgp_confederation_identifier_cmd
);
10964 install_element (BGP_NODE
, &no_bgp_confederation_identifier_cmd
);
10966 /* "bgp confederation peers" commands. */
10967 install_element (BGP_NODE
, &bgp_confederation_peers_cmd
);
10968 install_element (BGP_NODE
, &no_bgp_confederation_peers_cmd
);
10970 /* bgp max-med command */
10971 install_element (BGP_NODE
, &bgp_maxmed_admin_cmd
);
10972 install_element (BGP_NODE
, &no_bgp_maxmed_admin_cmd
);
10973 install_element (BGP_NODE
, &bgp_maxmed_admin_medv_cmd
);
10974 install_element (BGP_NODE
, &bgp_maxmed_onstartup_cmd
);
10975 install_element (BGP_NODE
, &no_bgp_maxmed_onstartup_cmd
);
10977 /* bgp disable-ebgp-connected-nh-check */
10978 install_element (BGP_NODE
, &bgp_disable_connected_route_check_cmd
);
10979 install_element (BGP_NODE
, &no_bgp_disable_connected_route_check_cmd
);
10981 /* bgp update-delay command */
10982 install_element (BGP_NODE
, &bgp_update_delay_cmd
);
10983 install_element (BGP_NODE
, &no_bgp_update_delay_cmd
);
10984 install_element (BGP_NODE
, &bgp_update_delay_establish_wait_cmd
);
10986 install_element (BGP_NODE
, &bgp_wpkt_quanta_cmd
);
10987 install_element (BGP_NODE
, &no_bgp_wpkt_quanta_cmd
);
10989 install_element (BGP_NODE
, &bgp_coalesce_time_cmd
);
10990 install_element (BGP_NODE
, &no_bgp_coalesce_time_cmd
);
10992 /* "maximum-paths" commands. */
10993 install_element (BGP_NODE
, &bgp_maxpaths_hidden_cmd
);
10994 install_element (BGP_NODE
, &no_bgp_maxpaths_hidden_cmd
);
10995 install_element (BGP_IPV4_NODE
, &bgp_maxpaths_cmd
);
10996 install_element (BGP_IPV4_NODE
, &no_bgp_maxpaths_cmd
);
10997 install_element (BGP_IPV6_NODE
, &bgp_maxpaths_cmd
);
10998 install_element (BGP_IPV6_NODE
, &no_bgp_maxpaths_cmd
);
10999 install_element (BGP_NODE
, &bgp_maxpaths_ibgp_hidden_cmd
);
11000 install_element (BGP_NODE
, &bgp_maxpaths_ibgp_cluster_hidden_cmd
);
11001 install_element (BGP_NODE
, &no_bgp_maxpaths_ibgp_hidden_cmd
);
11002 install_element (BGP_IPV4_NODE
, &bgp_maxpaths_ibgp_cmd
);
11003 install_element (BGP_IPV4_NODE
, &bgp_maxpaths_ibgp_cluster_cmd
);
11004 install_element (BGP_IPV4_NODE
, &no_bgp_maxpaths_ibgp_cmd
);
11005 install_element (BGP_IPV6_NODE
, &bgp_maxpaths_ibgp_cmd
);
11006 install_element (BGP_IPV6_NODE
, &bgp_maxpaths_ibgp_cluster_cmd
);
11007 install_element (BGP_IPV6_NODE
, &no_bgp_maxpaths_ibgp_cmd
);
11009 install_element (BGP_IPV4L_NODE
, &bgp_maxpaths_cmd
);
11010 install_element (BGP_IPV4L_NODE
, &no_bgp_maxpaths_cmd
);
11011 install_element (BGP_IPV6L_NODE
, &bgp_maxpaths_cmd
);
11012 install_element (BGP_IPV6L_NODE
, &no_bgp_maxpaths_cmd
);
11014 install_element (BGP_IPV4L_NODE
, &bgp_maxpaths_ibgp_cmd
);
11015 install_element (BGP_IPV4L_NODE
, &bgp_maxpaths_ibgp_cluster_cmd
);
11016 install_element (BGP_IPV4L_NODE
, &no_bgp_maxpaths_ibgp_cmd
);
11017 install_element (BGP_IPV6L_NODE
, &bgp_maxpaths_ibgp_cmd
);
11018 install_element (BGP_IPV6L_NODE
, &bgp_maxpaths_ibgp_cluster_cmd
);
11019 install_element (BGP_IPV6L_NODE
, &no_bgp_maxpaths_ibgp_cmd
);
11021 /* "timers bgp" commands. */
11022 install_element (BGP_NODE
, &bgp_timers_cmd
);
11023 install_element (BGP_NODE
, &no_bgp_timers_cmd
);
11025 /* route-map delay-timer commands - per instance for backwards compat. */
11026 install_element (BGP_NODE
, &bgp_set_route_map_delay_timer_cmd
);
11027 install_element (BGP_NODE
, &no_bgp_set_route_map_delay_timer_cmd
);
11029 /* "bgp client-to-client reflection" commands */
11030 install_element (BGP_NODE
, &no_bgp_client_to_client_reflection_cmd
);
11031 install_element (BGP_NODE
, &bgp_client_to_client_reflection_cmd
);
11033 /* "bgp always-compare-med" commands */
11034 install_element (BGP_NODE
, &bgp_always_compare_med_cmd
);
11035 install_element (BGP_NODE
, &no_bgp_always_compare_med_cmd
);
11037 /* "bgp deterministic-med" commands */
11038 install_element (BGP_NODE
, &bgp_deterministic_med_cmd
);
11039 install_element (BGP_NODE
, &no_bgp_deterministic_med_cmd
);
11041 /* "bgp graceful-restart" commands */
11042 install_element (BGP_NODE
, &bgp_graceful_restart_cmd
);
11043 install_element (BGP_NODE
, &no_bgp_graceful_restart_cmd
);
11044 install_element (BGP_NODE
, &bgp_graceful_restart_stalepath_time_cmd
);
11045 install_element (BGP_NODE
, &no_bgp_graceful_restart_stalepath_time_cmd
);
11046 install_element (BGP_NODE
, &bgp_graceful_restart_restart_time_cmd
);
11047 install_element (BGP_NODE
, &no_bgp_graceful_restart_restart_time_cmd
);
11049 install_element (BGP_NODE
, &bgp_graceful_restart_preserve_fw_cmd
);
11050 install_element (BGP_NODE
, &no_bgp_graceful_restart_preserve_fw_cmd
);
11052 /* "bgp fast-external-failover" commands */
11053 install_element (BGP_NODE
, &bgp_fast_external_failover_cmd
);
11054 install_element (BGP_NODE
, &no_bgp_fast_external_failover_cmd
);
11056 /* "bgp enforce-first-as" commands */
11057 install_element (BGP_NODE
, &bgp_enforce_first_as_cmd
);
11058 install_element (BGP_NODE
, &no_bgp_enforce_first_as_cmd
);
11060 /* "bgp bestpath compare-routerid" commands */
11061 install_element (BGP_NODE
, &bgp_bestpath_compare_router_id_cmd
);
11062 install_element (BGP_NODE
, &no_bgp_bestpath_compare_router_id_cmd
);
11064 /* "bgp bestpath as-path ignore" commands */
11065 install_element (BGP_NODE
, &bgp_bestpath_aspath_ignore_cmd
);
11066 install_element (BGP_NODE
, &no_bgp_bestpath_aspath_ignore_cmd
);
11068 /* "bgp bestpath as-path confed" commands */
11069 install_element (BGP_NODE
, &bgp_bestpath_aspath_confed_cmd
);
11070 install_element (BGP_NODE
, &no_bgp_bestpath_aspath_confed_cmd
);
11072 /* "bgp bestpath as-path multipath-relax" commands */
11073 install_element (BGP_NODE
, &bgp_bestpath_aspath_multipath_relax_cmd
);
11074 install_element (BGP_NODE
, &no_bgp_bestpath_aspath_multipath_relax_cmd
);
11076 /* "bgp log-neighbor-changes" commands */
11077 install_element (BGP_NODE
, &bgp_log_neighbor_changes_cmd
);
11078 install_element (BGP_NODE
, &no_bgp_log_neighbor_changes_cmd
);
11080 /* "bgp bestpath med" commands */
11081 install_element (BGP_NODE
, &bgp_bestpath_med_cmd
);
11082 install_element (BGP_NODE
, &no_bgp_bestpath_med_cmd
);
11084 /* "no bgp default ipv4-unicast" commands. */
11085 install_element (BGP_NODE
, &no_bgp_default_ipv4_unicast_cmd
);
11086 install_element (BGP_NODE
, &bgp_default_ipv4_unicast_cmd
);
11088 /* "bgp network import-check" commands. */
11089 install_element (BGP_NODE
, &bgp_network_import_check_cmd
);
11090 install_element (BGP_NODE
, &bgp_network_import_check_exact_cmd
);
11091 install_element (BGP_NODE
, &no_bgp_network_import_check_cmd
);
11093 /* "bgp default local-preference" commands. */
11094 install_element (BGP_NODE
, &bgp_default_local_preference_cmd
);
11095 install_element (BGP_NODE
, &no_bgp_default_local_preference_cmd
);
11097 /* bgp default show-hostname */
11098 install_element (BGP_NODE
, &bgp_default_show_hostname_cmd
);
11099 install_element (BGP_NODE
, &no_bgp_default_show_hostname_cmd
);
11101 /* "bgp default subgroup-pkt-queue-max" commands. */
11102 install_element (BGP_NODE
, &bgp_default_subgroup_pkt_queue_max_cmd
);
11103 install_element (BGP_NODE
, &no_bgp_default_subgroup_pkt_queue_max_cmd
);
11105 /* bgp ibgp-allow-policy-mods command */
11106 install_element (BGP_NODE
, &bgp_rr_allow_outbound_policy_cmd
);
11107 install_element (BGP_NODE
, &no_bgp_rr_allow_outbound_policy_cmd
);
11109 /* "bgp listen limit" commands. */
11110 install_element (BGP_NODE
, &bgp_listen_limit_cmd
);
11111 install_element (BGP_NODE
, &no_bgp_listen_limit_cmd
);
11113 /* "bgp listen range" commands. */
11114 install_element (BGP_NODE
, &bgp_listen_range_cmd
);
11115 install_element (BGP_NODE
, &no_bgp_listen_range_cmd
);
11117 /* "neighbor remote-as" commands. */
11118 install_element (BGP_NODE
, &neighbor_remote_as_cmd
);
11119 install_element (BGP_NODE
, &neighbor_interface_config_cmd
);
11120 install_element (BGP_NODE
, &neighbor_interface_config_v6only_cmd
);
11121 install_element (BGP_NODE
, &neighbor_interface_config_remote_as_cmd
);
11122 install_element (BGP_NODE
, &neighbor_interface_v6only_config_remote_as_cmd
);
11123 install_element (BGP_NODE
, &no_neighbor_cmd
);
11124 install_element (BGP_NODE
, &no_neighbor_interface_config_cmd
);
11126 /* "neighbor peer-group" commands. */
11127 install_element (BGP_NODE
, &neighbor_peer_group_cmd
);
11128 install_element (BGP_NODE
, &no_neighbor_peer_group_cmd
);
11129 install_element (BGP_NODE
, &no_neighbor_interface_peer_group_remote_as_cmd
);
11131 /* "neighbor local-as" commands. */
11132 install_element (BGP_NODE
, &neighbor_local_as_cmd
);
11133 install_element (BGP_NODE
, &neighbor_local_as_no_prepend_cmd
);
11134 install_element (BGP_NODE
, &neighbor_local_as_no_prepend_replace_as_cmd
);
11135 install_element (BGP_NODE
, &no_neighbor_local_as_cmd
);
11137 /* "neighbor solo" commands. */
11138 install_element (BGP_NODE
, &neighbor_solo_cmd
);
11139 install_element (BGP_NODE
, &no_neighbor_solo_cmd
);
11141 /* "neighbor password" commands. */
11142 install_element (BGP_NODE
, &neighbor_password_cmd
);
11143 install_element (BGP_NODE
, &no_neighbor_password_cmd
);
11145 /* "neighbor activate" commands. */
11146 install_element (BGP_NODE
, &neighbor_activate_hidden_cmd
);
11147 install_element (BGP_IPV4_NODE
, &neighbor_activate_cmd
);
11148 install_element (BGP_IPV4M_NODE
, &neighbor_activate_cmd
);
11149 install_element (BGP_IPV4L_NODE
, &neighbor_activate_cmd
);
11150 install_element (BGP_IPV6_NODE
, &neighbor_activate_cmd
);
11151 install_element (BGP_IPV6M_NODE
, &neighbor_activate_cmd
);
11152 install_element (BGP_IPV6L_NODE
, &neighbor_activate_cmd
);
11153 install_element (BGP_VPNV4_NODE
, &neighbor_activate_cmd
);
11154 install_element (BGP_VPNV6_NODE
, &neighbor_activate_cmd
);
11155 install_element (BGP_EVPN_NODE
, &neighbor_activate_cmd
);
11157 /* "no neighbor activate" commands. */
11158 install_element (BGP_NODE
, &no_neighbor_activate_hidden_cmd
);
11159 install_element (BGP_IPV4_NODE
, &no_neighbor_activate_cmd
);
11160 install_element (BGP_IPV4M_NODE
, &no_neighbor_activate_cmd
);
11161 install_element (BGP_IPV4L_NODE
, &no_neighbor_activate_cmd
);
11162 install_element (BGP_IPV6_NODE
, &no_neighbor_activate_cmd
);
11163 install_element (BGP_IPV6M_NODE
, &no_neighbor_activate_cmd
);
11164 install_element (BGP_IPV6L_NODE
, &no_neighbor_activate_cmd
);
11165 install_element (BGP_VPNV4_NODE
, &no_neighbor_activate_cmd
);
11166 install_element (BGP_VPNV6_NODE
, &no_neighbor_activate_cmd
);
11167 install_element (BGP_EVPN_NODE
, &no_neighbor_activate_cmd
);
11169 /* "neighbor peer-group" set commands. */
11170 install_element (BGP_NODE
, &neighbor_set_peer_group_cmd
);
11171 install_element (BGP_IPV4_NODE
, &neighbor_set_peer_group_hidden_cmd
);
11172 install_element (BGP_IPV4M_NODE
, &neighbor_set_peer_group_hidden_cmd
);
11173 install_element (BGP_IPV4L_NODE
, &neighbor_set_peer_group_hidden_cmd
);
11174 install_element (BGP_IPV6_NODE
, &neighbor_set_peer_group_hidden_cmd
);
11175 install_element (BGP_IPV6M_NODE
, &neighbor_set_peer_group_hidden_cmd
);
11176 install_element (BGP_IPV6L_NODE
, &neighbor_set_peer_group_hidden_cmd
);
11177 install_element (BGP_VPNV4_NODE
, &neighbor_set_peer_group_hidden_cmd
);
11178 install_element (BGP_VPNV6_NODE
, &neighbor_set_peer_group_hidden_cmd
);
11180 /* "no neighbor peer-group unset" commands. */
11181 install_element (BGP_NODE
, &no_neighbor_set_peer_group_cmd
);
11182 install_element (BGP_IPV4_NODE
, &no_neighbor_set_peer_group_hidden_cmd
);
11183 install_element (BGP_IPV4M_NODE
, &no_neighbor_set_peer_group_hidden_cmd
);
11184 install_element (BGP_IPV4L_NODE
, &no_neighbor_set_peer_group_hidden_cmd
);
11185 install_element (BGP_IPV6_NODE
, &no_neighbor_set_peer_group_hidden_cmd
);
11186 install_element (BGP_IPV6M_NODE
, &no_neighbor_set_peer_group_hidden_cmd
);
11187 install_element (BGP_IPV6L_NODE
, &no_neighbor_set_peer_group_hidden_cmd
);
11188 install_element (BGP_VPNV4_NODE
, &no_neighbor_set_peer_group_hidden_cmd
);
11189 install_element (BGP_VPNV6_NODE
, &no_neighbor_set_peer_group_hidden_cmd
);
11191 /* "neighbor softreconfiguration inbound" commands.*/
11192 install_element (BGP_NODE
, &neighbor_soft_reconfiguration_hidden_cmd
);
11193 install_element (BGP_NODE
, &no_neighbor_soft_reconfiguration_hidden_cmd
);
11194 install_element (BGP_IPV4_NODE
, &neighbor_soft_reconfiguration_cmd
);
11195 install_element (BGP_IPV4_NODE
, &no_neighbor_soft_reconfiguration_cmd
);
11196 install_element (BGP_IPV4L_NODE
, &neighbor_soft_reconfiguration_cmd
);
11197 install_element (BGP_IPV4L_NODE
, &no_neighbor_soft_reconfiguration_cmd
);
11198 install_element (BGP_IPV4M_NODE
, &neighbor_soft_reconfiguration_cmd
);
11199 install_element (BGP_IPV4M_NODE
, &no_neighbor_soft_reconfiguration_cmd
);
11200 install_element (BGP_IPV6_NODE
, &neighbor_soft_reconfiguration_cmd
);
11201 install_element (BGP_IPV6_NODE
, &no_neighbor_soft_reconfiguration_cmd
);
11202 install_element (BGP_IPV6M_NODE
, &neighbor_soft_reconfiguration_cmd
);
11203 install_element (BGP_IPV6M_NODE
, &no_neighbor_soft_reconfiguration_cmd
);
11204 install_element (BGP_IPV6L_NODE
, &neighbor_soft_reconfiguration_cmd
);
11205 install_element (BGP_IPV6L_NODE
, &no_neighbor_soft_reconfiguration_cmd
);
11206 install_element (BGP_VPNV4_NODE
, &neighbor_soft_reconfiguration_cmd
);
11207 install_element (BGP_VPNV4_NODE
, &no_neighbor_soft_reconfiguration_cmd
);
11208 install_element (BGP_VPNV6_NODE
, &neighbor_soft_reconfiguration_cmd
);
11209 install_element (BGP_VPNV6_NODE
, &no_neighbor_soft_reconfiguration_cmd
);
11211 /* "neighbor attribute-unchanged" commands. */
11212 install_element (BGP_NODE
, &neighbor_attr_unchanged_hidden_cmd
);
11213 install_element (BGP_NODE
, &no_neighbor_attr_unchanged_hidden_cmd
);
11214 install_element (BGP_IPV4_NODE
, &neighbor_attr_unchanged_cmd
);
11215 install_element (BGP_IPV4_NODE
, &no_neighbor_attr_unchanged_cmd
);
11216 install_element (BGP_IPV4M_NODE
, &neighbor_attr_unchanged_cmd
);
11217 install_element (BGP_IPV4M_NODE
, &no_neighbor_attr_unchanged_cmd
);
11218 install_element (BGP_IPV4L_NODE
, &neighbor_attr_unchanged_cmd
);
11219 install_element (BGP_IPV4L_NODE
, &no_neighbor_attr_unchanged_cmd
);
11220 install_element (BGP_IPV6_NODE
, &neighbor_attr_unchanged_cmd
);
11221 install_element (BGP_IPV6_NODE
, &no_neighbor_attr_unchanged_cmd
);
11222 install_element (BGP_IPV6M_NODE
, &neighbor_attr_unchanged_cmd
);
11223 install_element (BGP_IPV6M_NODE
, &no_neighbor_attr_unchanged_cmd
);
11224 install_element (BGP_IPV6L_NODE
, &neighbor_attr_unchanged_cmd
);
11225 install_element (BGP_IPV6L_NODE
, &no_neighbor_attr_unchanged_cmd
);
11226 install_element (BGP_VPNV4_NODE
, &neighbor_attr_unchanged_cmd
);
11227 install_element (BGP_VPNV4_NODE
, &no_neighbor_attr_unchanged_cmd
);
11228 install_element (BGP_VPNV6_NODE
, &neighbor_attr_unchanged_cmd
);
11229 install_element (BGP_VPNV6_NODE
, &no_neighbor_attr_unchanged_cmd
);
11231 install_element (BGP_EVPN_NODE
, &neighbor_attr_unchanged_cmd
);
11232 install_element (BGP_EVPN_NODE
, &no_neighbor_attr_unchanged_cmd
);
11234 /* "nexthop-local unchanged" commands */
11235 install_element (BGP_IPV6_NODE
, &neighbor_nexthop_local_unchanged_cmd
);
11236 install_element (BGP_IPV6_NODE
, &no_neighbor_nexthop_local_unchanged_cmd
);
11238 /* "neighbor next-hop-self" commands. */
11239 install_element (BGP_NODE
, &neighbor_nexthop_self_hidden_cmd
);
11240 install_element (BGP_NODE
, &no_neighbor_nexthop_self_hidden_cmd
);
11241 install_element (BGP_IPV4_NODE
, &neighbor_nexthop_self_cmd
);
11242 install_element (BGP_IPV4_NODE
, &no_neighbor_nexthop_self_cmd
);
11243 install_element (BGP_IPV4M_NODE
, &neighbor_nexthop_self_cmd
);
11244 install_element (BGP_IPV4M_NODE
, &no_neighbor_nexthop_self_cmd
);
11245 install_element (BGP_IPV4L_NODE
, &neighbor_nexthop_self_cmd
);
11246 install_element (BGP_IPV4L_NODE
, &no_neighbor_nexthop_self_cmd
);
11247 install_element (BGP_IPV6_NODE
, &neighbor_nexthop_self_cmd
);
11248 install_element (BGP_IPV6_NODE
, &no_neighbor_nexthop_self_cmd
);
11249 install_element (BGP_IPV6M_NODE
, &neighbor_nexthop_self_cmd
);
11250 install_element (BGP_IPV6M_NODE
, &no_neighbor_nexthop_self_cmd
);
11251 install_element (BGP_IPV6L_NODE
, &neighbor_nexthop_self_cmd
);
11252 install_element (BGP_IPV6L_NODE
, &no_neighbor_nexthop_self_cmd
);
11253 install_element (BGP_VPNV4_NODE
, &neighbor_nexthop_self_cmd
);
11254 install_element (BGP_VPNV4_NODE
, &no_neighbor_nexthop_self_cmd
);
11255 install_element (BGP_VPNV6_NODE
, &neighbor_nexthop_self_cmd
);
11256 install_element (BGP_VPNV6_NODE
, &no_neighbor_nexthop_self_cmd
);
11258 /* "neighbor next-hop-self force" commands. */
11259 install_element (BGP_NODE
, &neighbor_nexthop_self_force_hidden_cmd
);
11260 install_element (BGP_NODE
, &no_neighbor_nexthop_self_force_hidden_cmd
);
11261 install_element (BGP_IPV4_NODE
, &neighbor_nexthop_self_force_cmd
);
11262 install_element (BGP_IPV4_NODE
, &no_neighbor_nexthop_self_force_cmd
);
11263 install_element (BGP_IPV4M_NODE
, &neighbor_nexthop_self_force_cmd
);
11264 install_element (BGP_IPV4M_NODE
, &no_neighbor_nexthop_self_force_cmd
);
11265 install_element (BGP_IPV4L_NODE
, &neighbor_nexthop_self_force_cmd
);
11266 install_element (BGP_IPV4L_NODE
, &no_neighbor_nexthop_self_force_cmd
);
11267 install_element (BGP_IPV6_NODE
, &neighbor_nexthop_self_force_cmd
);
11268 install_element (BGP_IPV6_NODE
, &no_neighbor_nexthop_self_force_cmd
);
11269 install_element (BGP_IPV6M_NODE
, &neighbor_nexthop_self_force_cmd
);
11270 install_element (BGP_IPV6M_NODE
, &no_neighbor_nexthop_self_force_cmd
);
11271 install_element (BGP_IPV6L_NODE
, &neighbor_nexthop_self_force_cmd
);
11272 install_element (BGP_IPV6L_NODE
, &no_neighbor_nexthop_self_force_cmd
);
11273 install_element (BGP_VPNV4_NODE
, &neighbor_nexthop_self_force_cmd
);
11274 install_element (BGP_VPNV4_NODE
, &no_neighbor_nexthop_self_force_cmd
);
11275 install_element (BGP_VPNV6_NODE
, &neighbor_nexthop_self_force_cmd
);
11276 install_element (BGP_VPNV6_NODE
, &no_neighbor_nexthop_self_force_cmd
);
11278 /* "neighbor as-override" commands. */
11279 install_element (BGP_NODE
, &neighbor_as_override_hidden_cmd
);
11280 install_element (BGP_NODE
, &no_neighbor_as_override_hidden_cmd
);
11281 install_element (BGP_IPV4_NODE
, &neighbor_as_override_cmd
);
11282 install_element (BGP_IPV4_NODE
, &no_neighbor_as_override_cmd
);
11283 install_element (BGP_IPV4M_NODE
, &neighbor_as_override_cmd
);
11284 install_element (BGP_IPV4M_NODE
, &no_neighbor_as_override_cmd
);
11285 install_element (BGP_IPV4L_NODE
, &neighbor_as_override_cmd
);
11286 install_element (BGP_IPV4L_NODE
, &no_neighbor_as_override_cmd
);
11287 install_element (BGP_IPV6_NODE
, &neighbor_as_override_cmd
);
11288 install_element (BGP_IPV6_NODE
, &no_neighbor_as_override_cmd
);
11289 install_element (BGP_IPV6M_NODE
, &neighbor_as_override_cmd
);
11290 install_element (BGP_IPV6M_NODE
, &no_neighbor_as_override_cmd
);
11291 install_element (BGP_IPV6L_NODE
, &neighbor_as_override_cmd
);
11292 install_element (BGP_IPV6L_NODE
, &no_neighbor_as_override_cmd
);
11293 install_element (BGP_VPNV4_NODE
, &neighbor_as_override_cmd
);
11294 install_element (BGP_VPNV4_NODE
, &no_neighbor_as_override_cmd
);
11295 install_element (BGP_VPNV6_NODE
, &neighbor_as_override_cmd
);
11296 install_element (BGP_VPNV6_NODE
, &no_neighbor_as_override_cmd
);
11298 /* "neighbor remove-private-AS" commands. */
11299 install_element (BGP_NODE
, &neighbor_remove_private_as_hidden_cmd
);
11300 install_element (BGP_NODE
, &no_neighbor_remove_private_as_hidden_cmd
);
11301 install_element (BGP_NODE
, &neighbor_remove_private_as_all_hidden_cmd
);
11302 install_element (BGP_NODE
, &no_neighbor_remove_private_as_all_hidden_cmd
);
11303 install_element (BGP_NODE
, &neighbor_remove_private_as_replace_as_hidden_cmd
);
11304 install_element (BGP_NODE
, &no_neighbor_remove_private_as_replace_as_hidden_cmd
);
11305 install_element (BGP_NODE
, &neighbor_remove_private_as_all_replace_as_hidden_cmd
);
11306 install_element (BGP_NODE
, &no_neighbor_remove_private_as_all_replace_as_hidden_cmd
);
11307 install_element (BGP_IPV4_NODE
, &neighbor_remove_private_as_cmd
);
11308 install_element (BGP_IPV4_NODE
, &no_neighbor_remove_private_as_cmd
);
11309 install_element (BGP_IPV4_NODE
, &neighbor_remove_private_as_all_cmd
);
11310 install_element (BGP_IPV4_NODE
, &no_neighbor_remove_private_as_all_cmd
);
11311 install_element (BGP_IPV4_NODE
, &neighbor_remove_private_as_replace_as_cmd
);
11312 install_element (BGP_IPV4_NODE
, &no_neighbor_remove_private_as_replace_as_cmd
);
11313 install_element (BGP_IPV4_NODE
, &neighbor_remove_private_as_all_replace_as_cmd
);
11314 install_element (BGP_IPV4_NODE
, &no_neighbor_remove_private_as_all_replace_as_cmd
);
11315 install_element (BGP_IPV4M_NODE
, &neighbor_remove_private_as_cmd
);
11316 install_element (BGP_IPV4M_NODE
, &no_neighbor_remove_private_as_cmd
);
11317 install_element (BGP_IPV4M_NODE
, &neighbor_remove_private_as_all_cmd
);
11318 install_element (BGP_IPV4M_NODE
, &no_neighbor_remove_private_as_all_cmd
);
11319 install_element (BGP_IPV4M_NODE
, &neighbor_remove_private_as_replace_as_cmd
);
11320 install_element (BGP_IPV4M_NODE
, &no_neighbor_remove_private_as_replace_as_cmd
);
11321 install_element (BGP_IPV4M_NODE
, &neighbor_remove_private_as_all_replace_as_cmd
);
11322 install_element (BGP_IPV4M_NODE
, &no_neighbor_remove_private_as_all_replace_as_cmd
);
11323 install_element (BGP_IPV4L_NODE
, &neighbor_remove_private_as_cmd
);
11324 install_element (BGP_IPV4L_NODE
, &no_neighbor_remove_private_as_cmd
);
11325 install_element (BGP_IPV4L_NODE
, &neighbor_remove_private_as_all_cmd
);
11326 install_element (BGP_IPV4L_NODE
, &no_neighbor_remove_private_as_all_cmd
);
11327 install_element (BGP_IPV4L_NODE
, &neighbor_remove_private_as_replace_as_cmd
);
11328 install_element (BGP_IPV4L_NODE
, &no_neighbor_remove_private_as_replace_as_cmd
);
11329 install_element (BGP_IPV4L_NODE
, &neighbor_remove_private_as_all_replace_as_cmd
);
11330 install_element (BGP_IPV4L_NODE
, &no_neighbor_remove_private_as_all_replace_as_cmd
);
11331 install_element (BGP_IPV6_NODE
, &neighbor_remove_private_as_cmd
);
11332 install_element (BGP_IPV6_NODE
, &no_neighbor_remove_private_as_cmd
);
11333 install_element (BGP_IPV6_NODE
, &neighbor_remove_private_as_all_cmd
);
11334 install_element (BGP_IPV6_NODE
, &no_neighbor_remove_private_as_all_cmd
);
11335 install_element (BGP_IPV6_NODE
, &neighbor_remove_private_as_replace_as_cmd
);
11336 install_element (BGP_IPV6_NODE
, &no_neighbor_remove_private_as_replace_as_cmd
);
11337 install_element (BGP_IPV6_NODE
, &neighbor_remove_private_as_all_replace_as_cmd
);
11338 install_element (BGP_IPV6_NODE
, &no_neighbor_remove_private_as_all_replace_as_cmd
);
11339 install_element (BGP_IPV6M_NODE
, &neighbor_remove_private_as_cmd
);
11340 install_element (BGP_IPV6M_NODE
, &no_neighbor_remove_private_as_cmd
);
11341 install_element (BGP_IPV6M_NODE
, &neighbor_remove_private_as_all_cmd
);
11342 install_element (BGP_IPV6M_NODE
, &no_neighbor_remove_private_as_all_cmd
);
11343 install_element (BGP_IPV6M_NODE
, &neighbor_remove_private_as_replace_as_cmd
);
11344 install_element (BGP_IPV6M_NODE
, &no_neighbor_remove_private_as_replace_as_cmd
);
11345 install_element (BGP_IPV6M_NODE
, &neighbor_remove_private_as_all_replace_as_cmd
);
11346 install_element (BGP_IPV6M_NODE
, &no_neighbor_remove_private_as_all_replace_as_cmd
);
11347 install_element (BGP_IPV6L_NODE
, &neighbor_remove_private_as_cmd
);
11348 install_element (BGP_IPV6L_NODE
, &no_neighbor_remove_private_as_cmd
);
11349 install_element (BGP_IPV6L_NODE
, &neighbor_remove_private_as_all_cmd
);
11350 install_element (BGP_IPV6L_NODE
, &no_neighbor_remove_private_as_all_cmd
);
11351 install_element (BGP_IPV6L_NODE
, &neighbor_remove_private_as_replace_as_cmd
);
11352 install_element (BGP_IPV6L_NODE
, &no_neighbor_remove_private_as_replace_as_cmd
);
11353 install_element (BGP_IPV6L_NODE
, &neighbor_remove_private_as_all_replace_as_cmd
);
11354 install_element (BGP_IPV6L_NODE
, &no_neighbor_remove_private_as_all_replace_as_cmd
);
11355 install_element (BGP_VPNV4_NODE
, &neighbor_remove_private_as_cmd
);
11356 install_element (BGP_VPNV4_NODE
, &no_neighbor_remove_private_as_cmd
);
11357 install_element (BGP_VPNV4_NODE
, &neighbor_remove_private_as_all_cmd
);
11358 install_element (BGP_VPNV4_NODE
, &no_neighbor_remove_private_as_all_cmd
);
11359 install_element (BGP_VPNV4_NODE
, &neighbor_remove_private_as_replace_as_cmd
);
11360 install_element (BGP_VPNV4_NODE
, &no_neighbor_remove_private_as_replace_as_cmd
);
11361 install_element (BGP_VPNV4_NODE
, &neighbor_remove_private_as_all_replace_as_cmd
);
11362 install_element (BGP_VPNV4_NODE
, &no_neighbor_remove_private_as_all_replace_as_cmd
);
11363 install_element (BGP_VPNV6_NODE
, &neighbor_remove_private_as_cmd
);
11364 install_element (BGP_VPNV6_NODE
, &no_neighbor_remove_private_as_cmd
);
11365 install_element (BGP_VPNV6_NODE
, &neighbor_remove_private_as_all_cmd
);
11366 install_element (BGP_VPNV6_NODE
, &no_neighbor_remove_private_as_all_cmd
);
11367 install_element (BGP_VPNV6_NODE
, &neighbor_remove_private_as_replace_as_cmd
);
11368 install_element (BGP_VPNV6_NODE
, &no_neighbor_remove_private_as_replace_as_cmd
);
11369 install_element (BGP_VPNV6_NODE
, &neighbor_remove_private_as_all_replace_as_cmd
);
11370 install_element (BGP_VPNV6_NODE
, &no_neighbor_remove_private_as_all_replace_as_cmd
);
11372 /* "neighbor send-community" commands.*/
11373 install_element (BGP_NODE
, &neighbor_send_community_hidden_cmd
);
11374 install_element (BGP_NODE
, &neighbor_send_community_type_hidden_cmd
);
11375 install_element (BGP_NODE
, &no_neighbor_send_community_hidden_cmd
);
11376 install_element (BGP_NODE
, &no_neighbor_send_community_type_hidden_cmd
);
11377 install_element (BGP_IPV4_NODE
, &neighbor_send_community_cmd
);
11378 install_element (BGP_IPV4_NODE
, &neighbor_send_community_type_cmd
);
11379 install_element (BGP_IPV4_NODE
, &no_neighbor_send_community_cmd
);
11380 install_element (BGP_IPV4_NODE
, &no_neighbor_send_community_type_cmd
);
11381 install_element (BGP_IPV4M_NODE
, &neighbor_send_community_cmd
);
11382 install_element (BGP_IPV4M_NODE
, &neighbor_send_community_type_cmd
);
11383 install_element (BGP_IPV4M_NODE
, &no_neighbor_send_community_cmd
);
11384 install_element (BGP_IPV4M_NODE
, &no_neighbor_send_community_type_cmd
);
11385 install_element (BGP_IPV4L_NODE
, &neighbor_send_community_cmd
);
11386 install_element (BGP_IPV4L_NODE
, &neighbor_send_community_type_cmd
);
11387 install_element (BGP_IPV4L_NODE
, &no_neighbor_send_community_cmd
);
11388 install_element (BGP_IPV4L_NODE
, &no_neighbor_send_community_type_cmd
);
11389 install_element (BGP_IPV6_NODE
, &neighbor_send_community_cmd
);
11390 install_element (BGP_IPV6_NODE
, &neighbor_send_community_type_cmd
);
11391 install_element (BGP_IPV6_NODE
, &no_neighbor_send_community_cmd
);
11392 install_element (BGP_IPV6_NODE
, &no_neighbor_send_community_type_cmd
);
11393 install_element (BGP_IPV6M_NODE
, &neighbor_send_community_cmd
);
11394 install_element (BGP_IPV6M_NODE
, &neighbor_send_community_type_cmd
);
11395 install_element (BGP_IPV6M_NODE
, &no_neighbor_send_community_cmd
);
11396 install_element (BGP_IPV6M_NODE
, &no_neighbor_send_community_type_cmd
);
11397 install_element (BGP_IPV6L_NODE
, &neighbor_send_community_cmd
);
11398 install_element (BGP_IPV6L_NODE
, &neighbor_send_community_type_cmd
);
11399 install_element (BGP_IPV6L_NODE
, &no_neighbor_send_community_cmd
);
11400 install_element (BGP_IPV6L_NODE
, &no_neighbor_send_community_type_cmd
);
11401 install_element (BGP_VPNV4_NODE
, &neighbor_send_community_cmd
);
11402 install_element (BGP_VPNV4_NODE
, &neighbor_send_community_type_cmd
);
11403 install_element (BGP_VPNV4_NODE
, &no_neighbor_send_community_cmd
);
11404 install_element (BGP_VPNV4_NODE
, &no_neighbor_send_community_type_cmd
);
11405 install_element (BGP_VPNV6_NODE
, &neighbor_send_community_cmd
);
11406 install_element (BGP_VPNV6_NODE
, &neighbor_send_community_type_cmd
);
11407 install_element (BGP_VPNV6_NODE
, &no_neighbor_send_community_cmd
);
11408 install_element (BGP_VPNV6_NODE
, &no_neighbor_send_community_type_cmd
);
11410 /* "neighbor route-reflector" commands.*/
11411 install_element (BGP_NODE
, &neighbor_route_reflector_client_hidden_cmd
);
11412 install_element (BGP_NODE
, &no_neighbor_route_reflector_client_hidden_cmd
);
11413 install_element (BGP_IPV4_NODE
, &neighbor_route_reflector_client_cmd
);
11414 install_element (BGP_IPV4_NODE
, &no_neighbor_route_reflector_client_cmd
);
11415 install_element (BGP_IPV4M_NODE
, &neighbor_route_reflector_client_cmd
);
11416 install_element (BGP_IPV4M_NODE
, &no_neighbor_route_reflector_client_cmd
);
11417 install_element (BGP_IPV4L_NODE
, &neighbor_route_reflector_client_cmd
);
11418 install_element (BGP_IPV4L_NODE
, &no_neighbor_route_reflector_client_cmd
);
11419 install_element (BGP_IPV6_NODE
, &neighbor_route_reflector_client_cmd
);
11420 install_element (BGP_IPV6_NODE
, &no_neighbor_route_reflector_client_cmd
);
11421 install_element (BGP_IPV6M_NODE
, &neighbor_route_reflector_client_cmd
);
11422 install_element (BGP_IPV6M_NODE
, &no_neighbor_route_reflector_client_cmd
);
11423 install_element (BGP_IPV6L_NODE
, &neighbor_route_reflector_client_cmd
);
11424 install_element (BGP_IPV6L_NODE
, &no_neighbor_route_reflector_client_cmd
);
11425 install_element (BGP_VPNV4_NODE
, &neighbor_route_reflector_client_cmd
);
11426 install_element (BGP_VPNV4_NODE
, &no_neighbor_route_reflector_client_cmd
);
11427 install_element (BGP_VPNV6_NODE
, &neighbor_route_reflector_client_cmd
);
11428 install_element (BGP_VPNV6_NODE
, &no_neighbor_route_reflector_client_cmd
);
11430 /* "neighbor route-server" commands.*/
11431 install_element (BGP_NODE
, &neighbor_route_server_client_hidden_cmd
);
11432 install_element (BGP_NODE
, &no_neighbor_route_server_client_hidden_cmd
);
11433 install_element (BGP_IPV4_NODE
, &neighbor_route_server_client_cmd
);
11434 install_element (BGP_IPV4_NODE
, &no_neighbor_route_server_client_cmd
);
11435 install_element (BGP_IPV4M_NODE
, &neighbor_route_server_client_cmd
);
11436 install_element (BGP_IPV4M_NODE
, &no_neighbor_route_server_client_cmd
);
11437 install_element (BGP_IPV4L_NODE
, &neighbor_route_server_client_cmd
);
11438 install_element (BGP_IPV4L_NODE
, &no_neighbor_route_server_client_cmd
);
11439 install_element (BGP_IPV6_NODE
, &neighbor_route_server_client_cmd
);
11440 install_element (BGP_IPV6_NODE
, &no_neighbor_route_server_client_cmd
);
11441 install_element (BGP_IPV6M_NODE
, &neighbor_route_server_client_cmd
);
11442 install_element (BGP_IPV6M_NODE
, &no_neighbor_route_server_client_cmd
);
11443 install_element (BGP_IPV6L_NODE
, &neighbor_route_server_client_cmd
);
11444 install_element (BGP_IPV6L_NODE
, &no_neighbor_route_server_client_cmd
);
11445 install_element (BGP_VPNV4_NODE
, &neighbor_route_server_client_cmd
);
11446 install_element (BGP_VPNV4_NODE
, &no_neighbor_route_server_client_cmd
);
11447 install_element (BGP_VPNV6_NODE
, &neighbor_route_server_client_cmd
);
11448 install_element (BGP_VPNV6_NODE
, &no_neighbor_route_server_client_cmd
);
11450 /* "neighbor addpath-tx-all-paths" commands.*/
11451 install_element (BGP_NODE
, &neighbor_addpath_tx_all_paths_hidden_cmd
);
11452 install_element (BGP_NODE
, &no_neighbor_addpath_tx_all_paths_hidden_cmd
);
11453 install_element (BGP_IPV4_NODE
, &neighbor_addpath_tx_all_paths_cmd
);
11454 install_element (BGP_IPV4_NODE
, &no_neighbor_addpath_tx_all_paths_cmd
);
11455 install_element (BGP_IPV4M_NODE
, &neighbor_addpath_tx_all_paths_cmd
);
11456 install_element (BGP_IPV4M_NODE
, &no_neighbor_addpath_tx_all_paths_cmd
);
11457 install_element (BGP_IPV4L_NODE
, &neighbor_addpath_tx_all_paths_cmd
);
11458 install_element (BGP_IPV4L_NODE
, &no_neighbor_addpath_tx_all_paths_cmd
);
11459 install_element (BGP_IPV6_NODE
, &neighbor_addpath_tx_all_paths_cmd
);
11460 install_element (BGP_IPV6_NODE
, &no_neighbor_addpath_tx_all_paths_cmd
);
11461 install_element (BGP_IPV6M_NODE
, &neighbor_addpath_tx_all_paths_cmd
);
11462 install_element (BGP_IPV6M_NODE
, &no_neighbor_addpath_tx_all_paths_cmd
);
11463 install_element (BGP_IPV6L_NODE
, &neighbor_addpath_tx_all_paths_cmd
);
11464 install_element (BGP_IPV6L_NODE
, &no_neighbor_addpath_tx_all_paths_cmd
);
11465 install_element (BGP_VPNV4_NODE
, &neighbor_addpath_tx_all_paths_cmd
);
11466 install_element (BGP_VPNV4_NODE
, &no_neighbor_addpath_tx_all_paths_cmd
);
11467 install_element (BGP_VPNV6_NODE
, &neighbor_addpath_tx_all_paths_cmd
);
11468 install_element (BGP_VPNV6_NODE
, &no_neighbor_addpath_tx_all_paths_cmd
);
11470 /* "neighbor addpath-tx-bestpath-per-AS" commands.*/
11471 install_element (BGP_NODE
, &neighbor_addpath_tx_bestpath_per_as_hidden_cmd
);
11472 install_element (BGP_NODE
, &no_neighbor_addpath_tx_bestpath_per_as_hidden_cmd
);
11473 install_element (BGP_IPV4_NODE
, &neighbor_addpath_tx_bestpath_per_as_cmd
);
11474 install_element (BGP_IPV4_NODE
, &no_neighbor_addpath_tx_bestpath_per_as_cmd
);
11475 install_element (BGP_IPV4M_NODE
, &neighbor_addpath_tx_bestpath_per_as_cmd
);
11476 install_element (BGP_IPV4M_NODE
, &no_neighbor_addpath_tx_bestpath_per_as_cmd
);
11477 install_element (BGP_IPV4L_NODE
, &neighbor_addpath_tx_bestpath_per_as_cmd
);
11478 install_element (BGP_IPV4L_NODE
, &no_neighbor_addpath_tx_bestpath_per_as_cmd
);
11479 install_element (BGP_IPV6_NODE
, &neighbor_addpath_tx_bestpath_per_as_cmd
);
11480 install_element (BGP_IPV6_NODE
, &no_neighbor_addpath_tx_bestpath_per_as_cmd
);
11481 install_element (BGP_IPV6M_NODE
, &neighbor_addpath_tx_bestpath_per_as_cmd
);
11482 install_element (BGP_IPV6M_NODE
, &no_neighbor_addpath_tx_bestpath_per_as_cmd
);
11483 install_element (BGP_IPV6L_NODE
, &neighbor_addpath_tx_bestpath_per_as_cmd
);
11484 install_element (BGP_IPV6L_NODE
, &no_neighbor_addpath_tx_bestpath_per_as_cmd
);
11485 install_element (BGP_VPNV4_NODE
, &neighbor_addpath_tx_bestpath_per_as_cmd
);
11486 install_element (BGP_VPNV4_NODE
, &no_neighbor_addpath_tx_bestpath_per_as_cmd
);
11487 install_element (BGP_VPNV6_NODE
, &neighbor_addpath_tx_bestpath_per_as_cmd
);
11488 install_element (BGP_VPNV6_NODE
, &no_neighbor_addpath_tx_bestpath_per_as_cmd
);
11490 /* "neighbor passive" commands. */
11491 install_element (BGP_NODE
, &neighbor_passive_cmd
);
11492 install_element (BGP_NODE
, &no_neighbor_passive_cmd
);
11495 /* "neighbor shutdown" commands. */
11496 install_element (BGP_NODE
, &neighbor_shutdown_cmd
);
11497 install_element (BGP_NODE
, &no_neighbor_shutdown_cmd
);
11498 install_element (BGP_NODE
, &neighbor_shutdown_msg_cmd
);
11499 install_element (BGP_NODE
, &no_neighbor_shutdown_msg_cmd
);
11501 /* "neighbor capability extended-nexthop" commands.*/
11502 install_element (BGP_NODE
, &neighbor_capability_enhe_cmd
);
11503 install_element (BGP_NODE
, &no_neighbor_capability_enhe_cmd
);
11505 /* "neighbor capability orf prefix-list" commands.*/
11506 install_element (BGP_NODE
, &neighbor_capability_orf_prefix_hidden_cmd
);
11507 install_element (BGP_NODE
, &no_neighbor_capability_orf_prefix_hidden_cmd
);
11508 install_element (BGP_IPV4_NODE
, &neighbor_capability_orf_prefix_cmd
);
11509 install_element (BGP_IPV4_NODE
, &no_neighbor_capability_orf_prefix_cmd
);
11510 install_element (BGP_IPV4M_NODE
, &neighbor_capability_orf_prefix_cmd
);
11511 install_element (BGP_IPV4M_NODE
, &no_neighbor_capability_orf_prefix_cmd
);
11512 install_element (BGP_IPV4L_NODE
, &neighbor_capability_orf_prefix_cmd
);
11513 install_element (BGP_IPV4L_NODE
, &no_neighbor_capability_orf_prefix_cmd
);
11514 install_element (BGP_IPV6_NODE
, &neighbor_capability_orf_prefix_cmd
);
11515 install_element (BGP_IPV6_NODE
, &no_neighbor_capability_orf_prefix_cmd
);
11516 install_element (BGP_IPV6M_NODE
, &neighbor_capability_orf_prefix_cmd
);
11517 install_element (BGP_IPV6M_NODE
, &no_neighbor_capability_orf_prefix_cmd
);
11518 install_element (BGP_IPV6L_NODE
, &neighbor_capability_orf_prefix_cmd
);
11519 install_element (BGP_IPV6L_NODE
, &no_neighbor_capability_orf_prefix_cmd
);
11521 /* "neighbor capability dynamic" commands.*/
11522 install_element (BGP_NODE
, &neighbor_capability_dynamic_cmd
);
11523 install_element (BGP_NODE
, &no_neighbor_capability_dynamic_cmd
);
11525 /* "neighbor dont-capability-negotiate" commands. */
11526 install_element (BGP_NODE
, &neighbor_dont_capability_negotiate_cmd
);
11527 install_element (BGP_NODE
, &no_neighbor_dont_capability_negotiate_cmd
);
11529 /* "neighbor ebgp-multihop" commands. */
11530 install_element (BGP_NODE
, &neighbor_ebgp_multihop_cmd
);
11531 install_element (BGP_NODE
, &neighbor_ebgp_multihop_ttl_cmd
);
11532 install_element (BGP_NODE
, &no_neighbor_ebgp_multihop_cmd
);
11534 /* "neighbor disable-connected-check" commands. */
11535 install_element (BGP_NODE
, &neighbor_disable_connected_check_cmd
);
11536 install_element (BGP_NODE
, &no_neighbor_disable_connected_check_cmd
);
11538 /* "neighbor description" commands. */
11539 install_element (BGP_NODE
, &neighbor_description_cmd
);
11540 install_element (BGP_NODE
, &no_neighbor_description_cmd
);
11542 /* "neighbor update-source" commands. "*/
11543 install_element (BGP_NODE
, &neighbor_update_source_cmd
);
11544 install_element (BGP_NODE
, &no_neighbor_update_source_cmd
);
11546 /* "neighbor default-originate" commands. */
11547 install_element (BGP_NODE
, &neighbor_default_originate_hidden_cmd
);
11548 install_element (BGP_NODE
, &neighbor_default_originate_rmap_hidden_cmd
);
11549 install_element (BGP_NODE
, &no_neighbor_default_originate_hidden_cmd
);
11550 install_element (BGP_IPV4_NODE
, &neighbor_default_originate_cmd
);
11551 install_element (BGP_IPV4_NODE
, &neighbor_default_originate_rmap_cmd
);
11552 install_element (BGP_IPV4_NODE
, &no_neighbor_default_originate_cmd
);
11553 install_element (BGP_IPV4M_NODE
, &neighbor_default_originate_cmd
);
11554 install_element (BGP_IPV4M_NODE
, &neighbor_default_originate_rmap_cmd
);
11555 install_element (BGP_IPV4M_NODE
, &no_neighbor_default_originate_cmd
);
11556 install_element (BGP_IPV4L_NODE
, &neighbor_default_originate_cmd
);
11557 install_element (BGP_IPV4L_NODE
, &neighbor_default_originate_rmap_cmd
);
11558 install_element (BGP_IPV4L_NODE
, &no_neighbor_default_originate_cmd
);
11559 install_element (BGP_IPV6_NODE
, &neighbor_default_originate_cmd
);
11560 install_element (BGP_IPV6_NODE
, &neighbor_default_originate_rmap_cmd
);
11561 install_element (BGP_IPV6_NODE
, &no_neighbor_default_originate_cmd
);
11562 install_element (BGP_IPV6M_NODE
, &neighbor_default_originate_cmd
);
11563 install_element (BGP_IPV6M_NODE
, &neighbor_default_originate_rmap_cmd
);
11564 install_element (BGP_IPV6M_NODE
, &no_neighbor_default_originate_cmd
);
11565 install_element (BGP_IPV6L_NODE
, &neighbor_default_originate_cmd
);
11566 install_element (BGP_IPV6L_NODE
, &neighbor_default_originate_rmap_cmd
);
11567 install_element (BGP_IPV6L_NODE
, &no_neighbor_default_originate_cmd
);
11569 /* "neighbor port" commands. */
11570 install_element (BGP_NODE
, &neighbor_port_cmd
);
11571 install_element (BGP_NODE
, &no_neighbor_port_cmd
);
11573 /* "neighbor weight" commands. */
11574 install_element (BGP_NODE
, &neighbor_weight_hidden_cmd
);
11575 install_element (BGP_NODE
, &no_neighbor_weight_hidden_cmd
);
11577 install_element (BGP_IPV4_NODE
, &neighbor_weight_cmd
);
11578 install_element (BGP_IPV4_NODE
, &no_neighbor_weight_cmd
);
11579 install_element (BGP_IPV4M_NODE
, &neighbor_weight_cmd
);
11580 install_element (BGP_IPV4M_NODE
, &no_neighbor_weight_cmd
);
11581 install_element (BGP_IPV4L_NODE
, &neighbor_weight_cmd
);
11582 install_element (BGP_IPV4L_NODE
, &no_neighbor_weight_cmd
);
11583 install_element (BGP_IPV6_NODE
, &neighbor_weight_cmd
);
11584 install_element (BGP_IPV6_NODE
, &no_neighbor_weight_cmd
);
11585 install_element (BGP_IPV6M_NODE
, &neighbor_weight_cmd
);
11586 install_element (BGP_IPV6M_NODE
, &no_neighbor_weight_cmd
);
11587 install_element (BGP_IPV6L_NODE
, &neighbor_weight_cmd
);
11588 install_element (BGP_IPV6L_NODE
, &no_neighbor_weight_cmd
);
11589 install_element (BGP_VPNV4_NODE
, &neighbor_weight_cmd
);
11590 install_element (BGP_VPNV4_NODE
, &no_neighbor_weight_cmd
);
11591 install_element (BGP_VPNV6_NODE
, &neighbor_weight_cmd
);
11592 install_element (BGP_VPNV6_NODE
, &no_neighbor_weight_cmd
);
11594 /* "neighbor override-capability" commands. */
11595 install_element (BGP_NODE
, &neighbor_override_capability_cmd
);
11596 install_element (BGP_NODE
, &no_neighbor_override_capability_cmd
);
11598 /* "neighbor strict-capability-match" commands. */
11599 install_element (BGP_NODE
, &neighbor_strict_capability_cmd
);
11600 install_element (BGP_NODE
, &no_neighbor_strict_capability_cmd
);
11602 /* "neighbor timers" commands. */
11603 install_element (BGP_NODE
, &neighbor_timers_cmd
);
11604 install_element (BGP_NODE
, &no_neighbor_timers_cmd
);
11606 /* "neighbor timers connect" commands. */
11607 install_element (BGP_NODE
, &neighbor_timers_connect_cmd
);
11608 install_element (BGP_NODE
, &no_neighbor_timers_connect_cmd
);
11610 /* "neighbor advertisement-interval" commands. */
11611 install_element (BGP_NODE
, &neighbor_advertise_interval_cmd
);
11612 install_element (BGP_NODE
, &no_neighbor_advertise_interval_cmd
);
11614 /* "neighbor interface" commands. */
11615 install_element (BGP_NODE
, &neighbor_interface_cmd
);
11616 install_element (BGP_NODE
, &no_neighbor_interface_cmd
);
11618 /* "neighbor distribute" commands. */
11619 install_element (BGP_NODE
, &neighbor_distribute_list_hidden_cmd
);
11620 install_element (BGP_NODE
, &no_neighbor_distribute_list_hidden_cmd
);
11621 install_element (BGP_IPV4_NODE
, &neighbor_distribute_list_cmd
);
11622 install_element (BGP_IPV4_NODE
, &no_neighbor_distribute_list_cmd
);
11623 install_element (BGP_IPV4M_NODE
, &neighbor_distribute_list_cmd
);
11624 install_element (BGP_IPV4M_NODE
, &no_neighbor_distribute_list_cmd
);
11625 install_element (BGP_IPV4L_NODE
, &neighbor_distribute_list_cmd
);
11626 install_element (BGP_IPV4L_NODE
, &no_neighbor_distribute_list_cmd
);
11627 install_element (BGP_IPV6_NODE
, &neighbor_distribute_list_cmd
);
11628 install_element (BGP_IPV6_NODE
, &no_neighbor_distribute_list_cmd
);
11629 install_element (BGP_IPV6M_NODE
, &neighbor_distribute_list_cmd
);
11630 install_element (BGP_IPV6M_NODE
, &no_neighbor_distribute_list_cmd
);
11631 install_element (BGP_IPV6L_NODE
, &neighbor_distribute_list_cmd
);
11632 install_element (BGP_IPV6L_NODE
, &no_neighbor_distribute_list_cmd
);
11633 install_element (BGP_VPNV4_NODE
, &neighbor_distribute_list_cmd
);
11634 install_element (BGP_VPNV4_NODE
, &no_neighbor_distribute_list_cmd
);
11635 install_element (BGP_VPNV6_NODE
, &neighbor_distribute_list_cmd
);
11636 install_element (BGP_VPNV6_NODE
, &no_neighbor_distribute_list_cmd
);
11638 /* "neighbor prefix-list" commands. */
11639 install_element (BGP_NODE
, &neighbor_prefix_list_hidden_cmd
);
11640 install_element (BGP_NODE
, &no_neighbor_prefix_list_hidden_cmd
);
11641 install_element (BGP_IPV4_NODE
, &neighbor_prefix_list_cmd
);
11642 install_element (BGP_IPV4_NODE
, &no_neighbor_prefix_list_cmd
);
11643 install_element (BGP_IPV4M_NODE
, &neighbor_prefix_list_cmd
);
11644 install_element (BGP_IPV4M_NODE
, &no_neighbor_prefix_list_cmd
);
11645 install_element (BGP_IPV4L_NODE
, &neighbor_prefix_list_cmd
);
11646 install_element (BGP_IPV4L_NODE
, &no_neighbor_prefix_list_cmd
);
11647 install_element (BGP_IPV6_NODE
, &neighbor_prefix_list_cmd
);
11648 install_element (BGP_IPV6_NODE
, &no_neighbor_prefix_list_cmd
);
11649 install_element (BGP_IPV6M_NODE
, &neighbor_prefix_list_cmd
);
11650 install_element (BGP_IPV6M_NODE
, &no_neighbor_prefix_list_cmd
);
11651 install_element (BGP_IPV6L_NODE
, &neighbor_prefix_list_cmd
);
11652 install_element (BGP_IPV6L_NODE
, &no_neighbor_prefix_list_cmd
);
11653 install_element (BGP_VPNV4_NODE
, &neighbor_prefix_list_cmd
);
11654 install_element (BGP_VPNV4_NODE
, &no_neighbor_prefix_list_cmd
);
11655 install_element (BGP_VPNV6_NODE
, &neighbor_prefix_list_cmd
);
11656 install_element (BGP_VPNV6_NODE
, &no_neighbor_prefix_list_cmd
);
11658 /* "neighbor filter-list" commands. */
11659 install_element (BGP_NODE
, &neighbor_filter_list_hidden_cmd
);
11660 install_element (BGP_NODE
, &no_neighbor_filter_list_hidden_cmd
);
11661 install_element (BGP_IPV4_NODE
, &neighbor_filter_list_cmd
);
11662 install_element (BGP_IPV4_NODE
, &no_neighbor_filter_list_cmd
);
11663 install_element (BGP_IPV4M_NODE
, &neighbor_filter_list_cmd
);
11664 install_element (BGP_IPV4M_NODE
, &no_neighbor_filter_list_cmd
);
11665 install_element (BGP_IPV4L_NODE
, &neighbor_filter_list_cmd
);
11666 install_element (BGP_IPV4L_NODE
, &no_neighbor_filter_list_cmd
);
11667 install_element (BGP_IPV6_NODE
, &neighbor_filter_list_cmd
);
11668 install_element (BGP_IPV6_NODE
, &no_neighbor_filter_list_cmd
);
11669 install_element (BGP_IPV6M_NODE
, &neighbor_filter_list_cmd
);
11670 install_element (BGP_IPV6M_NODE
, &no_neighbor_filter_list_cmd
);
11671 install_element (BGP_IPV6L_NODE
, &neighbor_filter_list_cmd
);
11672 install_element (BGP_IPV6L_NODE
, &no_neighbor_filter_list_cmd
);
11673 install_element (BGP_VPNV4_NODE
, &neighbor_filter_list_cmd
);
11674 install_element (BGP_VPNV4_NODE
, &no_neighbor_filter_list_cmd
);
11675 install_element (BGP_VPNV6_NODE
, &neighbor_filter_list_cmd
);
11676 install_element (BGP_VPNV6_NODE
, &no_neighbor_filter_list_cmd
);
11678 /* "neighbor route-map" commands. */
11679 install_element (BGP_NODE
, &neighbor_route_map_hidden_cmd
);
11680 install_element (BGP_NODE
, &no_neighbor_route_map_hidden_cmd
);
11681 install_element (BGP_IPV4_NODE
, &neighbor_route_map_cmd
);
11682 install_element (BGP_IPV4_NODE
, &no_neighbor_route_map_cmd
);
11683 install_element (BGP_IPV4M_NODE
, &neighbor_route_map_cmd
);
11684 install_element (BGP_IPV4M_NODE
, &no_neighbor_route_map_cmd
);
11685 install_element (BGP_IPV4L_NODE
, &neighbor_route_map_cmd
);
11686 install_element (BGP_IPV4L_NODE
, &no_neighbor_route_map_cmd
);
11687 install_element (BGP_IPV6_NODE
, &neighbor_route_map_cmd
);
11688 install_element (BGP_IPV6_NODE
, &no_neighbor_route_map_cmd
);
11689 install_element (BGP_IPV6M_NODE
, &neighbor_route_map_cmd
);
11690 install_element (BGP_IPV6M_NODE
, &no_neighbor_route_map_cmd
);
11691 install_element (BGP_IPV6L_NODE
, &neighbor_route_map_cmd
);
11692 install_element (BGP_IPV6L_NODE
, &no_neighbor_route_map_cmd
);
11693 install_element (BGP_VPNV4_NODE
, &neighbor_route_map_cmd
);
11694 install_element (BGP_VPNV4_NODE
, &no_neighbor_route_map_cmd
);
11695 install_element (BGP_VPNV6_NODE
, &neighbor_route_map_cmd
);
11696 install_element (BGP_VPNV6_NODE
, &no_neighbor_route_map_cmd
);
11698 /* "neighbor unsuppress-map" commands. */
11699 install_element (BGP_NODE
, &neighbor_unsuppress_map_hidden_cmd
);
11700 install_element (BGP_NODE
, &no_neighbor_unsuppress_map_hidden_cmd
);
11701 install_element (BGP_IPV4_NODE
, &neighbor_unsuppress_map_cmd
);
11702 install_element (BGP_IPV4_NODE
, &no_neighbor_unsuppress_map_cmd
);
11703 install_element (BGP_IPV4M_NODE
, &neighbor_unsuppress_map_cmd
);
11704 install_element (BGP_IPV4M_NODE
, &no_neighbor_unsuppress_map_cmd
);
11705 install_element (BGP_IPV4L_NODE
, &neighbor_unsuppress_map_cmd
);
11706 install_element (BGP_IPV4L_NODE
, &no_neighbor_unsuppress_map_cmd
);
11707 install_element (BGP_IPV6_NODE
, &neighbor_unsuppress_map_cmd
);
11708 install_element (BGP_IPV6_NODE
, &no_neighbor_unsuppress_map_cmd
);
11709 install_element (BGP_IPV6M_NODE
, &neighbor_unsuppress_map_cmd
);
11710 install_element (BGP_IPV6M_NODE
, &no_neighbor_unsuppress_map_cmd
);
11711 install_element (BGP_IPV6L_NODE
, &neighbor_unsuppress_map_cmd
);
11712 install_element (BGP_IPV6L_NODE
, &no_neighbor_unsuppress_map_cmd
);
11713 install_element (BGP_VPNV4_NODE
, &neighbor_unsuppress_map_cmd
);
11714 install_element (BGP_VPNV4_NODE
, &no_neighbor_unsuppress_map_cmd
);
11715 install_element (BGP_VPNV6_NODE
, &neighbor_unsuppress_map_cmd
);
11716 install_element (BGP_VPNV6_NODE
, &no_neighbor_unsuppress_map_cmd
);
11718 /* "neighbor maximum-prefix" commands. */
11719 install_element (BGP_NODE
, &neighbor_maximum_prefix_hidden_cmd
);
11720 install_element (BGP_NODE
, &neighbor_maximum_prefix_threshold_hidden_cmd
);
11721 install_element (BGP_NODE
, &neighbor_maximum_prefix_warning_hidden_cmd
);
11722 install_element (BGP_NODE
, &neighbor_maximum_prefix_threshold_warning_hidden_cmd
);
11723 install_element (BGP_NODE
, &neighbor_maximum_prefix_restart_hidden_cmd
);
11724 install_element (BGP_NODE
, &neighbor_maximum_prefix_threshold_restart_hidden_cmd
);
11725 install_element (BGP_NODE
, &no_neighbor_maximum_prefix_hidden_cmd
);
11726 install_element (BGP_IPV4_NODE
, &neighbor_maximum_prefix_cmd
);
11727 install_element (BGP_IPV4_NODE
, &neighbor_maximum_prefix_threshold_cmd
);
11728 install_element (BGP_IPV4_NODE
, &neighbor_maximum_prefix_warning_cmd
);
11729 install_element (BGP_IPV4_NODE
, &neighbor_maximum_prefix_threshold_warning_cmd
);
11730 install_element (BGP_IPV4_NODE
, &neighbor_maximum_prefix_restart_cmd
);
11731 install_element (BGP_IPV4_NODE
, &neighbor_maximum_prefix_threshold_restart_cmd
);
11732 install_element (BGP_IPV4_NODE
, &no_neighbor_maximum_prefix_cmd
);
11733 install_element (BGP_IPV4M_NODE
, &neighbor_maximum_prefix_cmd
);
11734 install_element (BGP_IPV4M_NODE
, &neighbor_maximum_prefix_threshold_cmd
);
11735 install_element (BGP_IPV4M_NODE
, &neighbor_maximum_prefix_warning_cmd
);
11736 install_element (BGP_IPV4M_NODE
, &neighbor_maximum_prefix_threshold_warning_cmd
);
11737 install_element (BGP_IPV4M_NODE
, &neighbor_maximum_prefix_restart_cmd
);
11738 install_element (BGP_IPV4M_NODE
, &neighbor_maximum_prefix_threshold_restart_cmd
);
11739 install_element (BGP_IPV4M_NODE
, &no_neighbor_maximum_prefix_cmd
);
11740 install_element (BGP_IPV4L_NODE
, &neighbor_maximum_prefix_cmd
);
11741 install_element (BGP_IPV4L_NODE
, &neighbor_maximum_prefix_threshold_cmd
);
11742 install_element (BGP_IPV4L_NODE
, &neighbor_maximum_prefix_warning_cmd
);
11743 install_element (BGP_IPV4L_NODE
, &neighbor_maximum_prefix_threshold_warning_cmd
);
11744 install_element (BGP_IPV4L_NODE
, &neighbor_maximum_prefix_restart_cmd
);
11745 install_element (BGP_IPV4L_NODE
, &neighbor_maximum_prefix_threshold_restart_cmd
);
11746 install_element (BGP_IPV4L_NODE
, &no_neighbor_maximum_prefix_cmd
);
11747 install_element (BGP_IPV6_NODE
, &neighbor_maximum_prefix_cmd
);
11748 install_element (BGP_IPV6_NODE
, &neighbor_maximum_prefix_threshold_cmd
);
11749 install_element (BGP_IPV6_NODE
, &neighbor_maximum_prefix_warning_cmd
);
11750 install_element (BGP_IPV6_NODE
, &neighbor_maximum_prefix_threshold_warning_cmd
);
11751 install_element (BGP_IPV6_NODE
, &neighbor_maximum_prefix_restart_cmd
);
11752 install_element (BGP_IPV6_NODE
, &neighbor_maximum_prefix_threshold_restart_cmd
);
11753 install_element (BGP_IPV6_NODE
, &no_neighbor_maximum_prefix_cmd
);
11754 install_element (BGP_IPV6M_NODE
, &neighbor_maximum_prefix_cmd
);
11755 install_element (BGP_IPV6M_NODE
, &neighbor_maximum_prefix_threshold_cmd
);
11756 install_element (BGP_IPV6M_NODE
, &neighbor_maximum_prefix_warning_cmd
);
11757 install_element (BGP_IPV6M_NODE
, &neighbor_maximum_prefix_threshold_warning_cmd
);
11758 install_element (BGP_IPV6M_NODE
, &neighbor_maximum_prefix_restart_cmd
);
11759 install_element (BGP_IPV6M_NODE
, &neighbor_maximum_prefix_threshold_restart_cmd
);
11760 install_element (BGP_IPV6M_NODE
, &no_neighbor_maximum_prefix_cmd
);
11761 install_element (BGP_IPV6L_NODE
, &neighbor_maximum_prefix_cmd
);
11762 install_element (BGP_IPV6L_NODE
, &neighbor_maximum_prefix_threshold_cmd
);
11763 install_element (BGP_IPV6L_NODE
, &neighbor_maximum_prefix_warning_cmd
);
11764 install_element (BGP_IPV6L_NODE
, &neighbor_maximum_prefix_threshold_warning_cmd
);
11765 install_element (BGP_IPV6L_NODE
, &neighbor_maximum_prefix_restart_cmd
);
11766 install_element (BGP_IPV6L_NODE
, &neighbor_maximum_prefix_threshold_restart_cmd
);
11767 install_element (BGP_IPV6L_NODE
, &no_neighbor_maximum_prefix_cmd
);
11768 install_element (BGP_VPNV4_NODE
, &neighbor_maximum_prefix_cmd
);
11769 install_element (BGP_VPNV4_NODE
, &neighbor_maximum_prefix_threshold_cmd
);
11770 install_element (BGP_VPNV4_NODE
, &neighbor_maximum_prefix_warning_cmd
);
11771 install_element (BGP_VPNV4_NODE
, &neighbor_maximum_prefix_threshold_warning_cmd
);
11772 install_element (BGP_VPNV4_NODE
, &neighbor_maximum_prefix_restart_cmd
);
11773 install_element (BGP_VPNV4_NODE
, &neighbor_maximum_prefix_threshold_restart_cmd
);
11774 install_element (BGP_VPNV4_NODE
, &no_neighbor_maximum_prefix_cmd
);
11775 install_element (BGP_VPNV6_NODE
, &neighbor_maximum_prefix_cmd
);
11776 install_element (BGP_VPNV6_NODE
, &neighbor_maximum_prefix_threshold_cmd
);
11777 install_element (BGP_VPNV6_NODE
, &neighbor_maximum_prefix_warning_cmd
);
11778 install_element (BGP_VPNV6_NODE
, &neighbor_maximum_prefix_threshold_warning_cmd
);
11779 install_element (BGP_VPNV6_NODE
, &neighbor_maximum_prefix_restart_cmd
);
11780 install_element (BGP_VPNV6_NODE
, &neighbor_maximum_prefix_threshold_restart_cmd
);
11781 install_element (BGP_VPNV6_NODE
, &no_neighbor_maximum_prefix_cmd
);
11783 /* "neighbor allowas-in" */
11784 install_element (BGP_NODE
, &neighbor_allowas_in_hidden_cmd
);
11785 install_element (BGP_NODE
, &no_neighbor_allowas_in_hidden_cmd
);
11786 install_element (BGP_IPV4_NODE
, &neighbor_allowas_in_cmd
);
11787 install_element (BGP_IPV4_NODE
, &no_neighbor_allowas_in_cmd
);
11788 install_element (BGP_IPV4M_NODE
, &neighbor_allowas_in_cmd
);
11789 install_element (BGP_IPV4M_NODE
, &no_neighbor_allowas_in_cmd
);
11790 install_element (BGP_IPV4L_NODE
, &neighbor_allowas_in_cmd
);
11791 install_element (BGP_IPV4L_NODE
, &no_neighbor_allowas_in_cmd
);
11792 install_element (BGP_IPV6_NODE
, &neighbor_allowas_in_cmd
);
11793 install_element (BGP_IPV6_NODE
, &no_neighbor_allowas_in_cmd
);
11794 install_element (BGP_IPV6M_NODE
, &neighbor_allowas_in_cmd
);
11795 install_element (BGP_IPV6M_NODE
, &no_neighbor_allowas_in_cmd
);
11796 install_element (BGP_IPV6L_NODE
, &neighbor_allowas_in_cmd
);
11797 install_element (BGP_IPV6L_NODE
, &no_neighbor_allowas_in_cmd
);
11798 install_element (BGP_VPNV4_NODE
, &neighbor_allowas_in_cmd
);
11799 install_element (BGP_VPNV4_NODE
, &no_neighbor_allowas_in_cmd
);
11800 install_element (BGP_VPNV6_NODE
, &neighbor_allowas_in_cmd
);
11801 install_element (BGP_VPNV6_NODE
, &no_neighbor_allowas_in_cmd
);
11803 /* address-family commands. */
11804 install_element (BGP_NODE
, &address_family_ipv4_safi_cmd
);
11805 install_element (BGP_NODE
, &address_family_ipv6_safi_cmd
);
11806 #ifdef KEEP_OLD_VPN_COMMANDS
11807 install_element (BGP_NODE
, &address_family_vpnv4_cmd
);
11808 install_element (BGP_NODE
, &address_family_vpnv6_cmd
);
11809 #endif /* KEEP_OLD_VPN_COMMANDS */
11811 install_element (BGP_NODE
, &address_family_evpn_cmd
);
11813 /* "exit-address-family" command. */
11814 install_element (BGP_IPV4_NODE
, &exit_address_family_cmd
);
11815 install_element (BGP_IPV4M_NODE
, &exit_address_family_cmd
);
11816 install_element (BGP_IPV4L_NODE
, &exit_address_family_cmd
);
11817 install_element (BGP_IPV6_NODE
, &exit_address_family_cmd
);
11818 install_element (BGP_IPV6M_NODE
, &exit_address_family_cmd
);
11819 install_element (BGP_IPV6L_NODE
, &exit_address_family_cmd
);
11820 install_element (BGP_VPNV4_NODE
, &exit_address_family_cmd
);
11821 install_element (BGP_VPNV6_NODE
, &exit_address_family_cmd
);
11822 install_element (BGP_EVPN_NODE
, &exit_address_family_cmd
);
11824 /* "clear ip bgp commands" */
11825 install_element (ENABLE_NODE
, &clear_ip_bgp_all_cmd
);
11827 /* clear ip bgp prefix */
11828 install_element (ENABLE_NODE
, &clear_ip_bgp_prefix_cmd
);
11829 install_element (ENABLE_NODE
, &clear_bgp_ipv6_safi_prefix_cmd
);
11830 install_element (ENABLE_NODE
, &clear_bgp_instance_ipv6_safi_prefix_cmd
);
11832 /* "show [ip] bgp summary" commands. */
11833 install_element (VIEW_NODE
, &show_bgp_instance_all_ipv6_updgrps_cmd
);
11834 install_element (VIEW_NODE
, &show_bgp_instance_updgrps_adj_cmd
);
11835 install_element (VIEW_NODE
, &show_bgp_instance_updgrps_adj_s_cmd
);
11836 install_element (VIEW_NODE
, &show_bgp_instance_updgrps_stats_cmd
);
11837 install_element (VIEW_NODE
, &show_bgp_updgrps_adj_cmd
);
11838 install_element (VIEW_NODE
, &show_bgp_updgrps_adj_s_cmd
);
11839 install_element (VIEW_NODE
, &show_bgp_updgrps_afi_adj_cmd
);
11840 install_element (VIEW_NODE
, &show_bgp_updgrps_afi_adj_s_cmd
);
11841 install_element (VIEW_NODE
, &show_bgp_updgrps_stats_cmd
);
11842 install_element (VIEW_NODE
, &show_ip_bgp_instance_updgrps_adj_cmd
);
11843 install_element (VIEW_NODE
, &show_ip_bgp_instance_updgrps_adj_s_cmd
);
11844 install_element (VIEW_NODE
, &show_ip_bgp_summary_cmd
);
11845 install_element (VIEW_NODE
, &show_ip_bgp_updgrps_adj_cmd
);
11846 install_element (VIEW_NODE
, &show_ip_bgp_updgrps_adj_s_cmd
);
11847 install_element (VIEW_NODE
, &show_ip_bgp_updgrps_cmd
);
11849 /* "show [ip] bgp neighbors" commands. */
11850 install_element (VIEW_NODE
, &show_ip_bgp_neighbors_cmd
);
11852 /* "show [ip] bgp peer-group" commands. */
11853 install_element (VIEW_NODE
, &show_ip_bgp_peer_groups_cmd
);
11855 /* "show [ip] bgp paths" commands. */
11856 install_element (VIEW_NODE
, &show_ip_bgp_paths_cmd
);
11858 /* "show [ip] bgp community" commands. */
11859 install_element (VIEW_NODE
, &show_ip_bgp_community_info_cmd
);
11861 /* "show ip bgp large-community" commands. */
11862 install_element (VIEW_NODE
, &show_ip_bgp_lcommunity_info_cmd
);
11863 /* "show [ip] bgp attribute-info" commands. */
11864 install_element (VIEW_NODE
, &show_ip_bgp_attr_info_cmd
);
11866 /* "redistribute" commands. */
11867 install_element (BGP_NODE
, &bgp_redistribute_ipv4_hidden_cmd
);
11868 install_element (BGP_NODE
, &no_bgp_redistribute_ipv4_hidden_cmd
);
11869 install_element (BGP_NODE
, &bgp_redistribute_ipv4_rmap_hidden_cmd
);
11870 install_element (BGP_NODE
, &bgp_redistribute_ipv4_metric_hidden_cmd
);
11871 install_element (BGP_NODE
, &bgp_redistribute_ipv4_rmap_metric_hidden_cmd
);
11872 install_element (BGP_NODE
, &bgp_redistribute_ipv4_metric_rmap_hidden_cmd
);
11873 install_element (BGP_NODE
, &bgp_redistribute_ipv4_ospf_hidden_cmd
);
11874 install_element (BGP_NODE
, &no_bgp_redistribute_ipv4_ospf_hidden_cmd
);
11875 install_element (BGP_NODE
, &bgp_redistribute_ipv4_ospf_rmap_hidden_cmd
);
11876 install_element (BGP_NODE
, &bgp_redistribute_ipv4_ospf_metric_hidden_cmd
);
11877 install_element (BGP_NODE
, &bgp_redistribute_ipv4_ospf_rmap_metric_hidden_cmd
);
11878 install_element (BGP_NODE
, &bgp_redistribute_ipv4_ospf_metric_rmap_hidden_cmd
);
11879 install_element (BGP_IPV4_NODE
, &bgp_redistribute_ipv4_cmd
);
11880 install_element (BGP_IPV4_NODE
, &no_bgp_redistribute_ipv4_cmd
);
11881 install_element (BGP_IPV4_NODE
, &bgp_redistribute_ipv4_rmap_cmd
);
11882 install_element (BGP_IPV4_NODE
, &bgp_redistribute_ipv4_metric_cmd
);
11883 install_element (BGP_IPV4_NODE
, &bgp_redistribute_ipv4_rmap_metric_cmd
);
11884 install_element (BGP_IPV4_NODE
, &bgp_redistribute_ipv4_metric_rmap_cmd
);
11885 install_element (BGP_IPV4_NODE
, &bgp_redistribute_ipv4_ospf_cmd
);
11886 install_element (BGP_IPV4_NODE
, &no_bgp_redistribute_ipv4_ospf_cmd
);
11887 install_element (BGP_IPV4_NODE
, &bgp_redistribute_ipv4_ospf_rmap_cmd
);
11888 install_element (BGP_IPV4_NODE
, &bgp_redistribute_ipv4_ospf_metric_cmd
);
11889 install_element (BGP_IPV4_NODE
, &bgp_redistribute_ipv4_ospf_rmap_metric_cmd
);
11890 install_element (BGP_IPV4_NODE
, &bgp_redistribute_ipv4_ospf_metric_rmap_cmd
);
11891 install_element (BGP_IPV6_NODE
, &bgp_redistribute_ipv6_cmd
);
11892 install_element (BGP_IPV6_NODE
, &no_bgp_redistribute_ipv6_cmd
);
11893 install_element (BGP_IPV6_NODE
, &bgp_redistribute_ipv6_rmap_cmd
);
11894 install_element (BGP_IPV6_NODE
, &bgp_redistribute_ipv6_metric_cmd
);
11895 install_element (BGP_IPV6_NODE
, &bgp_redistribute_ipv6_rmap_metric_cmd
);
11896 install_element (BGP_IPV6_NODE
, &bgp_redistribute_ipv6_metric_rmap_cmd
);
11898 /* ttl_security commands */
11899 install_element (BGP_NODE
, &neighbor_ttl_security_cmd
);
11900 install_element (BGP_NODE
, &no_neighbor_ttl_security_cmd
);
11902 /* "show [ip] bgp memory" commands. */
11903 install_element (VIEW_NODE
, &show_bgp_memory_cmd
);
11905 /* "show [ip] bgp views" commands. */
11906 install_element (VIEW_NODE
, &show_bgp_views_cmd
);
11908 /* "show [ip] bgp vrfs" commands. */
11909 install_element (VIEW_NODE
, &show_bgp_vrfs_cmd
);
11911 /* Community-list. */
11912 community_list_vty ();
11915 #include "memory.h"
11916 #include "bgp_regex.h"
11917 #include "bgp_clist.h"
11918 #include "bgp_ecommunity.h"
11920 /* VTY functions. */
11922 /* Direction value to string conversion. */
11923 static const char *
11924 community_direct_str (int direct
)
11928 case COMMUNITY_DENY
:
11930 case COMMUNITY_PERMIT
:
11937 /* Display error string. */
11939 community_list_perror (struct vty
*vty
, int ret
)
11943 case COMMUNITY_LIST_ERR_CANT_FIND_LIST
:
11944 vty_out (vty
, "%% Can't find community-list%s", VTY_NEWLINE
);
11946 case COMMUNITY_LIST_ERR_MALFORMED_VAL
:
11947 vty_out (vty
, "%% Malformed community-list value%s", VTY_NEWLINE
);
11949 case COMMUNITY_LIST_ERR_STANDARD_CONFLICT
:
11950 vty_out (vty
, "%% Community name conflict, previously defined as standard community%s", VTY_NEWLINE
);
11952 case COMMUNITY_LIST_ERR_EXPANDED_CONFLICT
:
11953 vty_out (vty
, "%% Community name conflict, previously defined as expanded community%s", VTY_NEWLINE
);
11958 /* "community-list" keyword help string. */
11959 #define COMMUNITY_LIST_STR "Add a community list entry\n"
11962 /* ip community-list standard */
11963 DEFUN (ip_community_list_standard
,
11964 ip_community_list_standard_cmd
,
11965 "ip community-list <(1-99)|standard WORD> <deny|permit> AA:NN...",
11968 "Community list number (standard)\n"
11969 "Add an standard community-list entry\n"
11970 "Community list name\n"
11971 "Specify community to reject\n"
11972 "Specify community to accept\n"
11975 char *cl_name_or_number
= NULL
;
11977 int style
= COMMUNITY_LIST_STANDARD
;
11980 argv_find (argv
, argc
, "(1-99)", &idx
);
11981 argv_find (argv
, argc
, "WORD", &idx
);
11982 cl_name_or_number
= argv
[idx
]->arg
;
11983 direct
= argv_find (argv
, argc
, "permit", &idx
) ? COMMUNITY_PERMIT
: COMMUNITY_DENY
;
11984 argv_find (argv
, argc
, "AA:NN", &idx
);
11985 char *str
= argv_concat (argv
, argc
, idx
);
11987 int ret
= community_list_set (bgp_clist
, cl_name_or_number
, str
, direct
, style
);
11989 XFREE (MTYPE_TMP
, str
);
11993 /* Display error string. */
11994 community_list_perror (vty
, ret
);
11995 return CMD_WARNING
;
11998 return CMD_SUCCESS
;
12001 DEFUN (no_ip_community_list_standard_all
,
12002 no_ip_community_list_standard_all_cmd
,
12003 "no ip community-list <(1-99)|standard WORD> <deny|permit> AA:NN...",
12007 "Community list number (standard)\n"
12008 "Add an standard community-list entry\n"
12009 "Community list name\n"
12010 "Specify community to reject\n"
12011 "Specify community to accept\n"
12014 int delete_all
= 0;
12016 char *cl_name_or_number
= NULL
;
12018 int style
= COMMUNITY_LIST_STANDARD
;
12021 argv_find (argv
, argc
, "(1-99)", &idx
);
12022 argv_find (argv
, argc
, "WORD", &idx
);
12023 cl_name_or_number
= argv
[idx
]->arg
;
12024 direct
= argv_find (argv
, argc
, "permit", &idx
) ? COMMUNITY_PERMIT
: COMMUNITY_DENY
;
12025 argv_find (argv
, argc
, "AA:NN", &idx
);
12026 char *str
= argv_concat (argv
, argc
, idx
);
12028 int ret
= community_list_unset (bgp_clist
, cl_name_or_number
, str
, direct
, style
, delete_all
);
12030 XFREE (MTYPE_TMP
, str
);
12034 community_list_perror (vty
, ret
);
12035 return CMD_WARNING
;
12038 return CMD_SUCCESS
;
12041 /* ip community-list expanded */
12042 DEFUN (ip_community_list_expanded_all
,
12043 ip_community_list_expanded_all_cmd
,
12044 "ip community-list <(100-500)|expanded WORD> <deny|permit> AA:NN...",
12047 "Community list number (expanded)\n"
12048 "Add an expanded community-list entry\n"
12049 "Community list name\n"
12050 "Specify community to reject\n"
12051 "Specify community to accept\n"
12054 char *cl_name_or_number
= NULL
;
12056 int style
= COMMUNITY_LIST_EXPANDED
;
12059 argv_find (argv
, argc
, "(100-500)", &idx
);
12060 argv_find (argv
, argc
, "WORD", &idx
);
12061 cl_name_or_number
= argv
[idx
]->arg
;
12062 direct
= argv_find (argv
, argc
, "permit", &idx
) ? COMMUNITY_PERMIT
: COMMUNITY_DENY
;
12063 argv_find (argv
, argc
, "AA:NN", &idx
);
12064 char *str
= argv_concat (argv
, argc
, idx
);
12066 int ret
= community_list_set (bgp_clist
, cl_name_or_number
, str
, direct
, style
);
12068 XFREE (MTYPE_TMP
, str
);
12072 /* Display error string. */
12073 community_list_perror (vty
, ret
);
12074 return CMD_WARNING
;
12077 return CMD_SUCCESS
;
12080 DEFUN (no_ip_community_list_expanded_all
,
12081 no_ip_community_list_expanded_all_cmd
,
12082 "no ip community-list <(100-500)|expanded WORD> <deny|permit> AA:NN...",
12086 "Community list number (expanded)\n"
12087 "Add an expanded community-list entry\n"
12088 "Community list name\n"
12089 "Specify community to reject\n"
12090 "Specify community to accept\n"
12093 int delete_all
= 0;
12095 char *cl_name_or_number
= NULL
;
12097 int style
= COMMUNITY_LIST_EXPANDED
;
12100 argv_find (argv
, argc
, "(100-500)", &idx
);
12101 argv_find (argv
, argc
, "WORD", &idx
);
12102 cl_name_or_number
= argv
[idx
]->arg
;
12103 direct
= argv_find (argv
, argc
, "permit", &idx
) ? COMMUNITY_PERMIT
: COMMUNITY_DENY
;
12104 argv_find (argv
, argc
, "AA:NN", &idx
);
12105 char *str
= argv_concat (argv
, argc
, idx
);
12107 int ret
= community_list_unset (bgp_clist
, cl_name_or_number
, str
, direct
, style
, delete_all
);
12109 XFREE (MTYPE_TMP
, str
);
12113 community_list_perror (vty
, ret
);
12114 return CMD_WARNING
;
12117 return CMD_SUCCESS
;
12121 community_list_show (struct vty
*vty
, struct community_list
*list
)
12123 struct community_entry
*entry
;
12125 for (entry
= list
->head
; entry
; entry
= entry
->next
)
12127 if (entry
== list
->head
)
12129 if (all_digit (list
->name
))
12130 vty_out (vty
, "Community %s list %s%s",
12131 entry
->style
== COMMUNITY_LIST_STANDARD
?
12132 "standard" : "(expanded) access",
12133 list
->name
, VTY_NEWLINE
);
12135 vty_out (vty
, "Named Community %s list %s%s",
12136 entry
->style
== COMMUNITY_LIST_STANDARD
?
12137 "standard" : "expanded",
12138 list
->name
, VTY_NEWLINE
);
12141 vty_out (vty
, " %s%s",
12142 community_direct_str (entry
->direct
), VTY_NEWLINE
);
12144 vty_out (vty
, " %s %s%s",
12145 community_direct_str (entry
->direct
),
12146 entry
->style
== COMMUNITY_LIST_STANDARD
12147 ? community_str (entry
->u
.com
) : entry
->config
,
12152 DEFUN (show_ip_community_list
,
12153 show_ip_community_list_cmd
,
12154 "show ip community-list",
12157 "List community-list\n")
12159 struct community_list
*list
;
12160 struct community_list_master
*cm
;
12162 cm
= community_list_master_lookup (bgp_clist
, COMMUNITY_LIST_MASTER
);
12164 return CMD_SUCCESS
;
12166 for (list
= cm
->num
.head
; list
; list
= list
->next
)
12167 community_list_show (vty
, list
);
12169 for (list
= cm
->str
.head
; list
; list
= list
->next
)
12170 community_list_show (vty
, list
);
12172 return CMD_SUCCESS
;
12175 DEFUN (show_ip_community_list_arg
,
12176 show_ip_community_list_arg_cmd
,
12177 "show ip community-list <(1-500)|WORD>",
12180 "List community-list\n"
12181 "Community-list number\n"
12182 "Community-list name\n")
12184 int idx_comm_list
= 3;
12185 struct community_list
*list
;
12187 list
= community_list_lookup (bgp_clist
, argv
[idx_comm_list
]->arg
, COMMUNITY_LIST_MASTER
);
12190 vty_out (vty
, "%% Can't find community-list%s", VTY_NEWLINE
);
12191 return CMD_WARNING
;
12194 community_list_show (vty
, list
);
12196 return CMD_SUCCESS
;
12200 * Large Community code.
12203 lcommunity_list_set_vty (struct vty
*vty
, int argc
, struct cmd_token
**argv
,
12204 int style
, int reject_all_digit_name
)
12212 direct
= argv_find (argv
, argc
, "permit", &idx
) ? COMMUNITY_PERMIT
: COMMUNITY_DENY
;
12214 /* All digit name check. */
12216 argv_find (argv
, argc
, "WORD", &idx
);
12217 argv_find (argv
, argc
, "(1-99)", &idx
);
12218 argv_find (argv
, argc
, "(100-500)", &idx
);
12219 cl_name
= argv
[idx
]->arg
;
12220 if (reject_all_digit_name
&& all_digit (cl_name
))
12222 vty_out (vty
, "%% Community name cannot have all digits%s", VTY_NEWLINE
);
12223 return CMD_WARNING
;
12227 argv_find (argv
, argc
, "AA:BB:CC", &idx
);
12228 argv_find (argv
, argc
, "LINE", &idx
);
12229 /* Concat community string argument. */
12231 str
= argv_concat (argv
, argc
, idx
);
12235 ret
= lcommunity_list_set (bgp_clist
, cl_name
, str
, direct
, style
);
12237 /* Free temporary community list string allocated by
12240 XFREE (MTYPE_TMP
, str
);
12244 community_list_perror (vty
, ret
);
12245 return CMD_WARNING
;
12247 return CMD_SUCCESS
;
12251 lcommunity_list_unset_vty (struct vty
*vty
, int argc
, struct cmd_token
**argv
,
12259 argv_find (argv
, argc
, "permit", &idx
);
12260 argv_find (argv
, argc
, "deny", &idx
);
12264 /* Check the list direct. */
12265 if (strncmp (argv
[idx
]->arg
, "p", 1) == 0)
12266 direct
= COMMUNITY_PERMIT
;
12268 direct
= COMMUNITY_DENY
;
12271 argv_find (argv
, argc
, "LINE", &idx
);
12272 argv_find (argv
, argc
, "AA:AA:NN", &idx
);
12273 /* Concat community string argument. */
12274 str
= argv_concat (argv
, argc
, idx
);
12278 argv_find (argv
, argc
, "(1-99)", &idx
);
12279 argv_find (argv
, argc
, "(100-500)", &idx
);
12280 argv_find (argv
, argc
, "WORD", &idx
);
12282 /* Unset community list. */
12283 ret
= lcommunity_list_unset (bgp_clist
, argv
[idx
]->arg
, str
, direct
, style
);
12285 /* Free temporary community list string allocated by
12288 XFREE (MTYPE_TMP
, str
);
12292 community_list_perror (vty
, ret
);
12293 return CMD_WARNING
;
12296 return CMD_SUCCESS
;
12299 /* "large-community-list" keyword help string. */
12300 #define LCOMMUNITY_LIST_STR "Add a large community list entry\n"
12301 #define LCOMMUNITY_VAL_STR "large community in 'aa:bb:cc' format\n"
12303 DEFUN (ip_lcommunity_list_standard
,
12304 ip_lcommunity_list_standard_cmd
,
12305 "ip large-community-list (1-99) <deny|permit>",
12307 LCOMMUNITY_LIST_STR
12308 "Large Community list number (standard)\n"
12309 "Specify large community to reject\n"
12310 "Specify large community to accept\n"
12311 LCOMMUNITY_VAL_STR
)
12313 return lcommunity_list_set_vty (vty
, argc
, argv
, LARGE_COMMUNITY_LIST_STANDARD
, 0);
12316 DEFUN (ip_lcommunity_list_standard1
,
12317 ip_lcommunity_list_standard1_cmd
,
12318 "ip large-community-list (1-99) <deny|permit> AA:BB:CC...",
12320 LCOMMUNITY_LIST_STR
12321 "Large Community list number (standard)\n"
12322 "Specify large community to reject\n"
12323 "Specify large community to accept\n"
12324 LCOMMUNITY_VAL_STR
)
12326 return lcommunity_list_set_vty (vty
, argc
, argv
, LARGE_COMMUNITY_LIST_STANDARD
, 0);
12329 DEFUN (ip_lcommunity_list_expanded
,
12330 ip_lcommunity_list_expanded_cmd
,
12331 "ip large-community-list (100-500) <deny|permit> LINE...",
12333 LCOMMUNITY_LIST_STR
12334 "Large Community list number (expanded)\n"
12335 "Specify large community to reject\n"
12336 "Specify large community to accept\n"
12337 "An ordered list as a regular-expression\n")
12339 return lcommunity_list_set_vty (vty
, argc
, argv
, LARGE_COMMUNITY_LIST_EXPANDED
, 0);
12342 DEFUN (ip_lcommunity_list_name_standard
,
12343 ip_lcommunity_list_name_standard_cmd
,
12344 "ip large-community-list standard WORD <deny|permit>",
12346 LCOMMUNITY_LIST_STR
12347 "Specify standard large-community-list\n"
12348 "Large Community list name\n"
12349 "Specify large community to reject\n"
12350 "Specify large community to accept\n")
12352 return lcommunity_list_set_vty (vty
, argc
, argv
, LARGE_COMMUNITY_LIST_STANDARD
, 1);
12355 DEFUN (ip_lcommunity_list_name_standard1
,
12356 ip_lcommunity_list_name_standard1_cmd
,
12357 "ip large-community-list standard WORD <deny|permit> AA:BB:CC...",
12359 LCOMMUNITY_LIST_STR
12360 "Specify standard large-community-list\n"
12361 "Large Community list name\n"
12362 "Specify large community to reject\n"
12363 "Specify large community to accept\n"
12364 LCOMMUNITY_VAL_STR
)
12366 return lcommunity_list_set_vty (vty
, argc
, argv
, LARGE_COMMUNITY_LIST_STANDARD
, 1);
12369 DEFUN (ip_lcommunity_list_name_expanded
,
12370 ip_lcommunity_list_name_expanded_cmd
,
12371 "ip large-community-list expanded WORD <deny|permit> LINE...",
12373 LCOMMUNITY_LIST_STR
12374 "Specify expanded large-community-list\n"
12375 "Large Community list name\n"
12376 "Specify large community to reject\n"
12377 "Specify large community to accept\n"
12378 "An ordered list as a regular-expression\n")
12380 return lcommunity_list_set_vty (vty
, argc
, argv
, LARGE_COMMUNITY_LIST_EXPANDED
, 1);
12383 DEFUN (no_ip_lcommunity_list_standard_all
,
12384 no_ip_lcommunity_list_standard_all_cmd
,
12385 "no ip large-community-list <(1-99)|(100-500)|WORD>",
12388 LCOMMUNITY_LIST_STR
12389 "Large Community list number (standard)\n"
12390 "Large Community list number (expanded)\n"
12391 "Large Community list name\n")
12393 return lcommunity_list_unset_vty (vty
, argc
, argv
, LARGE_COMMUNITY_LIST_STANDARD
);
12396 DEFUN (no_ip_lcommunity_list_name_expanded_all
,
12397 no_ip_lcommunity_list_name_expanded_all_cmd
,
12398 "no ip large-community-list expanded WORD",
12401 LCOMMUNITY_LIST_STR
12402 "Specify expanded large-community-list\n"
12403 "Large Community list name\n")
12405 return lcommunity_list_unset_vty (vty
, argc
, argv
, LARGE_COMMUNITY_LIST_EXPANDED
);
12408 DEFUN (no_ip_lcommunity_list_standard
,
12409 no_ip_lcommunity_list_standard_cmd
,
12410 "no ip large-community-list (1-99) <deny|permit> AA:AA:NN...",
12413 LCOMMUNITY_LIST_STR
12414 "Large Community list number (standard)\n"
12415 "Specify large community to reject\n"
12416 "Specify large community to accept\n"
12417 LCOMMUNITY_VAL_STR
)
12419 return lcommunity_list_unset_vty (vty
, argc
, argv
, LARGE_COMMUNITY_LIST_STANDARD
);
12422 DEFUN (no_ip_lcommunity_list_expanded
,
12423 no_ip_lcommunity_list_expanded_cmd
,
12424 "no ip large-community-list (100-500) <deny|permit> LINE...",
12427 LCOMMUNITY_LIST_STR
12428 "Large Community list number (expanded)\n"
12429 "Specify large community to reject\n"
12430 "Specify large community to accept\n"
12431 "An ordered list as a regular-expression\n")
12433 return lcommunity_list_unset_vty (vty
, argc
, argv
, LARGE_COMMUNITY_LIST_EXPANDED
);
12436 DEFUN (no_ip_lcommunity_list_name_standard
,
12437 no_ip_lcommunity_list_name_standard_cmd
,
12438 "no ip large-community-list standard WORD <deny|permit> AA:AA:NN...",
12441 LCOMMUNITY_LIST_STR
12442 "Specify standard large-community-list\n"
12443 "Large Community list name\n"
12444 "Specify large community to reject\n"
12445 "Specify large community to accept\n"
12446 LCOMMUNITY_VAL_STR
)
12448 return lcommunity_list_unset_vty (vty
, argc
, argv
, LARGE_COMMUNITY_LIST_STANDARD
);
12451 DEFUN (no_ip_lcommunity_list_name_expanded
,
12452 no_ip_lcommunity_list_name_expanded_cmd
,
12453 "no ip large-community-list expanded WORD <deny|permit> LINE...",
12456 LCOMMUNITY_LIST_STR
12457 "Specify expanded large-community-list\n"
12458 "Large community list name\n"
12459 "Specify large community to reject\n"
12460 "Specify large community to accept\n"
12461 "An ordered list as a regular-expression\n")
12463 return lcommunity_list_unset_vty (vty
, argc
, argv
, LARGE_COMMUNITY_LIST_EXPANDED
);
12467 lcommunity_list_show (struct vty
*vty
, struct community_list
*list
)
12469 struct community_entry
*entry
;
12471 for (entry
= list
->head
; entry
; entry
= entry
->next
)
12473 if (entry
== list
->head
)
12475 if (all_digit (list
->name
))
12476 vty_out (vty
, "Large community %s list %s%s",
12477 entry
->style
== EXTCOMMUNITY_LIST_STANDARD
?
12478 "standard" : "(expanded) access",
12479 list
->name
, VTY_NEWLINE
);
12481 vty_out (vty
, "Named large community %s list %s%s",
12482 entry
->style
== EXTCOMMUNITY_LIST_STANDARD
?
12483 "standard" : "expanded",
12484 list
->name
, VTY_NEWLINE
);
12487 vty_out (vty
, " %s%s",
12488 community_direct_str (entry
->direct
), VTY_NEWLINE
);
12490 vty_out (vty
, " %s %s%s",
12491 community_direct_str (entry
->direct
),
12492 entry
->style
== EXTCOMMUNITY_LIST_STANDARD
?
12493 entry
->u
.ecom
->str
: entry
->config
,
12498 DEFUN (show_ip_lcommunity_list
,
12499 show_ip_lcommunity_list_cmd
,
12500 "show ip large-community-list",
12503 "List large-community list\n")
12505 struct community_list
*list
;
12506 struct community_list_master
*cm
;
12508 cm
= community_list_master_lookup (bgp_clist
, LARGE_COMMUNITY_LIST_MASTER
);
12510 return CMD_SUCCESS
;
12512 for (list
= cm
->num
.head
; list
; list
= list
->next
)
12513 lcommunity_list_show (vty
, list
);
12515 for (list
= cm
->str
.head
; list
; list
= list
->next
)
12516 lcommunity_list_show (vty
, list
);
12518 return CMD_SUCCESS
;
12521 DEFUN (show_ip_lcommunity_list_arg
,
12522 show_ip_lcommunity_list_arg_cmd
,
12523 "show ip large-community-list <(1-500)|WORD>",
12526 "List large-community list\n"
12527 "large-community-list number\n"
12528 "large-community-list name\n")
12530 struct community_list
*list
;
12532 list
= community_list_lookup (bgp_clist
, argv
[3]->arg
, LARGE_COMMUNITY_LIST_MASTER
);
12535 vty_out (vty
, "%% Can't find extcommunity-list%s", VTY_NEWLINE
);
12536 return CMD_WARNING
;
12539 lcommunity_list_show (vty
, list
);
12541 return CMD_SUCCESS
;
12544 /* "extcommunity-list" keyword help string. */
12545 #define EXTCOMMUNITY_LIST_STR "Add a extended community list entry\n"
12546 #define EXTCOMMUNITY_VAL_STR "Extended community attribute in 'rt aa:nn_or_IPaddr:nn' OR 'soo aa:nn_or_IPaddr:nn' format\n"
12548 DEFUN (ip_extcommunity_list_standard
,
12549 ip_extcommunity_list_standard_cmd
,
12550 "ip extcommunity-list <(1-99)|standard WORD> <deny|permit> AA:NN...",
12552 EXTCOMMUNITY_LIST_STR
12553 "Extended Community list number (standard)\n"
12554 "Specify standard extcommunity-list\n"
12555 "Community list name\n"
12556 "Specify community to reject\n"
12557 "Specify community to accept\n"
12558 EXTCOMMUNITY_VAL_STR
)
12560 int style
= EXTCOMMUNITY_LIST_STANDARD
;
12562 char *cl_number_or_name
= NULL
;
12565 argv_find (argv
, argc
, "(1-99)", &idx
);
12566 argv_find (argv
, argc
, "WORD", &idx
);
12567 cl_number_or_name
= argv
[idx
]->arg
;
12568 direct
= argv_find (argv
, argc
, "permit", &idx
) ? COMMUNITY_PERMIT
: COMMUNITY_DENY
;
12569 argv_find (argv
, argc
, "AA:NN", &idx
);
12570 char *str
= argv_concat (argv
, argc
, idx
);
12572 int ret
= extcommunity_list_set (bgp_clist
, cl_number_or_name
, str
, direct
, style
);
12574 XFREE (MTYPE_TMP
, str
);
12578 community_list_perror (vty
, ret
);
12579 return CMD_WARNING
;
12582 return CMD_SUCCESS
;
12585 DEFUN (ip_extcommunity_list_name_expanded
,
12586 ip_extcommunity_list_name_expanded_cmd
,
12587 "ip extcommunity-list <(100-500)|expanded WORD> <deny|permit> LINE...",
12589 EXTCOMMUNITY_LIST_STR
12590 "Extended Community list number (expanded)\n"
12591 "Specify expanded extcommunity-list\n"
12592 "Extended Community list name\n"
12593 "Specify community to reject\n"
12594 "Specify community to accept\n"
12595 "An ordered list as a regular-expression\n")
12597 int style
= EXTCOMMUNITY_LIST_EXPANDED
;
12599 char *cl_number_or_name
= NULL
;
12602 argv_find (argv
, argc
, "(100-500)", &idx
);
12603 argv_find (argv
, argc
, "WORD", &idx
);
12604 cl_number_or_name
= argv
[idx
]->arg
;
12605 direct
= argv_find (argv
, argc
, "permit", &idx
) ? COMMUNITY_PERMIT
: COMMUNITY_DENY
;
12606 argv_find (argv
, argc
, "LINE", &idx
);
12607 char *str
= argv_concat (argv
, argc
, idx
);
12609 int ret
= extcommunity_list_set (bgp_clist
, cl_number_or_name
, str
, direct
, style
);
12611 XFREE (MTYPE_TMP
, str
);
12615 community_list_perror (vty
, ret
);
12616 return CMD_WARNING
;
12619 return CMD_SUCCESS
;
12622 DEFUN (no_ip_extcommunity_list_standard_all
,
12623 no_ip_extcommunity_list_standard_all_cmd
,
12624 "no ip extcommunity-list <(1-99)|standard WORD> <deny|permit> AA:NN...",
12627 EXTCOMMUNITY_LIST_STR
12628 "Extended Community list number (standard)\n"
12629 "Specify standard extcommunity-list\n"
12630 "Community list name\n"
12631 "Specify community to reject\n"
12632 "Specify community to accept\n"
12633 EXTCOMMUNITY_VAL_STR
)
12637 int style
= EXTCOMMUNITY_LIST_STANDARD
;
12639 char *cl_number_or_name
= NULL
;
12642 argv_find (argv
, argc
, "(1-99)", &idx
);
12643 argv_find (argv
, argc
, "WORD", &idx
);
12644 cl_number_or_name
= argv
[idx
]->arg
;
12645 direct
= argv_find (argv
, argc
, "permit", &idx
) ? COMMUNITY_PERMIT
: COMMUNITY_DENY
;
12646 argv_find (argv
, argc
, "AA:NN", &idx
);
12647 char *str
= argv_concat (argv
, argc
, idx
);
12649 int ret
= extcommunity_list_unset (bgp_clist
, cl_number_or_name
, str
, direct
, style
, deleteall
);
12651 XFREE (MTYPE_TMP
, str
);
12655 community_list_perror (vty
, ret
);
12656 return CMD_WARNING
;
12659 return CMD_SUCCESS
;
12662 DEFUN (no_ip_extcommunity_list_expanded_all
,
12663 no_ip_extcommunity_list_expanded_all_cmd
,
12664 "no ip extcommunity-list <(100-500)|expanded WORD> <deny|permit> LINE...",
12667 EXTCOMMUNITY_LIST_STR
12668 "Extended Community list number (expanded)\n"
12669 "Specify expanded extcommunity-list\n"
12670 "Extended Community list name\n"
12671 "Specify community to reject\n"
12672 "Specify community to accept\n"
12673 "An ordered list as a regular-expression\n")
12677 int style
= EXTCOMMUNITY_LIST_EXPANDED
;
12679 char *cl_number_or_name
= NULL
;
12682 argv_find (argv
, argc
, "(100-500)", &idx
);
12683 argv_find (argv
, argc
, "WORD", &idx
);
12684 cl_number_or_name
= argv
[idx
]->arg
;
12685 direct
= argv_find (argv
, argc
, "permit", &idx
) ? COMMUNITY_PERMIT
: COMMUNITY_DENY
;
12686 argv_find (argv
, argc
, "LINE", &idx
);
12687 char *str
= argv_concat (argv
, argc
, idx
);
12689 int ret
= extcommunity_list_unset (bgp_clist
, cl_number_or_name
, str
, direct
, style
, deleteall
);
12691 XFREE (MTYPE_TMP
, str
);
12695 community_list_perror (vty
, ret
);
12696 return CMD_WARNING
;
12699 return CMD_SUCCESS
;
12703 extcommunity_list_show (struct vty
*vty
, struct community_list
*list
)
12705 struct community_entry
*entry
;
12707 for (entry
= list
->head
; entry
; entry
= entry
->next
)
12709 if (entry
== list
->head
)
12711 if (all_digit (list
->name
))
12712 vty_out (vty
, "Extended community %s list %s%s",
12713 entry
->style
== EXTCOMMUNITY_LIST_STANDARD
?
12714 "standard" : "(expanded) access",
12715 list
->name
, VTY_NEWLINE
);
12717 vty_out (vty
, "Named extended community %s list %s%s",
12718 entry
->style
== EXTCOMMUNITY_LIST_STANDARD
?
12719 "standard" : "expanded",
12720 list
->name
, VTY_NEWLINE
);
12723 vty_out (vty
, " %s%s",
12724 community_direct_str (entry
->direct
), VTY_NEWLINE
);
12726 vty_out (vty
, " %s %s%s",
12727 community_direct_str (entry
->direct
),
12728 entry
->style
== EXTCOMMUNITY_LIST_STANDARD
?
12729 entry
->u
.ecom
->str
: entry
->config
,
12734 DEFUN (show_ip_extcommunity_list
,
12735 show_ip_extcommunity_list_cmd
,
12736 "show ip extcommunity-list",
12739 "List extended-community list\n")
12741 struct community_list
*list
;
12742 struct community_list_master
*cm
;
12744 cm
= community_list_master_lookup (bgp_clist
, EXTCOMMUNITY_LIST_MASTER
);
12746 return CMD_SUCCESS
;
12748 for (list
= cm
->num
.head
; list
; list
= list
->next
)
12749 extcommunity_list_show (vty
, list
);
12751 for (list
= cm
->str
.head
; list
; list
= list
->next
)
12752 extcommunity_list_show (vty
, list
);
12754 return CMD_SUCCESS
;
12757 DEFUN (show_ip_extcommunity_list_arg
,
12758 show_ip_extcommunity_list_arg_cmd
,
12759 "show ip extcommunity-list <(1-500)|WORD>",
12762 "List extended-community list\n"
12763 "Extcommunity-list number\n"
12764 "Extcommunity-list name\n")
12766 int idx_comm_list
= 3;
12767 struct community_list
*list
;
12769 list
= community_list_lookup (bgp_clist
, argv
[idx_comm_list
]->arg
, EXTCOMMUNITY_LIST_MASTER
);
12772 vty_out (vty
, "%% Can't find extcommunity-list%s", VTY_NEWLINE
);
12773 return CMD_WARNING
;
12776 extcommunity_list_show (vty
, list
);
12778 return CMD_SUCCESS
;
12781 /* Return configuration string of community-list entry. */
12782 static const char *
12783 community_list_config_str (struct community_entry
*entry
)
12791 if (entry
->style
== COMMUNITY_LIST_STANDARD
)
12792 str
= community_str (entry
->u
.com
);
12794 str
= entry
->config
;
12799 /* Display community-list and extcommunity-list configuration. */
12801 community_list_config_write (struct vty
*vty
)
12803 struct community_list
*list
;
12804 struct community_entry
*entry
;
12805 struct community_list_master
*cm
;
12808 /* Community-list. */
12809 cm
= community_list_master_lookup (bgp_clist
, COMMUNITY_LIST_MASTER
);
12811 for (list
= cm
->num
.head
; list
; list
= list
->next
)
12812 for (entry
= list
->head
; entry
; entry
= entry
->next
)
12814 vty_out (vty
, "ip community-list %s %s %s%s",
12815 list
->name
, community_direct_str (entry
->direct
),
12816 community_list_config_str (entry
),
12820 for (list
= cm
->str
.head
; list
; list
= list
->next
)
12821 for (entry
= list
->head
; entry
; entry
= entry
->next
)
12823 vty_out (vty
, "ip community-list %s %s %s %s%s",
12824 entry
->style
== COMMUNITY_LIST_STANDARD
12825 ? "standard" : "expanded",
12826 list
->name
, community_direct_str (entry
->direct
),
12827 community_list_config_str (entry
),
12832 /* Extcommunity-list. */
12833 cm
= community_list_master_lookup (bgp_clist
, EXTCOMMUNITY_LIST_MASTER
);
12835 for (list
= cm
->num
.head
; list
; list
= list
->next
)
12836 for (entry
= list
->head
; entry
; entry
= entry
->next
)
12838 vty_out (vty
, "ip extcommunity-list %s %s %s%s",
12839 list
->name
, community_direct_str (entry
->direct
),
12840 community_list_config_str (entry
), VTY_NEWLINE
);
12843 for (list
= cm
->str
.head
; list
; list
= list
->next
)
12844 for (entry
= list
->head
; entry
; entry
= entry
->next
)
12846 vty_out (vty
, "ip extcommunity-list %s %s %s %s%s",
12847 entry
->style
== EXTCOMMUNITY_LIST_STANDARD
12848 ? "standard" : "expanded",
12849 list
->name
, community_direct_str (entry
->direct
),
12850 community_list_config_str (entry
), VTY_NEWLINE
);
12855 /* lcommunity-list. */
12856 cm
= community_list_master_lookup (bgp_clist
, LARGE_COMMUNITY_LIST_MASTER
);
12858 for (list
= cm
->num
.head
; list
; list
= list
->next
)
12859 for (entry
= list
->head
; entry
; entry
= entry
->next
)
12861 vty_out (vty
, "ip large-community-list %s %s %s%s",
12862 list
->name
, community_direct_str (entry
->direct
),
12863 community_list_config_str (entry
), VTY_NEWLINE
);
12866 for (list
= cm
->str
.head
; list
; list
= list
->next
)
12867 for (entry
= list
->head
; entry
; entry
= entry
->next
)
12869 vty_out (vty
, "ip large-community-list %s %s %s %s%s",
12870 entry
->style
== LARGE_COMMUNITY_LIST_STANDARD
12871 ? "standard" : "expanded",
12872 list
->name
, community_direct_str (entry
->direct
),
12873 community_list_config_str (entry
), VTY_NEWLINE
);
12880 static struct cmd_node community_list_node
=
12882 COMMUNITY_LIST_NODE
,
12884 1 /* Export to vtysh. */
12888 community_list_vty (void)
12890 install_node (&community_list_node
, community_list_config_write
);
12892 /* Community-list. */
12893 install_element (CONFIG_NODE
, &ip_community_list_standard_cmd
);
12894 install_element (CONFIG_NODE
, &ip_community_list_expanded_all_cmd
);
12895 install_element (CONFIG_NODE
, &no_ip_community_list_standard_all_cmd
);
12896 install_element (CONFIG_NODE
, &no_ip_community_list_expanded_all_cmd
);
12897 install_element (VIEW_NODE
, &show_ip_community_list_cmd
);
12898 install_element (VIEW_NODE
, &show_ip_community_list_arg_cmd
);
12900 /* Extcommunity-list. */
12901 install_element (CONFIG_NODE
, &ip_extcommunity_list_standard_cmd
);
12902 install_element (CONFIG_NODE
, &ip_extcommunity_list_name_expanded_cmd
);
12903 install_element (CONFIG_NODE
, &no_ip_extcommunity_list_standard_all_cmd
);
12904 install_element (CONFIG_NODE
, &no_ip_extcommunity_list_expanded_all_cmd
);
12905 install_element (VIEW_NODE
, &show_ip_extcommunity_list_cmd
);
12906 install_element (VIEW_NODE
, &show_ip_extcommunity_list_arg_cmd
);
12908 /* Large Community List */
12909 install_element (CONFIG_NODE
, &ip_lcommunity_list_standard_cmd
);
12910 install_element (CONFIG_NODE
, &ip_lcommunity_list_standard1_cmd
);
12911 install_element (CONFIG_NODE
, &ip_lcommunity_list_expanded_cmd
);
12912 install_element (CONFIG_NODE
, &ip_lcommunity_list_name_standard_cmd
);
12913 install_element (CONFIG_NODE
, &ip_lcommunity_list_name_standard1_cmd
);
12914 install_element (CONFIG_NODE
, &ip_lcommunity_list_name_expanded_cmd
);
12915 install_element (CONFIG_NODE
, &no_ip_lcommunity_list_standard_all_cmd
);
12916 install_element (CONFIG_NODE
, &no_ip_lcommunity_list_name_expanded_all_cmd
);
12917 install_element (CONFIG_NODE
, &no_ip_lcommunity_list_standard_cmd
);
12918 install_element (CONFIG_NODE
, &no_ip_lcommunity_list_expanded_cmd
);
12919 install_element (CONFIG_NODE
, &no_ip_lcommunity_list_name_standard_cmd
);
12920 install_element (CONFIG_NODE
, &no_ip_lcommunity_list_name_expanded_cmd
);
12921 install_element (VIEW_NODE
, &show_ip_lcommunity_list_cmd
);
12922 install_element (VIEW_NODE
, &show_ip_lcommunity_list_arg_cmd
);