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
17 along with GNU Zebra; see the file COPYING. If not, write to the Free
18 Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
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
);
64 /* Utility function to get address family from current node. */
66 bgp_node_afi (struct vty
*vty
)
74 case BGP_ENCAPV6_NODE
:
87 /* Utility function to get subsequent address family from current
90 bgp_node_safi (struct vty
*vty
)
96 case BGP_ENCAPV6_NODE
:
101 safi
= SAFI_MPLS_VPN
;
105 safi
= SAFI_MULTICAST
;
117 /* supports <ipv4|ipv6> */
119 bgp_vty_afi_from_arg(const char *afi_str
)
121 afi_t afi
= AFI_MAX
; /* unknown */
122 if (!strcmp(afi_str
, "ipv4")) {
125 else if (!strcmp(afi_str
, "ipv6")) {
128 else if (!strcmp(afi_str
, "l2vpn")) {
135 bgp_parse_afi(const char *str
, afi_t
*afi
)
137 *afi
= bgp_vty_afi_from_arg(str
);
145 argv_find_and_parse_afi(struct cmd_token
**argv
, int argc
, int *index
, afi_t
*afi
)
148 if (argv_find (argv
, argc
, "ipv4", index
))
154 else if (argv_find (argv
, argc
, "ipv6", index
))
163 /* supports <unicast|multicast|vpn|encap> */
165 bgp_vty_safi_from_arg(const char *safi_str
)
167 safi_t safi
= SAFI_MAX
; /* unknown */
168 if (strncmp (safi_str
, "m", 1) == 0)
169 safi
= SAFI_MULTICAST
;
170 else if (strncmp (safi_str
, "u", 1) == 0)
172 else if (strncmp (safi_str
, "e", 1) == 0)
174 else if (strncmp (safi_str
, "v", 1) == 0)
175 safi
= SAFI_MPLS_VPN
;
180 argv_find_and_parse_safi (struct cmd_token
**argv
, int argc
, int *index
, safi_t
*safi
)
183 if (argv_find (argv
, argc
, "unicast", index
))
187 *safi
= SAFI_UNICAST
;
189 else if (argv_find (argv
, argc
, "multicast", index
))
193 *safi
= SAFI_MULTICAST
;
195 else if (argv_find (argv
, argc
, "vpn", index
))
199 *safi
= SAFI_MPLS_VPN
;
201 else if (argv_find (argv
, argc
, "encap", index
))
207 else if (argv_find (argv
, argc
, "evpn", index
))
217 * bgp_vty_find_and_parse_afi_safi_bgp
219 * For a given 'show ...' command, correctly parse the afi/safi/bgp out from it
220 * This function *assumes* that the calling function pre-sets the afi/safi/bgp
221 * to appropriate values for the calling function. This is to allow the
222 * calling function to make decisions appropriate for the show command
223 * that is being parsed.
225 * The show commands are generally of the form:
226 * "show [ip] bgp [<view|vrf> WORD] [<ipv4|ipv6> [<unicast|multicast|vpn|encap>]] ..."
228 * Since we use argv_find if the show command in particular doesn't have:
231 * [<ipv4|ipv6> [<unicast|multicast|vpn|encap>]]
232 * The command parsing should still be ok.
234 * vty -> The vty for the command so we can output some useful data in
235 * the event of a parse error in the vrf.
236 * argv -> The command tokens
237 * argc -> How many command tokens we have
238 * idx -> The current place in the command, generally should be 0 for this function
239 * afi -> The parsed afi if it was included in the show command, returned here
240 * safi -> The parsed safi if it was included in the show command, returned here
241 * bgp -> Pointer to the bgp data structure we need to fill in.
243 * The function returns the correct location in the parse tree for the
246 * Returns 0 for failure to parse correctly, else the idx position of where
247 * it found the last token.
250 bgp_vty_find_and_parse_afi_safi_bgp (struct vty
*vty
, struct cmd_token
**argv
, int argc
, int *idx
,
251 afi_t
*afi
, safi_t
*safi
, struct bgp
**bgp
)
253 char *vrf_name
= NULL
;
259 if (argv_find (argv
, argc
, "ip", idx
))
262 if (argv_find (argv
, argc
, "view", idx
) || argv_find (argv
, argc
, "vrf", idx
))
264 vrf_name
= argv
[*idx
+ 1]->arg
;
267 if (strmatch (vrf_name
, "all"))
271 *bgp
= bgp_lookup_by_name (vrf_name
);
274 vty_out (vty
, "View/Vrf specified is unknown: %s%s", vrf_name
, VTY_NEWLINE
);
282 *bgp
= bgp_get_default ();
285 vty_out (vty
, "Unable to find default BGP instance%s", VTY_NEWLINE
);
291 if (argv_find_and_parse_afi (argv
, argc
, idx
, afi
))
292 argv_find_and_parse_safi (argv
, argc
, idx
, safi
);
299 peer_address_self_check (struct bgp
*bgp
, union sockunion
*su
)
301 struct interface
*ifp
= NULL
;
303 if (su
->sa
.sa_family
== AF_INET
)
304 ifp
= if_lookup_by_ipv4_exact (&su
->sin
.sin_addr
, bgp
->vrf_id
);
305 else if (su
->sa
.sa_family
== AF_INET6
)
306 ifp
= if_lookup_by_ipv6_exact (&su
->sin6
.sin6_addr
,
307 su
->sin6
.sin6_scope_id
, bgp
->vrf_id
);
315 /* Utility function for looking up peer from VTY. */
316 /* This is used only for configuration, so disallow if attempted on
317 * a dynamic neighbor.
320 peer_lookup_vty (struct vty
*vty
, const char *ip_str
)
322 struct bgp
*bgp
= VTY_GET_CONTEXT(bgp
);
331 ret
= str2sockunion (ip_str
, &su
);
334 peer
= peer_lookup_by_conf_if (bgp
, ip_str
);
337 if ((peer
= peer_lookup_by_hostname(bgp
, ip_str
)) == NULL
)
339 vty_out (vty
, "%% Malformed address or name: %s%s", ip_str
, VTY_NEWLINE
);
346 peer
= peer_lookup (bgp
, &su
);
349 vty_out (vty
, "%% Specify remote-as or peer-group commands first%s",
353 if (peer_dynamic_neighbor (peer
))
355 vty_out (vty
, "%% Operation not allowed on a dynamic neighbor%s",
364 /* Utility function for looking up peer or peer group. */
365 /* This is used only for configuration, so disallow if attempted on
366 * a dynamic neighbor.
369 peer_and_group_lookup_vty (struct vty
*vty
, const char *peer_str
)
371 struct bgp
*bgp
= VTY_GET_CONTEXT(bgp
);
374 struct peer
*peer
= NULL
;
375 struct peer_group
*group
= NULL
;
381 ret
= str2sockunion (peer_str
, &su
);
384 /* IP address, locate peer. */
385 peer
= peer_lookup (bgp
, &su
);
389 /* Not IP, could match either peer configured on interface or a group. */
390 peer
= peer_lookup_by_conf_if (bgp
, peer_str
);
392 group
= peer_group_lookup (bgp
, peer_str
);
397 if (peer_dynamic_neighbor (peer
))
399 vty_out (vty
, "%% Operation not allowed on a dynamic neighbor%s",
410 vty_out (vty
, "%% Specify remote-as or peer-group commands first%s",
417 bgp_vty_return (struct vty
*vty
, int ret
)
419 const char *str
= NULL
;
423 case BGP_ERR_INVALID_VALUE
:
424 str
= "Invalid value";
426 case BGP_ERR_INVALID_FLAG
:
427 str
= "Invalid flag";
429 case BGP_ERR_PEER_GROUP_SHUTDOWN
:
430 str
= "Peer-group has been shutdown. Activate the peer-group first";
432 case BGP_ERR_PEER_FLAG_CONFLICT
:
433 str
= "Can't set override-capability and strict-capability-match at the same time";
435 case BGP_ERR_PEER_GROUP_NO_REMOTE_AS
:
436 str
= "Specify remote-as or peer-group remote AS first";
438 case BGP_ERR_PEER_GROUP_CANT_CHANGE
:
439 str
= "Cannot change the peer-group. Deconfigure first";
441 case BGP_ERR_PEER_GROUP_MISMATCH
:
442 str
= "Peer is not a member of this peer-group";
444 case BGP_ERR_PEER_FILTER_CONFLICT
:
445 str
= "Prefix/distribute list can not co-exist";
447 case BGP_ERR_NOT_INTERNAL_PEER
:
448 str
= "Invalid command. Not an internal neighbor";
450 case BGP_ERR_REMOVE_PRIVATE_AS
:
451 str
= "remove-private-AS cannot be configured for IBGP peers";
453 case BGP_ERR_LOCAL_AS_ALLOWED_ONLY_FOR_EBGP
:
454 str
= "Local-AS allowed only for EBGP peers";
456 case BGP_ERR_CANNOT_HAVE_LOCAL_AS_SAME_AS
:
457 str
= "Cannot have local-as same as BGP AS number";
459 case BGP_ERR_TCPSIG_FAILED
:
460 str
= "Error while applying TCP-Sig to session(s)";
462 case BGP_ERR_NO_EBGP_MULTIHOP_WITH_TTLHACK
:
463 str
= "ebgp-multihop and ttl-security cannot be configured together";
465 case BGP_ERR_NO_IBGP_WITH_TTLHACK
:
466 str
= "ttl-security only allowed for EBGP peers";
468 case BGP_ERR_AS_OVERRIDE
:
469 str
= "as-override cannot be configured for IBGP peers";
471 case BGP_ERR_INVALID_DYNAMIC_NEIGHBORS_LIMIT
:
472 str
= "Invalid limit for number of dynamic neighbors";
474 case BGP_ERR_DYNAMIC_NEIGHBORS_RANGE_EXISTS
:
475 str
= "Dynamic neighbor listen range already exists";
477 case BGP_ERR_INVALID_FOR_DYNAMIC_PEER
:
478 str
= "Operation not allowed on a dynamic neighbor";
480 case BGP_ERR_INVALID_FOR_DIRECT_PEER
:
481 str
= "Operation not allowed on a directly connected neighbor";
486 vty_out (vty
, "%% %s%s", str
, VTY_NEWLINE
);
492 /* BGP clear sort. */
503 bgp_clear_vty_error (struct vty
*vty
, struct peer
*peer
, afi_t afi
,
504 safi_t safi
, int error
)
508 case BGP_ERR_AF_UNCONFIGURED
:
510 "%%BGP: Enable %s address family for the neighbor %s%s",
511 afi_safi_print(afi
, safi
), peer
->host
, VTY_NEWLINE
);
513 case BGP_ERR_SOFT_RECONFIG_UNCONFIGURED
:
514 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
);
521 /* `clear ip bgp' functions. */
523 bgp_clear (struct vty
*vty
, struct bgp
*bgp
, afi_t afi
, safi_t safi
,
524 enum clear_sort sort
,enum bgp_clear_type stype
, const char *arg
)
528 struct listnode
*node
, *nnode
;
530 /* Clear all neighbors. */
532 * Pass along pointer to next node to peer_clear() when walking all nodes
533 * on the BGP instance as that may get freed if it is a doppelganger
535 if (sort
== clear_all
)
537 for (ALL_LIST_ELEMENTS (bgp
->peer
, node
, nnode
, peer
))
539 if (stype
== BGP_CLEAR_SOFT_NONE
)
540 ret
= peer_clear (peer
, &nnode
);
541 else if (peer
->afc
[afi
][safi
])
542 ret
= peer_clear_soft (peer
, afi
, safi
, stype
);
547 bgp_clear_vty_error (vty
, peer
, afi
, safi
, ret
);
550 /* This is to apply read-only mode on this clear. */
551 if (stype
== BGP_CLEAR_SOFT_NONE
)
552 bgp
->update_delay_over
= 0;
557 /* Clear specified neighbors. */
558 if (sort
== clear_peer
)
563 /* Make sockunion for lookup. */
564 ret
= str2sockunion (arg
, &su
);
567 peer
= peer_lookup_by_conf_if (bgp
, arg
);
570 peer
= peer_lookup_by_hostname(bgp
, arg
);
573 vty_out (vty
, "Malformed address or name: %s%s", arg
, VTY_NEWLINE
);
580 peer
= peer_lookup (bgp
, &su
);
583 vty_out (vty
, "%%BGP: Unknown neighbor - \"%s\"%s", arg
, VTY_NEWLINE
);
588 if (stype
== BGP_CLEAR_SOFT_NONE
)
589 ret
= peer_clear (peer
, NULL
);
591 ret
= peer_clear_soft (peer
, afi
, safi
, stype
);
594 bgp_clear_vty_error (vty
, peer
, afi
, safi
, ret
);
599 /* Clear all peer-group members. */
600 if (sort
== clear_group
)
602 struct peer_group
*group
;
604 group
= peer_group_lookup (bgp
, arg
);
607 vty_out (vty
, "%%BGP: No such peer-group %s%s", arg
, VTY_NEWLINE
);
611 for (ALL_LIST_ELEMENTS (group
->peer
, node
, nnode
, peer
))
613 if (stype
== BGP_CLEAR_SOFT_NONE
)
615 peer_clear (peer
, NULL
);
619 if (! peer
->afc
[afi
][safi
])
622 ret
= peer_clear_soft (peer
, afi
, safi
, stype
);
625 bgp_clear_vty_error (vty
, peer
, afi
, safi
, ret
);
630 if (sort
== clear_external
)
632 for (ALL_LIST_ELEMENTS (bgp
->peer
, node
, nnode
, peer
))
634 if (peer
->sort
== BGP_PEER_IBGP
)
637 if (stype
== BGP_CLEAR_SOFT_NONE
)
638 ret
= peer_clear (peer
, &nnode
);
640 ret
= peer_clear_soft (peer
, afi
, safi
, stype
);
643 bgp_clear_vty_error (vty
, peer
, afi
, safi
, ret
);
648 if (sort
== clear_as
)
653 VTY_GET_INTEGER_RANGE ("AS", as
, arg
, 1, BGP_AS4_MAX
);
655 for (ALL_LIST_ELEMENTS (bgp
->peer
, node
, nnode
, peer
))
661 if (stype
== BGP_CLEAR_SOFT_NONE
)
662 ret
= peer_clear (peer
, &nnode
);
664 ret
= peer_clear_soft (peer
, afi
, safi
, stype
);
667 bgp_clear_vty_error (vty
, peer
, afi
, safi
, ret
);
670 vty_out (vty
, "%%BGP: No peer is configured with AS %s%s", arg
,
679 bgp_clear_vty (struct vty
*vty
, const char *name
, afi_t afi
, safi_t safi
,
680 enum clear_sort sort
, enum bgp_clear_type stype
,
685 /* BGP structure lookup. */
688 bgp
= bgp_lookup_by_name (name
);
691 vty_out (vty
, "Can't find BGP instance %s%s", name
, VTY_NEWLINE
);
697 bgp
= bgp_get_default ();
700 vty_out (vty
, "No BGP process is configured%s", VTY_NEWLINE
);
705 return bgp_clear (vty
, bgp
, afi
, safi
, sort
, stype
, arg
);
708 /* clear soft inbound */
710 bgp_clear_star_soft_in (struct vty
*vty
, const char *name
)
712 bgp_clear_vty (vty
, name
, AFI_IP
, SAFI_UNICAST
, clear_all
,
713 BGP_CLEAR_SOFT_IN
, NULL
);
714 bgp_clear_vty (vty
, name
, AFI_IP6
, SAFI_UNICAST
, clear_all
,
715 BGP_CLEAR_SOFT_IN
, NULL
);
718 /* clear soft outbound */
720 bgp_clear_star_soft_out (struct vty
*vty
, const char *name
)
722 bgp_clear_vty (vty
, name
, AFI_IP
, SAFI_UNICAST
, clear_all
,
723 BGP_CLEAR_SOFT_OUT
, NULL
);
724 bgp_clear_vty (vty
, name
, AFI_IP6
, SAFI_UNICAST
, clear_all
,
725 BGP_CLEAR_SOFT_OUT
, NULL
);
729 /* BGP global configuration. */
731 DEFUN (bgp_multiple_instance_func
,
732 bgp_multiple_instance_cmd
,
733 "bgp multiple-instance",
735 "Enable bgp multiple instance\n")
737 bgp_option_set (BGP_OPT_MULTIPLE_INSTANCE
);
741 DEFUN (no_bgp_multiple_instance
,
742 no_bgp_multiple_instance_cmd
,
743 "no bgp multiple-instance",
746 "BGP multiple instance\n")
750 ret
= bgp_option_unset (BGP_OPT_MULTIPLE_INSTANCE
);
753 vty_out (vty
, "%% There are more than two BGP instances%s", VTY_NEWLINE
);
759 DEFUN (bgp_config_type
,
761 "bgp config-type <cisco|zebra>",
763 "Configuration type\n"
768 if (strncmp (argv
[idx_vendor
]->arg
, "c", 1) == 0)
769 bgp_option_set (BGP_OPT_CONFIG_CISCO
);
771 bgp_option_unset (BGP_OPT_CONFIG_CISCO
);
776 DEFUN (no_bgp_config_type
,
777 no_bgp_config_type_cmd
,
778 "no bgp config-type [<cisco|zebra>]",
781 "Display configuration type\n"
785 bgp_option_unset (BGP_OPT_CONFIG_CISCO
);
790 DEFUN (no_synchronization
,
791 no_synchronization_cmd
,
792 "no synchronization",
794 "Perform IGP synchronization\n")
799 DEFUN (no_auto_summary
,
803 "Enable automatic network number summarization\n")
808 /* "router bgp" commands. */
809 DEFUN_NOSH (router_bgp
,
811 "router bgp [(1-4294967295) [<view|vrf> WORD]]",
815 BGP_INSTANCE_HELP_STR
)
818 int idx_view_vrf
= 3;
823 const char *name
= NULL
;
824 enum bgp_instance_type inst_type
;
826 // "router bgp" without an ASN
829 //Pending: Make VRF option available for ASN less config
830 bgp
= bgp_get_default();
834 vty_out (vty
, "%% No BGP process is configured%s", VTY_NEWLINE
);
838 if (listcount(bm
->bgp
) > 1)
840 vty_out (vty
, "%% Multiple BGP processes are configured%s", VTY_NEWLINE
);
848 VTY_GET_INTEGER_RANGE ("AS", as
, argv
[idx_asn
]->arg
, 1, BGP_AS4_MAX
);
850 inst_type
= BGP_INSTANCE_TYPE_DEFAULT
;
853 name
= argv
[idx_vrf
]->arg
;
855 if (!strcmp(argv
[idx_view_vrf
]->text
, "vrf"))
856 inst_type
= BGP_INSTANCE_TYPE_VRF
;
857 else if (!strcmp(argv
[idx_view_vrf
]->text
, "view"))
858 inst_type
= BGP_INSTANCE_TYPE_VIEW
;
861 ret
= bgp_get (&bgp
, &as
, name
, inst_type
);
864 case BGP_ERR_MULTIPLE_INSTANCE_NOT_SET
:
865 vty_out (vty
, "Please specify 'bgp multiple-instance' first%s",
868 case BGP_ERR_AS_MISMATCH
:
869 vty_out (vty
, "BGP is already running; AS is %u%s", as
, VTY_NEWLINE
);
871 case BGP_ERR_INSTANCE_MISMATCH
:
872 vty_out (vty
, "BGP instance name and AS number mismatch%s", VTY_NEWLINE
);
873 vty_out (vty
, "BGP instance is already running; AS is %u%s",
878 /* Pending: handle when user tries to change a view to vrf n vv. */
881 VTY_PUSH_CONTEXT(BGP_NODE
, bgp
);
886 /* "no router bgp" commands. */
887 DEFUN (no_router_bgp
,
889 "no router bgp [(1-4294967295) [<view|vrf> WORD]]",
894 BGP_INSTANCE_HELP_STR
)
900 const char *name
= NULL
;
902 // "no router bgp" without an ASN
905 //Pending: Make VRF option available for ASN less config
906 bgp
= bgp_get_default();
910 vty_out (vty
, "%% No BGP process is configured%s", VTY_NEWLINE
);
914 if (listcount(bm
->bgp
) > 1)
916 vty_out (vty
, "%% Multiple BGP processes are configured%s", VTY_NEWLINE
);
922 VTY_GET_INTEGER_RANGE ("AS", as
, argv
[idx_asn
]->arg
, 1, BGP_AS4_MAX
);
925 name
= argv
[idx_vrf
]->arg
;
927 /* Lookup bgp structure. */
928 bgp
= bgp_lookup (as
, name
);
931 vty_out (vty
, "%% Can't find BGP instance%s", VTY_NEWLINE
);
945 DEFUN (bgp_router_id
,
947 "bgp router-id A.B.C.D",
949 "Override configured router identifier\n"
950 "Manually configured router identifier\n")
952 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
957 ret
= inet_aton (argv
[idx_ipv4
]->arg
, &id
);
960 vty_out (vty
, "%% Malformed bgp router identifier%s", VTY_NEWLINE
);
964 bgp_router_id_static_set (bgp
, id
);
969 DEFUN (no_bgp_router_id
,
970 no_bgp_router_id_cmd
,
971 "no bgp router-id [A.B.C.D]",
974 "Override configured router identifier\n"
975 "Manually configured router identifier\n")
977 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
978 int idx_router_id
= 3;
982 if (argc
> idx_router_id
)
984 ret
= inet_aton (argv
[idx_router_id
]->arg
, &id
);
987 vty_out (vty
, "%% Malformed BGP router identifier%s", VTY_NEWLINE
);
991 if (! IPV4_ADDR_SAME (&bgp
->router_id_static
, &id
))
993 vty_out (vty
, "%% BGP router-id doesn't match%s", VTY_NEWLINE
);
999 bgp_router_id_static_set (bgp
, id
);
1005 /* BGP Cluster ID. */
1006 DEFUN (bgp_cluster_id
,
1008 "bgp cluster-id <A.B.C.D|(1-4294967295)>",
1010 "Configure Route-Reflector Cluster-id\n"
1011 "Route-Reflector Cluster-id in IP address format\n"
1012 "Route-Reflector Cluster-id as 32 bit quantity\n")
1014 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1017 struct in_addr cluster
;
1019 ret
= inet_aton (argv
[idx_ipv4
]->arg
, &cluster
);
1022 vty_out (vty
, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE
);
1026 bgp_cluster_id_set (bgp
, &cluster
);
1027 bgp_clear_star_soft_out (vty
, bgp
->name
);
1032 DEFUN (no_bgp_cluster_id
,
1033 no_bgp_cluster_id_cmd
,
1034 "no bgp cluster-id [<A.B.C.D|(1-4294967295)>]",
1037 "Configure Route-Reflector Cluster-id\n"
1038 "Route-Reflector Cluster-id in IP address format\n"
1039 "Route-Reflector Cluster-id as 32 bit quantity\n")
1041 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1042 bgp_cluster_id_unset (bgp
);
1043 bgp_clear_star_soft_out (vty
, bgp
->name
);
1048 DEFUN (bgp_confederation_identifier
,
1049 bgp_confederation_identifier_cmd
,
1050 "bgp confederation identifier (1-4294967295)",
1051 "BGP specific commands\n"
1052 "AS confederation parameters\n"
1054 "Set routing domain confederation AS\n")
1056 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1060 VTY_GET_INTEGER_RANGE ("AS", as
, argv
[idx_number
]->arg
, 1, BGP_AS4_MAX
);
1062 bgp_confederation_id_set (bgp
, as
);
1067 DEFUN (no_bgp_confederation_identifier
,
1068 no_bgp_confederation_identifier_cmd
,
1069 "no bgp confederation identifier [(1-4294967295)]",
1071 "BGP specific commands\n"
1072 "AS confederation parameters\n"
1074 "Set routing domain confederation AS\n")
1076 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1077 bgp_confederation_id_unset (bgp
);
1082 DEFUN (bgp_confederation_peers
,
1083 bgp_confederation_peers_cmd
,
1084 "bgp confederation peers (1-4294967295)...",
1085 "BGP specific commands\n"
1086 "AS confederation parameters\n"
1087 "Peer ASs in BGP confederation\n"
1090 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1095 for (i
= idx_asn
; i
< argc
; i
++)
1097 VTY_GET_INTEGER_RANGE ("AS", as
, argv
[i
]->arg
, 1, BGP_AS4_MAX
);
1101 vty_out (vty
, "%% Local member-AS not allowed in confed peer list%s",
1106 bgp_confederation_peers_add (bgp
, as
);
1111 DEFUN (no_bgp_confederation_peers
,
1112 no_bgp_confederation_peers_cmd
,
1113 "no bgp confederation peers (1-4294967295)...",
1115 "BGP specific commands\n"
1116 "AS confederation parameters\n"
1117 "Peer ASs in BGP confederation\n"
1120 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1125 for (i
= idx_asn
; i
< argc
; i
++)
1127 VTY_GET_INTEGER_RANGE ("AS", as
, argv
[i
]->arg
, 1, BGP_AS4_MAX
);
1129 bgp_confederation_peers_remove (bgp
, as
);
1135 * Central routine for maximum-paths configuration.
1136 * @peer_type: BGP_PEER_EBGP or BGP_PEER_IBGP
1137 * @set: 1 for setting values, 0 for removing the max-paths config.
1140 bgp_maxpaths_config_vty (struct vty
*vty
, int peer_type
, const char *mpaths
,
1141 u_int16_t options
, int set
)
1143 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1144 u_int16_t maxpaths
= 0;
1149 afi
= bgp_node_afi (vty
);
1150 safi
= bgp_node_safi (vty
);
1154 maxpaths
= strtol(mpaths
, NULL
, 10);
1155 if (maxpaths
> multipath_num
)
1158 "%% Maxpaths Specified: %d is > than multipath num specified on bgp command line %d",
1159 maxpaths
, multipath_num
);
1162 ret
= bgp_maximum_paths_set (bgp
, afi
, safi
, peer_type
, maxpaths
, options
);
1165 ret
= bgp_maximum_paths_unset (bgp
, afi
, safi
, peer_type
);
1170 "%% Failed to %sset maximum-paths %s %u for afi %u, safi %u%s",
1171 (set
== 1) ? "" : "un",
1172 (peer_type
== BGP_PEER_EBGP
) ? "ebgp" : "ibgp",
1173 maxpaths
, afi
, safi
, VTY_NEWLINE
);
1177 bgp_recalculate_all_bestpaths (bgp
);
1182 DEFUN (bgp_maxmed_admin
,
1183 bgp_maxmed_admin_cmd
,
1184 "bgp max-med administrative ",
1186 "Advertise routes with max-med\n"
1187 "Administratively applied, for an indefinite period\n")
1189 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1191 bgp
->v_maxmed_admin
= 1;
1192 bgp
->maxmed_admin_value
= BGP_MAXMED_VALUE_DEFAULT
;
1194 bgp_maxmed_update(bgp
);
1199 DEFUN (bgp_maxmed_admin_medv
,
1200 bgp_maxmed_admin_medv_cmd
,
1201 "bgp max-med administrative (0-4294967294)",
1203 "Advertise routes with max-med\n"
1204 "Administratively applied, for an indefinite period\n"
1205 "Max MED value to be used\n")
1207 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1210 bgp
->v_maxmed_admin
= 1;
1211 VTY_GET_INTEGER ("max-med admin med-value", bgp
->maxmed_admin_value
, argv
[idx_number
]->arg
);
1213 bgp_maxmed_update(bgp
);
1218 DEFUN (no_bgp_maxmed_admin
,
1219 no_bgp_maxmed_admin_cmd
,
1220 "no bgp max-med administrative [(0-4294967294)]",
1223 "Advertise routes with max-med\n"
1224 "Administratively applied, for an indefinite period\n"
1225 "Max MED value to be used\n")
1227 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1228 bgp
->v_maxmed_admin
= BGP_MAXMED_ADMIN_UNCONFIGURED
;
1229 bgp
->maxmed_admin_value
= BGP_MAXMED_VALUE_DEFAULT
;
1230 bgp_maxmed_update(bgp
);
1235 DEFUN (bgp_maxmed_onstartup
,
1236 bgp_maxmed_onstartup_cmd
,
1237 "bgp max-med on-startup (5-86400)",
1239 "Advertise routes with max-med\n"
1240 "Effective on a startup\n"
1241 "Time (seconds) period for max-med\n")
1243 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1245 VTY_GET_INTEGER ("max-med on-startup period", bgp
->v_maxmed_onstartup
, argv
[idx_number
]->arg
);
1246 bgp
->maxmed_onstartup_value
= BGP_MAXMED_VALUE_DEFAULT
;
1247 bgp_maxmed_update(bgp
);
1252 DEFUN (bgp_maxmed_onstartup_medv
,
1253 bgp_maxmed_onstartup_medv_cmd
,
1254 "bgp max-med on-startup (5-86400) (0-4294967294)",
1256 "Advertise routes with max-med\n"
1257 "Effective on a startup\n"
1258 "Time (seconds) period for max-med\n"
1259 "Max MED value to be used\n")
1261 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1263 int idx_number_2
= 4;
1264 VTY_GET_INTEGER ("max-med on-startup period", bgp
->v_maxmed_onstartup
, argv
[idx_number
]->arg
);
1265 VTY_GET_INTEGER ("max-med on-startup med-value", bgp
->maxmed_onstartup_value
, argv
[idx_number_2
]->arg
);
1266 bgp_maxmed_update(bgp
);
1271 DEFUN (no_bgp_maxmed_onstartup
,
1272 no_bgp_maxmed_onstartup_cmd
,
1273 "no bgp max-med on-startup [(5-86400) [(0-4294967294)]]",
1276 "Advertise routes with max-med\n"
1277 "Effective on a startup\n"
1278 "Time (seconds) period for max-med\n"
1279 "Max MED value to be used\n")
1281 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1283 /* Cancel max-med onstartup if its on */
1284 if (bgp
->t_maxmed_onstartup
)
1286 THREAD_TIMER_OFF (bgp
->t_maxmed_onstartup
);
1287 bgp
->maxmed_onstartup_over
= 1;
1290 bgp
->v_maxmed_onstartup
= BGP_MAXMED_ONSTARTUP_UNCONFIGURED
;
1291 bgp
->maxmed_onstartup_value
= BGP_MAXMED_VALUE_DEFAULT
;
1293 bgp_maxmed_update(bgp
);
1299 bgp_update_delay_config_vty (struct vty
*vty
, const char *delay
,
1302 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1303 u_int16_t update_delay
;
1304 u_int16_t establish_wait
;
1306 VTY_GET_INTEGER_RANGE ("update-delay", update_delay
, delay
,
1307 BGP_UPDATE_DELAY_MIN
, BGP_UPDATE_DELAY_MAX
);
1309 if (!wait
) /* update-delay <delay> */
1311 bgp
->v_update_delay
= update_delay
;
1312 bgp
->v_establish_wait
= bgp
->v_update_delay
;
1316 /* update-delay <delay> <establish-wait> */
1317 establish_wait
= atoi (wait
);
1318 if (update_delay
< establish_wait
)
1320 vty_out (vty
, "%%Failed: update-delay less than the establish-wait!%s",
1325 bgp
->v_update_delay
= update_delay
;
1326 bgp
->v_establish_wait
= establish_wait
;
1332 bgp_update_delay_deconfig_vty (struct vty
*vty
)
1334 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1336 bgp
->v_update_delay
= BGP_UPDATE_DELAY_DEF
;
1337 bgp
->v_establish_wait
= bgp
->v_update_delay
;
1343 bgp_config_write_update_delay (struct vty
*vty
, struct bgp
*bgp
)
1345 if (bgp
->v_update_delay
!= BGP_UPDATE_DELAY_DEF
)
1347 vty_out (vty
, " update-delay %d", bgp
->v_update_delay
);
1348 if (bgp
->v_update_delay
!= bgp
->v_establish_wait
)
1349 vty_out (vty
, " %d", bgp
->v_establish_wait
);
1350 vty_out (vty
, "%s", VTY_NEWLINE
);
1357 /* Update-delay configuration */
1358 DEFUN (bgp_update_delay
,
1359 bgp_update_delay_cmd
,
1360 "update-delay (0-3600)",
1361 "Force initial delay for best-path and updates\n"
1365 return bgp_update_delay_config_vty(vty
, argv
[idx_number
]->arg
, NULL
);
1368 DEFUN (bgp_update_delay_establish_wait
,
1369 bgp_update_delay_establish_wait_cmd
,
1370 "update-delay (0-3600) (1-3600)",
1371 "Force initial delay for best-path and updates\n"
1373 "Wait for peers to be established\n"
1377 int idx_number_2
= 2;
1378 return bgp_update_delay_config_vty(vty
, argv
[idx_number
]->arg
, argv
[idx_number_2
]->arg
);
1381 /* Update-delay deconfiguration */
1382 DEFUN (no_bgp_update_delay
,
1383 no_bgp_update_delay_cmd
,
1384 "no update-delay [(0-3600) [(1-3600)]]",
1386 "Force initial delay for best-path and updates\n"
1388 "Wait for peers to be established\n")
1390 return bgp_update_delay_deconfig_vty(vty
);
1395 bgp_wpkt_quanta_config_vty (struct vty
*vty
, const char *num
, char set
)
1397 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1400 VTY_GET_INTEGER_RANGE ("write-quanta", bgp
->wpkt_quanta
, num
,
1403 bgp
->wpkt_quanta
= BGP_WRITE_PACKET_MAX
;
1409 bgp_config_write_wpkt_quanta (struct vty
*vty
, struct bgp
*bgp
)
1411 if (bgp
->wpkt_quanta
!= BGP_WRITE_PACKET_MAX
)
1412 vty_out (vty
, " write-quanta %d%s",
1413 bgp
->wpkt_quanta
, VTY_NEWLINE
);
1419 /* Update-delay configuration */
1420 DEFUN (bgp_wpkt_quanta
,
1421 bgp_wpkt_quanta_cmd
,
1422 "write-quanta (1-10000)",
1423 "How many packets to write to peer socket per run\n"
1424 "Number of packets\n")
1427 return bgp_wpkt_quanta_config_vty(vty
, argv
[idx_number
]->arg
, 1);
1430 /* Update-delay deconfiguration */
1431 DEFUN (no_bgp_wpkt_quanta
,
1432 no_bgp_wpkt_quanta_cmd
,
1433 "no write-quanta (1-10000)",
1435 "How many packets to write to peer socket per run\n"
1436 "Number of packets\n")
1439 return bgp_wpkt_quanta_config_vty(vty
, argv
[idx_number
]->arg
, 0);
1443 bgp_coalesce_config_vty (struct vty
*vty
, const char *num
, char set
)
1445 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1448 VTY_GET_INTEGER_RANGE ("coalesce-time", bgp
->coalesce_time
, num
,
1451 bgp
->coalesce_time
= BGP_DEFAULT_SUBGROUP_COALESCE_TIME
;
1457 bgp_config_write_coalesce_time (struct vty
*vty
, struct bgp
*bgp
)
1459 if (bgp
->coalesce_time
!= BGP_DEFAULT_SUBGROUP_COALESCE_TIME
)
1460 vty_out (vty
, " coalesce-time %d%s",
1461 bgp
->coalesce_time
, VTY_NEWLINE
);
1467 DEFUN (bgp_coalesce_time
,
1468 bgp_coalesce_time_cmd
,
1469 "coalesce-time (0-4294967295)",
1470 "Subgroup coalesce timer\n"
1471 "Subgroup coalesce timer value (in ms)\n")
1474 return bgp_coalesce_config_vty(vty
, argv
[idx_number
]->arg
, 1);
1477 DEFUN (no_bgp_coalesce_time
,
1478 no_bgp_coalesce_time_cmd
,
1479 "no coalesce-time (0-4294967295)",
1481 "Subgroup coalesce timer\n"
1482 "Subgroup coalesce timer value (in ms)\n")
1485 return bgp_coalesce_config_vty(vty
, argv
[idx_number
]->arg
, 0);
1488 /* Maximum-paths configuration */
1489 DEFUN (bgp_maxpaths
,
1491 "maximum-paths (1-255)",
1492 "Forward packets over multiple paths\n"
1493 "Number of paths\n")
1496 return bgp_maxpaths_config_vty(vty
, BGP_PEER_EBGP
, argv
[idx_number
]->arg
, 0, 1);
1499 DEFUN (bgp_maxpaths_ibgp
,
1500 bgp_maxpaths_ibgp_cmd
,
1501 "maximum-paths ibgp (1-255)",
1502 "Forward packets over multiple paths\n"
1504 "Number of paths\n")
1507 return bgp_maxpaths_config_vty(vty
, BGP_PEER_IBGP
, argv
[idx_number
]->arg
, 0, 1);
1510 DEFUN (bgp_maxpaths_ibgp_cluster
,
1511 bgp_maxpaths_ibgp_cluster_cmd
,
1512 "maximum-paths ibgp (1-255) equal-cluster-length",
1513 "Forward packets over multiple paths\n"
1516 "Match the cluster length\n")
1519 return bgp_maxpaths_config_vty(vty
, BGP_PEER_IBGP
, argv
[idx_number
]->arg
,
1520 BGP_FLAG_IBGP_MULTIPATH_SAME_CLUSTERLEN
, 1);
1523 DEFUN (no_bgp_maxpaths
,
1524 no_bgp_maxpaths_cmd
,
1525 "no maximum-paths [(1-255)]",
1527 "Forward packets over multiple paths\n"
1528 "Number of paths\n")
1530 return bgp_maxpaths_config_vty(vty
, BGP_PEER_EBGP
, NULL
, 0, 0);
1533 DEFUN (no_bgp_maxpaths_ibgp
,
1534 no_bgp_maxpaths_ibgp_cmd
,
1535 "no maximum-paths ibgp [(1-255) [equal-cluster-length]]",
1537 "Forward packets over multiple paths\n"
1540 "Match the cluster length\n")
1542 return bgp_maxpaths_config_vty(vty
, BGP_PEER_IBGP
, NULL
, 0, 0);
1546 bgp_config_write_maxpaths (struct vty
*vty
, struct bgp
*bgp
, afi_t afi
,
1547 safi_t safi
, int *write
)
1549 if (bgp
->maxpaths
[afi
][safi
].maxpaths_ebgp
!= MULTIPATH_NUM
)
1551 bgp_config_write_family_header (vty
, afi
, safi
, write
);
1552 vty_out (vty
, " maximum-paths %d%s",
1553 bgp
->maxpaths
[afi
][safi
].maxpaths_ebgp
, VTY_NEWLINE
);
1556 if (bgp
->maxpaths
[afi
][safi
].maxpaths_ibgp
!= MULTIPATH_NUM
)
1558 bgp_config_write_family_header (vty
, afi
, safi
, write
);
1559 vty_out (vty
, " maximum-paths ibgp %d",
1560 bgp
->maxpaths
[afi
][safi
].maxpaths_ibgp
);
1561 if (CHECK_FLAG (bgp
->maxpaths
[afi
][safi
].ibgp_flags
,
1562 BGP_FLAG_IBGP_MULTIPATH_SAME_CLUSTERLEN
))
1563 vty_out (vty
, " equal-cluster-length");
1564 vty_out (vty
, "%s", VTY_NEWLINE
);
1574 "timers bgp (0-65535) (0-65535)",
1575 "Adjust routing timers\n"
1577 "Keepalive interval\n"
1580 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1582 int idx_number_2
= 3;
1583 unsigned long keepalive
= 0;
1584 unsigned long holdtime
= 0;
1586 VTY_GET_INTEGER ("keepalive", keepalive
, argv
[idx_number
]->arg
);
1587 VTY_GET_INTEGER ("holdtime", holdtime
, argv
[idx_number_2
]->arg
);
1589 /* Holdtime value check. */
1590 if (holdtime
< 3 && holdtime
!= 0)
1592 vty_out (vty
, "%% hold time value must be either 0 or greater than 3%s",
1597 bgp_timers_set (bgp
, keepalive
, holdtime
);
1602 DEFUN (no_bgp_timers
,
1604 "no timers bgp [(0-65535) (0-65535)]",
1606 "Adjust routing timers\n"
1608 "Keepalive interval\n"
1611 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1612 bgp_timers_unset (bgp
);
1618 DEFUN (bgp_client_to_client_reflection
,
1619 bgp_client_to_client_reflection_cmd
,
1620 "bgp client-to-client reflection",
1621 "BGP specific commands\n"
1622 "Configure client to client route reflection\n"
1623 "reflection of routes allowed\n")
1625 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1626 bgp_flag_unset (bgp
, BGP_FLAG_NO_CLIENT_TO_CLIENT
);
1627 bgp_clear_star_soft_out (vty
, bgp
->name
);
1632 DEFUN (no_bgp_client_to_client_reflection
,
1633 no_bgp_client_to_client_reflection_cmd
,
1634 "no bgp client-to-client reflection",
1636 "BGP specific commands\n"
1637 "Configure client to client route reflection\n"
1638 "reflection of routes allowed\n")
1640 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1641 bgp_flag_set (bgp
, BGP_FLAG_NO_CLIENT_TO_CLIENT
);
1642 bgp_clear_star_soft_out (vty
, bgp
->name
);
1647 /* "bgp always-compare-med" configuration. */
1648 DEFUN (bgp_always_compare_med
,
1649 bgp_always_compare_med_cmd
,
1650 "bgp always-compare-med",
1651 "BGP specific commands\n"
1652 "Allow comparing MED from different neighbors\n")
1654 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1655 bgp_flag_set (bgp
, BGP_FLAG_ALWAYS_COMPARE_MED
);
1656 bgp_recalculate_all_bestpaths (bgp
);
1661 DEFUN (no_bgp_always_compare_med
,
1662 no_bgp_always_compare_med_cmd
,
1663 "no bgp always-compare-med",
1665 "BGP specific commands\n"
1666 "Allow comparing MED from different neighbors\n")
1668 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1669 bgp_flag_unset (bgp
, BGP_FLAG_ALWAYS_COMPARE_MED
);
1670 bgp_recalculate_all_bestpaths (bgp
);
1675 /* "bgp deterministic-med" configuration. */
1676 DEFUN (bgp_deterministic_med
,
1677 bgp_deterministic_med_cmd
,
1678 "bgp deterministic-med",
1679 "BGP specific commands\n"
1680 "Pick the best-MED path among paths advertised from the neighboring AS\n")
1682 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1684 if (!bgp_flag_check(bgp
, BGP_FLAG_DETERMINISTIC_MED
))
1686 bgp_flag_set (bgp
, BGP_FLAG_DETERMINISTIC_MED
);
1687 bgp_recalculate_all_bestpaths (bgp
);
1693 DEFUN (no_bgp_deterministic_med
,
1694 no_bgp_deterministic_med_cmd
,
1695 "no bgp deterministic-med",
1697 "BGP specific commands\n"
1698 "Pick the best-MED path among paths advertised from the neighboring AS\n")
1700 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1701 int bestpath_per_as_used
;
1705 struct listnode
*node
, *nnode
;
1707 if (bgp_flag_check(bgp
, BGP_FLAG_DETERMINISTIC_MED
))
1709 bestpath_per_as_used
= 0;
1711 for (ALL_LIST_ELEMENTS (bgp
->peer
, node
, nnode
, peer
))
1713 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
1714 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
1715 if (CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_ADDPATH_TX_BESTPATH_PER_AS
))
1717 bestpath_per_as_used
= 1;
1721 if (bestpath_per_as_used
)
1725 if (bestpath_per_as_used
)
1727 vty_out (vty
, "bgp deterministic-med cannot be disabled while addpath-tx-bestpath-per-AS is in use%s",
1733 bgp_flag_unset (bgp
, BGP_FLAG_DETERMINISTIC_MED
);
1734 bgp_recalculate_all_bestpaths (bgp
);
1741 /* "bgp graceful-restart" configuration. */
1742 DEFUN (bgp_graceful_restart
,
1743 bgp_graceful_restart_cmd
,
1744 "bgp graceful-restart",
1745 "BGP specific commands\n"
1746 "Graceful restart capability parameters\n")
1748 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1749 bgp_flag_set (bgp
, BGP_FLAG_GRACEFUL_RESTART
);
1753 DEFUN (no_bgp_graceful_restart
,
1754 no_bgp_graceful_restart_cmd
,
1755 "no bgp graceful-restart",
1757 "BGP specific commands\n"
1758 "Graceful restart capability parameters\n")
1760 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1761 bgp_flag_unset (bgp
, BGP_FLAG_GRACEFUL_RESTART
);
1765 DEFUN (bgp_graceful_restart_stalepath_time
,
1766 bgp_graceful_restart_stalepath_time_cmd
,
1767 "bgp graceful-restart stalepath-time (1-3600)",
1768 "BGP specific commands\n"
1769 "Graceful restart capability parameters\n"
1770 "Set the max time to hold onto restarting peer's stale paths\n"
1771 "Delay value (seconds)\n")
1773 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1775 u_int32_t stalepath
;
1777 VTY_GET_INTEGER_RANGE ("stalepath-time", stalepath
, argv
[idx_number
]->arg
, 1, 3600);
1778 bgp
->stalepath_time
= stalepath
;
1782 DEFUN (bgp_graceful_restart_restart_time
,
1783 bgp_graceful_restart_restart_time_cmd
,
1784 "bgp graceful-restart restart-time (1-3600)",
1785 "BGP specific commands\n"
1786 "Graceful restart capability parameters\n"
1787 "Set the time to wait to delete stale routes before a BGP open message is received\n"
1788 "Delay value (seconds)\n")
1790 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1794 VTY_GET_INTEGER_RANGE ("restart-time", restart
, argv
[idx_number
]->arg
, 1, 3600);
1795 bgp
->restart_time
= restart
;
1799 DEFUN (no_bgp_graceful_restart_stalepath_time
,
1800 no_bgp_graceful_restart_stalepath_time_cmd
,
1801 "no bgp graceful-restart stalepath-time [(1-3600)]",
1803 "BGP specific commands\n"
1804 "Graceful restart capability parameters\n"
1805 "Set the max time to hold onto restarting peer's stale paths\n"
1806 "Delay value (seconds)\n")
1808 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1810 bgp
->stalepath_time
= BGP_DEFAULT_STALEPATH_TIME
;
1814 DEFUN (no_bgp_graceful_restart_restart_time
,
1815 no_bgp_graceful_restart_restart_time_cmd
,
1816 "no bgp graceful-restart restart-time [(1-3600)]",
1818 "BGP specific commands\n"
1819 "Graceful restart capability parameters\n"
1820 "Set the time to wait to delete stale routes before a BGP open message is received\n"
1821 "Delay value (seconds)\n")
1823 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1825 bgp
->restart_time
= BGP_DEFAULT_RESTART_TIME
;
1829 DEFUN (bgp_graceful_restart_preserve_fw
,
1830 bgp_graceful_restart_preserve_fw_cmd
,
1831 "bgp graceful-restart preserve-fw-state",
1832 "BGP specific commands\n"
1833 "Graceful restart capability parameters\n"
1834 "Sets F-bit indication that fib is preserved while doing Graceful Restart\n")
1836 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1837 bgp_flag_set(bgp
, BGP_FLAG_GR_PRESERVE_FWD
);
1841 DEFUN (no_bgp_graceful_restart_preserve_fw
,
1842 no_bgp_graceful_restart_preserve_fw_cmd
,
1843 "no bgp graceful-restart preserve-fw-state",
1845 "BGP specific commands\n"
1846 "Graceful restart capability parameters\n"
1847 "Unsets F-bit indication that fib is preserved while doing Graceful Restart\n")
1849 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1850 bgp_flag_unset(bgp
, BGP_FLAG_GR_PRESERVE_FWD
);
1854 /* "bgp fast-external-failover" configuration. */
1855 DEFUN (bgp_fast_external_failover
,
1856 bgp_fast_external_failover_cmd
,
1857 "bgp fast-external-failover",
1859 "Immediately reset session if a link to a directly connected external peer goes down\n")
1861 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1862 bgp_flag_unset (bgp
, BGP_FLAG_NO_FAST_EXT_FAILOVER
);
1866 DEFUN (no_bgp_fast_external_failover
,
1867 no_bgp_fast_external_failover_cmd
,
1868 "no bgp fast-external-failover",
1871 "Immediately reset session if a link to a directly connected external peer goes down\n")
1873 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1874 bgp_flag_set (bgp
, BGP_FLAG_NO_FAST_EXT_FAILOVER
);
1878 /* "bgp enforce-first-as" configuration. */
1879 DEFUN (bgp_enforce_first_as
,
1880 bgp_enforce_first_as_cmd
,
1881 "bgp enforce-first-as",
1883 "Enforce the first AS for EBGP routes\n")
1885 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1886 bgp_flag_set (bgp
, BGP_FLAG_ENFORCE_FIRST_AS
);
1887 bgp_clear_star_soft_in (vty
, bgp
->name
);
1892 DEFUN (no_bgp_enforce_first_as
,
1893 no_bgp_enforce_first_as_cmd
,
1894 "no bgp enforce-first-as",
1897 "Enforce the first AS for EBGP routes\n")
1899 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1900 bgp_flag_unset (bgp
, BGP_FLAG_ENFORCE_FIRST_AS
);
1901 bgp_clear_star_soft_in (vty
, bgp
->name
);
1906 /* "bgp bestpath compare-routerid" configuration. */
1907 DEFUN (bgp_bestpath_compare_router_id
,
1908 bgp_bestpath_compare_router_id_cmd
,
1909 "bgp bestpath compare-routerid",
1910 "BGP specific commands\n"
1911 "Change the default bestpath selection\n"
1912 "Compare router-id for identical EBGP paths\n")
1914 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1915 bgp_flag_set (bgp
, BGP_FLAG_COMPARE_ROUTER_ID
);
1916 bgp_recalculate_all_bestpaths (bgp
);
1921 DEFUN (no_bgp_bestpath_compare_router_id
,
1922 no_bgp_bestpath_compare_router_id_cmd
,
1923 "no bgp bestpath compare-routerid",
1925 "BGP specific commands\n"
1926 "Change the default bestpath selection\n"
1927 "Compare router-id for identical EBGP paths\n")
1929 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1930 bgp_flag_unset (bgp
, BGP_FLAG_COMPARE_ROUTER_ID
);
1931 bgp_recalculate_all_bestpaths (bgp
);
1936 /* "bgp bestpath as-path ignore" configuration. */
1937 DEFUN (bgp_bestpath_aspath_ignore
,
1938 bgp_bestpath_aspath_ignore_cmd
,
1939 "bgp bestpath as-path ignore",
1940 "BGP specific commands\n"
1941 "Change the default bestpath selection\n"
1942 "AS-path attribute\n"
1943 "Ignore as-path length in selecting a route\n")
1945 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1946 bgp_flag_set (bgp
, BGP_FLAG_ASPATH_IGNORE
);
1947 bgp_recalculate_all_bestpaths (bgp
);
1952 DEFUN (no_bgp_bestpath_aspath_ignore
,
1953 no_bgp_bestpath_aspath_ignore_cmd
,
1954 "no bgp bestpath as-path ignore",
1956 "BGP specific commands\n"
1957 "Change the default bestpath selection\n"
1958 "AS-path attribute\n"
1959 "Ignore as-path length in selecting a route\n")
1961 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1962 bgp_flag_unset (bgp
, BGP_FLAG_ASPATH_IGNORE
);
1963 bgp_recalculate_all_bestpaths (bgp
);
1968 /* "bgp bestpath as-path confed" configuration. */
1969 DEFUN (bgp_bestpath_aspath_confed
,
1970 bgp_bestpath_aspath_confed_cmd
,
1971 "bgp bestpath as-path confed",
1972 "BGP specific commands\n"
1973 "Change the default bestpath selection\n"
1974 "AS-path attribute\n"
1975 "Compare path lengths including confederation sets & sequences in selecting a route\n")
1977 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1978 bgp_flag_set (bgp
, BGP_FLAG_ASPATH_CONFED
);
1979 bgp_recalculate_all_bestpaths (bgp
);
1984 DEFUN (no_bgp_bestpath_aspath_confed
,
1985 no_bgp_bestpath_aspath_confed_cmd
,
1986 "no bgp bestpath as-path confed",
1988 "BGP specific commands\n"
1989 "Change the default bestpath selection\n"
1990 "AS-path attribute\n"
1991 "Compare path lengths including confederation sets & sequences in selecting a route\n")
1993 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1994 bgp_flag_unset (bgp
, BGP_FLAG_ASPATH_CONFED
);
1995 bgp_recalculate_all_bestpaths (bgp
);
2000 /* "bgp bestpath as-path multipath-relax" configuration. */
2001 DEFUN (bgp_bestpath_aspath_multipath_relax
,
2002 bgp_bestpath_aspath_multipath_relax_cmd
,
2003 "bgp bestpath as-path multipath-relax [<as-set|no-as-set>]",
2004 "BGP specific commands\n"
2005 "Change the default bestpath selection\n"
2006 "AS-path attribute\n"
2007 "Allow load sharing across routes that have different AS paths (but same length)\n"
2008 "Generate an AS_SET\n"
2009 "Do not generate an AS_SET\n")
2011 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2013 bgp_flag_set (bgp
, BGP_FLAG_ASPATH_MULTIPATH_RELAX
);
2015 /* no-as-set is now the default behavior so we can silently
2017 if (argv_find (argv
, argc
, "as-set", &idx
))
2018 bgp_flag_set (bgp
, BGP_FLAG_MULTIPATH_RELAX_AS_SET
);
2020 bgp_flag_unset (bgp
, BGP_FLAG_MULTIPATH_RELAX_AS_SET
) ;
2022 bgp_recalculate_all_bestpaths (bgp
);
2027 DEFUN (no_bgp_bestpath_aspath_multipath_relax
,
2028 no_bgp_bestpath_aspath_multipath_relax_cmd
,
2029 "no bgp bestpath as-path multipath-relax [<as-set|no-as-set>]",
2031 "BGP specific commands\n"
2032 "Change the default bestpath selection\n"
2033 "AS-path attribute\n"
2034 "Allow load sharing across routes that have different AS paths (but same length)\n"
2035 "Generate an AS_SET\n"
2036 "Do not generate an AS_SET\n")
2038 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2039 bgp_flag_unset (bgp
, BGP_FLAG_ASPATH_MULTIPATH_RELAX
);
2040 bgp_flag_unset (bgp
, BGP_FLAG_MULTIPATH_RELAX_AS_SET
);
2041 bgp_recalculate_all_bestpaths (bgp
);
2046 /* "bgp log-neighbor-changes" configuration. */
2047 DEFUN (bgp_log_neighbor_changes
,
2048 bgp_log_neighbor_changes_cmd
,
2049 "bgp log-neighbor-changes",
2050 "BGP specific commands\n"
2051 "Log neighbor up/down and reset reason\n")
2053 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2054 bgp_flag_set (bgp
, BGP_FLAG_LOG_NEIGHBOR_CHANGES
);
2058 DEFUN (no_bgp_log_neighbor_changes
,
2059 no_bgp_log_neighbor_changes_cmd
,
2060 "no bgp log-neighbor-changes",
2062 "BGP specific commands\n"
2063 "Log neighbor up/down and reset reason\n")
2065 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2066 bgp_flag_unset (bgp
, BGP_FLAG_LOG_NEIGHBOR_CHANGES
);
2070 /* "bgp bestpath med" configuration. */
2071 DEFUN (bgp_bestpath_med
,
2072 bgp_bestpath_med_cmd
,
2073 "bgp bestpath med <confed [missing-as-worst]|missing-as-worst [confed]>",
2074 "BGP specific commands\n"
2075 "Change the default bestpath selection\n"
2077 "Compare MED among confederation paths\n"
2078 "Treat missing MED as the least preferred one\n"
2079 "Treat missing MED as the least preferred one\n"
2080 "Compare MED among confederation paths\n")
2082 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2085 if (argv_find (argv
, argc
, "confed", &idx
))
2086 bgp_flag_set (bgp
, BGP_FLAG_MED_CONFED
);
2088 if (argv_find (argv
, argc
, "missing-as-worst", &idx
))
2089 bgp_flag_set (bgp
, BGP_FLAG_MED_MISSING_AS_WORST
);
2091 bgp_recalculate_all_bestpaths (bgp
);
2096 DEFUN (no_bgp_bestpath_med
,
2097 no_bgp_bestpath_med_cmd
,
2098 "no bgp bestpath med <confed [missing-as-worst]|missing-as-worst [confed]>",
2100 "BGP specific commands\n"
2101 "Change the default bestpath selection\n"
2103 "Compare MED among confederation paths\n"
2104 "Treat missing MED as the least preferred one\n"
2105 "Treat missing MED as the least preferred one\n"
2106 "Compare MED among confederation paths\n")
2108 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2111 if (argv_find (argv
, argc
, "confed", &idx
))
2112 bgp_flag_unset (bgp
, BGP_FLAG_MED_CONFED
);
2114 if (argv_find (argv
, argc
, "missing-as-worst", &idx
))
2115 bgp_flag_unset (bgp
, BGP_FLAG_MED_MISSING_AS_WORST
);
2117 bgp_recalculate_all_bestpaths (bgp
);
2122 /* "no bgp default ipv4-unicast". */
2123 DEFUN (no_bgp_default_ipv4_unicast
,
2124 no_bgp_default_ipv4_unicast_cmd
,
2125 "no bgp default ipv4-unicast",
2127 "BGP specific commands\n"
2128 "Configure BGP defaults\n"
2129 "Activate ipv4-unicast for a peer by default\n")
2131 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2132 bgp_flag_set (bgp
, BGP_FLAG_NO_DEFAULT_IPV4
);
2136 DEFUN (bgp_default_ipv4_unicast
,
2137 bgp_default_ipv4_unicast_cmd
,
2138 "bgp default ipv4-unicast",
2139 "BGP specific commands\n"
2140 "Configure BGP defaults\n"
2141 "Activate ipv4-unicast for a peer by default\n")
2143 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2144 bgp_flag_unset (bgp
, BGP_FLAG_NO_DEFAULT_IPV4
);
2148 /* Display hostname in certain command outputs */
2149 DEFUN (bgp_default_show_hostname
,
2150 bgp_default_show_hostname_cmd
,
2151 "bgp default show-hostname",
2152 "BGP specific commands\n"
2153 "Configure BGP defaults\n"
2154 "Show hostname in certain command ouputs\n")
2156 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2157 bgp_flag_set (bgp
, BGP_FLAG_SHOW_HOSTNAME
);
2161 DEFUN (no_bgp_default_show_hostname
,
2162 no_bgp_default_show_hostname_cmd
,
2163 "no bgp default show-hostname",
2165 "BGP specific commands\n"
2166 "Configure BGP defaults\n"
2167 "Show hostname in certain command ouputs\n")
2169 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2170 bgp_flag_unset (bgp
, BGP_FLAG_SHOW_HOSTNAME
);
2174 /* "bgp network import-check" configuration. */
2175 DEFUN (bgp_network_import_check
,
2176 bgp_network_import_check_cmd
,
2177 "bgp network import-check",
2178 "BGP specific commands\n"
2179 "BGP network command\n"
2180 "Check BGP network route exists in IGP\n")
2182 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2183 if (!bgp_flag_check(bgp
, BGP_FLAG_IMPORT_CHECK
))
2185 bgp_flag_set (bgp
, BGP_FLAG_IMPORT_CHECK
);
2186 bgp_static_redo_import_check(bgp
);
2192 ALIAS_HIDDEN (bgp_network_import_check
,
2193 bgp_network_import_check_exact_cmd
,
2194 "bgp network import-check exact",
2195 "BGP specific commands\n"
2196 "BGP network command\n"
2197 "Check BGP network route exists in IGP\n"
2198 "Match route precisely\n")
2200 DEFUN (no_bgp_network_import_check
,
2201 no_bgp_network_import_check_cmd
,
2202 "no bgp network import-check",
2204 "BGP specific commands\n"
2205 "BGP network command\n"
2206 "Check BGP network route exists in IGP\n")
2208 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2209 if (bgp_flag_check(bgp
, BGP_FLAG_IMPORT_CHECK
))
2211 bgp_flag_unset (bgp
, BGP_FLAG_IMPORT_CHECK
);
2212 bgp_static_redo_import_check(bgp
);
2218 DEFUN (bgp_default_local_preference
,
2219 bgp_default_local_preference_cmd
,
2220 "bgp default local-preference (0-4294967295)",
2221 "BGP specific commands\n"
2222 "Configure BGP defaults\n"
2223 "local preference (higher=more preferred)\n"
2224 "Configure default local preference value\n")
2226 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2228 u_int32_t local_pref
;
2230 VTY_GET_INTEGER ("local preference", local_pref
, argv
[idx_number
]->arg
);
2232 bgp_default_local_preference_set (bgp
, local_pref
);
2233 bgp_clear_star_soft_in (vty
, bgp
->name
);
2238 DEFUN (no_bgp_default_local_preference
,
2239 no_bgp_default_local_preference_cmd
,
2240 "no bgp default local-preference [(0-4294967295)]",
2242 "BGP specific commands\n"
2243 "Configure BGP defaults\n"
2244 "local preference (higher=more preferred)\n"
2245 "Configure default local preference value\n")
2247 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2248 bgp_default_local_preference_unset (bgp
);
2249 bgp_clear_star_soft_in (vty
, bgp
->name
);
2255 DEFUN (bgp_default_subgroup_pkt_queue_max
,
2256 bgp_default_subgroup_pkt_queue_max_cmd
,
2257 "bgp default subgroup-pkt-queue-max (20-100)",
2258 "BGP specific commands\n"
2259 "Configure BGP defaults\n"
2260 "subgroup-pkt-queue-max\n"
2261 "Configure subgroup packet queue max\n")
2263 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2267 VTY_GET_INTEGER ("subgroup packet queue max", max_size
, argv
[idx_number
]->arg
);
2269 bgp_default_subgroup_pkt_queue_max_set (bgp
, max_size
);
2274 DEFUN (no_bgp_default_subgroup_pkt_queue_max
,
2275 no_bgp_default_subgroup_pkt_queue_max_cmd
,
2276 "no bgp default subgroup-pkt-queue-max [(20-100)]",
2278 "BGP specific commands\n"
2279 "Configure BGP defaults\n"
2280 "subgroup-pkt-queue-max\n"
2281 "Configure subgroup packet queue max\n")
2283 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2284 bgp_default_subgroup_pkt_queue_max_unset (bgp
);
2289 DEFUN (bgp_rr_allow_outbound_policy
,
2290 bgp_rr_allow_outbound_policy_cmd
,
2291 "bgp route-reflector allow-outbound-policy",
2292 "BGP specific commands\n"
2293 "Allow modifications made by out route-map\n"
2294 "on ibgp neighbors\n")
2296 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2298 if (!bgp_flag_check(bgp
, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY
))
2300 bgp_flag_set(bgp
, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY
);
2301 update_group_announce_rrclients(bgp
);
2302 bgp_clear_star_soft_out (vty
, bgp
->name
);
2308 DEFUN (no_bgp_rr_allow_outbound_policy
,
2309 no_bgp_rr_allow_outbound_policy_cmd
,
2310 "no bgp route-reflector allow-outbound-policy",
2312 "BGP specific commands\n"
2313 "Allow modifications made by out route-map\n"
2314 "on ibgp neighbors\n")
2316 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2318 if (bgp_flag_check(bgp
, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY
))
2320 bgp_flag_unset(bgp
, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY
);
2321 update_group_announce_rrclients(bgp
);
2322 bgp_clear_star_soft_out (vty
, bgp
->name
);
2328 DEFUN (bgp_listen_limit
,
2329 bgp_listen_limit_cmd
,
2330 "bgp listen limit (1-5000)",
2331 "BGP specific commands\n"
2332 "Configure BGP defaults\n"
2333 "maximum number of BGP Dynamic Neighbors that can be created\n"
2334 "Configure Dynamic Neighbors listen limit value\n")
2336 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2340 VTY_GET_INTEGER_RANGE ("listen limit", listen_limit
, argv
[idx_number
]->arg
,
2341 BGP_DYNAMIC_NEIGHBORS_LIMIT_MIN
,
2342 BGP_DYNAMIC_NEIGHBORS_LIMIT_MAX
);
2344 bgp_listen_limit_set (bgp
, listen_limit
);
2349 DEFUN (no_bgp_listen_limit
,
2350 no_bgp_listen_limit_cmd
,
2351 "no bgp listen limit [(1-5000)]",
2352 "BGP specific commands\n"
2353 "Configure BGP defaults\n"
2354 "unset maximum number of BGP Dynamic Neighbors that can be created\n"
2355 "Configure Dynamic Neighbors listen limit value to default\n"
2356 "Configure Dynamic Neighbors listen limit value\n")
2358 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2359 bgp_listen_limit_unset (bgp
);
2365 * Check if this listen range is already configured. Check for exact
2366 * match or overlap based on input.
2368 static struct peer_group
*
2369 listen_range_exists (struct bgp
*bgp
, struct prefix
*range
, int exact
)
2371 struct listnode
*node
, *nnode
;
2372 struct listnode
*node1
, *nnode1
;
2373 struct peer_group
*group
;
2378 afi
= family2afi(range
->family
);
2379 for (ALL_LIST_ELEMENTS (bgp
->group
, node
, nnode
, group
))
2381 for (ALL_LIST_ELEMENTS (group
->listen_range
[afi
], node1
,
2385 match
= prefix_same (range
, lr
);
2387 match
= (prefix_match (range
, lr
) || prefix_match (lr
, range
));
2396 DEFUN (bgp_listen_range
,
2397 bgp_listen_range_cmd
,
2398 "bgp listen range <A.B.C.D/M|X:X::X:X/M> peer-group WORD",
2399 "BGP specific commands\n"
2400 "Configure BGP dynamic neighbors listen range\n"
2401 "Configure BGP dynamic neighbors listen range\n"
2403 "Member of the peer-group\n"
2404 "Peer-group name\n")
2406 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2407 struct prefix range
;
2408 struct peer_group
*group
, *existing_group
;
2413 argv_find (argv
, argc
, "A.B.C.D/M", &idx
);
2414 argv_find (argv
, argc
, "X:X::X:X/M", &idx
);
2415 char *prefix
= argv
[idx
]->arg
;
2416 argv_find (argv
, argc
, "WORD", &idx
);
2417 char *peergroup
= argv
[idx
]->arg
;
2419 /* Convert IP prefix string to struct prefix. */
2420 ret
= str2prefix (prefix
, &range
);
2423 vty_out (vty
, "%% Malformed listen range%s", VTY_NEWLINE
);
2427 afi
= family2afi(range
.family
);
2429 if (afi
== AFI_IP6
&& IN6_IS_ADDR_LINKLOCAL (&range
.u
.prefix6
))
2431 vty_out (vty
, "%% Malformed listen range (link-local address)%s",
2436 apply_mask (&range
);
2438 /* Check if same listen range is already configured. */
2439 existing_group
= listen_range_exists (bgp
, &range
, 1);
2442 if (strcmp (existing_group
->name
, peergroup
) == 0)
2446 vty_out (vty
, "%% Same listen range is attached to peer-group %s%s",
2447 existing_group
->name
, VTY_NEWLINE
);
2452 /* Check if an overlapping listen range exists. */
2453 if (listen_range_exists (bgp
, &range
, 0))
2455 vty_out (vty
, "%% Listen range overlaps with existing listen range%s",
2460 group
= peer_group_lookup (bgp
, peergroup
);
2463 vty_out (vty
, "%% Configure the peer-group first%s", VTY_NEWLINE
);
2467 ret
= peer_group_listen_range_add(group
, &range
);
2468 return bgp_vty_return (vty
, ret
);
2471 DEFUN (no_bgp_listen_range
,
2472 no_bgp_listen_range_cmd
,
2473 "no bgp listen range <A.B.C.D/M|X:X::X:X/M> peer-group WORD",
2475 "BGP specific commands\n"
2476 "Unconfigure BGP dynamic neighbors listen range\n"
2477 "Unconfigure BGP dynamic neighbors listen range\n"
2479 "Member of the peer-group\n"
2480 "Peer-group name\n")
2482 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2483 struct prefix range
;
2484 struct peer_group
*group
;
2489 argv_find (argv
, argc
, "A.B.C.D/M", &idx
);
2490 argv_find (argv
, argc
, "X:X::X:X/M", &idx
);
2491 char *prefix
= argv
[idx
]->arg
;
2492 argv_find (argv
, argc
, "WORD", &idx
);
2493 char *peergroup
= argv
[idx
]->arg
;
2495 // VTY_GET_IPV4_PREFIX ("listen range", range, argv[idx_ipv4_prefixlen]->arg);
2497 /* Convert IP prefix string to struct prefix. */
2498 ret
= str2prefix (prefix
, &range
);
2501 vty_out (vty
, "%% Malformed listen range%s", VTY_NEWLINE
);
2505 afi
= family2afi(range
.family
);
2507 if (afi
== AFI_IP6
&& IN6_IS_ADDR_LINKLOCAL (&range
.u
.prefix6
))
2509 vty_out (vty
, "%% Malformed listen range (link-local address)%s",
2514 apply_mask (&range
);
2516 group
= peer_group_lookup (bgp
, peergroup
);
2519 vty_out (vty
, "%% Peer-group does not exist%s", VTY_NEWLINE
);
2523 ret
= peer_group_listen_range_del(group
, &range
);
2524 return bgp_vty_return (vty
, ret
);
2528 bgp_config_write_listen (struct vty
*vty
, struct bgp
*bgp
)
2530 struct peer_group
*group
;
2531 struct listnode
*node
, *nnode
, *rnode
, *nrnode
;
2532 struct prefix
*range
;
2534 char buf
[PREFIX2STR_BUFFER
];
2536 if (bgp
->dynamic_neighbors_limit
!= BGP_DYNAMIC_NEIGHBORS_LIMIT_DEFAULT
)
2537 vty_out (vty
, " bgp listen limit %d%s",
2538 bgp
->dynamic_neighbors_limit
, VTY_NEWLINE
);
2540 for (ALL_LIST_ELEMENTS (bgp
->group
, node
, nnode
, group
))
2542 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
2544 for (ALL_LIST_ELEMENTS (group
->listen_range
[afi
], rnode
, nrnode
, range
))
2546 prefix2str(range
, buf
, sizeof(buf
));
2547 vty_out(vty
, " bgp listen range %s peer-group %s%s",
2548 buf
, group
->name
, VTY_NEWLINE
);
2557 DEFUN (bgp_disable_connected_route_check
,
2558 bgp_disable_connected_route_check_cmd
,
2559 "bgp disable-ebgp-connected-route-check",
2560 "BGP specific commands\n"
2561 "Disable checking if nexthop is connected on ebgp sessions\n")
2563 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2564 bgp_flag_set (bgp
, BGP_FLAG_DISABLE_NH_CONNECTED_CHK
);
2565 bgp_clear_star_soft_in (vty
, bgp
->name
);
2570 DEFUN (no_bgp_disable_connected_route_check
,
2571 no_bgp_disable_connected_route_check_cmd
,
2572 "no bgp disable-ebgp-connected-route-check",
2574 "BGP specific commands\n"
2575 "Disable checking if nexthop is connected on ebgp sessions\n")
2577 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2578 bgp_flag_unset (bgp
, BGP_FLAG_DISABLE_NH_CONNECTED_CHK
);
2579 bgp_clear_star_soft_in (vty
, bgp
->name
);
2586 peer_remote_as_vty (struct vty
*vty
, const char *peer_str
,
2587 const char *as_str
, afi_t afi
, safi_t safi
)
2589 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2592 int as_type
= AS_SPECIFIED
;
2595 if (as_str
[0] == 'i')
2598 as_type
= AS_INTERNAL
;
2600 else if (as_str
[0] == 'e')
2603 as_type
= AS_EXTERNAL
;
2607 /* Get AS number. */
2608 VTY_GET_INTEGER_RANGE ("AS", as
, as_str
, 1, BGP_AS4_MAX
);
2611 /* If peer is peer group, call proper function. */
2612 ret
= str2sockunion (peer_str
, &su
);
2615 /* Check for peer by interface */
2616 ret
= peer_remote_as (bgp
, NULL
, peer_str
, &as
, as_type
, afi
, safi
);
2619 ret
= peer_group_remote_as (bgp
, peer_str
, &as
, as_type
);
2622 vty_out (vty
, "%% Create the peer-group or interface first%s",
2631 if (peer_address_self_check (bgp
, &su
))
2633 vty_out (vty
, "%% Can not configure the local system as neighbor%s",
2637 ret
= peer_remote_as (bgp
, &su
, NULL
, &as
, as_type
, afi
, safi
);
2640 /* This peer belongs to peer group. */
2643 case BGP_ERR_PEER_GROUP_MEMBER
:
2644 vty_out (vty
, "%% Peer-group AS %u. Cannot configure remote-as for member%s", as
, VTY_NEWLINE
);
2646 case BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT
:
2647 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
);
2650 return bgp_vty_return (vty
, ret
);
2653 DEFUN (neighbor_remote_as
,
2654 neighbor_remote_as_cmd
,
2655 "neighbor <A.B.C.D|X:X::X:X|WORD> remote-as <(1-4294967295)|internal|external>",
2658 "Specify a BGP neighbor\n"
2660 "Internal BGP peer\n"
2661 "External BGP peer\n")
2664 int idx_remote_as
= 3;
2665 return peer_remote_as_vty (vty
, argv
[idx_peer
]->arg
, argv
[idx_remote_as
]->arg
, AFI_IP
, SAFI_UNICAST
);
2669 peer_conf_interface_get (struct vty
*vty
, const char *conf_if
, afi_t afi
,
2670 safi_t safi
, int v6only
, const char *peer_group_name
,
2673 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2675 int as_type
= AS_UNSPECIFIED
;
2677 struct peer_group
*group
;
2681 group
= peer_group_lookup (bgp
, conf_if
);
2685 vty_out (vty
, "%% Name conflict with peer-group %s", VTY_NEWLINE
);
2691 if (as_str
[0] == 'i')
2693 as_type
= AS_INTERNAL
;
2695 else if (as_str
[0] == 'e')
2697 as_type
= AS_EXTERNAL
;
2701 /* Get AS number. */
2702 VTY_GET_INTEGER_RANGE ("AS", as
, as_str
, 1, BGP_AS4_MAX
);
2703 as_type
= AS_SPECIFIED
;
2707 peer
= peer_lookup_by_conf_if (bgp
, conf_if
);
2710 if (bgp_flag_check (bgp
, BGP_FLAG_NO_DEFAULT_IPV4
)
2711 && afi
== AFI_IP
&& safi
== SAFI_UNICAST
)
2712 peer
= peer_create (NULL
, conf_if
, bgp
, bgp
->as
, as
, as_type
, 0, 0,
2715 peer
= peer_create (NULL
, conf_if
, bgp
, bgp
->as
, as
, as_type
, afi
, safi
,
2719 SET_FLAG(peer
->flags
, PEER_FLAG_IFPEER_V6ONLY
);
2721 /* Request zebra to initiate IPv6 RAs on this interface. We do this
2722 * any unnumbered peer in order to not worry about run-time transitions
2723 * (e.g., peering is initially IPv4, but the IPv4 /30 or /31 address
2724 * gets deleted later etc.)
2728 bgp_zebra_initiate_radv (bgp
, peer
);
2730 peer_flag_set (peer
, PEER_FLAG_CAPABILITY_ENHE
);
2732 else if ((v6only
&& !CHECK_FLAG(peer
->flags
, PEER_FLAG_IFPEER_V6ONLY
)) ||
2733 (!v6only
&& CHECK_FLAG(peer
->flags
, PEER_FLAG_IFPEER_V6ONLY
)))
2736 SET_FLAG(peer
->flags
, PEER_FLAG_IFPEER_V6ONLY
);
2738 UNSET_FLAG(peer
->flags
, PEER_FLAG_IFPEER_V6ONLY
);
2740 /* v6only flag changed. Reset bgp seesion */
2741 if (BGP_IS_VALID_STATE_FOR_NOTIF(peer
->status
))
2743 peer
->last_reset
= PEER_DOWN_V6ONLY_CHANGE
;
2744 bgp_notify_send (peer
, BGP_NOTIFY_CEASE
,
2745 BGP_NOTIFY_CEASE_CONFIG_CHANGE
);
2748 bgp_session_reset(peer
);
2754 if (peer_group_name
)
2756 group
= peer_group_lookup (bgp
, peer_group_name
);
2759 vty_out (vty
, "%% Configure the peer-group first%s", VTY_NEWLINE
);
2763 ret
= peer_group_bind (bgp
, &su
, peer
, group
, &as
);
2766 return bgp_vty_return (vty
, ret
);
2769 DEFUN (neighbor_interface_config
,
2770 neighbor_interface_config_cmd
,
2771 "neighbor WORD interface [peer-group WORD]",
2773 "Interface name or neighbor tag\n"
2774 "Enable BGP on interface\n"
2775 "Member of the peer-group\n"
2776 "Peer-group name\n")
2779 int idx_peer_group_word
= 4;
2781 if (argc
> idx_peer_group_word
)
2782 return peer_conf_interface_get (vty
, argv
[idx_word
]->arg
, AFI_IP
, SAFI_UNICAST
, 0,
2783 argv
[idx_peer_group_word
]->arg
, NULL
);
2785 return peer_conf_interface_get (vty
, argv
[idx_word
]->arg
, AFI_IP
, SAFI_UNICAST
, 0,
2789 DEFUN (neighbor_interface_config_v6only
,
2790 neighbor_interface_config_v6only_cmd
,
2791 "neighbor WORD interface v6only [peer-group WORD]",
2793 "Interface name or neighbor tag\n"
2794 "Enable BGP on interface\n"
2795 "Enable BGP with v6 link-local only\n"
2796 "Member of the peer-group\n"
2797 "Peer-group name\n")
2800 int idx_peer_group_word
= 5;
2802 if (argc
> idx_peer_group_word
)
2803 return peer_conf_interface_get (vty
, argv
[idx_word
]->arg
, AFI_IP
, SAFI_UNICAST
, 1,
2804 argv
[idx_peer_group_word
]->arg
, NULL
);
2806 return peer_conf_interface_get (vty
, argv
[idx_word
]->arg
, AFI_IP
, SAFI_UNICAST
, 1,
2811 DEFUN (neighbor_interface_config_remote_as
,
2812 neighbor_interface_config_remote_as_cmd
,
2813 "neighbor WORD interface remote-as <(1-4294967295)|internal|external>",
2815 "Interface name or neighbor tag\n"
2816 "Enable BGP on interface\n"
2817 "Specify a BGP neighbor\n"
2819 "Internal BGP peer\n"
2820 "External BGP peer\n")
2823 int idx_remote_as
= 4;
2824 return peer_conf_interface_get (vty
, argv
[idx_word
]->arg
, AFI_IP
, SAFI_UNICAST
, 0,
2825 NULL
, argv
[idx_remote_as
]->arg
);
2828 DEFUN (neighbor_interface_v6only_config_remote_as
,
2829 neighbor_interface_v6only_config_remote_as_cmd
,
2830 "neighbor WORD interface v6only remote-as <(1-4294967295)|internal|external>",
2832 "Interface name or neighbor tag\n"
2833 "Enable BGP with v6 link-local only\n"
2834 "Enable BGP on interface\n"
2835 "Specify a BGP neighbor\n"
2837 "Internal BGP peer\n"
2838 "External BGP peer\n")
2841 int idx_remote_as
= 5;
2842 return peer_conf_interface_get (vty
, argv
[idx_word
]->arg
, AFI_IP
, SAFI_UNICAST
, 1,
2843 NULL
, argv
[idx_remote_as
]->arg
);
2846 DEFUN (neighbor_peer_group
,
2847 neighbor_peer_group_cmd
,
2848 "neighbor WORD peer-group",
2850 "Interface name or neighbor tag\n"
2851 "Configure peer-group\n")
2853 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2856 struct peer_group
*group
;
2858 peer
= peer_lookup_by_conf_if (bgp
, argv
[idx_word
]->arg
);
2861 vty_out (vty
, "%% Name conflict with interface: %s", VTY_NEWLINE
);
2865 group
= peer_group_get (bgp
, argv
[idx_word
]->arg
);
2874 "no neighbor <WORD|<A.B.C.D|X:X::X:X> [remote-as <(1-4294967295)|internal|external>]>",
2878 "Specify a BGP neighbor\n"
2880 "Internal BGP peer\n"
2881 "External BGP peer\n")
2883 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2887 struct peer_group
*group
;
2891 ret
= str2sockunion (argv
[idx_peer
]->arg
, &su
);
2894 /* look up for neighbor by interface name config. */
2895 peer
= peer_lookup_by_conf_if (bgp
, argv
[idx_peer
]->arg
);
2898 /* Request zebra to terminate IPv6 RAs on this interface. */
2900 bgp_zebra_terminate_radv (peer
->bgp
, peer
);
2905 group
= peer_group_lookup (bgp
, argv
[idx_peer
]->arg
);
2907 peer_group_delete (group
);
2910 vty_out (vty
, "%% Create the peer-group first%s", VTY_NEWLINE
);
2916 peer
= peer_lookup (bgp
, &su
);
2919 if (peer_dynamic_neighbor (peer
))
2921 vty_out (vty
, "%% Operation not allowed on a dynamic neighbor%s",
2926 other
= peer
->doppelganger
;
2928 if (other
&& other
->status
!= Deleted
)
2936 DEFUN (no_neighbor_interface_config
,
2937 no_neighbor_interface_config_cmd
,
2938 "no neighbor WORD interface [v6only] [peer-group WORD] [remote-as <(1-4294967295)|internal|external>]",
2942 "Configure BGP on interface\n"
2943 "Enable BGP with v6 link-local only\n"
2944 "Member of the peer-group\n"
2946 "Specify a BGP neighbor\n"
2948 "Internal BGP peer\n"
2949 "External BGP peer\n")
2951 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2955 /* look up for neighbor by interface name config. */
2956 peer
= peer_lookup_by_conf_if (bgp
, argv
[idx_word
]->arg
);
2959 /* Request zebra to terminate IPv6 RAs on this interface. */
2961 bgp_zebra_terminate_radv (peer
->bgp
, peer
);
2966 vty_out (vty
, "%% Create the bgp interface first%s", VTY_NEWLINE
);
2972 DEFUN (no_neighbor_peer_group
,
2973 no_neighbor_peer_group_cmd
,
2974 "no neighbor WORD peer-group",
2978 "Configure peer-group\n")
2980 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2982 struct peer_group
*group
;
2984 group
= peer_group_lookup (bgp
, argv
[idx_word
]->arg
);
2986 peer_group_delete (group
);
2989 vty_out (vty
, "%% Create the peer-group first%s", VTY_NEWLINE
);
2995 DEFUN (no_neighbor_interface_peer_group_remote_as
,
2996 no_neighbor_interface_peer_group_remote_as_cmd
,
2997 "no neighbor WORD remote-as <(1-4294967295)|internal|external>",
3000 "Interface name or neighbor tag\n"
3001 "Specify a BGP neighbor\n"
3003 "Internal BGP peer\n"
3004 "External BGP peer\n")
3006 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
3008 struct peer_group
*group
;
3011 /* look up for neighbor by interface name config. */
3012 peer
= peer_lookup_by_conf_if (bgp
, argv
[idx_word
]->arg
);
3015 peer_as_change (peer
, 0, AS_SPECIFIED
);
3019 group
= peer_group_lookup (bgp
, argv
[idx_word
]->arg
);
3021 peer_group_remote_as_delete (group
);
3024 vty_out (vty
, "%% Create the peer-group or interface first%s", VTY_NEWLINE
);
3030 DEFUN (neighbor_local_as
,
3031 neighbor_local_as_cmd
,
3032 "neighbor <A.B.C.D|X:X::X:X|WORD> local-as (1-4294967295)",
3035 "Specify a local-as number\n"
3036 "AS number used as local AS\n")
3044 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
3048 VTY_GET_INTEGER_RANGE ("Local AS", as
, argv
[idx_number
]->arg
, 1, BGP_AS4_MAX
);
3049 ret
= peer_local_as_set (peer
, as
, 0, 0);
3050 return bgp_vty_return (vty
, ret
);
3053 DEFUN (neighbor_local_as_no_prepend
,
3054 neighbor_local_as_no_prepend_cmd
,
3055 "neighbor <A.B.C.D|X:X::X:X|WORD> local-as (1-4294967295) no-prepend",
3058 "Specify a local-as number\n"
3059 "AS number used as local AS\n"
3060 "Do not prepend local-as to updates from ebgp peers\n")
3068 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
3072 VTY_GET_INTEGER_RANGE ("Local AS", as
, argv
[idx_number
]->arg
, 1, BGP_AS4_MAX
);
3073 ret
= peer_local_as_set (peer
, as
, 1, 0);
3074 return bgp_vty_return (vty
, ret
);
3077 DEFUN (neighbor_local_as_no_prepend_replace_as
,
3078 neighbor_local_as_no_prepend_replace_as_cmd
,
3079 "neighbor <A.B.C.D|X:X::X:X|WORD> local-as (1-4294967295) no-prepend replace-as",
3082 "Specify a local-as number\n"
3083 "AS number used as local AS\n"
3084 "Do not prepend local-as to updates from ebgp peers\n"
3085 "Do not prepend local-as to updates from ibgp peers\n")
3093 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
3097 VTY_GET_INTEGER_RANGE ("Local AS", as
, argv
[idx_number
]->arg
, 1, BGP_AS4_MAX
);
3098 ret
= peer_local_as_set (peer
, as
, 1, 1);
3099 return bgp_vty_return (vty
, ret
);
3102 DEFUN (no_neighbor_local_as
,
3103 no_neighbor_local_as_cmd
,
3104 "no neighbor <A.B.C.D|X:X::X:X|WORD> local-as [(1-4294967295) [no-prepend [replace-as]]]",
3108 "Specify a local-as number\n"
3109 "AS number used as local AS\n"
3110 "Do not prepend local-as to updates from ebgp peers\n"
3111 "Do not prepend local-as to updates from ibgp peers\n")
3117 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
3121 ret
= peer_local_as_unset (peer
);
3122 return bgp_vty_return (vty
, ret
);
3128 DEFUN (neighbor_solo
,
3130 "neighbor <A.B.C.D|X:X::X:X|WORD> solo",
3133 "Solo peer - part of its own update group\n")
3139 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
3143 ret
= update_group_adjust_soloness(peer
, 1);
3144 return bgp_vty_return (vty
, ret
);
3147 DEFUN (no_neighbor_solo
,
3148 no_neighbor_solo_cmd
,
3149 "no neighbor <A.B.C.D|X:X::X:X|WORD> solo",
3153 "Solo peer - part of its own update group\n")
3159 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
3163 ret
= update_group_adjust_soloness(peer
, 0);
3164 return bgp_vty_return (vty
, ret
);
3167 DEFUN (neighbor_password
,
3168 neighbor_password_cmd
,
3169 "neighbor <A.B.C.D|X:X::X:X|WORD> password LINE",
3180 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
3184 ret
= peer_password_set (peer
, argv
[idx_line
]->arg
);
3185 return bgp_vty_return (vty
, ret
);
3188 DEFUN (no_neighbor_password
,
3189 no_neighbor_password_cmd
,
3190 "no neighbor <A.B.C.D|X:X::X:X|WORD> password [LINE]",
3201 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
3205 ret
= peer_password_unset (peer
);
3206 return bgp_vty_return (vty
, ret
);
3210 DEFUN (neighbor_activate
,
3211 neighbor_activate_cmd
,
3212 "neighbor <A.B.C.D|X:X::X:X|WORD> activate",
3215 "Enable the Address Family for this Neighbor\n")
3221 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
3225 ret
= peer_activate (peer
, bgp_node_afi (vty
), bgp_node_safi (vty
));
3232 DEFUN (no_neighbor_activate
,
3233 no_neighbor_activate_cmd
,
3234 "no neighbor <A.B.C.D|X:X::X:X|WORD> activate",
3238 "Enable the Address Family for this Neighbor\n")
3245 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
3249 ret
= peer_deactivate (peer
, bgp_node_afi (vty
), bgp_node_safi (vty
));
3256 DEFUN (neighbor_set_peer_group
,
3257 neighbor_set_peer_group_cmd
,
3258 "neighbor <A.B.C.D|X:X::X:X|WORD> peer-group WORD",
3261 "Member of the peer-group\n"
3262 "Peer-group name\n")
3264 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
3271 struct peer_group
*group
;
3275 ret
= str2sockunion (argv
[idx_peer
]->arg
, &su
);
3278 peer
= peer_lookup_by_conf_if (bgp
, argv
[idx_peer
]->arg
);
3281 vty_out (vty
, "%% Malformed address or name: %s%s", argv
[idx_peer
]->arg
, VTY_NEWLINE
);
3287 if (peer_address_self_check (bgp
, &su
))
3289 vty_out (vty
, "%% Can not configure the local system as neighbor%s",
3294 /* Disallow for dynamic neighbor. */
3295 peer
= peer_lookup (bgp
, &su
);
3296 if (peer
&& peer_dynamic_neighbor (peer
))
3298 vty_out (vty
, "%% Operation not allowed on a dynamic neighbor%s",
3304 group
= peer_group_lookup (bgp
, argv
[idx_word
]->arg
);
3307 vty_out (vty
, "%% Configure the peer-group first%s", VTY_NEWLINE
);
3311 ret
= peer_group_bind (bgp
, &su
, peer
, group
, &as
);
3313 if (ret
== BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT
)
3315 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
);
3319 return bgp_vty_return (vty
, ret
);
3322 DEFUN (no_neighbor_set_peer_group
,
3323 no_neighbor_set_peer_group_cmd
,
3324 "no neighbor <A.B.C.D|X:X::X:X|WORD> peer-group WORD",
3328 "Member of the peer-group\n"
3329 "Peer-group name\n")
3331 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
3336 struct peer_group
*group
;
3338 peer
= peer_lookup_vty (vty
, argv
[idx_peer
]->arg
);
3342 group
= peer_group_lookup (bgp
, argv
[idx_word
]->arg
);
3345 vty_out (vty
, "%% Configure the peer-group first%s", VTY_NEWLINE
);
3349 ret
= peer_group_unbind (bgp
, peer
, group
);
3351 return bgp_vty_return (vty
, ret
);
3355 peer_flag_modify_vty (struct vty
*vty
, const char *ip_str
,
3356 u_int16_t flag
, int set
)
3361 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
3366 * If 'neighbor <interface>', then this is for directly connected peers,
3367 * we should not accept disable-connected-check.
3369 if (peer
->conf_if
&& (flag
== PEER_FLAG_DISABLE_CONNECTED_CHECK
)) {
3370 vty_out (vty
, "%s is directly connected peer, cannot accept disable-"
3371 "connected-check%s", ip_str
, VTY_NEWLINE
);
3376 ret
= peer_flag_set (peer
, flag
);
3378 ret
= peer_flag_unset (peer
, flag
);
3380 return bgp_vty_return (vty
, ret
);
3384 peer_flag_set_vty (struct vty
*vty
, const char *ip_str
, u_int16_t flag
)
3386 return peer_flag_modify_vty (vty
, ip_str
, flag
, 1);
3390 peer_flag_unset_vty (struct vty
*vty
, const char *ip_str
, u_int16_t flag
)
3392 return peer_flag_modify_vty (vty
, ip_str
, flag
, 0);
3395 /* neighbor passive. */
3396 DEFUN (neighbor_passive
,
3397 neighbor_passive_cmd
,
3398 "neighbor <A.B.C.D|X:X::X:X|WORD> passive",
3401 "Don't send open messages to this neighbor\n")
3404 return peer_flag_set_vty (vty
, argv
[idx_peer
]->arg
, PEER_FLAG_PASSIVE
);
3407 DEFUN (no_neighbor_passive
,
3408 no_neighbor_passive_cmd
,
3409 "no neighbor <A.B.C.D|X:X::X:X|WORD> passive",
3413 "Don't send open messages to this neighbor\n")
3416 return peer_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, PEER_FLAG_PASSIVE
);
3419 /* neighbor shutdown. */
3420 DEFUN (neighbor_shutdown_msg
,
3421 neighbor_shutdown_msg_cmd
,
3422 "neighbor <A.B.C.D|X:X::X:X|WORD> shutdown message MSG...",
3425 "Administratively shut down this neighbor\n"
3426 "Add a shutdown message (draft-ietf-idr-shutdown-06)\n"
3427 "Shutdown message\n")
3433 struct peer
*peer
= peer_lookup_vty (vty
, argv
[idx_peer
]->arg
);
3436 message
= argv_concat (argv
, argc
, 4);
3437 peer_tx_shutdown_message_set (peer
, message
);
3438 XFREE (MTYPE_TMP
, message
);
3441 return peer_flag_set_vty (vty
, argv
[idx_peer
]->arg
, PEER_FLAG_SHUTDOWN
);
3444 ALIAS (neighbor_shutdown_msg
,
3445 neighbor_shutdown_cmd
,
3446 "neighbor <A.B.C.D|X:X::X:X|WORD> shutdown",
3449 "Administratively shut down this neighbor\n")
3451 DEFUN (no_neighbor_shutdown_msg
,
3452 no_neighbor_shutdown_msg_cmd
,
3453 "no neighbor <A.B.C.D|X:X::X:X|WORD> shutdown message MSG...",
3457 "Administratively shut down this neighbor\n"
3458 "Remove a shutdown message (draft-ietf-idr-shutdown-06)\n"
3459 "Shutdown message\n")
3463 struct peer
*peer
= peer_lookup_vty (vty
, argv
[idx_peer
]->arg
);
3464 peer_tx_shutdown_message_unset (peer
);
3466 return peer_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, PEER_FLAG_SHUTDOWN
);
3469 ALIAS (no_neighbor_shutdown_msg
,
3470 no_neighbor_shutdown_cmd
,
3471 "no neighbor <A.B.C.D|X:X::X:X|WORD> shutdown",
3475 "Administratively shut down this neighbor\n")
3477 /* neighbor capability dynamic. */
3478 DEFUN (neighbor_capability_dynamic
,
3479 neighbor_capability_dynamic_cmd
,
3480 "neighbor <A.B.C.D|X:X::X:X|WORD> capability dynamic",
3483 "Advertise capability to the peer\n"
3484 "Advertise dynamic capability to this neighbor\n")
3487 return peer_flag_set_vty (vty
, argv
[idx_peer
]->arg
, PEER_FLAG_DYNAMIC_CAPABILITY
);
3490 DEFUN (no_neighbor_capability_dynamic
,
3491 no_neighbor_capability_dynamic_cmd
,
3492 "no neighbor <A.B.C.D|X:X::X:X|WORD> capability dynamic",
3496 "Advertise capability to the peer\n"
3497 "Advertise dynamic capability to this neighbor\n")
3500 return peer_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, PEER_FLAG_DYNAMIC_CAPABILITY
);
3503 /* neighbor dont-capability-negotiate */
3504 DEFUN (neighbor_dont_capability_negotiate
,
3505 neighbor_dont_capability_negotiate_cmd
,
3506 "neighbor <A.B.C.D|X:X::X:X|WORD> dont-capability-negotiate",
3509 "Do not perform capability negotiation\n")
3512 return peer_flag_set_vty (vty
, argv
[idx_peer
]->arg
, PEER_FLAG_DONT_CAPABILITY
);
3515 DEFUN (no_neighbor_dont_capability_negotiate
,
3516 no_neighbor_dont_capability_negotiate_cmd
,
3517 "no neighbor <A.B.C.D|X:X::X:X|WORD> dont-capability-negotiate",
3521 "Do not perform capability negotiation\n")
3524 return peer_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, PEER_FLAG_DONT_CAPABILITY
);
3527 /* neighbor capability extended next hop encoding */
3528 DEFUN (neighbor_capability_enhe
,
3529 neighbor_capability_enhe_cmd
,
3530 "neighbor <A.B.C.D|X:X::X:X|WORD> capability extended-nexthop",
3533 "Advertise capability to the peer\n"
3534 "Advertise extended next-hop capability to the peer\n")
3537 return peer_flag_set_vty (vty
, argv
[idx_peer
]->arg
, PEER_FLAG_CAPABILITY_ENHE
);
3540 DEFUN (no_neighbor_capability_enhe
,
3541 no_neighbor_capability_enhe_cmd
,
3542 "no neighbor <A.B.C.D|X:X::X:X|WORD> capability extended-nexthop",
3546 "Advertise capability to the peer\n"
3547 "Advertise extended next-hop capability to the peer\n")
3550 return peer_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, PEER_FLAG_CAPABILITY_ENHE
);
3554 peer_af_flag_modify_vty (struct vty
*vty
, const char *peer_str
, afi_t afi
,
3555 safi_t safi
, u_int32_t flag
, int set
)
3560 peer
= peer_and_group_lookup_vty (vty
, peer_str
);
3565 ret
= peer_af_flag_set (peer
, afi
, safi
, flag
);
3567 ret
= peer_af_flag_unset (peer
, afi
, safi
, flag
);
3569 return bgp_vty_return (vty
, ret
);
3573 peer_af_flag_set_vty (struct vty
*vty
, const char *peer_str
, afi_t afi
,
3574 safi_t safi
, u_int32_t flag
)
3576 return peer_af_flag_modify_vty (vty
, peer_str
, afi
, safi
, flag
, 1);
3580 peer_af_flag_unset_vty (struct vty
*vty
, const char *peer_str
, afi_t afi
,
3581 safi_t safi
, u_int32_t flag
)
3583 return peer_af_flag_modify_vty (vty
, peer_str
, afi
, safi
, flag
, 0);
3586 /* neighbor capability orf prefix-list. */
3587 DEFUN (neighbor_capability_orf_prefix
,
3588 neighbor_capability_orf_prefix_cmd
,
3589 "neighbor <A.B.C.D|X:X::X:X|WORD> capability orf prefix-list <both|send|receive>",
3592 "Advertise capability to the peer\n"
3593 "Advertise ORF capability to the peer\n"
3594 "Advertise prefixlist ORF capability to this neighbor\n"
3595 "Capability to SEND and RECEIVE the ORF to/from this neighbor\n"
3596 "Capability to RECEIVE the ORF from this neighbor\n"
3597 "Capability to SEND the ORF to this neighbor\n")
3600 int idx_send_recv
= 5;
3603 if (strncmp (argv
[idx_send_recv
]->arg
, "s", 1) == 0)
3604 flag
= PEER_FLAG_ORF_PREFIX_SM
;
3605 else if (strncmp (argv
[idx_send_recv
]->arg
, "r", 1) == 0)
3606 flag
= PEER_FLAG_ORF_PREFIX_RM
;
3607 else if (strncmp (argv
[idx_send_recv
]->arg
, "b", 1) == 0)
3608 flag
= PEER_FLAG_ORF_PREFIX_SM
|PEER_FLAG_ORF_PREFIX_RM
;
3612 return peer_af_flag_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
3613 bgp_node_safi (vty
), flag
);
3616 DEFUN (no_neighbor_capability_orf_prefix
,
3617 no_neighbor_capability_orf_prefix_cmd
,
3618 "no neighbor <A.B.C.D|X:X::X:X|WORD> capability orf prefix-list <both|send|receive>",
3622 "Advertise capability to the peer\n"
3623 "Advertise ORF capability to the peer\n"
3624 "Advertise prefixlist ORF capability to this neighbor\n"
3625 "Capability to SEND and RECEIVE the ORF to/from this neighbor\n"
3626 "Capability to RECEIVE the ORF from this neighbor\n"
3627 "Capability to SEND the ORF to this neighbor\n")
3630 int idx_send_recv
= 6;
3633 if (strncmp (argv
[idx_send_recv
]->arg
, "s", 1) == 0)
3634 flag
= PEER_FLAG_ORF_PREFIX_SM
;
3635 else if (strncmp (argv
[idx_send_recv
]->arg
, "r", 1) == 0)
3636 flag
= PEER_FLAG_ORF_PREFIX_RM
;
3637 else if (strncmp (argv
[idx_send_recv
]->arg
, "b", 1) == 0)
3638 flag
= PEER_FLAG_ORF_PREFIX_SM
|PEER_FLAG_ORF_PREFIX_RM
;
3642 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
3643 bgp_node_safi (vty
), flag
);
3646 /* neighbor next-hop-self. */
3647 DEFUN (neighbor_nexthop_self
,
3648 neighbor_nexthop_self_cmd
,
3649 "neighbor <A.B.C.D|X:X::X:X|WORD> next-hop-self",
3652 "Disable the next hop calculation for this neighbor\n")
3655 return peer_af_flag_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
3656 bgp_node_safi (vty
), PEER_FLAG_NEXTHOP_SELF
);
3659 /* neighbor next-hop-self. */
3660 DEFUN (neighbor_nexthop_self_force
,
3661 neighbor_nexthop_self_force_cmd
,
3662 "neighbor <A.B.C.D|X:X::X:X|WORD> next-hop-self force",
3665 "Disable the next hop calculation for this neighbor\n"
3666 "Set the next hop to self for reflected routes\n")
3669 return peer_af_flag_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
3670 bgp_node_safi (vty
),
3671 PEER_FLAG_FORCE_NEXTHOP_SELF
);
3674 DEFUN (no_neighbor_nexthop_self
,
3675 no_neighbor_nexthop_self_cmd
,
3676 "no neighbor <A.B.C.D|X:X::X:X|WORD> next-hop-self",
3680 "Disable the next hop calculation for this neighbor\n")
3683 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
3684 bgp_node_safi (vty
),
3685 PEER_FLAG_NEXTHOP_SELF
);
3688 DEFUN (no_neighbor_nexthop_self_force
,
3689 no_neighbor_nexthop_self_force_cmd
,
3690 "no neighbor <A.B.C.D|X:X::X:X|WORD> next-hop-self force",
3694 "Disable the next hop calculation for this neighbor\n"
3695 "Set the next hop to self for reflected routes\n")
3698 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
3699 bgp_node_safi (vty
),
3700 PEER_FLAG_FORCE_NEXTHOP_SELF
);
3703 /* neighbor as-override */
3704 DEFUN (neighbor_as_override
,
3705 neighbor_as_override_cmd
,
3706 "neighbor <A.B.C.D|X:X::X:X|WORD> as-override",
3709 "Override ASNs in outbound updates if aspath equals remote-as\n")
3712 return peer_af_flag_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
3713 bgp_node_safi (vty
),
3714 PEER_FLAG_AS_OVERRIDE
);
3717 DEFUN (no_neighbor_as_override
,
3718 no_neighbor_as_override_cmd
,
3719 "no neighbor <A.B.C.D|X:X::X:X|WORD> as-override",
3723 "Override ASNs in outbound updates if aspath equals remote-as\n")
3726 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
3727 bgp_node_safi (vty
),
3728 PEER_FLAG_AS_OVERRIDE
);
3731 /* neighbor remove-private-AS. */
3732 DEFUN (neighbor_remove_private_as
,
3733 neighbor_remove_private_as_cmd
,
3734 "neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS",
3737 "Remove private ASNs in outbound updates\n")
3740 return peer_af_flag_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
3741 bgp_node_safi (vty
),
3742 PEER_FLAG_REMOVE_PRIVATE_AS
);
3745 DEFUN (neighbor_remove_private_as_all
,
3746 neighbor_remove_private_as_all_cmd
,
3747 "neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS all",
3750 "Remove private ASNs in outbound updates\n"
3751 "Apply to all AS numbers")
3754 return peer_af_flag_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
3755 bgp_node_safi (vty
),
3756 PEER_FLAG_REMOVE_PRIVATE_AS_ALL
);
3759 DEFUN (neighbor_remove_private_as_replace_as
,
3760 neighbor_remove_private_as_replace_as_cmd
,
3761 "neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS replace-AS",
3764 "Remove private ASNs in outbound updates\n"
3765 "Replace private ASNs with our ASN in outbound updates\n")
3768 return peer_af_flag_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
3769 bgp_node_safi (vty
),
3770 PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE
);
3773 DEFUN (neighbor_remove_private_as_all_replace_as
,
3774 neighbor_remove_private_as_all_replace_as_cmd
,
3775 "neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS all replace-AS",
3778 "Remove private ASNs in outbound updates\n"
3779 "Apply to all AS numbers\n"
3780 "Replace private ASNs with our ASN in outbound updates\n")
3783 return peer_af_flag_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
3784 bgp_node_safi (vty
),
3785 PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE
);
3788 DEFUN (no_neighbor_remove_private_as
,
3789 no_neighbor_remove_private_as_cmd
,
3790 "no neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS",
3794 "Remove private ASNs in outbound updates\n")
3797 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
3798 bgp_node_safi (vty
),
3799 PEER_FLAG_REMOVE_PRIVATE_AS
);
3802 DEFUN (no_neighbor_remove_private_as_all
,
3803 no_neighbor_remove_private_as_all_cmd
,
3804 "no neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS all",
3808 "Remove private ASNs in outbound updates\n"
3809 "Apply to all AS numbers\n")
3812 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
3813 bgp_node_safi (vty
),
3814 PEER_FLAG_REMOVE_PRIVATE_AS_ALL
);
3817 DEFUN (no_neighbor_remove_private_as_replace_as
,
3818 no_neighbor_remove_private_as_replace_as_cmd
,
3819 "no neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS replace-AS",
3823 "Remove private ASNs in outbound updates\n"
3824 "Replace private ASNs with our ASN in outbound updates\n")
3827 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
3828 bgp_node_safi (vty
),
3829 PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE
);
3832 DEFUN (no_neighbor_remove_private_as_all_replace_as
,
3833 no_neighbor_remove_private_as_all_replace_as_cmd
,
3834 "no neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS all replace-AS",
3838 "Remove private ASNs in outbound updates\n"
3839 "Apply to all AS numbers\n"
3840 "Replace private ASNs with our ASN in outbound updates\n")
3843 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
3844 bgp_node_safi (vty
),
3845 PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE
);
3849 /* neighbor send-community. */
3850 DEFUN (neighbor_send_community
,
3851 neighbor_send_community_cmd
,
3852 "neighbor <A.B.C.D|X:X::X:X|WORD> send-community",
3855 "Send Community attribute to this neighbor\n")
3858 return peer_af_flag_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
3859 bgp_node_safi (vty
),
3860 PEER_FLAG_SEND_COMMUNITY
);
3863 DEFUN (no_neighbor_send_community
,
3864 no_neighbor_send_community_cmd
,
3865 "no neighbor <A.B.C.D|X:X::X:X|WORD> send-community",
3869 "Send Community attribute to this neighbor\n")
3872 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
3873 bgp_node_safi (vty
),
3874 PEER_FLAG_SEND_COMMUNITY
);
3877 /* neighbor send-community extended. */
3878 DEFUN (neighbor_send_community_type
,
3879 neighbor_send_community_type_cmd
,
3880 "neighbor <A.B.C.D|X:X::X:X|WORD> send-community <both|all|extended|standard|large>",
3883 "Send Community attribute to this neighbor\n"
3884 "Send Standard and Extended Community attributes\n"
3885 "Send Standard, Large and Extended Community attributes\n"
3886 "Send Extended Community attributes\n"
3887 "Send Standard Community attributes\n"
3888 "Send Large Community attributes\n")
3893 char *peer
= argv
[1]->arg
;
3895 if (argv_find (argv
, argc
, "standard", &idx
))
3896 SET_FLAG (flag
, PEER_FLAG_SEND_COMMUNITY
);
3897 else if (argv_find (argv
, argc
, "extended", &idx
))
3898 SET_FLAG (flag
, PEER_FLAG_SEND_EXT_COMMUNITY
);
3899 else if (argv_find (argv
, argc
, "large", &idx
))
3900 SET_FLAG (flag
, PEER_FLAG_SEND_LARGE_COMMUNITY
);
3901 else if (argv_find (argv
, argc
, "both", &idx
))
3903 SET_FLAG (flag
, PEER_FLAG_SEND_COMMUNITY
);
3904 SET_FLAG (flag
, PEER_FLAG_SEND_EXT_COMMUNITY
);
3908 SET_FLAG (flag
, PEER_FLAG_SEND_COMMUNITY
);
3909 SET_FLAG (flag
, PEER_FLAG_SEND_EXT_COMMUNITY
);
3910 SET_FLAG (flag
, PEER_FLAG_SEND_LARGE_COMMUNITY
);
3913 return peer_af_flag_set_vty (vty
, peer
, bgp_node_afi (vty
), bgp_node_safi (vty
), flag
);
3916 DEFUN (no_neighbor_send_community_type
,
3917 no_neighbor_send_community_type_cmd
,
3918 "no neighbor <A.B.C.D|X:X::X:X|WORD> send-community <both|all|extended|standard|large>",
3922 "Send Community attribute to this neighbor\n"
3923 "Send Standard and Extended Community attributes\n"
3924 "Send Standard, Large and Extended Community attributes\n"
3925 "Send Extended Community attributes\n"
3926 "Send Standard Community attributes\n"
3927 "Send Large Community attributes\n")
3931 if (strncmp (argv
[idx_type
]->arg
, "s", 1) == 0)
3932 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
3933 bgp_node_safi (vty
),
3934 PEER_FLAG_SEND_COMMUNITY
);
3935 if (strncmp (argv
[idx_type
]->arg
, "e", 1) == 0)
3936 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
3937 bgp_node_safi (vty
),
3938 PEER_FLAG_SEND_EXT_COMMUNITY
);
3939 if (strncmp (argv
[idx_type
]->arg
, "l", 1) == 0)
3940 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
3941 bgp_node_safi (vty
),
3942 PEER_FLAG_SEND_LARGE_COMMUNITY
);
3943 if (strncmp (argv
[idx_type
]->arg
, "b", 1) == 0)
3944 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
3945 bgp_node_safi (vty
),
3946 PEER_FLAG_SEND_COMMUNITY
|
3947 PEER_FLAG_SEND_EXT_COMMUNITY
);
3949 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
3950 bgp_node_safi (vty
),
3951 (PEER_FLAG_SEND_COMMUNITY
|
3952 PEER_FLAG_SEND_EXT_COMMUNITY
|
3953 PEER_FLAG_SEND_LARGE_COMMUNITY
));
3956 /* neighbor soft-reconfig. */
3957 DEFUN (neighbor_soft_reconfiguration
,
3958 neighbor_soft_reconfiguration_cmd
,
3959 "neighbor <A.B.C.D|X:X::X:X|WORD> soft-reconfiguration inbound",
3962 "Per neighbor soft reconfiguration\n"
3963 "Allow inbound soft reconfiguration for this neighbor\n")
3966 return peer_af_flag_set_vty (vty
, argv
[idx_peer
]->arg
,
3967 bgp_node_afi (vty
), bgp_node_safi (vty
),
3968 PEER_FLAG_SOFT_RECONFIG
);
3971 DEFUN (no_neighbor_soft_reconfiguration
,
3972 no_neighbor_soft_reconfiguration_cmd
,
3973 "no neighbor <A.B.C.D|X:X::X:X|WORD> soft-reconfiguration inbound",
3977 "Per neighbor soft reconfiguration\n"
3978 "Allow inbound soft reconfiguration for this neighbor\n")
3981 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
,
3982 bgp_node_afi (vty
), bgp_node_safi (vty
),
3983 PEER_FLAG_SOFT_RECONFIG
);
3986 DEFUN (neighbor_route_reflector_client
,
3987 neighbor_route_reflector_client_cmd
,
3988 "neighbor <A.B.C.D|X:X::X:X|WORD> route-reflector-client",
3991 "Configure a neighbor as Route Reflector client\n")
3997 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
4001 return peer_af_flag_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4002 bgp_node_safi (vty
),
4003 PEER_FLAG_REFLECTOR_CLIENT
);
4006 DEFUN (no_neighbor_route_reflector_client
,
4007 no_neighbor_route_reflector_client_cmd
,
4008 "no neighbor <A.B.C.D|X:X::X:X|WORD> route-reflector-client",
4012 "Configure a neighbor as Route Reflector client\n")
4015 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4016 bgp_node_safi (vty
),
4017 PEER_FLAG_REFLECTOR_CLIENT
);
4020 /* neighbor route-server-client. */
4021 DEFUN (neighbor_route_server_client
,
4022 neighbor_route_server_client_cmd
,
4023 "neighbor <A.B.C.D|X:X::X:X|WORD> route-server-client",
4026 "Configure a neighbor as Route Server client\n")
4031 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
4034 return peer_af_flag_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4035 bgp_node_safi (vty
),
4036 PEER_FLAG_RSERVER_CLIENT
);
4039 DEFUN (no_neighbor_route_server_client
,
4040 no_neighbor_route_server_client_cmd
,
4041 "no neighbor <A.B.C.D|X:X::X:X|WORD> route-server-client",
4045 "Configure a neighbor as Route Server client\n")
4048 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4049 bgp_node_safi (vty
),
4050 PEER_FLAG_RSERVER_CLIENT
);
4053 DEFUN (neighbor_nexthop_local_unchanged
,
4054 neighbor_nexthop_local_unchanged_cmd
,
4055 "neighbor <A.B.C.D|X:X::X:X|WORD> nexthop-local unchanged",
4058 "Configure treatment of outgoing link-local nexthop attribute\n"
4059 "Leave link-local nexthop unchanged for this peer\n")
4062 return peer_af_flag_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4063 bgp_node_safi (vty
),
4064 PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED
);
4067 DEFUN (no_neighbor_nexthop_local_unchanged
,
4068 no_neighbor_nexthop_local_unchanged_cmd
,
4069 "no neighbor <A.B.C.D|X:X::X:X|WORD> nexthop-local unchanged",
4073 "Configure treatment of outgoing link-local-nexthop attribute\n"
4074 "Leave link-local nexthop unchanged for this peer\n")
4077 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4078 bgp_node_safi (vty
),
4079 PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED
);
4082 DEFUN (neighbor_attr_unchanged
,
4083 neighbor_attr_unchanged_cmd
,
4084 "neighbor <A.B.C.D|X:X::X:X|WORD> attribute-unchanged\
4086 as-path [<next-hop [med]|med [next-hop]>]|\
4087 next-hop [<as-path [med]|med [as-path]>]|\
4088 med [<as-path [next-hop]|next-hop [as-path]>]\
4092 "BGP attribute is propagated unchanged to this neighbor\n"
4093 "As-path attribute\n"
4094 "Nexthop attribute\n"
4097 "Nexthop attribute\n"
4098 "Nexthop attribute\n"
4099 "As-path attribute\n"
4102 "As-path attribute\n"
4104 "As-path attribute\n"
4105 "Nexthop attribute\n"
4106 "Nexthop attribute\n"
4107 "As-path attribute\n")
4110 char *peer
= argv
[1]->arg
;
4111 u_int16_t flags
= 0;
4113 if (argv_find (argv
, argc
, "as-path", &idx
))
4114 SET_FLAG (flags
, PEER_FLAG_AS_PATH_UNCHANGED
);
4116 if (argv_find (argv
, argc
, "next-hop", &idx
))
4117 SET_FLAG (flags
, PEER_FLAG_NEXTHOP_UNCHANGED
);
4119 if (argv_find (argv
, argc
, "med", &idx
))
4120 SET_FLAG (flags
, PEER_FLAG_MED_UNCHANGED
);
4122 if (!flags
) // no flags means all of them!
4124 SET_FLAG (flags
, PEER_FLAG_AS_PATH_UNCHANGED
);
4125 SET_FLAG (flags
, PEER_FLAG_NEXTHOP_UNCHANGED
);
4126 SET_FLAG (flags
, PEER_FLAG_MED_UNCHANGED
);
4129 return peer_af_flag_set_vty (vty
, peer
, bgp_node_afi (vty
), bgp_node_safi (vty
), flags
);
4132 DEFUN (no_neighbor_attr_unchanged
,
4133 no_neighbor_attr_unchanged_cmd
,
4134 "no neighbor <A.B.C.D|X:X::X:X|WORD> attribute-unchanged\
4136 as-path [<next-hop [med]|med [next-hop]>]|\
4137 next-hop [<as-path [med]|med [as-path]>]|\
4138 med [<as-path [next-hop]|next-hop [as-path]>]\
4143 "BGP attribute is propagated unchanged to this neighbor\n"
4144 "As-path attribute\n"
4145 "Nexthop attribute\n"
4148 "Nexthop attribute\n"
4149 "Nexthop attribute\n"
4150 "As-path attribute\n"
4153 "As-path attribute\n"
4155 "As-path attribute\n"
4156 "Nexthop attribute\n"
4157 "Nexthop attribute\n"
4158 "As-path attribute\n")
4161 char *peer
= argv
[2]->arg
;
4162 u_int16_t flags
= 0;
4164 if (argv_find (argv
, argc
, "as-path", &idx
))
4165 SET_FLAG (flags
, PEER_FLAG_AS_PATH_UNCHANGED
);
4167 if (argv_find (argv
, argc
, "next-hop", &idx
))
4168 SET_FLAG (flags
, PEER_FLAG_NEXTHOP_UNCHANGED
);
4170 if (argv_find (argv
, argc
, "med", &idx
))
4171 SET_FLAG (flags
, PEER_FLAG_MED_UNCHANGED
);
4173 if (!flags
) // no flags means all of them!
4175 SET_FLAG (flags
, PEER_FLAG_AS_PATH_UNCHANGED
);
4176 SET_FLAG (flags
, PEER_FLAG_NEXTHOP_UNCHANGED
);
4177 SET_FLAG (flags
, PEER_FLAG_MED_UNCHANGED
);
4180 return peer_af_flag_unset_vty (vty
, peer
, bgp_node_afi (vty
), bgp_node_safi (vty
), flags
);
4184 /* EBGP multihop configuration. */
4186 peer_ebgp_multihop_set_vty (struct vty
*vty
, const char *ip_str
,
4187 const char *ttl_str
)
4192 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
4197 return bgp_vty_return (vty
, BGP_ERR_INVALID_FOR_DIRECT_PEER
);
4202 VTY_GET_INTEGER_RANGE ("TTL", ttl
, ttl_str
, 1, MAXTTL
);
4204 return bgp_vty_return (vty
, peer_ebgp_multihop_set (peer
, ttl
));
4208 peer_ebgp_multihop_unset_vty (struct vty
*vty
, const char *ip_str
)
4212 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
4216 return bgp_vty_return (vty
, peer_ebgp_multihop_unset (peer
));
4219 /* neighbor ebgp-multihop. */
4220 DEFUN (neighbor_ebgp_multihop
,
4221 neighbor_ebgp_multihop_cmd
,
4222 "neighbor <A.B.C.D|X:X::X:X|WORD> ebgp-multihop",
4225 "Allow EBGP neighbors not on directly connected networks\n")
4228 return peer_ebgp_multihop_set_vty (vty
, argv
[idx_peer
]->arg
, NULL
);
4231 DEFUN (neighbor_ebgp_multihop_ttl
,
4232 neighbor_ebgp_multihop_ttl_cmd
,
4233 "neighbor <A.B.C.D|X:X::X:X|WORD> ebgp-multihop (1-255)",
4236 "Allow EBGP neighbors not on directly connected networks\n"
4237 "maximum hop count\n")
4241 return peer_ebgp_multihop_set_vty (vty
, argv
[idx_peer
]->arg
, argv
[idx_number
]->arg
);
4244 DEFUN (no_neighbor_ebgp_multihop
,
4245 no_neighbor_ebgp_multihop_cmd
,
4246 "no neighbor <A.B.C.D|X:X::X:X|WORD> ebgp-multihop [(1-255)]",
4250 "Allow EBGP neighbors not on directly connected networks\n"
4251 "maximum hop count\n")
4254 return peer_ebgp_multihop_unset_vty (vty
, argv
[idx_peer
]->arg
);
4258 /* disable-connected-check */
4259 DEFUN (neighbor_disable_connected_check
,
4260 neighbor_disable_connected_check_cmd
,
4261 "neighbor <A.B.C.D|X:X::X:X|WORD> <disable-connected-check|enforce-multihop>",
4264 "one-hop away EBGP peer using loopback address\n"
4265 "Enforce EBGP neighbors perform multihop\n")
4268 return peer_flag_set_vty (vty
, argv
[idx_peer
]->arg
, PEER_FLAG_DISABLE_CONNECTED_CHECK
);
4271 DEFUN (no_neighbor_disable_connected_check
,
4272 no_neighbor_disable_connected_check_cmd
,
4273 "no neighbor <A.B.C.D|X:X::X:X|WORD> <disable-connected-check|enforce-multihop>",
4277 "one-hop away EBGP peer using loopback address\n"
4278 "Enforce EBGP neighbors perform multihop\n")
4281 return peer_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, PEER_FLAG_DISABLE_CONNECTED_CHECK
);
4284 DEFUN (neighbor_description
,
4285 neighbor_description_cmd
,
4286 "neighbor <A.B.C.D|X:X::X:X|WORD> description LINE...",
4289 "Neighbor specific description\n"
4290 "Up to 80 characters describing this neighbor\n")
4297 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
4301 str
= argv_concat(argv
, argc
, idx_line
);
4303 peer_description_set (peer
, str
);
4305 XFREE (MTYPE_TMP
, str
);
4310 DEFUN (no_neighbor_description
,
4311 no_neighbor_description_cmd
,
4312 "no neighbor <A.B.C.D|X:X::X:X|WORD> description [LINE]",
4316 "Neighbor specific description\n"
4317 "Up to 80 characters describing this neighbor\n")
4322 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
4326 peer_description_unset (peer
);
4332 /* Neighbor update-source. */
4334 peer_update_source_vty (struct vty
*vty
, const char *peer_str
,
4335 const char *source_str
)
4340 peer
= peer_and_group_lookup_vty (vty
, peer_str
);
4350 int ret
= str2sockunion (source_str
, &su
);
4353 peer_update_source_addr_set (peer
, &su
);
4356 if (str2prefix (source_str
, &p
))
4358 vty_out (vty
, "%% Invalid update-source, remove prefix length %s",
4363 peer_update_source_if_set (peer
, source_str
);
4367 peer_update_source_unset (peer
);
4372 #define BGP_UPDATE_SOURCE_HELP_STR \
4375 "Interface name (requires zebra to be running)\n"
4377 DEFUN (neighbor_update_source
,
4378 neighbor_update_source_cmd
,
4379 "neighbor <A.B.C.D|X:X::X:X|WORD> update-source <A.B.C.D|X:X::X:X|WORD>",
4382 "Source of routing updates\n"
4383 BGP_UPDATE_SOURCE_HELP_STR
)
4387 return peer_update_source_vty (vty
, argv
[idx_peer
]->arg
, argv
[idx_peer_2
]->arg
);
4390 DEFUN (no_neighbor_update_source
,
4391 no_neighbor_update_source_cmd
,
4392 "no neighbor <A.B.C.D|X:X::X:X|WORD> update-source [<A.B.C.D|X:X::X:X|WORD>]",
4396 "Source of routing updates\n"
4397 BGP_UPDATE_SOURCE_HELP_STR
)
4400 return peer_update_source_vty (vty
, argv
[idx_peer
]->arg
, NULL
);
4404 peer_default_originate_set_vty (struct vty
*vty
, const char *peer_str
,
4405 afi_t afi
, safi_t safi
,
4406 const char *rmap
, int set
)
4411 peer
= peer_and_group_lookup_vty (vty
, peer_str
);
4416 ret
= peer_default_originate_set (peer
, afi
, safi
, rmap
);
4418 ret
= peer_default_originate_unset (peer
, afi
, safi
);
4420 return bgp_vty_return (vty
, ret
);
4423 /* neighbor default-originate. */
4424 DEFUN (neighbor_default_originate
,
4425 neighbor_default_originate_cmd
,
4426 "neighbor <A.B.C.D|X:X::X:X|WORD> default-originate",
4429 "Originate default route to this neighbor\n")
4432 return peer_default_originate_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4433 bgp_node_safi (vty
), NULL
, 1);
4436 DEFUN (neighbor_default_originate_rmap
,
4437 neighbor_default_originate_rmap_cmd
,
4438 "neighbor <A.B.C.D|X:X::X:X|WORD> default-originate route-map WORD",
4441 "Originate default route to this neighbor\n"
4442 "Route-map to specify criteria to originate default\n"
4447 return peer_default_originate_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4448 bgp_node_safi (vty
), argv
[idx_word
]->arg
, 1);
4451 DEFUN (no_neighbor_default_originate
,
4452 no_neighbor_default_originate_cmd
,
4453 "no neighbor <A.B.C.D|X:X::X:X|WORD> default-originate [route-map WORD]",
4457 "Originate default route to this neighbor\n"
4458 "Route-map to specify criteria to originate default\n"
4462 return peer_default_originate_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4463 bgp_node_safi (vty
), NULL
, 0);
4467 /* Set neighbor's BGP port. */
4469 peer_port_vty (struct vty
*vty
, const char *ip_str
, int afi
,
4470 const char *port_str
)
4476 peer
= peer_lookup_vty (vty
, ip_str
);
4482 sp
= getservbyname ("bgp", "tcp");
4483 port
= (sp
== NULL
) ? BGP_PORT_DEFAULT
: ntohs (sp
->s_port
);
4487 VTY_GET_INTEGER("port", port
, port_str
);
4490 peer_port_set (peer
, port
);
4495 /* Set specified peer's BGP port. */
4496 DEFUN (neighbor_port
,
4498 "neighbor <A.B.C.D|X:X::X:X> port (0-65535)",
4501 "Neighbor's BGP port\n"
4502 "TCP port number\n")
4506 return peer_port_vty (vty
, argv
[idx_ip
]->arg
, AFI_IP
, argv
[idx_number
]->arg
);
4509 DEFUN (no_neighbor_port
,
4510 no_neighbor_port_cmd
,
4511 "no neighbor <A.B.C.D|X:X::X:X> port [(0-65535)]",
4515 "Neighbor's BGP port\n"
4516 "TCP port number\n")
4519 return peer_port_vty (vty
, argv
[idx_ip
]->arg
, AFI_IP
, NULL
);
4523 /* neighbor weight. */
4525 peer_weight_set_vty (struct vty
*vty
, const char *ip_str
,
4526 afi_t afi
, safi_t safi
,
4527 const char *weight_str
)
4531 unsigned long weight
;
4533 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
4537 VTY_GET_INTEGER_RANGE("weight", weight
, weight_str
, 0, 65535);
4539 ret
= peer_weight_set (peer
, afi
, safi
, weight
);
4540 return bgp_vty_return (vty
, ret
);
4544 peer_weight_unset_vty (struct vty
*vty
, const char *ip_str
,
4545 afi_t afi
, safi_t safi
)
4550 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
4554 ret
= peer_weight_unset (peer
, afi
, safi
);
4555 return bgp_vty_return (vty
, ret
);
4558 DEFUN (neighbor_weight
,
4559 neighbor_weight_cmd
,
4560 "neighbor <A.B.C.D|X:X::X:X|WORD> weight (0-65535)",
4563 "Set default weight for routes from this neighbor\n"
4568 return peer_weight_set_vty (vty
,
4569 argv
[idx_peer
]->arg
,
4571 bgp_node_safi (vty
),
4572 argv
[idx_number
]->arg
);
4575 DEFUN (no_neighbor_weight
,
4576 no_neighbor_weight_cmd
,
4577 "no neighbor <A.B.C.D|X:X::X:X|WORD> weight [(0-65535)]",
4581 "Set default weight for routes from this neighbor\n"
4585 return peer_weight_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
), bgp_node_safi (vty
));
4589 /* Override capability negotiation. */
4590 DEFUN (neighbor_override_capability
,
4591 neighbor_override_capability_cmd
,
4592 "neighbor <A.B.C.D|X:X::X:X|WORD> override-capability",
4595 "Override capability negotiation result\n")
4598 return peer_flag_set_vty (vty
, argv
[idx_peer
]->arg
, PEER_FLAG_OVERRIDE_CAPABILITY
);
4601 DEFUN (no_neighbor_override_capability
,
4602 no_neighbor_override_capability_cmd
,
4603 "no neighbor <A.B.C.D|X:X::X:X|WORD> override-capability",
4607 "Override capability negotiation result\n")
4610 return peer_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, PEER_FLAG_OVERRIDE_CAPABILITY
);
4613 DEFUN (neighbor_strict_capability
,
4614 neighbor_strict_capability_cmd
,
4615 "neighbor <A.B.C.D|X:X::X:X> strict-capability-match",
4618 "Strict capability negotiation match\n")
4621 return peer_flag_set_vty (vty
, argv
[idx_ip
]->arg
, PEER_FLAG_STRICT_CAP_MATCH
);
4624 DEFUN (no_neighbor_strict_capability
,
4625 no_neighbor_strict_capability_cmd
,
4626 "no neighbor <A.B.C.D|X:X::X:X> strict-capability-match",
4630 "Strict capability negotiation match\n")
4633 return peer_flag_unset_vty (vty
, argv
[idx_ip
]->arg
, PEER_FLAG_STRICT_CAP_MATCH
);
4637 peer_timers_set_vty (struct vty
*vty
, const char *ip_str
,
4638 const char *keep_str
, const char *hold_str
)
4642 u_int32_t keepalive
;
4645 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
4649 VTY_GET_INTEGER_RANGE ("Keepalive", keepalive
, keep_str
, 0, 65535);
4650 VTY_GET_INTEGER_RANGE ("Holdtime", holdtime
, hold_str
, 0, 65535);
4652 ret
= peer_timers_set (peer
, keepalive
, holdtime
);
4654 return bgp_vty_return (vty
, ret
);
4658 peer_timers_unset_vty (struct vty
*vty
, const char *ip_str
)
4663 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
4667 ret
= peer_timers_unset (peer
);
4669 return bgp_vty_return (vty
, ret
);
4672 DEFUN (neighbor_timers
,
4673 neighbor_timers_cmd
,
4674 "neighbor <A.B.C.D|X:X::X:X|WORD> timers (0-65535) (0-65535)",
4677 "BGP per neighbor timers\n"
4678 "Keepalive interval\n"
4683 int idx_number_2
= 4;
4684 return peer_timers_set_vty (vty
, argv
[idx_peer
]->arg
, argv
[idx_number
]->arg
, argv
[idx_number_2
]->arg
);
4687 DEFUN (no_neighbor_timers
,
4688 no_neighbor_timers_cmd
,
4689 "no neighbor <A.B.C.D|X:X::X:X|WORD> timers [(0-65535) (0-65535)]",
4693 "BGP per neighbor timers\n"
4694 "Keepalive interval\n"
4698 return peer_timers_unset_vty (vty
, argv
[idx_peer
]->arg
);
4703 peer_timers_connect_set_vty (struct vty
*vty
, const char *ip_str
,
4704 const char *time_str
)
4710 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
4714 VTY_GET_INTEGER_RANGE ("Connect time", connect
, time_str
, 0, 65535);
4716 ret
= peer_timers_connect_set (peer
, connect
);
4718 return bgp_vty_return (vty
, ret
);
4722 peer_timers_connect_unset_vty (struct vty
*vty
, const char *ip_str
)
4727 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
4731 ret
= peer_timers_connect_unset (peer
);
4733 return bgp_vty_return (vty
, ret
);
4736 DEFUN (neighbor_timers_connect
,
4737 neighbor_timers_connect_cmd
,
4738 "neighbor <A.B.C.D|X:X::X:X|WORD> timers connect (1-65535)",
4741 "BGP per neighbor timers\n"
4742 "BGP connect timer\n"
4747 return peer_timers_connect_set_vty (vty
, argv
[idx_peer
]->arg
, argv
[idx_number
]->arg
);
4750 DEFUN (no_neighbor_timers_connect
,
4751 no_neighbor_timers_connect_cmd
,
4752 "no neighbor <A.B.C.D|X:X::X:X|WORD> timers connect [(1-65535)]",
4756 "BGP per neighbor timers\n"
4757 "BGP connect timer\n"
4761 return peer_timers_connect_unset_vty (vty
, argv
[idx_peer
]->arg
);
4766 peer_advertise_interval_vty (struct vty
*vty
, const char *ip_str
,
4767 const char *time_str
, int set
)
4771 u_int32_t routeadv
= 0;
4773 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
4778 VTY_GET_INTEGER_RANGE ("advertise interval", routeadv
, time_str
, 0, 600);
4781 ret
= peer_advertise_interval_set (peer
, routeadv
);
4783 ret
= peer_advertise_interval_unset (peer
);
4785 return bgp_vty_return (vty
, ret
);
4788 DEFUN (neighbor_advertise_interval
,
4789 neighbor_advertise_interval_cmd
,
4790 "neighbor <A.B.C.D|X:X::X:X|WORD> advertisement-interval (0-600)",
4793 "Minimum interval between sending BGP routing updates\n"
4794 "time in seconds\n")
4798 return peer_advertise_interval_vty (vty
, argv
[idx_peer
]->arg
, argv
[idx_number
]->arg
, 1);
4801 DEFUN (no_neighbor_advertise_interval
,
4802 no_neighbor_advertise_interval_cmd
,
4803 "no neighbor <A.B.C.D|X:X::X:X|WORD> advertisement-interval [(0-600)]",
4807 "Minimum interval between sending BGP routing updates\n"
4808 "time in seconds\n")
4811 return peer_advertise_interval_vty (vty
, argv
[idx_peer
]->arg
, NULL
, 0);
4815 /* Time to wait before processing route-map updates */
4816 DEFUN (bgp_set_route_map_delay_timer
,
4817 bgp_set_route_map_delay_timer_cmd
,
4818 "bgp route-map delay-timer (0-600)",
4820 "BGP route-map delay timer\n"
4821 "Time in secs to wait before processing route-map changes\n"
4822 "0 disables the timer, no route updates happen when route-maps change\n")
4825 u_int32_t rmap_delay_timer
;
4827 if (argv
[idx_number
]->arg
)
4829 VTY_GET_INTEGER_RANGE ("delay-timer", rmap_delay_timer
, argv
[idx_number
]->arg
, 0, 600);
4830 bm
->rmap_update_timer
= rmap_delay_timer
;
4832 /* if the dynamic update handling is being disabled, and a timer is
4833 * running, stop the timer and act as if the timer has already fired.
4835 if (!rmap_delay_timer
&& bm
->t_rmap_update
)
4837 BGP_TIMER_OFF(bm
->t_rmap_update
);
4838 thread_execute (bm
->master
, bgp_route_map_update_timer
, NULL
, 0);
4846 DEFUN (no_bgp_set_route_map_delay_timer
,
4847 no_bgp_set_route_map_delay_timer_cmd
,
4848 "no bgp route-map delay-timer [(0-600)]",
4851 "Default BGP route-map delay timer\n"
4852 "Reset to default time to wait for processing route-map changes\n"
4853 "0 disables the timer, no route updates happen when route-maps change\n")
4856 bm
->rmap_update_timer
= RMAP_DEFAULT_UPDATE_TIMER
;
4862 /* neighbor interface */
4864 peer_interface_vty (struct vty
*vty
, const char *ip_str
, const char *str
)
4868 peer
= peer_lookup_vty (vty
, ip_str
);
4869 if (! peer
|| peer
->conf_if
)
4873 peer_interface_set (peer
, str
);
4875 peer_interface_unset (peer
);
4880 DEFUN (neighbor_interface
,
4881 neighbor_interface_cmd
,
4882 "neighbor <A.B.C.D|X:X::X:X> interface WORD",
4890 return peer_interface_vty (vty
, argv
[idx_ip
]->arg
, argv
[idx_word
]->arg
);
4893 DEFUN (no_neighbor_interface
,
4894 no_neighbor_interface_cmd
,
4895 "no neighbor <A.B.C.D|X:X::X:X|WORD> interface WORD",
4903 return peer_interface_vty (vty
, argv
[idx_peer
]->arg
, NULL
);
4906 /* Set distribute list to the peer. */
4908 peer_distribute_set_vty (struct vty
*vty
, const char *ip_str
,
4909 afi_t afi
, safi_t safi
,
4910 const char *name_str
, const char *direct_str
)
4914 int direct
= FILTER_IN
;
4916 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
4920 /* Check filter direction. */
4921 if (strncmp (direct_str
, "i", 1) == 0)
4923 else if (strncmp (direct_str
, "o", 1) == 0)
4924 direct
= FILTER_OUT
;
4926 ret
= peer_distribute_set (peer
, afi
, safi
, direct
, name_str
);
4928 return bgp_vty_return (vty
, ret
);
4932 peer_distribute_unset_vty (struct vty
*vty
, const char *ip_str
, afi_t afi
,
4933 safi_t safi
, const char *direct_str
)
4937 int direct
= FILTER_IN
;
4939 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
4943 /* Check filter direction. */
4944 if (strncmp (direct_str
, "i", 1) == 0)
4946 else if (strncmp (direct_str
, "o", 1) == 0)
4947 direct
= FILTER_OUT
;
4949 ret
= peer_distribute_unset (peer
, afi
, safi
, direct
);
4951 return bgp_vty_return (vty
, ret
);
4954 DEFUN (neighbor_distribute_list
,
4955 neighbor_distribute_list_cmd
,
4956 "neighbor <A.B.C.D|X:X::X:X|WORD> distribute-list <(1-199)|(1300-2699)|WORD> <in|out>",
4959 "Filter updates to/from this neighbor\n"
4960 "IP access-list number\n"
4961 "IP access-list number (expanded range)\n"
4962 "IP Access-list name\n"
4963 "Filter incoming updates\n"
4964 "Filter outgoing updates\n")
4969 return peer_distribute_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4970 bgp_node_safi (vty
), argv
[idx_acl
]->arg
, argv
[idx_in_out
]->arg
);
4973 DEFUN (no_neighbor_distribute_list
,
4974 no_neighbor_distribute_list_cmd
,
4975 "no neighbor <A.B.C.D|X:X::X:X|WORD> distribute-list <(1-199)|(1300-2699)|WORD> <in|out>",
4979 "Filter updates to/from this neighbor\n"
4980 "IP access-list number\n"
4981 "IP access-list number (expanded range)\n"
4982 "IP Access-list name\n"
4983 "Filter incoming updates\n"
4984 "Filter outgoing updates\n")
4988 return peer_distribute_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4989 bgp_node_safi (vty
), argv
[idx_in_out
]->arg
);
4992 /* Set prefix list to the peer. */
4994 peer_prefix_list_set_vty (struct vty
*vty
, const char *ip_str
, afi_t afi
,
4995 safi_t safi
, const char *name_str
,
4996 const char *direct_str
)
5000 int direct
= FILTER_IN
;
5002 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
5006 /* Check filter direction. */
5007 if (strncmp (direct_str
, "i", 1) == 0)
5009 else if (strncmp (direct_str
, "o", 1) == 0)
5010 direct
= FILTER_OUT
;
5012 ret
= peer_prefix_list_set (peer
, afi
, safi
, direct
, name_str
);
5014 return bgp_vty_return (vty
, ret
);
5018 peer_prefix_list_unset_vty (struct vty
*vty
, const char *ip_str
, afi_t afi
,
5019 safi_t safi
, const char *direct_str
)
5023 int direct
= FILTER_IN
;
5025 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
5029 /* Check filter direction. */
5030 if (strncmp (direct_str
, "i", 1) == 0)
5032 else if (strncmp (direct_str
, "o", 1) == 0)
5033 direct
= FILTER_OUT
;
5035 ret
= peer_prefix_list_unset (peer
, afi
, safi
, direct
);
5037 return bgp_vty_return (vty
, ret
);
5040 DEFUN (neighbor_prefix_list
,
5041 neighbor_prefix_list_cmd
,
5042 "neighbor <A.B.C.D|X:X::X:X|WORD> prefix-list WORD <in|out>",
5045 "Filter updates to/from this neighbor\n"
5046 "Name of a prefix list\n"
5047 "Filter incoming updates\n"
5048 "Filter outgoing updates\n")
5053 return peer_prefix_list_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
5054 bgp_node_safi (vty
), argv
[idx_word
]->arg
, argv
[idx_in_out
]->arg
);
5057 DEFUN (no_neighbor_prefix_list
,
5058 no_neighbor_prefix_list_cmd
,
5059 "no neighbor <A.B.C.D|X:X::X:X|WORD> prefix-list WORD <in|out>",
5063 "Filter updates to/from this neighbor\n"
5064 "Name of a prefix list\n"
5065 "Filter incoming updates\n"
5066 "Filter outgoing updates\n")
5070 return peer_prefix_list_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
5071 bgp_node_safi (vty
), argv
[idx_in_out
]->arg
);
5075 peer_aslist_set_vty (struct vty
*vty
, const char *ip_str
,
5076 afi_t afi
, safi_t safi
,
5077 const char *name_str
, const char *direct_str
)
5081 int direct
= FILTER_IN
;
5083 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
5087 /* Check filter direction. */
5088 if (strncmp (direct_str
, "i", 1) == 0)
5090 else if (strncmp (direct_str
, "o", 1) == 0)
5091 direct
= FILTER_OUT
;
5093 ret
= peer_aslist_set (peer
, afi
, safi
, direct
, name_str
);
5095 return bgp_vty_return (vty
, ret
);
5099 peer_aslist_unset_vty (struct vty
*vty
, const char *ip_str
,
5100 afi_t afi
, safi_t safi
,
5101 const char *direct_str
)
5105 int direct
= FILTER_IN
;
5107 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
5111 /* Check filter direction. */
5112 if (strncmp (direct_str
, "i", 1) == 0)
5114 else if (strncmp (direct_str
, "o", 1) == 0)
5115 direct
= FILTER_OUT
;
5117 ret
= peer_aslist_unset (peer
, afi
, safi
, direct
);
5119 return bgp_vty_return (vty
, ret
);
5122 DEFUN (neighbor_filter_list
,
5123 neighbor_filter_list_cmd
,
5124 "neighbor <A.B.C.D|X:X::X:X|WORD> filter-list WORD <in|out>",
5127 "Establish BGP filters\n"
5128 "AS path access-list name\n"
5129 "Filter incoming routes\n"
5130 "Filter outgoing routes\n")
5135 return peer_aslist_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
5136 bgp_node_safi (vty
), argv
[idx_word
]->arg
, argv
[idx_in_out
]->arg
);
5139 DEFUN (no_neighbor_filter_list
,
5140 no_neighbor_filter_list_cmd
,
5141 "no neighbor <A.B.C.D|X:X::X:X|WORD> filter-list WORD <in|out>",
5145 "Establish BGP filters\n"
5146 "AS path access-list name\n"
5147 "Filter incoming routes\n"
5148 "Filter outgoing routes\n")
5152 return peer_aslist_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
5153 bgp_node_safi (vty
), argv
[idx_in_out
]->arg
);
5156 /* Set route-map to the peer. */
5158 peer_route_map_set_vty (struct vty
*vty
, const char *ip_str
,
5159 afi_t afi
, safi_t safi
,
5160 const char *name_str
, const char *direct_str
)
5164 int direct
= RMAP_IN
;
5166 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
5170 /* Check filter direction. */
5171 if (strncmp (direct_str
, "in", 2) == 0)
5173 else if (strncmp (direct_str
, "o", 1) == 0)
5176 ret
= peer_route_map_set (peer
, afi
, safi
, direct
, name_str
);
5178 return bgp_vty_return (vty
, ret
);
5182 peer_route_map_unset_vty (struct vty
*vty
, const char *ip_str
, afi_t afi
,
5183 safi_t safi
, const char *direct_str
)
5187 int direct
= RMAP_IN
;
5189 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
5193 /* Check filter direction. */
5194 if (strncmp (direct_str
, "in", 2) == 0)
5196 else if (strncmp (direct_str
, "o", 1) == 0)
5199 ret
= peer_route_map_unset (peer
, afi
, safi
, direct
);
5201 return bgp_vty_return (vty
, ret
);
5204 DEFUN (neighbor_route_map
,
5205 neighbor_route_map_cmd
,
5206 "neighbor <A.B.C.D|X:X::X:X|WORD> route-map WORD <in|out>",
5209 "Apply route map to neighbor\n"
5210 "Name of route map\n"
5211 "Apply map to incoming routes\n"
5212 "Apply map to outbound routes\n")
5217 return peer_route_map_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
5218 bgp_node_safi (vty
), argv
[idx_word
]->arg
, argv
[idx_in_out
]->arg
);
5221 DEFUN (no_neighbor_route_map
,
5222 no_neighbor_route_map_cmd
,
5223 "no neighbor <A.B.C.D|X:X::X:X|WORD> route-map WORD <in|out>",
5227 "Apply route map to neighbor\n"
5228 "Name of route map\n"
5229 "Apply map to incoming routes\n"
5230 "Apply map to outbound routes\n")
5234 return peer_route_map_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
5235 bgp_node_safi (vty
), argv
[idx_in_out
]->arg
);
5238 /* Set unsuppress-map to the peer. */
5240 peer_unsuppress_map_set_vty (struct vty
*vty
, const char *ip_str
, afi_t afi
,
5241 safi_t safi
, const char *name_str
)
5246 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
5250 ret
= peer_unsuppress_map_set (peer
, afi
, safi
, name_str
);
5252 return bgp_vty_return (vty
, ret
);
5255 /* Unset route-map from the peer. */
5257 peer_unsuppress_map_unset_vty (struct vty
*vty
, const char *ip_str
, afi_t afi
,
5263 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
5267 ret
= peer_unsuppress_map_unset (peer
, afi
, safi
);
5269 return bgp_vty_return (vty
, ret
);
5272 DEFUN (neighbor_unsuppress_map
,
5273 neighbor_unsuppress_map_cmd
,
5274 "neighbor <A.B.C.D|X:X::X:X|WORD> unsuppress-map WORD",
5277 "Route-map to selectively unsuppress suppressed routes\n"
5278 "Name of route map\n")
5282 return peer_unsuppress_map_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
5283 bgp_node_safi (vty
), argv
[idx_word
]->arg
);
5286 DEFUN (no_neighbor_unsuppress_map
,
5287 no_neighbor_unsuppress_map_cmd
,
5288 "no neighbor <A.B.C.D|X:X::X:X|WORD> unsuppress-map WORD",
5292 "Route-map to selectively unsuppress suppressed routes\n"
5293 "Name of route map\n")
5296 return peer_unsuppress_map_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
5297 bgp_node_safi (vty
));
5301 peer_maximum_prefix_set_vty (struct vty
*vty
, const char *ip_str
, afi_t afi
,
5302 safi_t safi
, const char *num_str
,
5303 const char *threshold_str
, int warning
,
5304 const char *restart_str
)
5312 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
5316 VTY_GET_INTEGER ("maximum number", max
, num_str
);
5318 threshold
= atoi (threshold_str
);
5320 threshold
= MAXIMUM_PREFIX_THRESHOLD_DEFAULT
;
5323 restart
= atoi (restart_str
);
5327 ret
= peer_maximum_prefix_set (peer
, afi
, safi
, max
, threshold
, warning
, restart
);
5329 return bgp_vty_return (vty
, ret
);
5333 peer_maximum_prefix_unset_vty (struct vty
*vty
, const char *ip_str
, afi_t afi
,
5339 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
5343 ret
= peer_maximum_prefix_unset (peer
, afi
, safi
);
5345 return bgp_vty_return (vty
, ret
);
5348 /* Maximum number of prefix configuration. prefix count is different
5349 for each peer configuration. So this configuration can be set for
5350 each peer configuration. */
5351 DEFUN (neighbor_maximum_prefix
,
5352 neighbor_maximum_prefix_cmd
,
5353 "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295)",
5356 "Maximum number of prefix accept from this peer\n"
5357 "maximum no. of prefix limit\n")
5361 return peer_maximum_prefix_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
5362 bgp_node_safi (vty
), argv
[idx_number
]->arg
, NULL
, 0,
5366 DEFUN (neighbor_maximum_prefix_threshold
,
5367 neighbor_maximum_prefix_threshold_cmd
,
5368 "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295) (1-100)",
5371 "Maximum number of prefix accept from this peer\n"
5372 "maximum no. of prefix limit\n"
5373 "Threshold value (%) at which to generate a warning msg\n")
5377 int idx_number_2
= 4;
5378 return peer_maximum_prefix_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
5379 bgp_node_safi (vty
), argv
[idx_number
]->arg
, argv
[idx_number_2
]->arg
, 0,
5383 DEFUN (neighbor_maximum_prefix_warning
,
5384 neighbor_maximum_prefix_warning_cmd
,
5385 "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295) warning-only",
5388 "Maximum number of prefix accept from this peer\n"
5389 "maximum no. of prefix limit\n"
5390 "Only give warning message when limit is exceeded\n")
5394 return peer_maximum_prefix_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
5395 bgp_node_safi (vty
), argv
[idx_number
]->arg
, NULL
, 1,
5399 DEFUN (neighbor_maximum_prefix_threshold_warning
,
5400 neighbor_maximum_prefix_threshold_warning_cmd
,
5401 "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295) (1-100) warning-only",
5404 "Maximum number of prefix accept from this peer\n"
5405 "maximum no. of prefix limit\n"
5406 "Threshold value (%) at which to generate a warning msg\n"
5407 "Only give warning message when limit is exceeded\n")
5411 int idx_number_2
= 4;
5412 return peer_maximum_prefix_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
5413 bgp_node_safi (vty
), argv
[idx_number
]->arg
, argv
[idx_number_2
]->arg
, 1, NULL
);
5416 DEFUN (neighbor_maximum_prefix_restart
,
5417 neighbor_maximum_prefix_restart_cmd
,
5418 "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295) restart (1-65535)",
5421 "Maximum number of prefix accept from this peer\n"
5422 "maximum no. of prefix limit\n"
5423 "Restart bgp connection after limit is exceeded\n"
5424 "Restart interval in minutes")
5428 int idx_number_2
= 5;
5429 return peer_maximum_prefix_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
5430 bgp_node_safi (vty
), argv
[idx_number
]->arg
, NULL
, 0, argv
[idx_number_2
]->arg
);
5433 DEFUN (neighbor_maximum_prefix_threshold_restart
,
5434 neighbor_maximum_prefix_threshold_restart_cmd
,
5435 "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295) (1-100) restart (1-65535)",
5438 "Maximum number of prefixes to accept from this peer\n"
5439 "maximum no. of prefix limit\n"
5440 "Threshold value (%) at which to generate a warning msg\n"
5441 "Restart bgp connection after limit is exceeded\n"
5442 "Restart interval in minutes\n")
5446 int idx_number_2
= 4;
5447 int idx_number_3
= 6;
5448 return peer_maximum_prefix_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
5449 bgp_node_safi (vty
), argv
[idx_number
]->arg
, argv
[idx_number_2
]->arg
, 0, argv
[idx_number_3
]->arg
);
5452 DEFUN (no_neighbor_maximum_prefix
,
5453 no_neighbor_maximum_prefix_cmd
,
5454 "no neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix [(1-4294967295) [(1-100)] [restart (1-65535)] [warning-only]]",
5458 "Maximum number of prefixes to accept from this peer\n"
5459 "maximum no. of prefix limit\n"
5460 "Threshold value (%) at which to generate a warning msg\n"
5461 "Restart bgp connection after limit is exceeded\n"
5462 "Restart interval in minutes\n"
5463 "Only give warning message when limit is exceeded\n")
5466 return peer_maximum_prefix_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
5467 bgp_node_safi (vty
));
5471 /* "neighbor allowas-in" */
5472 DEFUN (neighbor_allowas_in
,
5473 neighbor_allowas_in_cmd
,
5474 "neighbor <A.B.C.D|X:X::X:X|WORD> allowas-in [<(1-10)|origin>]",
5477 "Accept as-path with my AS present in it\n"
5478 "Number of occurances of AS number\n"
5479 "Only accept my AS in the as-path if the route was originated in my AS\n")
5482 int idx_number_origin
= 3;
5488 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
5492 if (argc
<= idx_number_origin
)
5496 if (argv
[idx_number_origin
]->type
== WORD_TKN
)
5499 allow_num
= atoi (argv
[idx_number_origin
]->arg
);
5502 ret
= peer_allowas_in_set (peer
, bgp_node_afi (vty
), bgp_node_safi (vty
),
5505 return bgp_vty_return (vty
, ret
);
5508 DEFUN (no_neighbor_allowas_in
,
5509 no_neighbor_allowas_in_cmd
,
5510 "no neighbor <A.B.C.D|X:X::X:X|WORD> allowas-in [<(1-10)|origin>]",
5514 "allow local ASN appears in aspath attribute\n"
5515 "Number of occurances of AS number\n"
5516 "Only accept my AS in the as-path if the route was originated in my AS\n")
5522 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
5526 ret
= peer_allowas_in_unset (peer
, bgp_node_afi (vty
), bgp_node_safi (vty
));
5528 return bgp_vty_return (vty
, ret
);
5531 DEFUN (neighbor_ttl_security
,
5532 neighbor_ttl_security_cmd
,
5533 "neighbor <A.B.C.D|X:X::X:X|WORD> ttl-security hops (1-254)",
5536 "BGP ttl-security parameters\n"
5537 "Specify the maximum number of hops to the BGP peer\n"
5538 "Number of hops to BGP peer\n")
5545 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
5549 VTY_GET_INTEGER_RANGE ("", gtsm_hops
, argv
[idx_number
]->arg
, 1, 254);
5552 * If 'neighbor swpX', then this is for directly connected peers,
5553 * we should not accept a ttl-security hops value greater than 1.
5555 if (peer
->conf_if
&& (gtsm_hops
> 1)) {
5556 vty_out (vty
, "%s is directly connected peer, hops cannot exceed 1%s",
5557 argv
[idx_peer
]->arg
, VTY_NEWLINE
);
5561 return bgp_vty_return (vty
, peer_ttl_security_hops_set (peer
, gtsm_hops
));
5564 DEFUN (no_neighbor_ttl_security
,
5565 no_neighbor_ttl_security_cmd
,
5566 "no neighbor <A.B.C.D|X:X::X:X|WORD> ttl-security hops (1-254)",
5570 "BGP ttl-security parameters\n"
5571 "Specify the maximum number of hops to the BGP peer\n"
5572 "Number of hops to BGP peer\n")
5577 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
5581 return bgp_vty_return (vty
, peer_ttl_security_hops_unset (peer
));
5584 DEFUN (neighbor_addpath_tx_all_paths
,
5585 neighbor_addpath_tx_all_paths_cmd
,
5586 "neighbor <A.B.C.D|X:X::X:X|WORD> addpath-tx-all-paths",
5589 "Use addpath to advertise all paths to a neighbor\n")
5594 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
5598 return peer_af_flag_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
5599 bgp_node_safi (vty
),
5600 PEER_FLAG_ADDPATH_TX_ALL_PATHS
);
5603 DEFUN (no_neighbor_addpath_tx_all_paths
,
5604 no_neighbor_addpath_tx_all_paths_cmd
,
5605 "no neighbor <A.B.C.D|X:X::X:X|WORD> addpath-tx-all-paths",
5609 "Use addpath to advertise all paths to a neighbor\n")
5612 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
5613 bgp_node_safi (vty
),
5614 PEER_FLAG_ADDPATH_TX_ALL_PATHS
);
5617 DEFUN (neighbor_addpath_tx_bestpath_per_as
,
5618 neighbor_addpath_tx_bestpath_per_as_cmd
,
5619 "neighbor <A.B.C.D|X:X::X:X|WORD> addpath-tx-bestpath-per-AS",
5622 "Use addpath to advertise the bestpath per each neighboring AS\n")
5627 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
5631 return peer_af_flag_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
5632 bgp_node_safi (vty
),
5633 PEER_FLAG_ADDPATH_TX_BESTPATH_PER_AS
);
5636 DEFUN (no_neighbor_addpath_tx_bestpath_per_as
,
5637 no_neighbor_addpath_tx_bestpath_per_as_cmd
,
5638 "no neighbor <A.B.C.D|X:X::X:X|WORD> addpath-tx-bestpath-per-AS",
5642 "Use addpath to advertise the bestpath per each neighboring AS\n")
5645 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
5646 bgp_node_safi (vty
),
5647 PEER_FLAG_ADDPATH_TX_BESTPATH_PER_AS
);
5650 DEFUN_NOSH (address_family_ipv4_safi
,
5651 address_family_ipv4_safi_cmd
,
5652 "address-family ipv4 [<unicast|multicast|vpn|encap>]",
5653 "Enter Address Family command mode\n"
5658 if (argc
== (idx_safi
+ 1))
5660 switch (bgp_vty_safi_from_arg(argv
[idx_safi
]->arg
))
5662 case SAFI_MULTICAST
:
5663 vty
->node
= BGP_IPV4M_NODE
;
5666 vty
->node
= BGP_ENCAP_NODE
;
5669 vty
->node
= BGP_VPNV4_NODE
;
5673 vty
->node
= BGP_IPV4_NODE
;
5678 vty
->node
= BGP_IPV4_NODE
;
5683 DEFUN_NOSH (address_family_ipv6_safi
,
5684 address_family_ipv6_safi_cmd
,
5685 "address-family ipv6 [<unicast|multicast|vpn|encap>]",
5686 "Enter Address Family command mode\n"
5691 if (argc
== (idx_safi
+ 1))
5693 switch (bgp_vty_safi_from_arg(argv
[idx_safi
]->arg
))
5695 case SAFI_MULTICAST
:
5696 vty
->node
= BGP_IPV6M_NODE
;
5699 vty
->node
= BGP_ENCAPV6_NODE
;
5702 vty
->node
= BGP_VPNV6_NODE
;
5706 vty
->node
= BGP_IPV6_NODE
;
5711 vty
->node
= BGP_IPV6_NODE
;
5716 #ifdef KEEP_OLD_VPN_COMMANDS
5717 DEFUN_NOSH (address_family_vpnv4
,
5718 address_family_vpnv4_cmd
,
5719 "address-family vpnv4 [unicast]",
5720 "Enter Address Family command mode\n"
5722 "Address Family modifier\n")
5724 vty
->node
= BGP_VPNV4_NODE
;
5728 DEFUN_NOSH (address_family_vpnv6
,
5729 address_family_vpnv6_cmd
,
5730 "address-family vpnv6 [unicast]",
5731 "Enter Address Family command mode\n"
5733 "Address Family modifier\n")
5735 vty
->node
= BGP_VPNV6_NODE
;
5740 DEFUN_NOSH (address_family_encap
,
5741 address_family_encap_cmd
,
5742 "address-family <encap|encapv4>",
5743 "Enter Address Family command mode\n"
5747 vty
->node
= BGP_ENCAP_NODE
;
5752 DEFUN_NOSH (address_family_encapv6
,
5753 address_family_encapv6_cmd
,
5754 "address-family encapv6",
5755 "Enter Address Family command mode\n"
5758 vty
->node
= BGP_ENCAPV6_NODE
;
5762 DEFUN_NOSH (address_family_evpn
,
5763 address_family_evpn_cmd
,
5764 "address-family <l2vpn evpn>",
5765 "Enter Address Family command mode\n"
5766 "EVPN Address family\n"
5767 "Layer2 VPN Address family\n"
5768 "Ethernet Virtual Private Network Subsequent Address Family\n")
5770 vty
->node
= BGP_EVPN_NODE
;
5774 DEFUN_NOSH (exit_address_family
,
5775 exit_address_family_cmd
,
5776 "exit-address-family",
5777 "Exit from Address Family configuration mode\n")
5779 if (vty
->node
== BGP_IPV4_NODE
5780 || vty
->node
== BGP_IPV4M_NODE
5781 || vty
->node
== BGP_VPNV4_NODE
5782 || vty
->node
== BGP_IPV6_NODE
5783 || vty
->node
== BGP_IPV6M_NODE
5784 || vty
->node
== BGP_VPNV6_NODE
5785 || vty
->node
== BGP_ENCAP_NODE
5786 || vty
->node
== BGP_ENCAPV6_NODE
5787 || vty
->node
== BGP_EVPN_NODE
)
5788 vty
->node
= BGP_NODE
;
5792 /* Recalculate bestpath and re-advertise a prefix */
5794 bgp_clear_prefix (struct vty
*vty
, const char *view_name
, const char *ip_str
,
5795 afi_t afi
, safi_t safi
, struct prefix_rd
*prd
)
5798 struct prefix match
;
5799 struct bgp_node
*rn
;
5800 struct bgp_node
*rm
;
5802 struct bgp_table
*table
;
5803 struct bgp_table
*rib
;
5805 /* BGP structure lookup. */
5808 bgp
= bgp_lookup_by_name (view_name
);
5811 vty_out (vty
, "%% Can't find BGP instance %s%s", view_name
, VTY_NEWLINE
);
5817 bgp
= bgp_get_default ();
5820 vty_out (vty
, "%% No BGP process is configured%s", VTY_NEWLINE
);
5825 /* Check IP address argument. */
5826 ret
= str2prefix (ip_str
, &match
);
5829 vty_out (vty
, "%% address is malformed%s", VTY_NEWLINE
);
5833 match
.family
= afi2family (afi
);
5834 rib
= bgp
->rib
[afi
][safi
];
5836 if (safi
== SAFI_MPLS_VPN
)
5838 for (rn
= bgp_table_top (rib
); rn
; rn
= bgp_route_next (rn
))
5840 if (prd
&& memcmp (rn
->p
.u
.val
, prd
->val
, 8) != 0)
5843 if ((table
= rn
->info
) != NULL
)
5845 if ((rm
= bgp_node_match (table
, &match
)) != NULL
)
5847 if (rm
->p
.prefixlen
== match
.prefixlen
)
5849 SET_FLAG (rn
->flags
, BGP_NODE_USER_CLEAR
);
5850 bgp_process (bgp
, rm
, afi
, safi
);
5852 bgp_unlock_node (rm
);
5859 if ((rn
= bgp_node_match (rib
, &match
)) != NULL
)
5861 if (rn
->p
.prefixlen
== match
.prefixlen
)
5863 SET_FLAG (rn
->flags
, BGP_NODE_USER_CLEAR
);
5864 bgp_process (bgp
, rn
, afi
, safi
);
5866 bgp_unlock_node (rn
);
5873 /* one clear bgp command to rule them all */
5874 DEFUN (clear_ip_bgp_all
,
5875 clear_ip_bgp_all_cmd
,
5876 "clear [ip] bgp [<view|vrf> WORD] ["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>]",
5880 BGP_INSTANCE_HELP_STR
5882 "BGP neighbor address to clear\n"
5883 "BGP IPv6 neighbor to clear\n"
5884 "BGP neighbor on interface to clear\n"
5885 "Clear peers with the AS number\n"
5886 "Clear all external peers\n"
5887 "Clear all members of peer-group\n"
5888 "BGP peer-group name\n"
5895 "Push out prefix-list ORF and do inbound soft reconfig\n"
5900 afi_t afi
= AFI_IP6
;
5901 safi_t safi
= SAFI_UNICAST
;
5902 enum clear_sort clr_sort
= clear_peer
;
5903 enum bgp_clear_type clr_type
;
5904 char *clr_arg
= NULL
;
5908 /* clear [ip] bgp */
5909 if (argv_find (argv
, argc
, "ip", &idx
))
5911 /* [<view|vrf> WORD] */
5912 if (argv_find (argv
, argc
, "view", &idx
) || argv_find (argv
, argc
, "vrf", &idx
))
5914 vrf
= argv
[idx
+ 1]->arg
;
5917 /* <*|A.B.C.D|X:X::X:X|WORD|(1-4294967295)|external|peer-group WORD> */
5918 if (argv_find (argv
, argc
, "*", &idx
))
5920 clr_sort
= clear_all
;
5922 else if (argv_find (argv
, argc
, "A.B.C.D", &idx
))
5924 clr_sort
= clear_peer
;
5925 clr_arg
= argv
[idx
]->arg
;
5927 else if (argv_find (argv
, argc
, "X:X::X:X", &idx
))
5929 clr_sort
= clear_peer
;
5930 clr_arg
= argv
[idx
]->arg
;
5932 else if (argv_find (argv
, argc
, "peer-group", &idx
))
5934 clr_sort
= clear_group
;
5936 clr_arg
= argv
[idx
]->arg
;
5938 else if (argv_find (argv
, argc
, "WORD", &idx
))
5940 clr_sort
= clear_peer
;
5941 clr_arg
= argv
[idx
]->arg
;
5943 else if (argv_find (argv
, argc
, "(1-4294967295)", &idx
))
5945 clr_sort
= clear_as
;
5946 clr_arg
= argv
[idx
]->arg
;
5948 else if (argv_find (argv
, argc
, "external", &idx
))
5950 clr_sort
= clear_external
;
5952 /* ["BGP_AFI_CMD_STR" ["BGP_SAFI_CMD_STR"]] */
5953 if (argv_find_and_parse_afi (argv
, argc
, &idx
, &afi
))
5955 argv_find_and_parse_safi (argv
, argc
, &idx
, &safi
);
5957 /* [<soft [<in|out>]|in [prefix-filter]|out>] */
5958 if (argv_find (argv
, argc
, "soft", &idx
))
5960 if (argv_find (argv
, argc
, "in", &idx
) || argv_find (argv
, argc
, "out", &idx
))
5961 clr_type
= strmatch (argv
[idx
]->text
, "in") ? BGP_CLEAR_SOFT_IN
: BGP_CLEAR_SOFT_OUT
;
5963 clr_type
= BGP_CLEAR_SOFT_BOTH
;
5965 else if (argv_find (argv
, argc
, "in", &idx
))
5967 clr_type
= argv_find (argv
, argc
, "prefix-filter", &idx
) ? BGP_CLEAR_SOFT_IN_ORF_PREFIX
: BGP_CLEAR_SOFT_IN
;
5969 else if (argv_find (argv
, argc
, "out", &idx
))
5971 clr_type
= BGP_CLEAR_SOFT_OUT
;
5974 clr_type
= BGP_CLEAR_SOFT_NONE
;
5976 return bgp_clear_vty (vty
, vrf
, afi
, safi
, clr_sort
, clr_type
, clr_arg
);
5979 DEFUN (clear_ip_bgp_prefix
,
5980 clear_ip_bgp_prefix_cmd
,
5981 "clear [ip] bgp [<view|vrf> WORD] prefix A.B.C.D/M",
5985 BGP_INSTANCE_HELP_STR
5986 "Clear bestpath and re-advertise\n"
5990 char *prefix
= NULL
;
5994 /* [<view|vrf> WORD] */
5995 if (argv_find (argv
, argc
, "WORD", &idx
))
5996 vrf
= argv
[idx
]->arg
;
5998 prefix
= argv
[argc
-1]->arg
;
6000 return bgp_clear_prefix (vty
, vrf
, prefix
, AFI_IP
, SAFI_UNICAST
, NULL
);
6003 DEFUN (clear_bgp_ipv6_safi_prefix
,
6004 clear_bgp_ipv6_safi_prefix_cmd
,
6005 "clear [ip] bgp ipv6 "BGP_SAFI_CMD_STR
" prefix X:X::X:X/M",
6011 "Clear bestpath and re-advertise\n"
6015 int idx_ipv6_prefixlen
= 5;
6016 return bgp_clear_prefix (vty
, NULL
, argv
[idx_ipv6_prefixlen
]->arg
, AFI_IP6
,
6017 bgp_vty_safi_from_arg(argv
[idx_safi
]->arg
), NULL
);
6020 DEFUN (clear_bgp_instance_ipv6_safi_prefix
,
6021 clear_bgp_instance_ipv6_safi_prefix_cmd
,
6022 "clear [ip] bgp <view|vrf> WORD ipv6 "BGP_SAFI_CMD_STR
" prefix X:X::X:X/M",
6026 BGP_INSTANCE_HELP_STR
6029 "Clear bestpath and re-advertise\n"
6034 int idx_ipv6_prefixlen
= 7;
6035 return bgp_clear_prefix (vty
, argv
[idx_word
]->arg
, argv
[idx_ipv6_prefixlen
]->arg
, AFI_IP6
,
6036 bgp_vty_safi_from_arg(argv
[idx_safi
]->arg
), NULL
);
6039 DEFUN (show_bgp_views
,
6041 "show [ip] bgp views",
6045 "Show the defined BGP views\n")
6047 struct list
*inst
= bm
->bgp
;
6048 struct listnode
*node
;
6051 if (!bgp_option_check (BGP_OPT_MULTIPLE_INSTANCE
))
6053 vty_out (vty
, "BGP Multiple Instance is not enabled%s", VTY_NEWLINE
);
6057 vty_out (vty
, "Defined BGP views:%s", VTY_NEWLINE
);
6058 for (ALL_LIST_ELEMENTS_RO(inst
, node
, bgp
))
6061 if (bgp
->inst_type
== BGP_INSTANCE_TYPE_VRF
)
6063 vty_out (vty
, "\t%s (AS%u)%s",
6064 bgp
->name
? bgp
->name
: "(null)",
6065 bgp
->as
, VTY_NEWLINE
);
6071 DEFUN (show_bgp_vrfs
,
6073 "show [ip] bgp vrfs [json]",
6080 struct list
*inst
= bm
->bgp
;
6081 struct listnode
*node
;
6083 u_char uj
= use_json(argc
, argv
);
6084 json_object
*json
= NULL
;
6085 json_object
*json_vrfs
= NULL
;
6087 static char header
[] = "Type Id RouterId #PeersCfg #PeersEstb Name";
6089 if (!bgp_option_check (BGP_OPT_MULTIPLE_INSTANCE
))
6091 vty_out (vty
, "BGP Multiple Instance is not enabled%s", VTY_NEWLINE
);
6097 json
= json_object_new_object();
6098 json_vrfs
= json_object_new_object();
6101 for (ALL_LIST_ELEMENTS_RO(inst
, node
, bgp
))
6103 const char *name
, *type
;
6105 struct listnode
*node
, *nnode
;
6106 int peers_cfg
, peers_estb
;
6107 json_object
*json_vrf
= NULL
;
6111 if (bgp
->inst_type
== BGP_INSTANCE_TYPE_VIEW
)
6115 if (!uj
&& count
== 1)
6116 vty_out (vty
, "%s%s", header
, VTY_NEWLINE
);
6118 peers_cfg
= peers_estb
= 0;
6120 json_vrf
= json_object_new_object();
6123 for (ALL_LIST_ELEMENTS (bgp
->peer
, node
, nnode
, peer
))
6125 if (!CHECK_FLAG(peer
->flags
, PEER_FLAG_CONFIG_NODE
))
6128 if (peer
->status
== Established
)
6132 if (bgp
->inst_type
== BGP_INSTANCE_TYPE_DEFAULT
)
6143 vrf_id_ui
= (bgp
->vrf_id
== VRF_UNKNOWN
) ? -1 : bgp
->vrf_id
;
6146 json_object_string_add(json_vrf
, "type", type
);
6147 json_object_int_add(json_vrf
, "vrfId", vrf_id_ui
);
6148 json_object_string_add(json_vrf
, "routerId", inet_ntoa (bgp
->router_id
));
6149 json_object_int_add(json_vrf
, "numConfiguredPeers", peers_cfg
);
6150 json_object_int_add(json_vrf
, "numEstablishedPeers", peers_estb
);
6152 json_object_object_add(json_vrfs
, name
, json_vrf
);
6155 vty_out (vty
, "%4s %-5d %-16s %9u %10u %s%s",
6156 type
, vrf_id_ui
, inet_ntoa (bgp
->router_id
),
6157 peers_cfg
, peers_estb
, name
,
6163 json_object_object_add(json
, "vrfs", json_vrfs
);
6165 json_object_int_add(json
, "totalVrfs", count
);
6167 vty_out (vty
, "%s%s", json_object_to_json_string_ext(json
, JSON_C_TO_STRING_PRETTY
), VTY_NEWLINE
);
6168 json_object_free(json
);
6173 vty_out (vty
, "%sTotal number of VRFs (including default): %d%s",
6174 VTY_NEWLINE
, count
, VTY_NEWLINE
);
6180 DEFUN (show_bgp_memory
,
6181 show_bgp_memory_cmd
,
6182 "show [ip] bgp memory",
6186 "Global BGP memory statistics\n")
6188 char memstrbuf
[MTYPE_MEMSTR_LEN
];
6189 unsigned long count
;
6191 /* RIB related usage stats */
6192 count
= mtype_stats_alloc (MTYPE_BGP_NODE
);
6193 vty_out (vty
, "%ld RIB nodes, using %s of memory%s", count
,
6194 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6195 count
* sizeof (struct bgp_node
)),
6198 count
= mtype_stats_alloc (MTYPE_BGP_ROUTE
);
6199 vty_out (vty
, "%ld BGP routes, using %s of memory%s", count
,
6200 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6201 count
* sizeof (struct bgp_info
)),
6203 if ((count
= mtype_stats_alloc (MTYPE_BGP_ROUTE_EXTRA
)))
6204 vty_out (vty
, "%ld BGP route ancillaries, using %s of memory%s", count
,
6205 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6206 count
* sizeof (struct bgp_info_extra
)),
6209 if ((count
= mtype_stats_alloc (MTYPE_BGP_STATIC
)))
6210 vty_out (vty
, "%ld Static routes, using %s of memory%s", count
,
6211 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6212 count
* sizeof (struct bgp_static
)),
6215 if ((count
= mtype_stats_alloc (MTYPE_BGP_PACKET
)))
6216 vty_out (vty
, "%ld Packets, using %s of memory%s", count
,
6217 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6218 count
* sizeof (struct bpacket
)),
6222 if ((count
= mtype_stats_alloc (MTYPE_BGP_ADJ_IN
)))
6223 vty_out (vty
, "%ld Adj-In entries, using %s of memory%s", count
,
6224 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6225 count
* sizeof (struct bgp_adj_in
)),
6227 if ((count
= mtype_stats_alloc (MTYPE_BGP_ADJ_OUT
)))
6228 vty_out (vty
, "%ld Adj-Out entries, using %s of memory%s", count
,
6229 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6230 count
* sizeof (struct bgp_adj_out
)),
6233 if ((count
= mtype_stats_alloc (MTYPE_BGP_NEXTHOP_CACHE
)))
6234 vty_out (vty
, "%ld Nexthop cache entries, using %s of memory%s", count
,
6235 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6236 count
* sizeof (struct bgp_nexthop_cache
)),
6239 if ((count
= mtype_stats_alloc (MTYPE_BGP_DAMP_INFO
)))
6240 vty_out (vty
, "%ld Dampening entries, using %s of memory%s", count
,
6241 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6242 count
* sizeof (struct bgp_damp_info
)),
6246 count
= attr_count();
6247 vty_out (vty
, "%ld BGP attributes, using %s of memory%s", count
,
6248 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6249 count
* sizeof(struct attr
)),
6251 if ((count
= mtype_stats_alloc (MTYPE_ATTR_EXTRA
)))
6252 vty_out (vty
, "%ld BGP extra attributes, using %s of memory%s", count
,
6253 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6254 count
* sizeof(struct attr_extra
)),
6257 if ((count
= attr_unknown_count()))
6258 vty_out (vty
, "%ld unknown attributes%s", count
, VTY_NEWLINE
);
6260 /* AS_PATH attributes */
6261 count
= aspath_count ();
6262 vty_out (vty
, "%ld BGP AS-PATH entries, using %s of memory%s", count
,
6263 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6264 count
* sizeof (struct aspath
)),
6267 count
= mtype_stats_alloc (MTYPE_AS_SEG
);
6268 vty_out (vty
, "%ld BGP AS-PATH segments, using %s of memory%s", count
,
6269 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6270 count
* sizeof (struct assegment
)),
6273 /* Other attributes */
6274 if ((count
= community_count ()))
6275 vty_out (vty
, "%ld BGP community entries, using %s of memory%s", count
,
6276 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6277 count
* sizeof (struct community
)),
6279 if ((count
= mtype_stats_alloc (MTYPE_ECOMMUNITY
)))
6280 vty_out (vty
, "%ld BGP community entries, using %s of memory%s", count
,
6281 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6282 count
* sizeof (struct ecommunity
)),
6284 if ((count
= mtype_stats_alloc (MTYPE_LCOMMUNITY
)))
6285 vty_out (vty
, "%ld BGP large-community entries, using %s of memory%s",
6287 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6288 count
* sizeof (struct lcommunity
)),
6291 if ((count
= mtype_stats_alloc (MTYPE_CLUSTER
)))
6292 vty_out (vty
, "%ld Cluster lists, using %s of memory%s", count
,
6293 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6294 count
* sizeof (struct cluster_list
)),
6297 /* Peer related usage */
6298 count
= mtype_stats_alloc (MTYPE_BGP_PEER
);
6299 vty_out (vty
, "%ld peers, using %s of memory%s", count
,
6300 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6301 count
* sizeof (struct peer
)),
6304 if ((count
= mtype_stats_alloc (MTYPE_PEER_GROUP
)))
6305 vty_out (vty
, "%ld peer groups, using %s of memory%s", count
,
6306 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6307 count
* sizeof (struct peer_group
)),
6311 if ((count
= mtype_stats_alloc (MTYPE_HASH
)))
6312 vty_out (vty
, "%ld hash tables, using %s of memory%s", count
,
6313 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6314 count
* sizeof (struct hash
)),
6316 if ((count
= mtype_stats_alloc (MTYPE_HASH_BACKET
)))
6317 vty_out (vty
, "%ld hash buckets, using %s of memory%s", count
,
6318 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6319 count
* sizeof (struct hash_backet
)),
6321 if ((count
= mtype_stats_alloc (MTYPE_BGP_REGEXP
)))
6322 vty_out (vty
, "%ld compiled regexes, using %s of memory%s", count
,
6323 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6324 count
* sizeof (regex_t
)),
6329 /* Show BGP peer's summary information. */
6331 bgp_show_summary (struct vty
*vty
, struct bgp
*bgp
, int afi
, int safi
,
6332 u_char use_json
, json_object
*json
)
6335 struct listnode
*node
, *nnode
;
6336 unsigned int count
= 0, dn_count
= 0;
6337 char timebuf
[BGP_UPTIME_LEN
], dn_flag
[2];
6338 char neighbor_buf
[VTY_BUFSIZ
];
6339 int neighbor_col_default_width
= 16;
6341 int max_neighbor_width
= 0;
6342 json_object
*json_peer
= NULL
;
6343 json_object
*json_peers
= NULL
;
6348 json
= json_object_new_object();
6350 json_peers
= json_object_new_object();
6354 /* Loop over all neighbors that will be displayed to determine how many
6355 * characters are needed for the Neighbor column
6357 for (ALL_LIST_ELEMENTS (bgp
->peer
, node
, nnode
, peer
))
6359 if (!CHECK_FLAG(peer
->flags
, PEER_FLAG_CONFIG_NODE
))
6362 if (peer
->afc
[afi
][safi
])
6364 memset(dn_flag
, '\0', sizeof(dn_flag
));
6365 if (peer_dynamic_neighbor(peer
))
6368 if (peer
->hostname
&& bgp_flag_check(bgp
, BGP_FLAG_SHOW_HOSTNAME
))
6369 sprintf(neighbor_buf
, "%s%s(%s) ", dn_flag
, peer
->hostname
, peer
->host
);
6371 sprintf(neighbor_buf
, "%s%s ", dn_flag
, peer
->host
);
6373 len
= strlen(neighbor_buf
);
6375 if (len
> max_neighbor_width
)
6376 max_neighbor_width
= len
;
6380 /* Originally we displayed the Neighbor column as 16
6381 * characters wide so make that the default
6383 if (max_neighbor_width
< neighbor_col_default_width
)
6384 max_neighbor_width
= neighbor_col_default_width
;
6387 for (ALL_LIST_ELEMENTS (bgp
->peer
, node
, nnode
, peer
))
6389 if (!CHECK_FLAG(peer
->flags
, PEER_FLAG_CONFIG_NODE
))
6392 if (peer
->afc
[afi
][safi
])
6397 char memstrbuf
[MTYPE_MEMSTR_LEN
];
6400 vrf_id_ui
= (bgp
->vrf_id
== VRF_UNKNOWN
) ? -1 : bgp
->vrf_id
;
6402 /* Usage summary and header */
6405 json_object_string_add(json
, "routerId", inet_ntoa (bgp
->router_id
));
6406 json_object_int_add(json
, "as", bgp
->as
);
6407 json_object_int_add(json
, "vrfId", vrf_id_ui
);
6408 json_object_string_add(json
, "vrfName",
6409 (bgp
->inst_type
== BGP_INSTANCE_TYPE_DEFAULT
)
6410 ? "Default" : bgp
->name
);
6415 "BGP router identifier %s, local AS number %u vrf-id %d",
6416 inet_ntoa (bgp
->router_id
), bgp
->as
, vrf_id_ui
);
6417 vty_out (vty
, "%s", VTY_NEWLINE
);
6420 if (bgp_update_delay_configured(bgp
))
6424 json_object_int_add(json
, "updateDelayLimit", bgp
->v_update_delay
);
6426 if (bgp
->v_update_delay
!= bgp
->v_establish_wait
)
6427 json_object_int_add(json
, "updateDelayEstablishWait", bgp
->v_establish_wait
);
6429 if (bgp_update_delay_active(bgp
))
6431 json_object_string_add(json
, "updateDelayFirstNeighbor", bgp
->update_delay_begin_time
);
6432 json_object_boolean_true_add(json
, "updateDelayInProgress");
6436 if (bgp
->update_delay_over
)
6438 json_object_string_add(json
, "updateDelayFirstNeighbor",
6439 bgp
->update_delay_begin_time
);
6440 json_object_string_add(json
, "updateDelayBestpathResumed",
6441 bgp
->update_delay_end_time
);
6442 json_object_string_add(json
, "updateDelayZebraUpdateResume",
6443 bgp
->update_delay_zebra_resume_time
);
6444 json_object_string_add(json
, "updateDelayPeerUpdateResume",
6445 bgp
->update_delay_peers_resume_time
);
6451 vty_out (vty
, "Read-only mode update-delay limit: %d seconds%s",
6452 bgp
->v_update_delay
, VTY_NEWLINE
);
6453 if (bgp
->v_update_delay
!= bgp
->v_establish_wait
)
6454 vty_out (vty
, " Establish wait: %d seconds%s",
6455 bgp
->v_establish_wait
, VTY_NEWLINE
);
6457 if (bgp_update_delay_active(bgp
))
6459 vty_out (vty
, " First neighbor established: %s%s",
6460 bgp
->update_delay_begin_time
, VTY_NEWLINE
);
6461 vty_out (vty
, " Delay in progress%s", VTY_NEWLINE
);
6465 if (bgp
->update_delay_over
)
6467 vty_out (vty
, " First neighbor established: %s%s",
6468 bgp
->update_delay_begin_time
, VTY_NEWLINE
);
6469 vty_out (vty
, " Best-paths resumed: %s%s",
6470 bgp
->update_delay_end_time
, VTY_NEWLINE
);
6471 vty_out (vty
, " zebra update resumed: %s%s",
6472 bgp
->update_delay_zebra_resume_time
, VTY_NEWLINE
);
6473 vty_out (vty
, " peers update resumed: %s%s",
6474 bgp
->update_delay_peers_resume_time
, VTY_NEWLINE
);
6482 if (bgp_maxmed_onstartup_configured(bgp
) && bgp
->maxmed_active
)
6483 json_object_boolean_true_add(json
, "maxMedOnStartup");
6484 if (bgp
->v_maxmed_admin
)
6485 json_object_boolean_true_add(json
, "maxMedAdministrative");
6487 json_object_int_add(json
, "tableVersion", bgp_table_version(bgp
->rib
[afi
][safi
]));
6489 ents
= bgp_table_count (bgp
->rib
[afi
][safi
]);
6490 json_object_int_add(json
, "ribCount", ents
);
6491 json_object_int_add(json
, "ribMemory", ents
* sizeof (struct bgp_node
));
6493 ents
= listcount (bgp
->peer
);
6494 json_object_int_add(json
, "peerCount", ents
);
6495 json_object_int_add(json
, "peerMemory", ents
* sizeof (struct peer
));
6497 if ((ents
= listcount (bgp
->group
)))
6499 json_object_int_add(json
, "peerGroupCount", ents
);
6500 json_object_int_add(json
, "peerGroupMemory", ents
* sizeof (struct peer_group
));
6503 if (CHECK_FLAG (bgp
->af_flags
[afi
][safi
], BGP_CONFIG_DAMPENING
))
6504 json_object_boolean_true_add(json
, "dampeningEnabled");
6508 if (bgp_maxmed_onstartup_configured(bgp
) && bgp
->maxmed_active
)
6509 vty_out (vty
, "Max-med on-startup active%s", VTY_NEWLINE
);
6510 if (bgp
->v_maxmed_admin
)
6511 vty_out (vty
, "Max-med administrative active%s", VTY_NEWLINE
);
6513 vty_out(vty
, "BGP table version %" PRIu64
"%s",
6514 bgp_table_version(bgp
->rib
[afi
][safi
]), VTY_NEWLINE
);
6516 ents
= bgp_table_count (bgp
->rib
[afi
][safi
]);
6517 vty_out (vty
, "RIB entries %ld, using %s of memory%s", ents
,
6518 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6519 ents
* sizeof (struct bgp_node
)),
6522 /* Peer related usage */
6523 ents
= listcount (bgp
->peer
);
6524 vty_out (vty
, "Peers %ld, using %s of memory%s",
6526 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6527 ents
* sizeof (struct peer
)),
6530 if ((ents
= listcount (bgp
->group
)))
6531 vty_out (vty
, "Peer groups %ld, using %s of memory%s", ents
,
6532 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6533 ents
* sizeof (struct peer_group
)),
6536 if (CHECK_FLAG (bgp
->af_flags
[afi
][safi
], BGP_CONFIG_DAMPENING
))
6537 vty_out (vty
, "Dampening enabled.%s", VTY_NEWLINE
);
6538 vty_out (vty
, "%s", VTY_NEWLINE
);
6540 /* Subtract 8 here because 'Neighbor' is 8 characters */
6541 vty_out (vty
, "Neighbor");
6542 vty_out (vty
, "%*s", max_neighbor_width
- 8, " ");
6543 vty_out (vty
, "V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd%s", VTY_NEWLINE
);
6551 json_peer
= json_object_new_object();
6553 if (peer_dynamic_neighbor(peer
))
6554 json_object_boolean_true_add(json_peer
, "dynamicPeer");
6557 json_object_string_add(json_peer
, "hostname", peer
->hostname
);
6559 if (peer
->domainname
)
6560 json_object_string_add(json_peer
, "domainname", peer
->domainname
);
6562 json_object_int_add(json_peer
, "remoteAs", peer
->as
);
6563 json_object_int_add(json_peer
, "version", 4);
6564 json_object_int_add(json_peer
, "msgRcvd",
6565 peer
->open_in
+ peer
->update_in
+ peer
->keepalive_in
6566 + peer
->notify_in
+ peer
->refresh_in
6567 + peer
->dynamic_cap_in
);
6568 json_object_int_add(json_peer
, "msgSent",
6569 peer
->open_out
+ peer
->update_out
+ peer
->keepalive_out
6570 + peer
->notify_out
+ peer
->refresh_out
6571 + peer
->dynamic_cap_out
);
6573 json_object_int_add(json_peer
, "tableVersion", peer
->version
[afi
][safi
]);
6574 json_object_int_add(json_peer
, "outq", peer
->obuf
->count
);
6575 json_object_int_add(json_peer
, "inq", 0);
6576 peer_uptime (peer
->uptime
, timebuf
, BGP_UPTIME_LEN
, use_json
, json_peer
);
6577 json_object_int_add(json_peer
, "prefixReceivedCount", peer
->pcount
[afi
][safi
]);
6579 if (CHECK_FLAG (peer
->flags
, PEER_FLAG_SHUTDOWN
))
6580 json_object_string_add(json_peer
, "state", "Idle (Admin)");
6581 else if (CHECK_FLAG (peer
->sflags
, PEER_STATUS_PREFIX_OVERFLOW
))
6582 json_object_string_add(json_peer
, "state", "Idle (PfxCt)");
6584 json_object_string_add(json_peer
, "state", LOOKUP(bgp_status_msg
, peer
->status
));
6587 json_object_string_add(json_peer
, "idType", "interface");
6588 else if (peer
->su
.sa
.sa_family
== AF_INET
)
6589 json_object_string_add(json_peer
, "idType", "ipv4");
6590 else if (peer
->su
.sa
.sa_family
== AF_INET6
)
6591 json_object_string_add(json_peer
, "idType", "ipv6");
6593 json_object_object_add(json_peers
, peer
->host
, json_peer
);
6597 memset(dn_flag
, '\0', sizeof(dn_flag
));
6598 if (peer_dynamic_neighbor(peer
))
6604 if (peer
->hostname
&& bgp_flag_check(bgp
, BGP_FLAG_SHOW_HOSTNAME
))
6605 len
= vty_out (vty
, "%s%s(%s)", dn_flag
, peer
->hostname
,
6608 len
= vty_out (vty
, "%s%s", dn_flag
, peer
->host
);
6610 /* pad the neighbor column with spaces */
6611 if (len
< max_neighbor_width
)
6612 vty_out (vty
, "%*s", max_neighbor_width
- len
, " ");
6614 vty_out (vty
, "4 %10u %7d %7d %8" PRIu64
" %4d %4zd %8s",
6616 peer
->open_in
+ peer
->update_in
+ peer
->keepalive_in
6617 + peer
->notify_in
+ peer
->refresh_in
6618 + peer
->dynamic_cap_in
,
6619 peer
->open_out
+ peer
->update_out
+ peer
->keepalive_out
6620 + peer
->notify_out
+ peer
->refresh_out
6621 + peer
->dynamic_cap_out
,
6622 peer
->version
[afi
][safi
],
6625 peer_uptime (peer
->uptime
, timebuf
, BGP_UPTIME_LEN
, 0, NULL
));
6627 if (peer
->status
== Established
)
6628 vty_out (vty
, " %12ld", peer
->pcount
[afi
][safi
]);
6631 if (CHECK_FLAG (peer
->flags
, PEER_FLAG_SHUTDOWN
))
6632 vty_out (vty
, " Idle (Admin)");
6633 else if (CHECK_FLAG (peer
->sflags
, PEER_STATUS_PREFIX_OVERFLOW
))
6634 vty_out (vty
, " Idle (PfxCt)");
6636 vty_out (vty
, " %12s", LOOKUP(bgp_status_msg
, peer
->status
));
6638 vty_out (vty
, "%s", VTY_NEWLINE
);
6645 json_object_object_add(json
, "peers", json_peers
);
6647 json_object_int_add(json
, "totalPeers", count
);
6648 json_object_int_add(json
, "dynamicPeers", dn_count
);
6650 vty_out (vty
, "%s%s", json_object_to_json_string_ext(json
, JSON_C_TO_STRING_PRETTY
), VTY_NEWLINE
);
6651 json_object_free(json
);
6656 vty_out (vty
, "%sTotal number of neighbors %d%s", VTY_NEWLINE
,
6657 count
, VTY_NEWLINE
);
6661 vty_out(vty
, "{\"error\": {\"message\": \"No %s neighbor configured\"}}%s",
6662 afi_safi_print(afi
, safi
), VTY_NEWLINE
);
6664 vty_out (vty
, "No %s neighbor is configured%s",
6665 afi_safi_print(afi
, safi
), VTY_NEWLINE
);
6668 if (dn_count
&& ! use_json
)
6670 vty_out(vty
, "* - dynamic neighbor%s", VTY_NEWLINE
);
6672 "%d dynamic neighbor(s), limit %d%s",
6673 dn_count
, bgp
->dynamic_neighbors_limit
, VTY_NEWLINE
);
6681 bgp_show_summary_afi_safi (struct vty
*vty
, struct bgp
*bgp
, int afi
, int safi
,
6682 u_char use_json
, json_object
*json
)
6685 int afi_wildcard
= (afi
== AFI_MAX
);
6686 int safi_wildcard
= (safi
== SAFI_MAX
);
6687 int is_wildcard
= (afi_wildcard
|| safi_wildcard
);
6688 if (use_json
&& is_wildcard
)
6689 vty_out (vty
, "{%s", VTY_NEWLINE
);
6691 afi
= 1; /* AFI_IP */
6692 while (afi
< AFI_MAX
)
6695 safi
= 1; /* SAFI_UNICAST */
6696 while (safi
< SAFI_MAX
)
6702 json
= json_object_new_object();
6705 vty_out (vty
, ",%s", VTY_NEWLINE
);
6709 vty_out(vty
, "\"%s\":", afi_safi_json(afi
, safi
));
6713 vty_out (vty
, "%s%s Summary:%s",
6714 VTY_NEWLINE
, afi_safi_print(afi
, safi
), VTY_NEWLINE
);
6717 bgp_show_summary (vty
, bgp
, afi
, safi
, use_json
, json
);
6719 if (safi
== SAFI_RESERVED_4
||
6720 safi
== SAFI_RESERVED_5
) /* handle special cases to match zebra.h */
6722 if (! safi_wildcard
)
6726 if (! afi_wildcard
||
6727 afi
== AFI_L2VPN
) /* special case, not handled yet */
6731 if (use_json
&& is_wildcard
)
6732 vty_out (vty
, "}%s", VTY_NEWLINE
);
6737 bgp_show_all_instances_summary_vty (struct vty
*vty
, afi_t afi
, safi_t safi
,
6740 struct listnode
*node
, *nnode
;
6742 json_object
*json
= NULL
;
6746 vty_out (vty
, "{%s", VTY_NEWLINE
);
6748 for (ALL_LIST_ELEMENTS (bm
->bgp
, node
, nnode
, bgp
))
6752 json
= json_object_new_object();
6755 vty_out (vty
, ",%s", VTY_NEWLINE
);
6759 vty_out(vty
, "\"%s\":", (bgp
->inst_type
== BGP_INSTANCE_TYPE_DEFAULT
)
6760 ? "Default" : bgp
->name
);
6764 vty_out (vty
, "%sInstance %s:%s",
6766 (bgp
->inst_type
== BGP_INSTANCE_TYPE_DEFAULT
)
6767 ? "Default" : bgp
->name
, VTY_NEWLINE
);
6769 bgp_show_summary_afi_safi (vty
, bgp
, afi
, safi
, use_json
, json
);
6773 vty_out (vty
, "}%s", VTY_NEWLINE
);
6778 bgp_show_summary_vty (struct vty
*vty
, const char *name
,
6779 afi_t afi
, safi_t safi
, u_char use_json
)
6785 if (strmatch(name
, "all"))
6787 bgp_show_all_instances_summary_vty (vty
, afi
, safi
, use_json
);
6792 bgp
= bgp_lookup_by_name (name
);
6797 vty_out (vty
, "{}%s", VTY_NEWLINE
);
6799 vty_out (vty
, "%% No such BGP instance exist%s", VTY_NEWLINE
);
6803 bgp_show_summary_afi_safi (vty
, bgp
, afi
, safi
, use_json
, NULL
);
6808 bgp
= bgp_get_default ();
6811 bgp_show_summary_afi_safi (vty
, bgp
, afi
, safi
, use_json
, NULL
);
6816 /* `show [ip] bgp summary' commands. */
6817 DEFUN (show_ip_bgp_summary
,
6818 show_ip_bgp_summary_cmd
,
6819 "show [ip] bgp [<view|vrf> WORD] ["BGP_AFI_CMD_STR
" ["BGP_SAFI_CMD_STR
"]] summary [json]",
6823 BGP_INSTANCE_HELP_STR
6826 "Summary of BGP neighbor status\n"
6830 afi_t afi
= AFI_MAX
;
6831 safi_t safi
= SAFI_MAX
;
6836 if (argv_find (argv
, argc
, "ip", &idx
))
6838 /* [<view|vrf> WORD] */
6839 if (argv_find (argv
, argc
, "view", &idx
) || argv_find (argv
, argc
, "vrf", &idx
))
6840 vrf
= argv
[++idx
]->arg
;
6841 /* ["BGP_AFI_CMD_STR" ["BGP_SAFI_CMD_STR"]] */
6842 if (argv_find_and_parse_afi (argv
, argc
, &idx
, &afi
))
6844 argv_find_and_parse_safi (argv
, argc
, &idx
, &safi
);
6847 int uj
= use_json (argc
, argv
);
6849 return bgp_show_summary_vty (vty
, vrf
, afi
, safi
, uj
);
6853 afi_safi_print (afi_t afi
, safi_t safi
)
6855 if (afi
== AFI_IP
&& safi
== SAFI_UNICAST
)
6856 return "IPv4 Unicast";
6857 else if (afi
== AFI_IP
&& safi
== SAFI_MULTICAST
)
6858 return "IPv4 Multicast";
6859 else if (afi
== AFI_IP
&& safi
== SAFI_MPLS_VPN
)
6861 else if (afi
== AFI_IP
&& safi
== SAFI_ENCAP
)
6862 return "IPv4 Encap";
6863 else if (afi
== AFI_IP6
&& safi
== SAFI_UNICAST
)
6864 return "IPv6 Unicast";
6865 else if (afi
== AFI_IP6
&& safi
== SAFI_MULTICAST
)
6866 return "IPv6 Multicast";
6867 else if (afi
== AFI_IP6
&& safi
== SAFI_MPLS_VPN
)
6869 else if (afi
== AFI_IP6
&& safi
== SAFI_ENCAP
)
6870 return "IPv6 Encap";
6871 else if (afi
== AFI_L2VPN
&& safi
== SAFI_EVPN
)
6872 return "L2VPN EVPN";
6878 afi_safi_json (afi_t afi
, safi_t safi
)
6880 if (afi
== AFI_IP
&& safi
== SAFI_UNICAST
)
6881 return "IPv4Unicast";
6882 else if (afi
== AFI_IP
&& safi
== SAFI_MULTICAST
)
6883 return "IPv4Multicast";
6884 else if (afi
== AFI_IP
&& safi
== SAFI_MPLS_VPN
)
6886 else if (afi
== AFI_IP
&& safi
== SAFI_ENCAP
)
6888 else if (afi
== AFI_IP6
&& safi
== SAFI_UNICAST
)
6889 return "IPv6Unicast";
6890 else if (afi
== AFI_IP6
&& safi
== SAFI_MULTICAST
)
6891 return "IPv6Multicast";
6892 else if (afi
== AFI_IP6
&& safi
== SAFI_MPLS_VPN
)
6894 else if (afi
== AFI_IP6
&& safi
== SAFI_ENCAP
)
6896 else if (afi
== AFI_L2VPN
&& safi
== SAFI_EVPN
)
6897 return "L2VPN EVPN";
6902 /* Show BGP peer's information. */
6910 bgp_show_peer_afi_orf_cap (struct vty
*vty
, struct peer
*p
, afi_t afi
, safi_t safi
,
6911 u_int16_t adv_smcap
, u_int16_t adv_rmcap
, u_int16_t rcv_smcap
,
6912 u_int16_t rcv_rmcap
, u_char use_json
, json_object
*json_pref
)
6915 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], adv_smcap
)
6916 || CHECK_FLAG (p
->af_cap
[afi
][safi
], rcv_smcap
))
6920 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], adv_smcap
) && CHECK_FLAG (p
->af_cap
[afi
][safi
], rcv_smcap
))
6921 json_object_string_add(json_pref
, "sendMode", "advertisedAndReceived");
6922 else if (CHECK_FLAG (p
->af_cap
[afi
][safi
], adv_smcap
))
6923 json_object_string_add(json_pref
, "sendMode", "advertised");
6924 else if (CHECK_FLAG (p
->af_cap
[afi
][safi
], rcv_smcap
))
6925 json_object_string_add(json_pref
, "sendMode", "received");
6929 vty_out (vty
, " Send-mode: ");
6930 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], adv_smcap
))
6931 vty_out (vty
, "advertised");
6932 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], rcv_smcap
))
6933 vty_out (vty
, "%sreceived",
6934 CHECK_FLAG (p
->af_cap
[afi
][safi
], adv_smcap
) ?
6936 vty_out (vty
, "%s", VTY_NEWLINE
);
6941 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], adv_rmcap
)
6942 || CHECK_FLAG (p
->af_cap
[afi
][safi
], rcv_rmcap
))
6946 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], adv_rmcap
) && CHECK_FLAG (p
->af_cap
[afi
][safi
], rcv_rmcap
))
6947 json_object_string_add(json_pref
, "recvMode", "advertisedAndReceived");
6948 else if (CHECK_FLAG (p
->af_cap
[afi
][safi
], adv_rmcap
))
6949 json_object_string_add(json_pref
, "recvMode", "advertised");
6950 else if (CHECK_FLAG (p
->af_cap
[afi
][safi
], rcv_rmcap
))
6951 json_object_string_add(json_pref
, "recvMode", "received");
6955 vty_out (vty
, " Receive-mode: ");
6956 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], adv_rmcap
))
6957 vty_out (vty
, "advertised");
6958 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], rcv_rmcap
))
6959 vty_out (vty
, "%sreceived",
6960 CHECK_FLAG (p
->af_cap
[afi
][safi
], adv_rmcap
) ?
6962 vty_out (vty
, "%s", VTY_NEWLINE
);
6968 bgp_show_peer_afi (struct vty
*vty
, struct peer
*p
, afi_t afi
, safi_t safi
,
6969 u_char use_json
, json_object
*json_neigh
)
6971 struct bgp_filter
*filter
;
6972 struct peer_af
*paf
;
6973 char orf_pfx_name
[BUFSIZ
];
6975 json_object
*json_af
= NULL
;
6976 json_object
*json_prefA
= NULL
;
6977 json_object
*json_prefB
= NULL
;
6978 json_object
*json_addr
= NULL
;
6982 json_addr
= json_object_new_object();
6983 json_af
= json_object_new_object();
6984 filter
= &p
->filter
[afi
][safi
];
6986 if (peer_group_active(p
))
6987 json_object_string_add(json_addr
, "peerGroupMember", p
->group
->name
);
6989 paf
= peer_af_find(p
, afi
, safi
);
6990 if (paf
&& PAF_SUBGRP(paf
))
6992 json_object_int_add(json_addr
, "updateGroupId", PAF_UPDGRP(paf
)->id
);
6993 json_object_int_add(json_addr
, "subGroupId", PAF_SUBGRP(paf
)->id
);
6994 json_object_int_add(json_addr
, "packetQueueLength", bpacket_queue_virtual_length(paf
));
6997 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_ADV
)
6998 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_RCV
)
6999 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_ADV
)
7000 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_RCV
))
7002 json_object_int_add(json_af
, "orfType", ORF_TYPE_PREFIX
);
7003 json_prefA
= json_object_new_object();
7004 bgp_show_peer_afi_orf_cap (vty
, p
, afi
, safi
,
7005 PEER_CAP_ORF_PREFIX_SM_ADV
,
7006 PEER_CAP_ORF_PREFIX_RM_ADV
,
7007 PEER_CAP_ORF_PREFIX_SM_RCV
,
7008 PEER_CAP_ORF_PREFIX_RM_RCV
, use_json
, json_prefA
);
7009 json_object_object_add(json_af
, "orfPrefixList", json_prefA
);
7012 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_ADV
)
7013 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_OLD_RCV
)
7014 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_ADV
)
7015 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_OLD_RCV
))
7017 json_object_int_add(json_af
, "orfOldType", ORF_TYPE_PREFIX_OLD
);
7018 json_prefB
= json_object_new_object();
7019 bgp_show_peer_afi_orf_cap (vty
, p
, afi
, safi
,
7020 PEER_CAP_ORF_PREFIX_SM_ADV
,
7021 PEER_CAP_ORF_PREFIX_RM_ADV
,
7022 PEER_CAP_ORF_PREFIX_SM_OLD_RCV
,
7023 PEER_CAP_ORF_PREFIX_RM_OLD_RCV
, use_json
, json_prefB
);
7024 json_object_object_add(json_af
, "orfOldPrefixList", json_prefB
);
7027 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_ADV
)
7028 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_RCV
)
7029 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_OLD_RCV
)
7030 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_ADV
)
7031 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_RCV
)
7032 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_OLD_RCV
))
7033 json_object_object_add(json_addr
, "afDependentCap", json_af
);
7035 json_object_free(json_af
);
7037 sprintf (orf_pfx_name
, "%s.%d.%d", p
->host
, afi
, safi
);
7038 orf_pfx_count
= prefix_bgp_show_prefix_list (NULL
, afi
, orf_pfx_name
, use_json
);
7040 if (CHECK_FLAG (p
->af_sflags
[afi
][safi
], PEER_STATUS_ORF_PREFIX_SEND
)
7043 if (CHECK_FLAG (p
->af_sflags
[afi
][safi
], PEER_STATUS_ORF_PREFIX_SEND
))
7044 json_object_boolean_true_add(json_neigh
, "orfSent");
7046 json_object_int_add(json_addr
, "orfRecvCounter", orf_pfx_count
);
7048 if (CHECK_FLAG (p
->af_sflags
[afi
][safi
], PEER_STATUS_ORF_WAIT_REFRESH
))
7049 json_object_string_add(json_addr
, "orfFirstUpdate", "deferredUntilORFOrRouteRefreshRecvd");
7051 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_REFLECTOR_CLIENT
))
7052 json_object_boolean_true_add(json_addr
, "routeReflectorClient");
7053 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_RSERVER_CLIENT
))
7054 json_object_boolean_true_add(json_addr
, "routeServerClient");
7055 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_SOFT_RECONFIG
))
7056 json_object_boolean_true_add(json_addr
, "inboundSoftConfigPermit");
7058 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE
))
7059 json_object_boolean_true_add(json_addr
, "privateAsNumsAllReplacedInUpdatesToNbr");
7060 else if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE
))
7061 json_object_boolean_true_add(json_addr
, "privateAsNumsReplacedInUpdatesToNbr");
7062 else if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_REMOVE_PRIVATE_AS_ALL
))
7063 json_object_boolean_true_add(json_addr
, "privateAsNumsAllRemovedInUpdatesToNbr");
7064 else if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_REMOVE_PRIVATE_AS
))
7065 json_object_boolean_true_add(json_addr
, "privateAsNumsRemovedInUpdatesToNbr");
7067 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_ADDPATH_TX_ALL_PATHS
))
7068 json_object_boolean_true_add(json_addr
, "addpathTxAllPaths");
7070 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_ADDPATH_TX_BESTPATH_PER_AS
))
7071 json_object_boolean_true_add(json_addr
, "addpathTxBestpathPerAS");
7073 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_AS_OVERRIDE
))
7074 json_object_string_add(json_addr
, "overrideASNsInOutboundUpdates", "ifAspathEqualRemoteAs");
7076 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_NEXTHOP_SELF
) ||
7077 CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_FORCE_NEXTHOP_SELF
))
7078 json_object_boolean_true_add(json_addr
, "routerAlwaysNextHop");
7079 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_AS_PATH_UNCHANGED
))
7080 json_object_boolean_true_add(json_addr
, "unchangedAsPathPropogatedToNbr");
7081 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_NEXTHOP_UNCHANGED
))
7082 json_object_boolean_true_add(json_addr
, "unchangedNextHopPropogatedToNbr");
7083 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_MED_UNCHANGED
))
7084 json_object_boolean_true_add(json_addr
, "unchangedMedPropogatedToNbr");
7085 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_SEND_COMMUNITY
)
7086 || CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_SEND_EXT_COMMUNITY
))
7088 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_SEND_COMMUNITY
)
7089 && CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_SEND_EXT_COMMUNITY
))
7090 json_object_string_add(json_addr
, "commAttriSentToNbr", "extendedAndStandard");
7091 else if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_SEND_EXT_COMMUNITY
))
7092 json_object_string_add(json_addr
, "commAttriSentToNbr", "extended");
7094 json_object_string_add(json_addr
, "commAttriSentToNbr", "standard");
7096 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_DEFAULT_ORIGINATE
))
7098 if (p
->default_rmap
[afi
][safi
].name
)
7099 json_object_string_add(json_addr
, "defaultRouteMap", p
->default_rmap
[afi
][safi
].name
);
7101 if (paf
&& PAF_SUBGRP(paf
) && CHECK_FLAG(PAF_SUBGRP(paf
)->sflags
, SUBGRP_STATUS_DEFAULT_ORIGINATE
))
7102 json_object_boolean_true_add(json_addr
, "defaultSent");
7104 json_object_boolean_true_add(json_addr
, "defaultNotSent");
7107 if (filter
->plist
[FILTER_IN
].name
7108 || filter
->dlist
[FILTER_IN
].name
7109 || filter
->aslist
[FILTER_IN
].name
7110 || filter
->map
[RMAP_IN
].name
)
7111 json_object_boolean_true_add(json_addr
, "inboundPathPolicyConfig");
7112 if (filter
->plist
[FILTER_OUT
].name
7113 || filter
->dlist
[FILTER_OUT
].name
7114 || filter
->aslist
[FILTER_OUT
].name
7115 || filter
->map
[RMAP_OUT
].name
7116 || filter
->usmap
.name
)
7117 json_object_boolean_true_add(json_addr
, "outboundPathPolicyConfig");
7120 if (filter
->plist
[FILTER_IN
].name
)
7121 json_object_string_add(json_addr
, "incomingUpdatePrefixFilterList", filter
->plist
[FILTER_IN
].name
);
7122 if (filter
->plist
[FILTER_OUT
].name
)
7123 json_object_string_add(json_addr
, "outgoingUpdatePrefixFilterList", filter
->plist
[FILTER_OUT
].name
);
7125 /* distribute-list */
7126 if (filter
->dlist
[FILTER_IN
].name
)
7127 json_object_string_add(json_addr
, "incomingUpdateNetworkFilterList", filter
->dlist
[FILTER_IN
].name
);
7128 if (filter
->dlist
[FILTER_OUT
].name
)
7129 json_object_string_add(json_addr
, "outgoingUpdateNetworkFilterList", filter
->dlist
[FILTER_OUT
].name
);
7132 if (filter
->aslist
[FILTER_IN
].name
)
7133 json_object_string_add(json_addr
, "incomingUpdateAsPathFilterList", filter
->aslist
[FILTER_IN
].name
);
7134 if (filter
->aslist
[FILTER_OUT
].name
)
7135 json_object_string_add(json_addr
, "outgoingUpdateAsPathFilterList", filter
->aslist
[FILTER_OUT
].name
);
7138 if (filter
->map
[RMAP_IN
].name
)
7139 json_object_string_add(json_addr
, "routeMapForIncomingAdvertisements", filter
->map
[RMAP_IN
].name
);
7140 if (filter
->map
[RMAP_OUT
].name
)
7141 json_object_string_add(json_addr
, "routeMapForOutgoingAdvertisements", filter
->map
[RMAP_OUT
].name
);
7143 /* unsuppress-map */
7144 if (filter
->usmap
.name
)
7145 json_object_string_add(json_addr
, "selectiveUnsuppressRouteMap", filter
->usmap
.name
);
7147 /* Receive prefix count */
7148 json_object_int_add(json_addr
, "acceptedPrefixCounter", p
->pcount
[afi
][safi
]);
7150 /* Maximum prefix */
7151 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_MAX_PREFIX
))
7153 json_object_int_add(json_addr
, "prefixAllowedMax", p
->pmax
[afi
][safi
]);
7154 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_MAX_PREFIX_WARNING
))
7155 json_object_boolean_true_add(json_addr
, "prefixAllowedMaxWarning");
7156 json_object_int_add(json_addr
, "prefixAllowedWarningThresh", p
->pmax_threshold
[afi
][safi
]);
7157 if (p
->pmax_restart
[afi
][safi
])
7158 json_object_int_add(json_addr
, "prefixAllowedRestartIntervalMsecs", p
->pmax_restart
[afi
][safi
] * 60000);
7160 json_object_object_add(json_neigh
, afi_safi_print (afi
, safi
), json_addr
);
7165 filter
= &p
->filter
[afi
][safi
];
7167 vty_out (vty
, " For address family: %s%s", afi_safi_print (afi
, safi
),
7170 if (peer_group_active(p
))
7171 vty_out (vty
, " %s peer-group member%s", p
->group
->name
, VTY_NEWLINE
);
7173 paf
= peer_af_find(p
, afi
, safi
);
7174 if (paf
&& PAF_SUBGRP(paf
))
7176 vty_out (vty
, " Update group %" PRIu64
", subgroup %" PRIu64
"%s",
7177 PAF_UPDGRP(paf
)->id
, PAF_SUBGRP(paf
)->id
, VTY_NEWLINE
);
7178 vty_out (vty
, " Packet Queue length %d%s",
7179 bpacket_queue_virtual_length(paf
), VTY_NEWLINE
);
7183 vty_out(vty
, " Not part of any update group%s", VTY_NEWLINE
);
7185 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_ADV
)
7186 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_RCV
)
7187 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_OLD_RCV
)
7188 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_ADV
)
7189 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_RCV
)
7190 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_OLD_RCV
))
7191 vty_out (vty
, " AF-dependant capabilities:%s", VTY_NEWLINE
);
7193 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_ADV
)
7194 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_RCV
)
7195 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_ADV
)
7196 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_RCV
))
7198 vty_out (vty
, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s",
7199 ORF_TYPE_PREFIX
, VTY_NEWLINE
);
7200 bgp_show_peer_afi_orf_cap (vty
, p
, afi
, safi
,
7201 PEER_CAP_ORF_PREFIX_SM_ADV
,
7202 PEER_CAP_ORF_PREFIX_RM_ADV
,
7203 PEER_CAP_ORF_PREFIX_SM_RCV
,
7204 PEER_CAP_ORF_PREFIX_RM_RCV
, use_json
, NULL
);
7206 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_ADV
)
7207 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_OLD_RCV
)
7208 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_ADV
)
7209 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_OLD_RCV
))
7211 vty_out (vty
, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s",
7212 ORF_TYPE_PREFIX_OLD
, VTY_NEWLINE
);
7213 bgp_show_peer_afi_orf_cap (vty
, p
, afi
, safi
,
7214 PEER_CAP_ORF_PREFIX_SM_ADV
,
7215 PEER_CAP_ORF_PREFIX_RM_ADV
,
7216 PEER_CAP_ORF_PREFIX_SM_OLD_RCV
,
7217 PEER_CAP_ORF_PREFIX_RM_OLD_RCV
, use_json
, NULL
);
7220 sprintf (orf_pfx_name
, "%s.%d.%d", p
->host
, afi
, safi
);
7221 orf_pfx_count
= prefix_bgp_show_prefix_list (NULL
, afi
, orf_pfx_name
, use_json
);
7223 if (CHECK_FLAG (p
->af_sflags
[afi
][safi
], PEER_STATUS_ORF_PREFIX_SEND
)
7226 vty_out (vty
, " Outbound Route Filter (ORF):");
7227 if (CHECK_FLAG (p
->af_sflags
[afi
][safi
], PEER_STATUS_ORF_PREFIX_SEND
))
7228 vty_out (vty
, " sent;");
7230 vty_out (vty
, " received (%d entries)", orf_pfx_count
);
7231 vty_out (vty
, "%s", VTY_NEWLINE
);
7233 if (CHECK_FLAG (p
->af_sflags
[afi
][safi
], PEER_STATUS_ORF_WAIT_REFRESH
))
7234 vty_out (vty
, " First update is deferred until ORF or ROUTE-REFRESH is received%s", VTY_NEWLINE
);
7236 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_REFLECTOR_CLIENT
))
7237 vty_out (vty
, " Route-Reflector Client%s", VTY_NEWLINE
);
7238 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_RSERVER_CLIENT
))
7239 vty_out (vty
, " Route-Server Client%s", VTY_NEWLINE
);
7240 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_SOFT_RECONFIG
))
7241 vty_out (vty
, " Inbound soft reconfiguration allowed%s", VTY_NEWLINE
);
7243 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE
))
7244 vty_out (vty
, " Private AS numbers (all) replaced in updates to this neighbor%s", VTY_NEWLINE
);
7245 else if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE
))
7246 vty_out (vty
, " Private AS numbers replaced in updates to this neighbor%s", VTY_NEWLINE
);
7247 else if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_REMOVE_PRIVATE_AS_ALL
))
7248 vty_out (vty
, " Private AS numbers (all) removed in updates to this neighbor%s", VTY_NEWLINE
);
7249 else if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_REMOVE_PRIVATE_AS
))
7250 vty_out (vty
, " Private AS numbers removed in updates to this neighbor%s", VTY_NEWLINE
);
7252 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_ADDPATH_TX_ALL_PATHS
))
7253 vty_out (vty
, " Advertise all paths via addpath%s", VTY_NEWLINE
);
7255 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_ADDPATH_TX_BESTPATH_PER_AS
))
7256 vty_out (vty
, " Advertise bestpath per AS via addpath%s", VTY_NEWLINE
);
7258 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_AS_OVERRIDE
))
7259 vty_out (vty
, " Override ASNs in outbound updates if aspath equals remote-as%s", VTY_NEWLINE
);
7261 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_NEXTHOP_SELF
) ||
7262 CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_FORCE_NEXTHOP_SELF
))
7263 vty_out (vty
, " NEXT_HOP is always this router%s", VTY_NEWLINE
);
7264 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_AS_PATH_UNCHANGED
))
7265 vty_out (vty
, " AS_PATH is propagated unchanged to this neighbor%s", VTY_NEWLINE
);
7266 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_NEXTHOP_UNCHANGED
))
7267 vty_out (vty
, " NEXT_HOP is propagated unchanged to this neighbor%s", VTY_NEWLINE
);
7268 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_MED_UNCHANGED
))
7269 vty_out (vty
, " MED is propagated unchanged to this neighbor%s", VTY_NEWLINE
);
7270 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_SEND_COMMUNITY
)
7271 || CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_SEND_EXT_COMMUNITY
)
7272 || CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_SEND_LARGE_COMMUNITY
))
7274 vty_out (vty
, " Community attribute sent to this neighbor");
7275 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_SEND_COMMUNITY
)
7276 && CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_SEND_EXT_COMMUNITY
)
7277 && CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_SEND_LARGE_COMMUNITY
))
7278 vty_out (vty
, "(all)%s", VTY_NEWLINE
);
7279 else if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_SEND_LARGE_COMMUNITY
))
7280 vty_out (vty
, "(large)%s", VTY_NEWLINE
);
7281 else if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_SEND_EXT_COMMUNITY
))
7282 vty_out (vty
, "(extended)%s", VTY_NEWLINE
);
7284 vty_out (vty
, "(standard)%s", VTY_NEWLINE
);
7286 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_DEFAULT_ORIGINATE
))
7288 vty_out (vty
, " Default information originate,");
7290 if (p
->default_rmap
[afi
][safi
].name
)
7291 vty_out (vty
, " default route-map %s%s,",
7292 p
->default_rmap
[afi
][safi
].map
? "*" : "",
7293 p
->default_rmap
[afi
][safi
].name
);
7294 if (paf
&& PAF_SUBGRP(paf
) && CHECK_FLAG(PAF_SUBGRP(paf
)->sflags
, SUBGRP_STATUS_DEFAULT_ORIGINATE
))
7295 vty_out (vty
, " default sent%s", VTY_NEWLINE
);
7297 vty_out (vty
, " default not sent%s", VTY_NEWLINE
);
7300 if (filter
->plist
[FILTER_IN
].name
7301 || filter
->dlist
[FILTER_IN
].name
7302 || filter
->aslist
[FILTER_IN
].name
7303 || filter
->map
[RMAP_IN
].name
)
7304 vty_out (vty
, " Inbound path policy configured%s", VTY_NEWLINE
);
7305 if (filter
->plist
[FILTER_OUT
].name
7306 || filter
->dlist
[FILTER_OUT
].name
7307 || filter
->aslist
[FILTER_OUT
].name
7308 || filter
->map
[RMAP_OUT
].name
7309 || filter
->usmap
.name
)
7310 vty_out (vty
, " Outbound path policy configured%s", VTY_NEWLINE
);
7313 if (filter
->plist
[FILTER_IN
].name
)
7314 vty_out (vty
, " Incoming update prefix filter list is %s%s%s",
7315 filter
->plist
[FILTER_IN
].plist
? "*" : "",
7316 filter
->plist
[FILTER_IN
].name
,
7318 if (filter
->plist
[FILTER_OUT
].name
)
7319 vty_out (vty
, " Outgoing update prefix filter list is %s%s%s",
7320 filter
->plist
[FILTER_OUT
].plist
? "*" : "",
7321 filter
->plist
[FILTER_OUT
].name
,
7324 /* distribute-list */
7325 if (filter
->dlist
[FILTER_IN
].name
)
7326 vty_out (vty
, " Incoming update network filter list is %s%s%s",
7327 filter
->dlist
[FILTER_IN
].alist
? "*" : "",
7328 filter
->dlist
[FILTER_IN
].name
,
7330 if (filter
->dlist
[FILTER_OUT
].name
)
7331 vty_out (vty
, " Outgoing update network filter list is %s%s%s",
7332 filter
->dlist
[FILTER_OUT
].alist
? "*" : "",
7333 filter
->dlist
[FILTER_OUT
].name
,
7337 if (filter
->aslist
[FILTER_IN
].name
)
7338 vty_out (vty
, " Incoming update AS path filter list is %s%s%s",
7339 filter
->aslist
[FILTER_IN
].aslist
? "*" : "",
7340 filter
->aslist
[FILTER_IN
].name
,
7342 if (filter
->aslist
[FILTER_OUT
].name
)
7343 vty_out (vty
, " Outgoing update AS path filter list is %s%s%s",
7344 filter
->aslist
[FILTER_OUT
].aslist
? "*" : "",
7345 filter
->aslist
[FILTER_OUT
].name
,
7349 if (filter
->map
[RMAP_IN
].name
)
7350 vty_out (vty
, " Route map for incoming advertisements is %s%s%s",
7351 filter
->map
[RMAP_IN
].map
? "*" : "",
7352 filter
->map
[RMAP_IN
].name
,
7354 if (filter
->map
[RMAP_OUT
].name
)
7355 vty_out (vty
, " Route map for outgoing advertisements is %s%s%s",
7356 filter
->map
[RMAP_OUT
].map
? "*" : "",
7357 filter
->map
[RMAP_OUT
].name
,
7360 /* unsuppress-map */
7361 if (filter
->usmap
.name
)
7362 vty_out (vty
, " Route map for selective unsuppress is %s%s%s",
7363 filter
->usmap
.map
? "*" : "",
7364 filter
->usmap
.name
, VTY_NEWLINE
);
7366 /* Receive prefix count */
7367 vty_out (vty
, " %ld accepted prefixes%s", p
->pcount
[afi
][safi
], VTY_NEWLINE
);
7369 /* Maximum prefix */
7370 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_MAX_PREFIX
))
7372 vty_out (vty
, " Maximum prefixes allowed %ld%s%s", p
->pmax
[afi
][safi
],
7373 CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_MAX_PREFIX_WARNING
)
7374 ? " (warning-only)" : "", VTY_NEWLINE
);
7375 vty_out (vty
, " Threshold for warning message %d%%",
7376 p
->pmax_threshold
[afi
][safi
]);
7377 if (p
->pmax_restart
[afi
][safi
])
7378 vty_out (vty
, ", restart interval %d min", p
->pmax_restart
[afi
][safi
]);
7379 vty_out (vty
, "%s", VTY_NEWLINE
);
7382 vty_out (vty
, "%s", VTY_NEWLINE
);
7387 bgp_show_peer (struct vty
*vty
, struct peer
*p
, u_char use_json
, json_object
*json
)
7390 char buf1
[PREFIX2STR_BUFFER
], buf
[SU_ADDRSTRLEN
];
7391 char timebuf
[BGP_UPTIME_LEN
];
7393 const char *subcode_str
;
7394 const char *code_str
;
7399 json_object
*json_neigh
= NULL
;
7404 json_neigh
= json_object_new_object();
7406 memset (dn_flag
, '\0', sizeof (dn_flag
));
7407 if (!p
->conf_if
&& peer_dynamic_neighbor (p
))
7412 if (p
->conf_if
) /* Configured interface name. */
7413 vty_out (vty
, "BGP neighbor on %s: %s, ", p
->conf_if
,
7414 BGP_PEER_SU_UNSPEC(p
) ? "None" :
7415 sockunion2str (&p
->su
, buf
, SU_ADDRSTRLEN
));
7416 else /* Configured IP address. */
7417 vty_out (vty
, "BGP neighbor is %s%s, ", dn_flag
, p
->host
);
7422 if (p
->conf_if
&& BGP_PEER_SU_UNSPEC(p
))
7423 json_object_string_add(json_neigh
, "bgpNeighborAddr", "none");
7424 else if (p
->conf_if
&& !BGP_PEER_SU_UNSPEC(p
))
7425 json_object_string_add(json_neigh
, "bgpNeighborAddr", sockunion2str (&p
->su
, buf
, SU_ADDRSTRLEN
));
7427 json_object_int_add(json_neigh
, "remoteAs", p
->as
);
7429 if (p
->change_local_as
)
7430 json_object_int_add(json_neigh
, "localAs", p
->change_local_as
);
7432 json_object_int_add(json_neigh
, "localAs", p
->local_as
);
7434 if (CHECK_FLAG (p
->flags
, PEER_FLAG_LOCAL_AS_NO_PREPEND
))
7435 json_object_boolean_true_add(json_neigh
, "localAsNoPrepend");
7437 if (CHECK_FLAG (p
->flags
, PEER_FLAG_LOCAL_AS_REPLACE_AS
))
7438 json_object_boolean_true_add(json_neigh
, "localAsReplaceAs");
7442 if ((p
->as_type
== AS_SPECIFIED
) ||
7443 (p
->as_type
== AS_EXTERNAL
) ||
7444 (p
->as_type
== AS_INTERNAL
))
7445 vty_out (vty
, "remote AS %u, ", p
->as
);
7447 vty_out (vty
, "remote AS Unspecified, ");
7448 vty_out (vty
, "local AS %u%s%s, ",
7449 p
->change_local_as
? p
->change_local_as
: p
->local_as
,
7450 CHECK_FLAG (p
->flags
, PEER_FLAG_LOCAL_AS_NO_PREPEND
) ?
7452 CHECK_FLAG (p
->flags
, PEER_FLAG_LOCAL_AS_REPLACE_AS
) ?
7453 " replace-as" : "");
7455 /* peer type internal, external, confed-internal or confed-external */
7456 if (p
->as
== p
->local_as
)
7460 if (CHECK_FLAG(bgp
->config
, BGP_CONFIG_CONFEDERATION
))
7461 json_object_boolean_true_add(json_neigh
, "nbrConfedInternalLink");
7463 json_object_boolean_true_add(json_neigh
, "nbrInternalLink");
7467 if (CHECK_FLAG(bgp
->config
, BGP_CONFIG_CONFEDERATION
))
7468 vty_out (vty
, "confed-internal link%s", VTY_NEWLINE
);
7470 vty_out (vty
, "internal link%s", VTY_NEWLINE
);
7477 if (CHECK_FLAG(bgp
->config
, BGP_CONFIG_CONFEDERATION
))
7478 json_object_boolean_true_add(json_neigh
, "nbrConfedExternalLink");
7480 json_object_boolean_true_add(json_neigh
, "nbrExternalLink");
7484 if (bgp_confederation_peers_check(bgp
, p
->as
))
7485 vty_out (vty
, "confed-external link%s", VTY_NEWLINE
);
7487 vty_out (vty
, "external link%s", VTY_NEWLINE
);
7495 json_object_string_add(json_neigh
, "nbrDesc", p
->desc
);
7497 vty_out (vty
, " Description: %s%s", p
->desc
, VTY_NEWLINE
);
7505 json_object_string_add(json_neigh
, "hostname", p
->hostname
);
7508 json_object_string_add(json_neigh
, "domainname", p
->domainname
);
7512 if (p
->domainname
&& (p
->domainname
[0] != '\0'))
7513 vty_out(vty
, "Hostname: %s.%s%s", p
->hostname
, p
->domainname
,
7516 vty_out(vty
, "Hostname: %s%s", p
->hostname
, VTY_NEWLINE
);
7526 json_object_string_add(json_neigh
, "peerGroup", p
->group
->name
);
7530 struct prefix prefix
, *range
= NULL
;
7532 sockunion2hostprefix(&(p
->su
), &prefix
);
7533 range
= peer_group_lookup_dynamic_neighbor_range (p
->group
, &prefix
);
7537 prefix2str(range
, buf1
, sizeof(buf1
));
7538 json_object_string_add(json_neigh
, "peerSubnetRangeGroup", buf1
);
7544 vty_out (vty
, " Member of peer-group %s for session parameters%s",
7545 p
->group
->name
, VTY_NEWLINE
);
7549 struct prefix prefix
, *range
= NULL
;
7551 sockunion2hostprefix(&(p
->su
), &prefix
);
7552 range
= peer_group_lookup_dynamic_neighbor_range (p
->group
, &prefix
);
7556 prefix2str(range
, buf1
, sizeof(buf1
));
7557 vty_out (vty
, " Belongs to the subnet range group: %s%s", buf1
, VTY_NEWLINE
);
7565 /* Administrative shutdown. */
7566 if (CHECK_FLAG (p
->flags
, PEER_FLAG_SHUTDOWN
))
7567 json_object_boolean_true_add(json_neigh
, "adminShutDown");
7570 json_object_int_add(json_neigh
, "bgpVersion", 4);
7571 json_object_string_add(json_neigh
, "remoteRouterId",
7572 inet_ntop (AF_INET
, &p
->remote_id
, buf1
, sizeof(buf1
)));
7575 if (CHECK_FLAG (bgp
->config
, BGP_CONFIG_CONFEDERATION
) && bgp_confederation_peers_check (bgp
, p
->as
))
7576 json_object_boolean_true_add(json_neigh
, "nbrCommonAdmin");
7579 json_object_string_add(json_neigh
, "bgpState", LOOKUP (bgp_status_msg
, p
->status
));
7581 if (p
->status
== Established
)
7586 uptime
= bgp_clock();
7587 uptime
-= p
->uptime
;
7588 tm
= gmtime(&uptime
);
7590 json_object_int_add(json_neigh
, "bgpTimerUp", (tm
->tm_sec
* 1000) + (tm
->tm_min
* 60000) + (tm
->tm_hour
* 3600000));
7593 else if (p
->status
== Active
)
7595 if (CHECK_FLAG (p
->flags
, PEER_FLAG_PASSIVE
))
7596 json_object_string_add(json_neigh
, "bgpStateIs", "passive");
7597 else if (CHECK_FLAG (p
->sflags
, PEER_STATUS_NSF_WAIT
))
7598 json_object_string_add(json_neigh
, "bgpStateIs", "passiveNSF");
7605 uptime
= bgp_clock();
7606 uptime
-= p
->readtime
;
7607 tm
= gmtime(&uptime
);
7608 json_object_int_add(json_neigh
, "bgpTimerLastRead", (tm
->tm_sec
* 1000) + (tm
->tm_min
* 60000) + (tm
->tm_hour
* 3600000));
7610 uptime
= bgp_clock();
7611 uptime
-= p
->last_write
;
7612 tm
= gmtime(&uptime
);
7613 json_object_int_add(json_neigh
, "bgpTimerLastWrite", (tm
->tm_sec
* 1000) + (tm
->tm_min
* 60000) + (tm
->tm_hour
* 3600000));
7615 uptime
= bgp_clock();
7616 uptime
-= p
->update_time
;
7617 tm
= gmtime(&uptime
);
7618 json_object_int_add(json_neigh
, "bgpInUpdateElapsedTimeMsecs",
7619 (tm
->tm_sec
* 1000) + (tm
->tm_min
* 60000) + (tm
->tm_hour
* 3600000));
7621 /* Configured timer values. */
7622 json_object_int_add(json_neigh
, "bgpTimerHoldTimeMsecs", p
->v_holdtime
* 1000);
7623 json_object_int_add(json_neigh
, "bgpTimerKeepAliveIntervalMsecs", p
->v_keepalive
* 1000);
7625 if (CHECK_FLAG (p
->config
, PEER_CONFIG_TIMER
))
7627 json_object_int_add(json_neigh
, "bgpTimerConfiguredHoldTimeMsecs", p
->holdtime
* 1000);
7628 json_object_int_add(json_neigh
, "bgpTimerConfiguredKeepAliveIntervalMsecs", p
->keepalive
* 1000);
7633 /* Administrative shutdown. */
7634 if (CHECK_FLAG (p
->flags
, PEER_FLAG_SHUTDOWN
))
7635 vty_out (vty
, " Administratively shut down%s", VTY_NEWLINE
);
7638 vty_out (vty
, " BGP version 4");
7639 vty_out (vty
, ", remote router ID %s%s",
7640 inet_ntop (AF_INET
, &p
->remote_id
, buf1
, sizeof(buf1
)),
7644 if (CHECK_FLAG (bgp
->config
, BGP_CONFIG_CONFEDERATION
)
7645 && bgp_confederation_peers_check (bgp
, p
->as
))
7646 vty_out (vty
, " Neighbor under common administration%s", VTY_NEWLINE
);
7649 vty_out (vty
, " BGP state = %s", LOOKUP (bgp_status_msg
, p
->status
));
7651 if (p
->status
== Established
)
7652 vty_out (vty
, ", up for %8s", peer_uptime (p
->uptime
, timebuf
, BGP_UPTIME_LEN
, 0, NULL
));
7654 else if (p
->status
== Active
)
7656 if (CHECK_FLAG (p
->flags
, PEER_FLAG_PASSIVE
))
7657 vty_out (vty
, " (passive)");
7658 else if (CHECK_FLAG (p
->sflags
, PEER_STATUS_NSF_WAIT
))
7659 vty_out (vty
, " (NSF passive)");
7661 vty_out (vty
, "%s", VTY_NEWLINE
);
7664 vty_out (vty
, " Last read %s", peer_uptime (p
->readtime
, timebuf
, BGP_UPTIME_LEN
, 0, NULL
));
7665 vty_out (vty
, ", Last write %s%s",
7666 peer_uptime (p
->last_write
, timebuf
, BGP_UPTIME_LEN
, 0, NULL
), VTY_NEWLINE
);
7668 /* Configured timer values. */
7669 vty_out (vty
, " Hold time is %d, keepalive interval is %d seconds%s",
7670 p
->v_holdtime
, p
->v_keepalive
, VTY_NEWLINE
);
7671 if (CHECK_FLAG (p
->config
, PEER_CONFIG_TIMER
))
7673 vty_out (vty
, " Configured hold time is %d", p
->holdtime
);
7674 vty_out (vty
, ", keepalive interval is %d seconds%s",
7675 p
->keepalive
, VTY_NEWLINE
);
7679 if (p
->status
== Established
)
7682 || p
->afc_adv
[AFI_IP
][SAFI_UNICAST
]
7683 || p
->afc_recv
[AFI_IP
][SAFI_UNICAST
]
7684 || p
->afc_adv
[AFI_IP
][SAFI_MULTICAST
]
7685 || p
->afc_recv
[AFI_IP
][SAFI_MULTICAST
]
7686 || p
->afc_adv
[AFI_IP6
][SAFI_UNICAST
]
7687 || p
->afc_recv
[AFI_IP6
][SAFI_UNICAST
]
7688 || p
->afc_adv
[AFI_IP6
][SAFI_MULTICAST
]
7689 || p
->afc_recv
[AFI_IP6
][SAFI_MULTICAST
]
7690 || p
->afc_adv
[AFI_IP6
][SAFI_MPLS_VPN
]
7691 || p
->afc_recv
[AFI_IP6
][SAFI_MPLS_VPN
]
7692 || p
->afc_adv
[AFI_IP6
][SAFI_ENCAP
]
7693 || p
->afc_recv
[AFI_IP6
][SAFI_ENCAP
]
7694 || p
->afc_adv
[AFI_IP
][SAFI_ENCAP
]
7695 || p
->afc_recv
[AFI_IP
][SAFI_ENCAP
]
7696 || p
->afc_adv
[AFI_IP
][SAFI_MPLS_VPN
]
7697 || p
->afc_recv
[AFI_IP
][SAFI_MPLS_VPN
])
7701 json_object
*json_cap
= NULL
;
7703 json_cap
= json_object_new_object();
7706 if (CHECK_FLAG (p
->cap
, PEER_CAP_AS4_RCV
)
7707 || CHECK_FLAG (p
->cap
, PEER_CAP_AS4_ADV
))
7709 if (CHECK_FLAG (p
->cap
, PEER_CAP_AS4_ADV
) && CHECK_FLAG (p
->cap
, PEER_CAP_AS4_RCV
))
7710 json_object_string_add(json_cap
, "4byteAs", "advertisedAndReceived");
7711 else if (CHECK_FLAG (p
->cap
, PEER_CAP_AS4_ADV
))
7712 json_object_string_add(json_cap
, "4byteAs", "advertised");
7713 else if (CHECK_FLAG (p
->cap
, PEER_CAP_AS4_RCV
))
7714 json_object_string_add(json_cap
, "4byteAs", "received");
7718 if (CHECK_FLAG (p
->cap
, PEER_CAP_ADDPATH_RCV
)
7719 || CHECK_FLAG (p
->cap
, PEER_CAP_ADDPATH_ADV
))
7721 json_object
*json_add
= NULL
;
7722 const char *print_store
;
7724 json_add
= json_object_new_object();
7726 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
7727 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
7729 json_object
*json_sub
= NULL
;
7730 json_sub
= json_object_new_object();
7731 print_store
= afi_safi_print (afi
, safi
);
7733 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_TX_ADV
) ||
7734 CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_TX_RCV
))
7736 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
))
7737 json_object_boolean_true_add(json_sub
, "txAdvertisedAndReceived");
7738 else if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_TX_ADV
))
7739 json_object_boolean_true_add(json_sub
, "txAdvertised");
7740 else if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_TX_RCV
))
7741 json_object_boolean_true_add(json_sub
, "txReceived");
7744 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_RX_ADV
) ||
7745 CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_RX_RCV
))
7747 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
))
7748 json_object_boolean_true_add(json_sub
, "rxAdvertisedAndReceived");
7749 else if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_RX_ADV
))
7750 json_object_boolean_true_add(json_sub
, "rxAdvertised");
7751 else if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_RX_RCV
))
7752 json_object_boolean_true_add(json_sub
, "rxReceived");
7755 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_TX_ADV
) ||
7756 CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_TX_RCV
) ||
7757 CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_RX_ADV
) ||
7758 CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_RX_RCV
))
7759 json_object_object_add(json_add
, print_store
, json_sub
);
7761 json_object_free(json_sub
);
7764 json_object_object_add(json_cap
, "addPath", json_add
);
7768 if (CHECK_FLAG (p
->cap
, PEER_CAP_DYNAMIC_RCV
)
7769 || CHECK_FLAG (p
->cap
, PEER_CAP_DYNAMIC_ADV
))
7771 if (CHECK_FLAG (p
->cap
, PEER_CAP_DYNAMIC_ADV
) && CHECK_FLAG (p
->cap
, PEER_CAP_DYNAMIC_RCV
))
7772 json_object_string_add(json_cap
, "dynamic", "advertisedAndReceived");
7773 else if (CHECK_FLAG (p
->cap
, PEER_CAP_DYNAMIC_ADV
))
7774 json_object_string_add(json_cap
, "dynamic", "advertised");
7775 else if (CHECK_FLAG (p
->cap
, PEER_CAP_DYNAMIC_RCV
))
7776 json_object_string_add(json_cap
, "dynamic", "received");
7779 /* Extended nexthop */
7780 if (CHECK_FLAG (p
->cap
, PEER_CAP_ENHE_RCV
)
7781 || CHECK_FLAG (p
->cap
, PEER_CAP_ENHE_ADV
))
7783 json_object
*json_nxt
= NULL
;
7784 const char *print_store
;
7787 if (CHECK_FLAG (p
->cap
, PEER_CAP_ENHE_ADV
) && CHECK_FLAG (p
->cap
, PEER_CAP_ENHE_RCV
))
7788 json_object_string_add(json_cap
, "extendedNexthop", "advertisedAndReceived");
7789 else if (CHECK_FLAG (p
->cap
, PEER_CAP_ENHE_ADV
))
7790 json_object_string_add(json_cap
, "extendedNexthop", "advertised");
7791 else if (CHECK_FLAG (p
->cap
, PEER_CAP_ENHE_RCV
))
7792 json_object_string_add(json_cap
, "extendedNexthop", "received");
7794 if (CHECK_FLAG (p
->cap
, PEER_CAP_ENHE_RCV
))
7796 json_nxt
= json_object_new_object();
7798 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
7800 if (CHECK_FLAG (p
->af_cap
[AFI_IP
][safi
], PEER_CAP_ENHE_AF_RCV
))
7802 print_store
= afi_safi_print (AFI_IP
, safi
);
7803 json_object_string_add(json_nxt
, print_store
, "recieved");
7806 json_object_object_add(json_cap
, "extendedNexthopFamililesByPeer", json_nxt
);
7811 if (CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_ADV
)
7812 || CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_NEW_RCV
)
7813 || CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_OLD_RCV
))
7815 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
)))
7817 if (CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_OLD_RCV
) && CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_NEW_RCV
))
7818 json_object_string_add(json_cap
, "routeRefresh", "advertisedAndReceivedOldNew");
7821 if (CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_OLD_RCV
))
7822 json_object_string_add(json_cap
, "routeRefresh", "advertisedAndReceivedOld");
7824 json_object_string_add(json_cap
, "routeRefresh", "advertisedAndReceivedNew");
7827 else if (CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_ADV
))
7828 json_object_string_add(json_cap
, "routeRefresh", "advertised");
7829 else if (CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_NEW_RCV
) || CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_OLD_RCV
))
7830 json_object_string_add(json_cap
, "routeRefresh", "received");
7833 /* Multiprotocol Extensions */
7834 json_object
*json_multi
= NULL
;
7835 json_multi
= json_object_new_object();
7837 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
7839 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
7841 if (p
->afc_adv
[afi
][safi
] || p
->afc_recv
[afi
][safi
])
7843 json_object
*json_exten
= NULL
;
7844 json_exten
= json_object_new_object();
7846 if (p
->afc_adv
[afi
][safi
] && p
->afc_recv
[afi
][safi
])
7847 json_object_boolean_true_add(json_exten
, "advertisedAndReceived");
7848 else if (p
->afc_adv
[afi
][safi
])
7849 json_object_boolean_true_add(json_exten
, "advertised");
7850 else if (p
->afc_recv
[afi
][safi
])
7851 json_object_boolean_true_add(json_exten
, "received");
7853 json_object_object_add(json_multi
, afi_safi_print (afi
, safi
), json_exten
);
7857 json_object_object_add(json_cap
, "multiprotocolExtensions", json_multi
);
7859 /* Gracefull Restart */
7860 if (CHECK_FLAG (p
->cap
, PEER_CAP_RESTART_RCV
)
7861 || CHECK_FLAG (p
->cap
, PEER_CAP_RESTART_ADV
))
7863 if (CHECK_FLAG (p
->cap
, PEER_CAP_RESTART_ADV
) && CHECK_FLAG (p
->cap
, PEER_CAP_RESTART_RCV
))
7864 json_object_string_add(json_cap
, "gracefulRestart", "advertisedAndReceived");
7865 else if (CHECK_FLAG (p
->cap
, PEER_CAP_RESTART_ADV
))
7866 json_object_string_add(json_cap
, "gracefulRestartCapability", "advertised");
7867 else if (CHECK_FLAG (p
->cap
, PEER_CAP_RESTART_RCV
))
7868 json_object_string_add(json_cap
, "gracefulRestartCapability", "received");
7870 if (CHECK_FLAG (p
->cap
, PEER_CAP_RESTART_RCV
))
7872 int restart_af_count
= 0;
7873 json_object
*json_restart
= NULL
;
7874 json_restart
= json_object_new_object();
7876 json_object_int_add(json_cap
, "gracefulRestartRemoteTimerMsecs", p
->v_gr_restart
* 1000);
7878 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
7880 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
7882 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_RESTART_AF_RCV
))
7884 json_object
*json_sub
= NULL
;
7885 json_sub
= json_object_new_object();
7887 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_RESTART_AF_PRESERVE_RCV
))
7888 json_object_boolean_true_add(json_sub
, "preserved");
7890 json_object_object_add(json_restart
, afi_safi_print (afi
, safi
), json_sub
);
7894 if (! restart_af_count
)
7896 json_object_string_add(json_cap
, "addressFamiliesByPeer", "none");
7897 json_object_free(json_restart
);
7900 json_object_object_add(json_cap
, "addressFamiliesByPeer", json_restart
);
7903 json_object_object_add(json_neigh
, "neighborCapabilities", json_cap
);
7907 vty_out (vty
, " Neighbor capabilities:%s", VTY_NEWLINE
);
7910 if (CHECK_FLAG (p
->cap
, PEER_CAP_AS4_RCV
)
7911 || CHECK_FLAG (p
->cap
, PEER_CAP_AS4_ADV
))
7913 vty_out (vty
, " 4 Byte AS:");
7914 if (CHECK_FLAG (p
->cap
, PEER_CAP_AS4_ADV
))
7915 vty_out (vty
, " advertised");
7916 if (CHECK_FLAG (p
->cap
, PEER_CAP_AS4_RCV
))
7917 vty_out (vty
, " %sreceived",
7918 CHECK_FLAG (p
->cap
, PEER_CAP_AS4_ADV
) ? "and " : "");
7919 vty_out (vty
, "%s", VTY_NEWLINE
);
7923 if (CHECK_FLAG (p
->cap
, PEER_CAP_ADDPATH_RCV
)
7924 || CHECK_FLAG (p
->cap
, PEER_CAP_ADDPATH_ADV
))
7926 vty_out (vty
, " AddPath:%s", VTY_NEWLINE
);
7928 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
7929 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
7931 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_TX_ADV
) ||
7932 CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_TX_RCV
))
7934 vty_out (vty
, " %s: TX ", afi_safi_print (afi
, safi
));
7936 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_TX_ADV
))
7937 vty_out (vty
, "advertised %s", afi_safi_print (afi
, safi
));
7939 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_TX_RCV
))
7940 vty_out (vty
, "%sreceived", CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_TX_ADV
) ? " and " : "" );
7942 vty_out (vty
, "%s", VTY_NEWLINE
);
7945 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_RX_ADV
) ||
7946 CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_RX_RCV
))
7948 vty_out (vty
, " %s: RX ", afi_safi_print (afi
, safi
));
7950 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_RX_ADV
))
7951 vty_out (vty
, "advertised %s", afi_safi_print (afi
, safi
));
7953 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_RX_RCV
))
7954 vty_out (vty
, "%sreceived", CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_RX_ADV
) ? " and " : "" );
7956 vty_out (vty
, "%s", VTY_NEWLINE
);
7962 if (CHECK_FLAG (p
->cap
, PEER_CAP_DYNAMIC_RCV
)
7963 || CHECK_FLAG (p
->cap
, PEER_CAP_DYNAMIC_ADV
))
7965 vty_out (vty
, " Dynamic:");
7966 if (CHECK_FLAG (p
->cap
, PEER_CAP_DYNAMIC_ADV
))
7967 vty_out (vty
, " advertised");
7968 if (CHECK_FLAG (p
->cap
, PEER_CAP_DYNAMIC_RCV
))
7969 vty_out (vty
, " %sreceived",
7970 CHECK_FLAG (p
->cap
, PEER_CAP_DYNAMIC_ADV
) ? "and " : "");
7971 vty_out (vty
, "%s", VTY_NEWLINE
);
7974 /* Extended nexthop */
7975 if (CHECK_FLAG (p
->cap
, PEER_CAP_ENHE_RCV
)
7976 || CHECK_FLAG (p
->cap
, PEER_CAP_ENHE_ADV
))
7978 vty_out (vty
, " Extended nexthop:");
7979 if (CHECK_FLAG (p
->cap
, PEER_CAP_ENHE_ADV
))
7980 vty_out (vty
, " advertised");
7981 if (CHECK_FLAG (p
->cap
, PEER_CAP_ENHE_RCV
))
7982 vty_out (vty
, " %sreceived",
7983 CHECK_FLAG (p
->cap
, PEER_CAP_ENHE_ADV
) ? "and " : "");
7984 vty_out (vty
, "%s", VTY_NEWLINE
);
7986 if (CHECK_FLAG (p
->cap
, PEER_CAP_ENHE_RCV
))
7988 vty_out (vty
, " Address families by peer:%s ", VTY_NEWLINE
);
7989 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
7990 if (CHECK_FLAG (p
->af_cap
[AFI_IP
][safi
], PEER_CAP_ENHE_AF_RCV
))
7991 vty_out (vty
, " %s%s",
7992 afi_safi_print (AFI_IP
, safi
), VTY_NEWLINE
);
7997 if (CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_ADV
)
7998 || CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_NEW_RCV
)
7999 || CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_OLD_RCV
))
8001 vty_out (vty
, " Route refresh:");
8002 if (CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_ADV
))
8003 vty_out (vty
, " advertised");
8004 if (CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_NEW_RCV
)
8005 || CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_OLD_RCV
))
8006 vty_out (vty
, " %sreceived(%s)",
8007 CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_ADV
) ? "and " : "",
8008 (CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_OLD_RCV
)
8009 && CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_NEW_RCV
)) ?
8010 "old & new" : CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_OLD_RCV
) ? "old" : "new");
8012 vty_out (vty
, "%s", VTY_NEWLINE
);
8015 /* Multiprotocol Extensions */
8016 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
8017 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
8018 if (p
->afc_adv
[afi
][safi
] || p
->afc_recv
[afi
][safi
])
8020 vty_out (vty
, " Address Family %s:", afi_safi_print (afi
, safi
));
8021 if (p
->afc_adv
[afi
][safi
])
8022 vty_out (vty
, " advertised");
8023 if (p
->afc_recv
[afi
][safi
])
8024 vty_out (vty
, " %sreceived", p
->afc_adv
[afi
][safi
] ? "and " : "");
8025 vty_out (vty
, "%s", VTY_NEWLINE
);
8028 /* Hostname capability */
8029 if (CHECK_FLAG(p
->cap
, PEER_CAP_HOSTNAME_ADV
) ||
8030 CHECK_FLAG(p
->cap
, PEER_CAP_HOSTNAME_RCV
))
8032 vty_out (vty
, " Hostname Capability:");
8033 if (CHECK_FLAG (p
->cap
, PEER_CAP_HOSTNAME_ADV
))
8034 vty_out (vty
, " advertised");
8035 if (CHECK_FLAG (p
->cap
, PEER_CAP_HOSTNAME_RCV
))
8036 vty_out (vty
, " %sreceived",
8037 CHECK_FLAG (p
->cap
, PEER_CAP_HOSTNAME_ADV
) ? "and " : "");
8038 vty_out (vty
, "%s", VTY_NEWLINE
);
8041 /* Gracefull Restart */
8042 if (CHECK_FLAG (p
->cap
, PEER_CAP_RESTART_RCV
)
8043 || CHECK_FLAG (p
->cap
, PEER_CAP_RESTART_ADV
))
8045 vty_out (vty
, " Graceful Restart Capabilty:");
8046 if (CHECK_FLAG (p
->cap
, PEER_CAP_RESTART_ADV
))
8047 vty_out (vty
, " advertised");
8048 if (CHECK_FLAG (p
->cap
, PEER_CAP_RESTART_RCV
))
8049 vty_out (vty
, " %sreceived",
8050 CHECK_FLAG (p
->cap
, PEER_CAP_RESTART_ADV
) ? "and " : "");
8051 vty_out (vty
, "%s", VTY_NEWLINE
);
8053 if (CHECK_FLAG (p
->cap
, PEER_CAP_RESTART_RCV
))
8055 int restart_af_count
= 0;
8057 vty_out (vty
, " Remote Restart timer is %d seconds%s",
8058 p
->v_gr_restart
, VTY_NEWLINE
);
8059 vty_out (vty
, " Address families by peer:%s ", VTY_NEWLINE
);
8061 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
8062 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
8063 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_RESTART_AF_RCV
))
8065 vty_out (vty
, "%s%s(%s)", restart_af_count
? ", " : "",
8066 afi_safi_print (afi
, safi
),
8067 CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_RESTART_AF_PRESERVE_RCV
) ?
8068 "preserved" : "not preserved");
8071 if (! restart_af_count
)
8072 vty_out (vty
, "none");
8073 vty_out (vty
, "%s", VTY_NEWLINE
);
8080 /* graceful restart information */
8081 if (CHECK_FLAG (p
->cap
, PEER_CAP_RESTART_RCV
)
8085 json_object
*json_grace
= NULL
;
8086 json_object
*json_grace_send
= NULL
;
8087 json_object
*json_grace_recv
= NULL
;
8088 int eor_send_af_count
= 0;
8089 int eor_receive_af_count
= 0;
8093 json_grace
= json_object_new_object();
8094 json_grace_send
= json_object_new_object();
8095 json_grace_recv
= json_object_new_object();
8097 if (p
->status
== Established
)
8099 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
8101 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
8103 if (CHECK_FLAG (p
->af_sflags
[afi
][safi
], PEER_STATUS_EOR_SEND
))
8105 json_object_boolean_true_add(json_grace_send
, afi_safi_print (afi
, safi
));
8106 eor_send_af_count
++;
8110 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
8112 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
8114 if (CHECK_FLAG (p
->af_sflags
[afi
][safi
], PEER_STATUS_EOR_RECEIVED
))
8116 json_object_boolean_true_add(json_grace_recv
, afi_safi_print (afi
, safi
));
8117 eor_receive_af_count
++;
8123 json_object_object_add(json_grace
, "endOfRibSend", json_grace_send
);
8124 json_object_object_add(json_grace
, "endOfRibRecv", json_grace_recv
);
8126 if (p
->t_gr_restart
)
8127 json_object_int_add(json_grace
, "gracefulRestartTimerMsecs", thread_timer_remain_second (p
->t_gr_restart
) * 1000);
8130 json_object_int_add(json_grace
, "gracefulStalepathTimerMsecs", thread_timer_remain_second (p
->t_gr_stale
) * 1000);
8132 json_object_object_add(json_neigh
, "gracefulRestartInfo", json_grace
);
8136 vty_out (vty
, " Graceful restart informations:%s", VTY_NEWLINE
);
8137 if (p
->status
== Established
)
8139 vty_out (vty
, " End-of-RIB send: ");
8140 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
8142 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
8144 if (CHECK_FLAG (p
->af_sflags
[afi
][safi
], PEER_STATUS_EOR_SEND
))
8146 vty_out (vty
, "%s%s", eor_send_af_count
? ", " : "",
8147 afi_safi_print (afi
, safi
));
8148 eor_send_af_count
++;
8152 vty_out (vty
, "%s", VTY_NEWLINE
);
8153 vty_out (vty
, " End-of-RIB received: ");
8154 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
8156 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
8158 if (CHECK_FLAG (p
->af_sflags
[afi
][safi
], PEER_STATUS_EOR_RECEIVED
))
8160 vty_out (vty
, "%s%s", eor_receive_af_count
? ", " : "",
8161 afi_safi_print (afi
, safi
));
8162 eor_receive_af_count
++;
8166 vty_out (vty
, "%s", VTY_NEWLINE
);
8169 if (p
->t_gr_restart
)
8170 vty_out (vty
, " The remaining time of restart timer is %ld%s",
8171 thread_timer_remain_second (p
->t_gr_restart
), VTY_NEWLINE
);
8174 vty_out (vty
, " The remaining time of stalepath timer is %ld%s",
8175 thread_timer_remain_second (p
->t_gr_stale
), VTY_NEWLINE
);
8180 json_object
*json_stat
= NULL
;
8181 json_stat
= json_object_new_object();
8182 /* Packet counts. */
8183 json_object_int_add(json_stat
, "depthInq", 0);
8184 json_object_int_add(json_stat
, "depthOutq", (unsigned long) p
->obuf
->count
);
8185 json_object_int_add(json_stat
, "opensSent", p
->open_out
);
8186 json_object_int_add(json_stat
, "opensRecv", p
->open_in
);
8187 json_object_int_add(json_stat
, "notificationsSent", p
->notify_out
);
8188 json_object_int_add(json_stat
, "notificationsRecv", p
->notify_in
);
8189 json_object_int_add(json_stat
, "updatesSent", p
->update_out
);
8190 json_object_int_add(json_stat
, "updatesRecv", p
->update_in
);
8191 json_object_int_add(json_stat
, "keepalivesSent", p
->keepalive_out
);
8192 json_object_int_add(json_stat
, "keepalivesRecv", p
->keepalive_in
);
8193 json_object_int_add(json_stat
, "routeRefreshSent", p
->refresh_out
);
8194 json_object_int_add(json_stat
, "routeRefreshRecv", p
->refresh_in
);
8195 json_object_int_add(json_stat
, "capabilitySent", p
->dynamic_cap_out
);
8196 json_object_int_add(json_stat
, "capabilityRecv", p
->dynamic_cap_in
);
8197 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
);
8198 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
);
8199 json_object_object_add(json_neigh
, "messageStats", json_stat
);
8203 /* Packet counts. */
8204 vty_out (vty
, " Message statistics:%s", VTY_NEWLINE
);
8205 vty_out (vty
, " Inq depth is 0%s", VTY_NEWLINE
);
8206 vty_out (vty
, " Outq depth is %lu%s", (unsigned long) p
->obuf
->count
, VTY_NEWLINE
);
8207 vty_out (vty
, " Sent Rcvd%s", VTY_NEWLINE
);
8208 vty_out (vty
, " Opens: %10d %10d%s", p
->open_out
, p
->open_in
, VTY_NEWLINE
);
8209 vty_out (vty
, " Notifications: %10d %10d%s", p
->notify_out
, p
->notify_in
, VTY_NEWLINE
);
8210 vty_out (vty
, " Updates: %10d %10d%s", p
->update_out
, p
->update_in
, VTY_NEWLINE
);
8211 vty_out (vty
, " Keepalives: %10d %10d%s", p
->keepalive_out
, p
->keepalive_in
, VTY_NEWLINE
);
8212 vty_out (vty
, " Route Refresh: %10d %10d%s", p
->refresh_out
, p
->refresh_in
, VTY_NEWLINE
);
8213 vty_out (vty
, " Capability: %10d %10d%s", p
->dynamic_cap_out
, p
->dynamic_cap_in
, VTY_NEWLINE
);
8214 vty_out (vty
, " Total: %10d %10d%s", p
->open_out
+ p
->notify_out
+
8215 p
->update_out
+ p
->keepalive_out
+ p
->refresh_out
+ p
->dynamic_cap_out
,
8216 p
->open_in
+ p
->notify_in
+ p
->update_in
+ p
->keepalive_in
+ p
->refresh_in
+
8217 p
->dynamic_cap_in
, VTY_NEWLINE
);
8222 /* advertisement-interval */
8223 json_object_int_add(json_neigh
, "minBtwnAdvertisementRunsTimerMsecs", p
->v_routeadv
* 1000);
8225 /* Update-source. */
8226 if (p
->update_if
|| p
->update_source
)
8229 json_object_string_add(json_neigh
, "updateSource", p
->update_if
);
8230 else if (p
->update_source
)
8231 json_object_string_add(json_neigh
, "updateSource", sockunion2str (p
->update_source
, buf1
, SU_ADDRSTRLEN
));
8236 /* advertisement-interval */
8237 vty_out (vty
, " Minimum time between advertisement runs is %d seconds%s",
8238 p
->v_routeadv
, VTY_NEWLINE
);
8240 /* Update-source. */
8241 if (p
->update_if
|| p
->update_source
)
8243 vty_out (vty
, " Update source is ");
8245 vty_out (vty
, "%s", p
->update_if
);
8246 else if (p
->update_source
)
8247 vty_out (vty
, "%s", sockunion2str (p
->update_source
, buf1
, SU_ADDRSTRLEN
));
8248 vty_out (vty
, "%s", VTY_NEWLINE
);
8251 vty_out (vty
, "%s", VTY_NEWLINE
);
8254 /* Address Family Information */
8255 json_object
*json_hold
= NULL
;
8258 json_hold
= json_object_new_object();
8260 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
8261 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
8262 if (p
->afc
[afi
][safi
])
8263 bgp_show_peer_afi (vty
, p
, afi
, safi
, use_json
, json_hold
);
8267 json_object_object_add(json_neigh
, "addressFamilyInfo", json_hold
);
8268 json_object_int_add(json_neigh
, "connectionsEstablished", p
->established
);
8269 json_object_int_add(json_neigh
, "connectionsDropped", p
->dropped
);
8272 vty_out (vty
, " Connections established %d; dropped %d%s", p
->established
, p
->dropped
,
8275 if (! p
->last_reset
)
8278 json_object_string_add(json_neigh
, "lastReset", "never");
8280 vty_out (vty
, " Last reset never%s", VTY_NEWLINE
);
8289 uptime
= bgp_clock();
8290 uptime
-= p
->resettime
;
8291 tm
= gmtime(&uptime
);
8292 json_object_int_add(json_neigh
, "lastResetTimerMsecs", (tm
->tm_sec
* 1000) + (tm
->tm_min
* 60000) + (tm
->tm_hour
* 3600000));
8293 json_object_string_add(json_neigh
, "lastResetDueTo", peer_down_str
[(int) p
->last_reset
]);
8294 if (p
->last_reset
== PEER_DOWN_NOTIFY_SEND
||
8295 p
->last_reset
== PEER_DOWN_NOTIFY_RECEIVED
)
8297 char errorcodesubcode_hexstr
[5];
8298 char errorcodesubcode_str
[256];
8300 code_str
= bgp_notify_code_str(p
->notify
.code
);
8301 subcode_str
= bgp_notify_subcode_str(p
->notify
.code
, p
->notify
.subcode
);
8303 sprintf(errorcodesubcode_hexstr
, "%02X%02X", p
->notify
.code
, p
->notify
.subcode
);
8304 json_object_string_add(json_neigh
, "lastErrorCodeSubcode", errorcodesubcode_hexstr
);
8305 snprintf(errorcodesubcode_str
, 255, "%s%s", code_str
, subcode_str
);
8306 json_object_string_add(json_neigh
, "lastNotificationReason", errorcodesubcode_str
);
8307 if (p
->last_reset
== PEER_DOWN_NOTIFY_RECEIVED
8308 && p
->notify
.code
== BGP_NOTIFY_CEASE
8309 && (p
->notify
.subcode
== BGP_NOTIFY_CEASE_ADMIN_SHUTDOWN
8310 || p
->notify
.subcode
== BGP_NOTIFY_CEASE_ADMIN_RESET
)
8311 && p
->notify
.length
)
8314 const char *msg_str
;
8316 msg_str
= bgp_notify_admin_message(msgbuf
, sizeof(msgbuf
),
8317 (u_char
*)p
->notify
.data
, p
->notify
.length
);
8319 json_object_string_add(json_neigh
, "lastShutdownDescription", msg_str
);
8325 vty_out (vty
, " Last reset %s, ",
8326 peer_uptime (p
->resettime
, timebuf
, BGP_UPTIME_LEN
, 0, NULL
));
8328 if (p
->last_reset
== PEER_DOWN_NOTIFY_SEND
||
8329 p
->last_reset
== PEER_DOWN_NOTIFY_RECEIVED
)
8331 code_str
= bgp_notify_code_str(p
->notify
.code
);
8332 subcode_str
= bgp_notify_subcode_str(p
->notify
.code
, p
->notify
.subcode
);
8333 vty_out (vty
, "due to NOTIFICATION %s (%s%s)%s",
8334 p
->last_reset
== PEER_DOWN_NOTIFY_SEND
? "sent" : "received",
8335 code_str
, subcode_str
, VTY_NEWLINE
);
8336 if (p
->last_reset
== PEER_DOWN_NOTIFY_RECEIVED
8337 && p
->notify
.code
== BGP_NOTIFY_CEASE
8338 && (p
->notify
.subcode
== BGP_NOTIFY_CEASE_ADMIN_SHUTDOWN
8339 || p
->notify
.subcode
== BGP_NOTIFY_CEASE_ADMIN_RESET
)
8340 && p
->notify
.length
)
8343 const char *msg_str
;
8345 msg_str
= bgp_notify_admin_message(msgbuf
, sizeof(msgbuf
),
8346 (u_char
*)p
->notify
.data
, p
->notify
.length
);
8348 vty_out (vty
, " Message: \"%s\"%s", msg_str
, VTY_NEWLINE
);
8353 vty_out (vty
, "due to %s%s",
8354 peer_down_str
[(int) p
->last_reset
], VTY_NEWLINE
);
8357 if (p
->last_reset_cause_size
)
8359 msg
= p
->last_reset_cause
;
8360 vty_out(vty
, " Message received that caused BGP to send a NOTIFICATION:%s ", VTY_NEWLINE
);
8361 for (i
= 1; i
<= p
->last_reset_cause_size
; i
++)
8363 vty_out(vty
, "%02X", *msg
++);
8365 if (i
!= p
->last_reset_cause_size
)
8369 vty_out(vty
, "%s ", VTY_NEWLINE
);
8371 else if (i
% 4 == 0)
8377 vty_out(vty
, "%s", VTY_NEWLINE
);
8382 if (CHECK_FLAG (p
->sflags
, PEER_STATUS_PREFIX_OVERFLOW
))
8385 json_object_boolean_true_add(json_neigh
, "prefixesConfigExceedMax");
8387 vty_out (vty
, " Peer had exceeded the max. no. of prefixes configured.%s", VTY_NEWLINE
);
8389 if (p
->t_pmax_restart
)
8393 json_object_boolean_true_add(json_neigh
, "reducePrefixNumFrom");
8394 json_object_int_add(json_neigh
, "restartInTimerMsec", thread_timer_remain_second (p
->t_pmax_restart
) * 1000);
8397 vty_out (vty
, " Reduce the no. of prefix from %s, will restart in %ld seconds%s",
8398 p
->host
, thread_timer_remain_second (p
->t_pmax_restart
),
8404 json_object_boolean_true_add(json_neigh
, "reducePrefixNumAndClearIpBgp");
8406 vty_out (vty
, " Reduce the no. of prefix and clear ip bgp %s to restore peering%s",
8407 p
->host
, VTY_NEWLINE
);
8411 /* EBGP Multihop and GTSM */
8412 if (p
->sort
!= BGP_PEER_IBGP
)
8416 if (p
->gtsm_hops
> 0)
8417 json_object_int_add(json_neigh
, "externalBgpNbrMaxHopsAway", p
->gtsm_hops
);
8418 else if (p
->ttl
> 1)
8419 json_object_int_add(json_neigh
, "externalBgpNbrMaxHopsAway", p
->ttl
);
8423 if (p
->gtsm_hops
> 0)
8424 vty_out (vty
, " External BGP neighbor may be up to %d hops away.%s",
8425 p
->gtsm_hops
, VTY_NEWLINE
);
8426 else if (p
->ttl
> 1)
8427 vty_out (vty
, " External BGP neighbor may be up to %d hops away.%s",
8428 p
->ttl
, VTY_NEWLINE
);
8433 if (p
->gtsm_hops
> 0)
8436 json_object_int_add(json_neigh
, "internalBgpNbrMaxHopsAway", p
->gtsm_hops
);
8438 vty_out (vty
, " Internal BGP neighbor may be up to %d hops away.%s",
8439 p
->gtsm_hops
, VTY_NEWLINE
);
8443 /* Local address. */
8448 json_object_string_add(json_neigh
, "hostLocal", sockunion2str (p
->su_local
, buf1
, SU_ADDRSTRLEN
));
8449 json_object_int_add(json_neigh
, "portLocal", ntohs (p
->su_local
->sin
.sin_port
));
8452 vty_out (vty
, "Local host: %s, Local port: %d%s",
8453 sockunion2str (p
->su_local
, buf1
, SU_ADDRSTRLEN
),
8454 ntohs (p
->su_local
->sin
.sin_port
),
8458 /* Remote address. */
8463 json_object_string_add(json_neigh
, "hostForeign", sockunion2str (p
->su_remote
, buf1
, SU_ADDRSTRLEN
));
8464 json_object_int_add(json_neigh
, "portForeign", ntohs (p
->su_remote
->sin
.sin_port
));
8467 vty_out (vty
, "Foreign host: %s, Foreign port: %d%s",
8468 sockunion2str (p
->su_remote
, buf1
, SU_ADDRSTRLEN
),
8469 ntohs (p
->su_remote
->sin
.sin_port
),
8473 /* Nexthop display. */
8478 json_object_string_add(json_neigh
, "nexthop",
8479 inet_ntop (AF_INET
, &p
->nexthop
.v4
, buf1
, sizeof(buf1
)));
8480 json_object_string_add(json_neigh
, "nexthopGlobal",
8481 inet_ntop (AF_INET6
, &p
->nexthop
.v6_global
, buf1
, sizeof(buf1
)));
8482 json_object_string_add(json_neigh
, "nexthopLocal",
8483 inet_ntop (AF_INET6
, &p
->nexthop
.v6_local
, buf1
, sizeof(buf1
)));
8484 if (p
->shared_network
)
8485 json_object_string_add(json_neigh
, "bgpConnection", "sharedNetwork");
8487 json_object_string_add(json_neigh
, "bgpConnection", "nonSharedNetwork");
8491 vty_out (vty
, "Nexthop: %s%s",
8492 inet_ntop (AF_INET
, &p
->nexthop
.v4
, buf1
, sizeof(buf1
)),
8494 vty_out (vty
, "Nexthop global: %s%s",
8495 inet_ntop (AF_INET6
, &p
->nexthop
.v6_global
, buf1
, sizeof(buf1
)),
8497 vty_out (vty
, "Nexthop local: %s%s",
8498 inet_ntop (AF_INET6
, &p
->nexthop
.v6_local
, buf1
, sizeof(buf1
)),
8500 vty_out (vty
, "BGP connection: %s%s",
8501 p
->shared_network
? "shared network" : "non shared network",
8506 /* Timer information. */
8509 json_object_int_add(json_neigh
, "connectRetryTimer", p
->v_connect
);
8510 if (p
->status
== Established
&& p
->rtt
)
8511 json_object_int_add(json_neigh
, "estimatedRttInMsecs", p
->rtt
);
8513 json_object_int_add(json_neigh
, "nextStartTimerDueInMsecs", thread_timer_remain_second (p
->t_start
) * 1000);
8515 json_object_int_add(json_neigh
, "nextConnectTimerDueInMsecs", thread_timer_remain_second (p
->t_connect
) * 1000);
8518 json_object_int_add(json_neigh
, "mraiInterval", p
->v_routeadv
);
8519 json_object_int_add(json_neigh
, "mraiTimerExpireInMsecs", thread_timer_remain_second (p
->t_routeadv
) * 1000);
8523 json_object_string_add(json_neigh
, "readThread", "on");
8525 json_object_string_add(json_neigh
, "readThread", "off");
8527 json_object_string_add(json_neigh
, "writeThread", "on");
8529 json_object_string_add(json_neigh
, "writeThread", "off");
8533 vty_out (vty
, "BGP Connect Retry Timer in Seconds: %d%s",
8534 p
->v_connect
, VTY_NEWLINE
);
8535 if (p
->status
== Established
&& p
->rtt
)
8536 vty_out (vty
, "Estimated round trip time: %d ms%s",
8537 p
->rtt
, VTY_NEWLINE
);
8539 vty_out (vty
, "Next start timer due in %ld seconds%s",
8540 thread_timer_remain_second (p
->t_start
), VTY_NEWLINE
);
8542 vty_out (vty
, "Next connect timer due in %ld seconds%s",
8543 thread_timer_remain_second (p
->t_connect
), VTY_NEWLINE
);
8545 vty_out (vty
, "MRAI (interval %u) timer expires in %ld seconds%s",
8546 p
->v_routeadv
, thread_timer_remain_second (p
->t_routeadv
),
8549 vty_out (vty
, "Read thread: %s Write thread: %s%s",
8550 p
->t_read
? "on" : "off",
8551 p
->t_write
? "on" : "off",
8555 if (p
->notify
.code
== BGP_NOTIFY_OPEN_ERR
8556 && p
->notify
.subcode
== BGP_NOTIFY_OPEN_UNSUP_CAPBL
)
8557 bgp_capability_vty_out (vty
, p
, use_json
, json_neigh
);
8560 vty_out (vty
, "%s", VTY_NEWLINE
);
8562 /* BFD information. */
8563 bgp_bfd_show_info(vty
, p
, use_json
, json_neigh
);
8567 if (p
->conf_if
) /* Configured interface name. */
8568 json_object_object_add(json
, p
->conf_if
, json_neigh
);
8569 else /* Configured IP address. */
8570 json_object_object_add(json
, p
->host
, json_neigh
);
8575 bgp_show_neighbor (struct vty
*vty
, struct bgp
*bgp
, enum show_type type
,
8576 union sockunion
*su
, const char *conf_if
, u_char use_json
, json_object
*json
)
8578 struct listnode
*node
, *nnode
;
8582 for (ALL_LIST_ELEMENTS (bgp
->peer
, node
, nnode
, peer
))
8584 if (!CHECK_FLAG(peer
->flags
, PEER_FLAG_CONFIG_NODE
))
8590 bgp_show_peer (vty
, peer
, use_json
, json
);
8595 if ((peer
->conf_if
&& !strcmp(peer
->conf_if
, conf_if
)) ||
8596 (peer
->hostname
&& !strcmp(peer
->hostname
, conf_if
)))
8599 bgp_show_peer (vty
, peer
, use_json
, json
);
8604 if (sockunion_same (&peer
->su
, su
))
8607 bgp_show_peer (vty
, peer
, use_json
, json
);
8614 if (type
== show_peer
&& ! find
)
8617 json_object_boolean_true_add(json
, "bgpNoSuchNeighbor");
8619 vty_out (vty
, "%% No such neighbor%s", VTY_NEWLINE
);
8624 vty_out (vty
, "%s%s", json_object_to_json_string_ext(json
, JSON_C_TO_STRING_PRETTY
), VTY_NEWLINE
);
8625 json_object_free(json
);
8629 vty_out (vty
, "%s", VTY_NEWLINE
);
8636 bgp_show_all_instances_neighbors_vty (struct vty
*vty
, u_char use_json
)
8638 struct listnode
*node
, *nnode
;
8640 json_object
*json
= NULL
;
8644 vty_out (vty
, "{%s", VTY_NEWLINE
);
8646 for (ALL_LIST_ELEMENTS (bm
->bgp
, node
, nnode
, bgp
))
8650 if (!(json
= json_object_new_object()))
8652 zlog_err("Unable to allocate memory for JSON object");
8654 "{\"error\": {\"message:\": \"Unable to allocate memory for JSON object\"}}}%s",
8659 json_object_int_add(json
, "vrfId",
8660 (bgp
->vrf_id
== VRF_UNKNOWN
)
8661 ? -1 : bgp
->vrf_id
);
8662 json_object_string_add(json
, "vrfName",
8663 (bgp
->inst_type
== BGP_INSTANCE_TYPE_DEFAULT
)
8664 ? "Default" : bgp
->name
);
8667 vty_out (vty
, ",%s", VTY_NEWLINE
);
8671 vty_out(vty
, "\"%s\":", (bgp
->inst_type
== BGP_INSTANCE_TYPE_DEFAULT
)
8672 ? "Default" : bgp
->name
);
8676 vty_out (vty
, "%sInstance %s:%s",
8678 (bgp
->inst_type
== BGP_INSTANCE_TYPE_DEFAULT
)
8679 ? "Default" : bgp
->name
,
8682 bgp_show_neighbor (vty
, bgp
, show_all
, NULL
, NULL
, use_json
, json
);
8686 vty_out (vty
, "}%s", VTY_NEWLINE
);
8690 bgp_show_neighbor_vty (struct vty
*vty
, const char *name
,
8691 enum show_type type
, const char *ip_str
, u_char use_json
)
8696 json_object
*json
= NULL
;
8699 json
= json_object_new_object();
8703 if (strmatch(name
, "all"))
8705 bgp_show_all_instances_neighbors_vty (vty
, use_json
);
8710 bgp
= bgp_lookup_by_name (name
);
8715 json_object_boolean_true_add(json
, "bgpNoSuchInstance");
8716 vty_out (vty
, "%s%s", json_object_to_json_string_ext(json
, JSON_C_TO_STRING_PRETTY
), VTY_NEWLINE
);
8717 json_object_free(json
);
8720 vty_out (vty
, "%% No such BGP instance exist%s", VTY_NEWLINE
);
8728 bgp
= bgp_get_default ();
8735 ret
= str2sockunion (ip_str
, &su
);
8737 bgp_show_neighbor (vty
, bgp
, type
, NULL
, ip_str
, use_json
, json
);
8739 bgp_show_neighbor (vty
, bgp
, type
, &su
, NULL
, use_json
, json
);
8743 bgp_show_neighbor (vty
, bgp
, type
, NULL
, NULL
, use_json
, json
);
8750 /* "show [ip] bgp neighbors" commands. */
8751 DEFUN (show_ip_bgp_neighbors
,
8752 show_ip_bgp_neighbors_cmd
,
8753 "show [ip] bgp [<view|vrf> WORD] [<ipv4|ipv6|vpnv4 <all|rd ASN:nn_or_IP-address:nn>>] neighbors [<A.B.C.D|X:X::X:X|WORD>] [json]",
8757 BGP_INSTANCE_HELP_STR
8761 "Display information about all VPNv4 NLRIs\n"
8762 "Display information for a route distinguisher\n"
8763 "VPN Route Distinguisher\n"
8764 "Detailed information on TCP and BGP neighbor connections\n"
8765 "Neighbor to display information about\n"
8766 "Neighbor to display information about\n"
8767 "Neighbor on BGP configured interface\n"
8771 char *sh_arg
= NULL
;
8772 enum show_type sh_type
;
8774 u_char uj
= use_json(argc
, argv
);
8778 if (argv_find (argv
, argc
, "WORD", &idx
))
8779 vrf
= argv
[idx
]->arg
;
8781 if (argv_find (argv
, argc
, "A.B.C.D", &idx
) ||
8782 argv_find (argv
, argc
, "X:X::X:X", &idx
) ||
8783 argv_find (argv
, argc
, "WORD", &idx
))
8785 sh_type
= show_peer
;
8786 sh_arg
= argv
[idx
]->arg
;
8791 return bgp_show_neighbor_vty (vty
, vrf
, sh_type
, sh_arg
, uj
);
8794 /* Show BGP's AS paths internal data. There are both `show [ip] bgp
8795 paths' and `show ip mbgp paths'. Those functions results are the
8797 DEFUN (show_ip_bgp_paths
,
8798 show_ip_bgp_paths_cmd
,
8799 "show [ip] bgp ["BGP_SAFI_CMD_STR
"] paths",
8804 "Path information\n")
8806 vty_out (vty
, "Address Refcnt Path%s", VTY_NEWLINE
);
8807 aspath_print_all_vty (vty
);
8814 community_show_all_iterator (struct hash_backet
*backet
, struct vty
*vty
)
8816 struct community
*com
;
8818 com
= (struct community
*) backet
->data
;
8819 vty_out (vty
, "[%p] (%ld) %s%s", (void *)backet
, com
->refcnt
,
8820 community_str (com
), VTY_NEWLINE
);
8823 /* Show BGP's community internal data. */
8824 DEFUN (show_ip_bgp_community_info
,
8825 show_ip_bgp_community_info_cmd
,
8826 "show [ip] bgp community-info",
8830 "List all bgp community information\n")
8832 vty_out (vty
, "Address Refcnt Community%s", VTY_NEWLINE
);
8834 hash_iterate (community_hash (),
8835 (void (*) (struct hash_backet
*, void *))
8836 community_show_all_iterator
,
8843 lcommunity_show_all_iterator (struct hash_backet
*backet
, struct vty
*vty
)
8845 struct lcommunity
*lcom
;
8847 lcom
= (struct lcommunity
*) backet
->data
;
8848 vty_out (vty
, "[%p] (%ld) %s%s", (void *)backet
, lcom
->refcnt
,
8849 lcommunity_str (lcom
), VTY_NEWLINE
);
8852 /* Show BGP's community internal data. */
8853 DEFUN (show_ip_bgp_lcommunity_info
,
8854 show_ip_bgp_lcommunity_info_cmd
,
8855 "show ip bgp large-community-info",
8859 "List all bgp large-community information\n")
8861 vty_out (vty
, "Address Refcnt Large-community%s", VTY_NEWLINE
);
8863 hash_iterate (lcommunity_hash (),
8864 (void (*) (struct hash_backet
*, void *))
8865 lcommunity_show_all_iterator
,
8872 DEFUN (show_ip_bgp_attr_info
,
8873 show_ip_bgp_attr_info_cmd
,
8874 "show [ip] bgp attribute-info",
8878 "List all bgp attribute information\n")
8880 attr_show_all (vty
);
8885 bgp_show_all_instances_updgrps_vty (struct vty
*vty
, afi_t afi
, safi_t safi
)
8887 struct listnode
*node
, *nnode
;
8890 for (ALL_LIST_ELEMENTS (bm
->bgp
, node
, nnode
, bgp
))
8892 vty_out (vty
, "%sInstance %s:%s",
8894 (bgp
->inst_type
== BGP_INSTANCE_TYPE_DEFAULT
) ? "Default" : bgp
->name
,
8896 update_group_show(bgp
, afi
, safi
, vty
, 0);
8901 bgp_show_update_groups(struct vty
*vty
, const char *name
,
8909 if (strmatch (name
, "all"))
8911 bgp_show_all_instances_updgrps_vty (vty
, afi
, safi
);
8916 bgp
= bgp_lookup_by_name (name
);
8921 bgp
= bgp_get_default ();
8925 update_group_show(bgp
, afi
, safi
, vty
, subgrp_id
);
8929 DEFUN (show_ip_bgp_updgrps
,
8930 show_ip_bgp_updgrps_cmd
,
8931 "show [ip] bgp [<view|vrf> WORD] ["BGP_AFI_CMD_STR
" ["BGP_SAFI_CMD_STR
"]] update-groups [SUBGROUP-ID]",
8935 BGP_INSTANCE_HELP_STR
8938 "Detailed info about dynamic update groups\n"
8939 "Specific subgroup to display detailed info for\n")
8942 afi_t afi
= AFI_IP6
;
8943 safi_t safi
= SAFI_UNICAST
;
8944 uint64_t subgrp_id
= 0;
8949 if (argv_find (argv
, argc
, "ip", &idx
))
8951 /* [<view|vrf> WORD] */
8952 if (argv_find (argv
, argc
, "view", &idx
) || argv_find (argv
, argc
, "vrf", &idx
))
8953 vrf
= argv
[++idx
]->arg
;
8954 /* ["BGP_AFI_CMD_STR" ["BGP_SAFI_CMD_STR"]] */
8955 if (argv_find_and_parse_afi (argv
, argc
, &idx
, &afi
))
8957 argv_find_and_parse_safi (argv
, argc
, &idx
, &safi
);
8960 /* get subgroup id, if provided */
8962 if (argv
[idx
]->type
== VARIABLE_TKN
)
8963 VTY_GET_ULL("subgroup-id", subgrp_id
, argv
[idx
]->arg
);
8965 return (bgp_show_update_groups(vty
, vrf
, afi
, safi
, subgrp_id
));
8968 DEFUN (show_bgp_instance_all_ipv6_updgrps
,
8969 show_bgp_instance_all_ipv6_updgrps_cmd
,
8970 "show [ip] bgp <view|vrf> all update-groups",
8974 BGP_INSTANCE_ALL_HELP_STR
8975 "Detailed info about dynamic update groups\n")
8977 bgp_show_all_instances_updgrps_vty (vty
, AFI_IP6
, SAFI_UNICAST
);
8981 DEFUN (show_bgp_updgrps_stats
,
8982 show_bgp_updgrps_stats_cmd
,
8983 "show [ip] bgp update-groups statistics",
8987 "Detailed info about dynamic update groups\n"
8992 bgp
= bgp_get_default();
8994 update_group_show_stats(bgp
, vty
);
8999 DEFUN (show_bgp_instance_updgrps_stats
,
9000 show_bgp_instance_updgrps_stats_cmd
,
9001 "show [ip] bgp <view|vrf> WORD update-groups statistics",
9005 BGP_INSTANCE_HELP_STR
9006 "Detailed info about dynamic update groups\n"
9012 bgp
= bgp_lookup_by_name (argv
[idx_word
]->arg
);
9014 update_group_show_stats(bgp
, vty
);
9020 show_bgp_updgrps_adj_info_aux (struct vty
*vty
, const char *name
,
9021 afi_t afi
, safi_t safi
,
9022 const char *what
, uint64_t subgrp_id
)
9027 bgp
= bgp_lookup_by_name (name
);
9029 bgp
= bgp_get_default ();
9033 if (!strcmp(what
, "advertise-queue"))
9034 update_group_show_adj_queue(bgp
, afi
, safi
, vty
, subgrp_id
);
9035 else if (!strcmp(what
, "advertised-routes"))
9036 update_group_show_advertised(bgp
, afi
, safi
, vty
, subgrp_id
);
9037 else if (!strcmp(what
, "packet-queue"))
9038 update_group_show_packet_queue(bgp
, afi
, safi
, vty
, subgrp_id
);
9042 DEFUN (show_ip_bgp_updgrps_adj
,
9043 show_ip_bgp_updgrps_adj_cmd
,
9044 "show [ip] bgp update-groups <advertise-queue|advertised-routes|packet-queue>",
9048 "Detailed info about dynamic update groups\n"
9049 "Advertisement queue\n"
9050 "Announced routes\n"
9055 show_bgp_updgrps_adj_info_aux(vty
, NULL
, AFI_IP
, SAFI_UNICAST
, argv
[idx_type
]->arg
, 0);
9059 DEFUN (show_ip_bgp_instance_updgrps_adj
,
9060 show_ip_bgp_instance_updgrps_adj_cmd
,
9061 "show [ip] bgp <view|vrf> WORD update-groups <advertise-queue|advertised-routes|packet-queue>",
9065 BGP_INSTANCE_HELP_STR
9066 "Detailed info about dynamic update groups\n"
9067 "Advertisement queue\n"
9068 "Announced routes\n"
9074 show_bgp_updgrps_adj_info_aux(vty
, argv
[idx_word
]->arg
, AFI_IP
, SAFI_UNICAST
, argv
[idx_type
]->arg
, 0);
9078 DEFUN (show_bgp_updgrps_afi_adj
,
9079 show_bgp_updgrps_afi_adj_cmd
,
9080 "show [ip] bgp "BGP_AFI_SAFI_CMD_STR
" update-groups <advertise-queue|advertised-routes|packet-queue>",
9084 BGP_AFI_SAFI_HELP_STR
9085 "Detailed info about dynamic update groups\n"
9086 "Advertisement queue\n"
9087 "Announced routes\n"
9089 "Specific subgroup info wanted for\n")
9094 show_bgp_updgrps_adj_info_aux(vty
, NULL
,
9095 bgp_vty_afi_from_arg(argv
[idx_afi
]->arg
),
9096 bgp_vty_safi_from_arg(argv
[idx_safi
]->arg
),
9097 argv
[idx_type
]->arg
, 0);
9101 DEFUN (show_bgp_updgrps_adj
,
9102 show_bgp_updgrps_adj_cmd
,
9103 "show [ip] bgp update-groups <advertise-queue|advertised-routes|packet-queue>",
9107 "Detailed info about dynamic update groups\n"
9108 "Advertisement queue\n"
9109 "Announced routes\n"
9113 show_bgp_updgrps_adj_info_aux(vty
, NULL
, AFI_IP6
, SAFI_UNICAST
, argv
[idx_type
]->arg
, 0);
9117 DEFUN (show_bgp_instance_updgrps_adj
,
9118 show_bgp_instance_updgrps_adj_cmd
,
9119 "show [ip] bgp <view|vrf> WORD update-groups <advertise-queue|advertised-routes|packet-queue>",
9123 BGP_INSTANCE_HELP_STR
9124 "Detailed info about dynamic update groups\n"
9125 "Advertisement queue\n"
9126 "Announced routes\n"
9131 show_bgp_updgrps_adj_info_aux(vty
, argv
[idx_word
]->arg
, AFI_IP6
, SAFI_UNICAST
, argv
[idx_type
]->arg
, 0);
9135 DEFUN (show_ip_bgp_updgrps_adj_s
,
9136 show_ip_bgp_updgrps_adj_s_cmd
,
9137 "show [ip] bgp update-groups SUBGROUP-ID <advertise-queue|advertised-routes|packet-queue>",
9141 "Detailed info about dynamic update groups\n"
9142 "Specific subgroup to display info for\n"
9143 "Advertisement queue\n"
9144 "Announced routes\n"
9148 int idx_subgroup_id
= 4;
9152 VTY_GET_ULL("subgroup-id", subgrp_id
, argv
[idx_subgroup_id
]->arg
);
9154 show_bgp_updgrps_adj_info_aux(vty
, NULL
, AFI_IP
, SAFI_UNICAST
, argv
[idx_type
]->arg
, subgrp_id
);
9158 DEFUN (show_ip_bgp_instance_updgrps_adj_s
,
9159 show_ip_bgp_instance_updgrps_adj_s_cmd
,
9160 "show [ip] bgp <view|vrf> WORD update-groups SUBGROUP-ID <advertise-queue|advertised-routes|packet-queue>",
9164 BGP_INSTANCE_HELP_STR
9165 "Detailed info about dynamic update groups\n"
9166 "Specific subgroup to display info for\n"
9167 "Advertisement queue\n"
9168 "Announced routes\n"
9173 int idx_subgroup_id
= 6;
9177 VTY_GET_ULL("subgroup-id", subgrp_id
, argv
[idx_subgroup_id
]->arg
);
9179 show_bgp_updgrps_adj_info_aux(vty
, argv
[idx_vrf
]->arg
, AFI_IP
, SAFI_UNICAST
, argv
[idx_type
]->arg
, subgrp_id
);
9183 DEFUN (show_bgp_updgrps_afi_adj_s
,
9184 show_bgp_updgrps_afi_adj_s_cmd
,
9185 "show [ip] bgp "BGP_AFI_SAFI_CMD_STR
" update-groups SUBGROUP-ID <advertise-queue|advertised-routes|packet-queue>",
9189 BGP_AFI_SAFI_HELP_STR
9190 "Detailed info about dynamic update groups\n"
9191 "Specific subgroup to display info for\n"
9192 "Advertisement queue\n"
9193 "Announced routes\n"
9195 "Specific subgroup info wanted for\n")
9199 int idx_subgroup_id
= 5;
9203 VTY_GET_ULL("subgroup-id", subgrp_id
, argv
[idx_subgroup_id
]->arg
);
9205 show_bgp_updgrps_adj_info_aux(vty
, NULL
,
9206 bgp_vty_afi_from_arg(argv
[idx_afi
]->arg
),
9207 bgp_vty_safi_from_arg(argv
[idx_safi
]->arg
),
9208 argv
[idx_type
]->arg
, subgrp_id
);
9212 DEFUN (show_bgp_updgrps_adj_s
,
9213 show_bgp_updgrps_adj_s_cmd
,
9214 "show [ip] bgp update-groups SUBGROUP-ID <advertise-queue|advertised-routes|packet-queue>",
9218 "Detailed info about dynamic update groups\n"
9219 "Specific subgroup to display info for\n"
9220 "Advertisement queue\n"
9221 "Announced routes\n"
9224 int idx_subgroup_id
= 3;
9228 VTY_GET_ULL("subgroup-id", subgrp_id
, argv
[idx_subgroup_id
]->arg
);
9230 show_bgp_updgrps_adj_info_aux(vty
, NULL
, AFI_IP6
, SAFI_UNICAST
, argv
[idx_type
]->arg
, subgrp_id
);
9234 DEFUN (show_bgp_instance_updgrps_adj_s
,
9235 show_bgp_instance_updgrps_adj_s_cmd
,
9236 "show [ip] bgp <view|vrf> WORD update-groups SUBGROUP-ID <advertise-queue|advertised-routes|packet-queue>",
9240 BGP_INSTANCE_HELP_STR
9241 "Detailed info about dynamic update groups\n"
9242 "Specific subgroup to display info for\n"
9243 "Advertisement queue\n"
9244 "Announced routes\n"
9248 int idx_subgroup_id
= 5;
9252 VTY_GET_ULL("subgroup-id", subgrp_id
, argv
[idx_subgroup_id
]->arg
);
9254 show_bgp_updgrps_adj_info_aux(vty
, argv
[idx_vrf
]->arg
, AFI_IP6
, SAFI_UNICAST
, argv
[idx_type
]->arg
, subgrp_id
);
9261 bgp_show_one_peer_group (struct vty
*vty
, struct peer_group
*group
)
9263 struct listnode
*node
, *nnode
;
9264 struct prefix
*range
;
9267 char buf
[PREFIX2STR_BUFFER
];
9270 const char *peer_status
;
9278 if (conf
->as_type
== AS_SPECIFIED
||
9279 conf
->as_type
== AS_EXTERNAL
) {
9280 vty_out (vty
, "%sBGP peer-group %s, remote AS %d%s",
9281 VTY_NEWLINE
, group
->name
, conf
->as
, VTY_NEWLINE
);
9282 } else if (conf
->as_type
== AS_INTERNAL
) {
9283 vty_out (vty
, "%sBGP peer-group %s, remote AS %d%s",
9284 VTY_NEWLINE
, group
->name
, group
->bgp
->as
, VTY_NEWLINE
);
9286 vty_out (vty
, "%sBGP peer-group %s%s",
9287 VTY_NEWLINE
, group
->name
, VTY_NEWLINE
);
9290 if ((group
->bgp
->as
== conf
->as
) || (conf
->as_type
== AS_INTERNAL
))
9291 vty_out (vty
, " Peer-group type is internal%s", VTY_NEWLINE
);
9293 vty_out (vty
, " Peer-group type is external%s", VTY_NEWLINE
);
9295 /* Display AFs configured. */
9296 vty_out (vty
, " Configured address-families:");
9297 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
9298 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
9300 if (conf
->afc
[afi
][safi
])
9303 vty_out (vty
, " %s;", afi_safi_print(afi
, safi
));
9307 vty_out (vty
, " none%s", VTY_NEWLINE
);
9309 vty_out (vty
, "%s", VTY_NEWLINE
);
9311 /* Display listen ranges (for dynamic neighbors), if any */
9312 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
9316 else if (afi
== AFI_IP6
)
9320 lr_count
= listcount(group
->listen_range
[afi
]);
9324 " %d %s listen range(s)%s",
9325 lr_count
, af_str
, VTY_NEWLINE
);
9328 for (ALL_LIST_ELEMENTS (group
->listen_range
[afi
], node
,
9331 prefix2str(range
, buf
, sizeof(buf
));
9332 vty_out(vty
, " %s%s", buf
, VTY_NEWLINE
);
9337 /* Display group members and their status */
9338 if (listcount(group
->peer
))
9340 vty_out (vty
, " Peer-group members:%s", VTY_NEWLINE
);
9341 for (ALL_LIST_ELEMENTS (group
->peer
, node
, nnode
, peer
))
9343 if (CHECK_FLAG (peer
->flags
, PEER_FLAG_SHUTDOWN
))
9344 peer_status
= "Idle (Admin)";
9345 else if (CHECK_FLAG (peer
->sflags
, PEER_STATUS_PREFIX_OVERFLOW
))
9346 peer_status
= "Idle (PfxCt)";
9348 peer_status
= LOOKUP(bgp_status_msg
, peer
->status
);
9350 dynamic
= peer_dynamic_neighbor(peer
);
9351 vty_out (vty
, " %s %s %s %s",
9352 peer
->host
, dynamic
? "(dynamic)" : "",
9353 peer_status
, VTY_NEWLINE
);
9360 /* Show BGP peer group's information. */
9361 enum show_group_type
9368 bgp_show_peer_group (struct vty
*vty
, struct bgp
*bgp
,
9369 enum show_group_type type
, const char *group_name
)
9371 struct listnode
*node
, *nnode
;
9372 struct peer_group
*group
;
9375 for (ALL_LIST_ELEMENTS (bgp
->group
, node
, nnode
, group
))
9379 case show_all_groups
:
9380 bgp_show_one_peer_group (vty
, group
);
9382 case show_peer_group
:
9383 if (group_name
&& (strcmp(group
->name
, group_name
) == 0))
9386 bgp_show_one_peer_group (vty
, group
);
9392 if (type
== show_peer_group
&& ! find
)
9393 vty_out (vty
, "%% No such peer-group%s", VTY_NEWLINE
);
9399 bgp_show_peer_group_vty (struct vty
*vty
, const char *name
,
9400 enum show_group_type type
, const char *group_name
)
9403 int ret
= CMD_SUCCESS
;
9406 bgp
= bgp_lookup_by_name (name
);
9408 bgp
= bgp_get_default ();
9412 vty_out (vty
, "%% No such BGP instance exist%s", VTY_NEWLINE
);
9416 ret
= bgp_show_peer_group (vty
, bgp
, type
, group_name
);
9421 DEFUN (show_ip_bgp_peer_groups
,
9422 show_ip_bgp_peer_groups_cmd
,
9423 "show [ip] bgp [<view|vrf> WORD] peer-group [PGNAME]",
9427 BGP_INSTANCE_HELP_STR
9428 "Detailed information on BGP peer groups\n"
9429 "Peer group name\n")
9435 vrf
= argv_find (argv
, argc
, "WORD", &idx
) ? argv
[idx
]->arg
: NULL
;
9436 pg
= argv_find (argv
, argc
, "PGNAME", &idx
) ? argv
[idx
]->arg
: NULL
;
9438 return bgp_show_peer_group_vty (vty
, vrf
, show_all_groups
, pg
);
9442 /* Redistribute VTY commands. */
9444 DEFUN (bgp_redistribute_ipv4
,
9445 bgp_redistribute_ipv4_cmd
,
9446 "redistribute " FRR_IP_REDIST_STR_BGPD
,
9447 "Redistribute information from another routing protocol\n"
9448 FRR_IP_REDIST_HELP_STR_BGPD
)
9450 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
9451 int idx_protocol
= 1;
9454 type
= proto_redistnum (AFI_IP
, argv
[idx_protocol
]->text
);
9457 vty_out (vty
, "%% Invalid route type%s", VTY_NEWLINE
);
9460 bgp_redist_add(bgp
, AFI_IP
, type
, 0);
9461 return bgp_redistribute_set (bgp
, AFI_IP
, type
, 0);
9464 DEFUN (bgp_redistribute_ipv4_rmap
,
9465 bgp_redistribute_ipv4_rmap_cmd
,
9466 "redistribute " FRR_IP_REDIST_STR_BGPD
" route-map WORD",
9467 "Redistribute information from another routing protocol\n"
9468 FRR_IP_REDIST_HELP_STR_BGPD
9469 "Route map reference\n"
9470 "Pointer to route-map entries\n")
9472 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
9473 int idx_protocol
= 1;
9476 struct bgp_redist
*red
;
9478 type
= proto_redistnum (AFI_IP
, argv
[idx_protocol
]->text
);
9481 vty_out (vty
, "%% Invalid route type%s", VTY_NEWLINE
);
9485 red
= bgp_redist_add(bgp
, AFI_IP
, type
, 0);
9486 bgp_redistribute_rmap_set (red
, argv
[idx_word
]->arg
);
9487 return bgp_redistribute_set (bgp
, AFI_IP
, type
, 0);
9490 DEFUN (bgp_redistribute_ipv4_metric
,
9491 bgp_redistribute_ipv4_metric_cmd
,
9492 "redistribute " FRR_IP_REDIST_STR_BGPD
" metric (0-4294967295)",
9493 "Redistribute information from another routing protocol\n"
9494 FRR_IP_REDIST_HELP_STR_BGPD
9495 "Metric for redistributed routes\n"
9498 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
9499 int idx_protocol
= 1;
9503 struct bgp_redist
*red
;
9505 type
= proto_redistnum (AFI_IP
, argv
[idx_protocol
]->text
);
9508 vty_out (vty
, "%% Invalid route type%s", VTY_NEWLINE
);
9511 VTY_GET_INTEGER ("metric", metric
, argv
[idx_number
]->arg
);
9513 red
= bgp_redist_add(bgp
, AFI_IP
, type
, 0);
9514 bgp_redistribute_metric_set(bgp
, red
, AFI_IP
, type
, metric
);
9515 return bgp_redistribute_set (bgp
, AFI_IP
, type
, 0);
9518 DEFUN (bgp_redistribute_ipv4_rmap_metric
,
9519 bgp_redistribute_ipv4_rmap_metric_cmd
,
9520 "redistribute " FRR_IP_REDIST_STR_BGPD
" route-map WORD metric (0-4294967295)",
9521 "Redistribute information from another routing protocol\n"
9522 FRR_IP_REDIST_HELP_STR_BGPD
9523 "Route map reference\n"
9524 "Pointer to route-map entries\n"
9525 "Metric for redistributed routes\n"
9528 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
9529 int idx_protocol
= 1;
9534 struct bgp_redist
*red
;
9536 type
= proto_redistnum (AFI_IP
, argv
[idx_protocol
]->text
);
9539 vty_out (vty
, "%% Invalid route type%s", VTY_NEWLINE
);
9542 VTY_GET_INTEGER ("metric", metric
, argv
[idx_number
]->arg
);
9544 red
= bgp_redist_add(bgp
, AFI_IP
, type
, 0);
9545 bgp_redistribute_rmap_set (red
, argv
[idx_word
]->arg
);
9546 bgp_redistribute_metric_set(bgp
, red
, AFI_IP
, type
, metric
);
9547 return bgp_redistribute_set (bgp
, AFI_IP
, type
, 0);
9550 DEFUN (bgp_redistribute_ipv4_metric_rmap
,
9551 bgp_redistribute_ipv4_metric_rmap_cmd
,
9552 "redistribute " FRR_IP_REDIST_STR_BGPD
" metric (0-4294967295) route-map WORD",
9553 "Redistribute information from another routing protocol\n"
9554 FRR_IP_REDIST_HELP_STR_BGPD
9555 "Metric for redistributed routes\n"
9557 "Route map reference\n"
9558 "Pointer to route-map entries\n")
9560 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
9561 int idx_protocol
= 1;
9566 struct bgp_redist
*red
;
9568 type
= proto_redistnum (AFI_IP
, argv
[idx_protocol
]->text
);
9571 vty_out (vty
, "%% Invalid route type%s", VTY_NEWLINE
);
9574 VTY_GET_INTEGER ("metric", metric
, argv
[idx_number
]->arg
);
9576 red
= bgp_redist_add(bgp
, AFI_IP
, type
, 0);
9577 bgp_redistribute_metric_set(bgp
, red
, AFI_IP
, type
, metric
);
9578 bgp_redistribute_rmap_set (red
, argv
[idx_word
]->arg
);
9579 return bgp_redistribute_set (bgp
, AFI_IP
, type
, 0);
9582 DEFUN (bgp_redistribute_ipv4_ospf
,
9583 bgp_redistribute_ipv4_ospf_cmd
,
9584 "redistribute <ospf|table> (1-65535)",
9585 "Redistribute information from another routing protocol\n"
9586 "Open Shortest Path First (OSPFv2)\n"
9587 "Non-main Kernel Routing Table\n"
9588 "Instance ID/Table ID\n")
9590 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
9591 int idx_ospf_table
= 1;
9596 VTY_GET_INTEGER ("Instance ID", instance
, argv
[idx_number
]->arg
);
9598 if (strncmp(argv
[idx_ospf_table
]->arg
, "o", 1) == 0)
9599 protocol
= ZEBRA_ROUTE_OSPF
;
9601 protocol
= ZEBRA_ROUTE_TABLE
;
9603 bgp_redist_add(bgp
, AFI_IP
, protocol
, instance
);
9604 return bgp_redistribute_set (bgp
, AFI_IP
, protocol
, instance
);
9607 DEFUN (bgp_redistribute_ipv4_ospf_rmap
,
9608 bgp_redistribute_ipv4_ospf_rmap_cmd
,
9609 "redistribute <ospf|table> (1-65535) route-map WORD",
9610 "Redistribute information from another routing protocol\n"
9611 "Open Shortest Path First (OSPFv2)\n"
9612 "Non-main Kernel Routing Table\n"
9613 "Instance ID/Table ID\n"
9614 "Route map reference\n"
9615 "Pointer to route-map entries\n")
9617 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
9618 int idx_ospf_table
= 1;
9621 struct bgp_redist
*red
;
9625 if (strncmp(argv
[idx_ospf_table
]->arg
, "o", 1) == 0)
9626 protocol
= ZEBRA_ROUTE_OSPF
;
9628 protocol
= ZEBRA_ROUTE_TABLE
;
9630 VTY_GET_INTEGER ("Instance ID", instance
, argv
[idx_number
]->arg
);
9631 red
= bgp_redist_add(bgp
, AFI_IP
, protocol
, instance
);
9632 bgp_redistribute_rmap_set (red
, argv
[idx_word
]->arg
);
9633 return bgp_redistribute_set (bgp
, AFI_IP
, protocol
, instance
);
9636 DEFUN (bgp_redistribute_ipv4_ospf_metric
,
9637 bgp_redistribute_ipv4_ospf_metric_cmd
,
9638 "redistribute <ospf|table> (1-65535) metric (0-4294967295)",
9639 "Redistribute information from another routing protocol\n"
9640 "Open Shortest Path First (OSPFv2)\n"
9641 "Non-main Kernel Routing Table\n"
9642 "Instance ID/Table ID\n"
9643 "Metric for redistributed routes\n"
9646 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
9647 int idx_ospf_table
= 1;
9649 int idx_number_2
= 4;
9651 struct bgp_redist
*red
;
9655 if (strncmp(argv
[idx_ospf_table
]->arg
, "o", 1) == 0)
9656 protocol
= ZEBRA_ROUTE_OSPF
;
9658 protocol
= ZEBRA_ROUTE_TABLE
;
9660 VTY_GET_INTEGER ("Instance ID", instance
, argv
[idx_number
]->arg
);
9661 VTY_GET_INTEGER ("metric", metric
, argv
[idx_number_2
]->arg
);
9663 red
= bgp_redist_add(bgp
, AFI_IP
, protocol
, instance
);
9664 bgp_redistribute_metric_set(bgp
, red
, AFI_IP
, protocol
, metric
);
9665 return bgp_redistribute_set (bgp
, AFI_IP
, protocol
, instance
);
9668 DEFUN (bgp_redistribute_ipv4_ospf_rmap_metric
,
9669 bgp_redistribute_ipv4_ospf_rmap_metric_cmd
,
9670 "redistribute <ospf|table> (1-65535) route-map WORD metric (0-4294967295)",
9671 "Redistribute information from another routing protocol\n"
9672 "Open Shortest Path First (OSPFv2)\n"
9673 "Non-main Kernel Routing Table\n"
9674 "Instance ID/Table ID\n"
9675 "Route map reference\n"
9676 "Pointer to route-map entries\n"
9677 "Metric for redistributed routes\n"
9680 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
9681 int idx_ospf_table
= 1;
9684 int idx_number_2
= 6;
9686 struct bgp_redist
*red
;
9690 if (strncmp(argv
[idx_ospf_table
]->arg
, "o", 1) == 0)
9691 protocol
= ZEBRA_ROUTE_OSPF
;
9693 protocol
= ZEBRA_ROUTE_TABLE
;
9695 VTY_GET_INTEGER ("Instance ID", instance
, argv
[idx_number
]->arg
);
9696 VTY_GET_INTEGER ("metric", metric
, argv
[idx_number_2
]->arg
);
9698 red
= bgp_redist_add(bgp
, AFI_IP
, protocol
, instance
);
9699 bgp_redistribute_rmap_set (red
, argv
[idx_word
]->arg
);
9700 bgp_redistribute_metric_set(bgp
, red
, AFI_IP
, protocol
, metric
);
9701 return bgp_redistribute_set (bgp
, AFI_IP
, protocol
, instance
);
9704 DEFUN (bgp_redistribute_ipv4_ospf_metric_rmap
,
9705 bgp_redistribute_ipv4_ospf_metric_rmap_cmd
,
9706 "redistribute <ospf|table> (1-65535) metric (0-4294967295) route-map WORD",
9707 "Redistribute information from another routing protocol\n"
9708 "Open Shortest Path First (OSPFv2)\n"
9709 "Non-main Kernel Routing Table\n"
9710 "Instance ID/Table ID\n"
9711 "Metric for redistributed routes\n"
9713 "Route map reference\n"
9714 "Pointer to route-map entries\n")
9716 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
9717 int idx_ospf_table
= 1;
9719 int idx_number_2
= 4;
9722 struct bgp_redist
*red
;
9726 if (strncmp(argv
[idx_ospf_table
]->arg
, "o", 1) == 0)
9727 protocol
= ZEBRA_ROUTE_OSPF
;
9729 protocol
= ZEBRA_ROUTE_TABLE
;
9731 VTY_GET_INTEGER ("Instance ID", instance
, argv
[idx_number
]->arg
);
9732 VTY_GET_INTEGER ("metric", metric
, argv
[idx_number_2
]->arg
);
9734 red
= bgp_redist_add(bgp
, AFI_IP
, protocol
, instance
);
9735 bgp_redistribute_metric_set(bgp
, red
, AFI_IP
, protocol
, metric
);
9736 bgp_redistribute_rmap_set (red
, argv
[idx_word
]->arg
);
9737 return bgp_redistribute_set (bgp
, AFI_IP
, protocol
, instance
);
9740 DEFUN (no_bgp_redistribute_ipv4_ospf
,
9741 no_bgp_redistribute_ipv4_ospf_cmd
,
9742 "no redistribute <ospf|table> (1-65535) [metric (0-4294967295)] [route-map WORD]",
9744 "Redistribute information from another routing protocol\n"
9745 "Open Shortest Path First (OSPFv2)\n"
9746 "Non-main Kernel Routing Table\n"
9747 "Instance ID/Table ID\n"
9748 "Metric for redistributed routes\n"
9750 "Route map reference\n"
9751 "Pointer to route-map entries\n")
9753 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
9754 int idx_ospf_table
= 2;
9759 if (strncmp(argv
[idx_ospf_table
]->arg
, "o", 1) == 0)
9760 protocol
= ZEBRA_ROUTE_OSPF
;
9762 protocol
= ZEBRA_ROUTE_TABLE
;
9764 VTY_GET_INTEGER ("Instance ID", instance
, argv
[idx_number
]->arg
);
9765 return bgp_redistribute_unset (bgp
, AFI_IP
, protocol
, instance
);
9768 DEFUN (no_bgp_redistribute_ipv4
,
9769 no_bgp_redistribute_ipv4_cmd
,
9770 "no redistribute " FRR_IP_REDIST_STR_BGPD
" [metric (0-4294967295)] [route-map WORD]",
9772 "Redistribute information from another routing protocol\n"
9773 FRR_IP_REDIST_HELP_STR_BGPD
9774 "Metric for redistributed routes\n"
9776 "Route map reference\n"
9777 "Pointer to route-map entries\n")
9779 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
9780 int idx_protocol
= 2;
9783 type
= proto_redistnum (AFI_IP
, argv
[idx_protocol
]->text
);
9786 vty_out (vty
, "%% Invalid route type%s", VTY_NEWLINE
);
9789 return bgp_redistribute_unset (bgp
, AFI_IP
, type
, 0);
9792 DEFUN (bgp_redistribute_ipv6
,
9793 bgp_redistribute_ipv6_cmd
,
9794 "redistribute " FRR_IP6_REDIST_STR_BGPD
,
9795 "Redistribute information from another routing protocol\n"
9796 FRR_IP6_REDIST_HELP_STR_BGPD
)
9798 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
9799 int idx_protocol
= 1;
9802 type
= proto_redistnum (AFI_IP6
, argv
[idx_protocol
]->text
);
9805 vty_out (vty
, "%% Invalid route type%s", VTY_NEWLINE
);
9809 bgp_redist_add(bgp
, AFI_IP6
, type
, 0);
9810 return bgp_redistribute_set (bgp
, AFI_IP6
, type
, 0);
9813 DEFUN (bgp_redistribute_ipv6_rmap
,
9814 bgp_redistribute_ipv6_rmap_cmd
,
9815 "redistribute " FRR_IP6_REDIST_STR_BGPD
" route-map WORD",
9816 "Redistribute information from another routing protocol\n"
9817 FRR_IP6_REDIST_HELP_STR_BGPD
9818 "Route map reference\n"
9819 "Pointer to route-map entries\n")
9821 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
9822 int idx_protocol
= 1;
9825 struct bgp_redist
*red
;
9827 type
= proto_redistnum (AFI_IP6
, argv
[idx_protocol
]->text
);
9830 vty_out (vty
, "%% Invalid route type%s", VTY_NEWLINE
);
9834 red
= bgp_redist_add(bgp
, AFI_IP6
, type
, 0);
9835 bgp_redistribute_rmap_set (red
, argv
[idx_word
]->arg
);
9836 return bgp_redistribute_set (bgp
, AFI_IP6
, type
, 0);
9839 DEFUN (bgp_redistribute_ipv6_metric
,
9840 bgp_redistribute_ipv6_metric_cmd
,
9841 "redistribute " FRR_IP6_REDIST_STR_BGPD
" metric (0-4294967295)",
9842 "Redistribute information from another routing protocol\n"
9843 FRR_IP6_REDIST_HELP_STR_BGPD
9844 "Metric for redistributed routes\n"
9847 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
9848 int idx_protocol
= 1;
9852 struct bgp_redist
*red
;
9854 type
= proto_redistnum (AFI_IP6
, argv
[idx_protocol
]->text
);
9857 vty_out (vty
, "%% Invalid route type%s", VTY_NEWLINE
);
9860 VTY_GET_INTEGER ("metric", metric
, argv
[idx_number
]->arg
);
9862 red
= bgp_redist_add(bgp
, AFI_IP6
, type
, 0);
9863 bgp_redistribute_metric_set(bgp
, red
, AFI_IP6
, type
, metric
);
9864 return bgp_redistribute_set (bgp
, AFI_IP6
, type
, 0);
9867 DEFUN (bgp_redistribute_ipv6_rmap_metric
,
9868 bgp_redistribute_ipv6_rmap_metric_cmd
,
9869 "redistribute " FRR_IP6_REDIST_STR_BGPD
" route-map WORD metric (0-4294967295)",
9870 "Redistribute information from another routing protocol\n"
9871 FRR_IP6_REDIST_HELP_STR_BGPD
9872 "Route map reference\n"
9873 "Pointer to route-map entries\n"
9874 "Metric for redistributed routes\n"
9877 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
9878 int idx_protocol
= 1;
9883 struct bgp_redist
*red
;
9885 type
= proto_redistnum (AFI_IP6
, argv
[idx_protocol
]->text
);
9888 vty_out (vty
, "%% Invalid route type%s", VTY_NEWLINE
);
9891 VTY_GET_INTEGER ("metric", metric
, argv
[idx_number
]->arg
);
9893 red
= bgp_redist_add(bgp
, AFI_IP6
, type
, 0);
9894 bgp_redistribute_rmap_set (red
, argv
[idx_word
]->arg
);
9895 bgp_redistribute_metric_set(bgp
, red
, AFI_IP6
, type
, metric
);
9896 return bgp_redistribute_set (bgp
, AFI_IP6
, type
, 0);
9899 DEFUN (bgp_redistribute_ipv6_metric_rmap
,
9900 bgp_redistribute_ipv6_metric_rmap_cmd
,
9901 "redistribute " FRR_IP6_REDIST_STR_BGPD
" metric (0-4294967295) route-map WORD",
9902 "Redistribute information from another routing protocol\n"
9903 FRR_IP6_REDIST_HELP_STR_BGPD
9904 "Metric for redistributed routes\n"
9906 "Route map reference\n"
9907 "Pointer to route-map entries\n")
9909 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
9910 int idx_protocol
= 1;
9915 struct bgp_redist
*red
;
9917 type
= proto_redistnum (AFI_IP6
, argv
[idx_protocol
]->text
);
9920 vty_out (vty
, "%% Invalid route type%s", VTY_NEWLINE
);
9923 VTY_GET_INTEGER ("metric", metric
, argv
[idx_number
]->arg
);
9925 red
= bgp_redist_add(bgp
, AFI_IP6
, type
, 0);
9926 bgp_redistribute_metric_set(bgp
, red
, AFI_IP6
, SAFI_UNICAST
, metric
);
9927 bgp_redistribute_rmap_set (red
, argv
[idx_word
]->arg
);
9928 return bgp_redistribute_set (bgp
, AFI_IP6
, type
, 0);
9931 DEFUN (no_bgp_redistribute_ipv6
,
9932 no_bgp_redistribute_ipv6_cmd
,
9933 "no redistribute " FRR_IP6_REDIST_STR_BGPD
" [metric (0-4294967295)] [route-map WORD]",
9935 "Redistribute information from another routing protocol\n"
9936 FRR_IP6_REDIST_HELP_STR_BGPD
9937 "Metric for redistributed routes\n"
9939 "Route map reference\n"
9940 "Pointer to route-map entries\n")
9942 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
9943 int idx_protocol
= 2;
9946 type
= proto_redistnum (AFI_IP6
, argv
[idx_protocol
]->text
);
9949 vty_out (vty
, "%% Invalid route type%s", VTY_NEWLINE
);
9953 return bgp_redistribute_unset (bgp
, AFI_IP6
, type
, 0);
9957 bgp_config_write_redistribute (struct vty
*vty
, struct bgp
*bgp
, afi_t afi
,
9958 safi_t safi
, int *write
)
9962 /* Unicast redistribution only. */
9963 if (safi
!= SAFI_UNICAST
)
9966 for (i
= 0; i
< ZEBRA_ROUTE_MAX
; i
++)
9968 /* Redistribute BGP does not make sense. */
9969 if (i
!= ZEBRA_ROUTE_BGP
)
9971 struct list
*red_list
;
9972 struct listnode
*node
;
9973 struct bgp_redist
*red
;
9975 red_list
= bgp
->redist
[afi
][i
];
9979 for (ALL_LIST_ELEMENTS_RO(red_list
, node
, red
))
9981 /* Display "address-family" when it is not yet diplayed. */
9982 bgp_config_write_family_header (vty
, afi
, safi
, write
);
9984 /* "redistribute" configuration. */
9985 vty_out (vty
, " redistribute %s", zebra_route_string(i
));
9987 vty_out (vty
, " %d", red
->instance
);
9988 if (red
->redist_metric_flag
)
9989 vty_out (vty
, " metric %u", red
->redist_metric
);
9991 vty_out (vty
, " route-map %s", red
->rmap
.name
);
9992 vty_out (vty
, "%s", VTY_NEWLINE
);
9999 /* BGP node structure. */
10000 static struct cmd_node bgp_node
=
10003 "%s(config-router)# ",
10007 static struct cmd_node bgp_ipv4_unicast_node
=
10010 "%s(config-router-af)# ",
10014 static struct cmd_node bgp_ipv4_multicast_node
=
10017 "%s(config-router-af)# ",
10021 static struct cmd_node bgp_ipv6_unicast_node
=
10024 "%s(config-router-af)# ",
10028 static struct cmd_node bgp_ipv6_multicast_node
=
10031 "%s(config-router-af)# ",
10035 static struct cmd_node bgp_vpnv4_node
=
10038 "%s(config-router-af)# ",
10042 static struct cmd_node bgp_vpnv6_node
=
10045 "%s(config-router-af-vpnv6)# ",
10049 static struct cmd_node bgp_encap_node
=
10052 "%s(config-router-af-encap)# ",
10056 static struct cmd_node bgp_encapv6_node
=
10059 "%s(config-router-af-encapv6)# ",
10063 static struct cmd_node bgp_evpn_node
=
10066 "%s(config-router-evpn)# ",
10070 static void community_list_vty (void);
10073 bgp_vty_init (void)
10075 /* Install bgp top node. */
10076 install_node (&bgp_node
, bgp_config_write
);
10077 install_node (&bgp_ipv4_unicast_node
, NULL
);
10078 install_node (&bgp_ipv4_multicast_node
, NULL
);
10079 install_node (&bgp_ipv6_unicast_node
, NULL
);
10080 install_node (&bgp_ipv6_multicast_node
, NULL
);
10081 install_node (&bgp_vpnv4_node
, NULL
);
10082 install_node (&bgp_vpnv6_node
, NULL
);
10083 install_node (&bgp_encap_node
, NULL
);
10084 install_node (&bgp_encapv6_node
, NULL
);
10085 install_node (&bgp_evpn_node
, NULL
);
10087 /* Install default VTY commands to new nodes. */
10088 install_default (BGP_NODE
);
10089 install_default (BGP_IPV4_NODE
);
10090 install_default (BGP_IPV4M_NODE
);
10091 install_default (BGP_IPV6_NODE
);
10092 install_default (BGP_IPV6M_NODE
);
10093 install_default (BGP_VPNV4_NODE
);
10094 install_default (BGP_VPNV6_NODE
);
10095 install_default (BGP_ENCAP_NODE
);
10096 install_default (BGP_ENCAPV6_NODE
);
10097 install_default (BGP_EVPN_NODE
);
10099 /* "bgp multiple-instance" commands. */
10100 install_element (CONFIG_NODE
, &bgp_multiple_instance_cmd
);
10101 install_element (CONFIG_NODE
, &no_bgp_multiple_instance_cmd
);
10103 /* "bgp config-type" commands. */
10104 install_element (CONFIG_NODE
, &bgp_config_type_cmd
);
10105 install_element (CONFIG_NODE
, &no_bgp_config_type_cmd
);
10107 /* bgp route-map delay-timer commands. */
10108 install_element (CONFIG_NODE
, &bgp_set_route_map_delay_timer_cmd
);
10109 install_element (CONFIG_NODE
, &no_bgp_set_route_map_delay_timer_cmd
);
10111 /* Dummy commands (Currently not supported) */
10112 install_element (BGP_NODE
, &no_synchronization_cmd
);
10113 install_element (BGP_NODE
, &no_auto_summary_cmd
);
10115 /* "router bgp" commands. */
10116 install_element (CONFIG_NODE
, &router_bgp_cmd
);
10118 /* "no router bgp" commands. */
10119 install_element (CONFIG_NODE
, &no_router_bgp_cmd
);
10121 /* "bgp router-id" commands. */
10122 install_element (BGP_NODE
, &bgp_router_id_cmd
);
10123 install_element (BGP_NODE
, &no_bgp_router_id_cmd
);
10125 /* "bgp cluster-id" commands. */
10126 install_element (BGP_NODE
, &bgp_cluster_id_cmd
);
10127 install_element (BGP_NODE
, &no_bgp_cluster_id_cmd
);
10129 /* "bgp confederation" commands. */
10130 install_element (BGP_NODE
, &bgp_confederation_identifier_cmd
);
10131 install_element (BGP_NODE
, &no_bgp_confederation_identifier_cmd
);
10133 /* "bgp confederation peers" commands. */
10134 install_element (BGP_NODE
, &bgp_confederation_peers_cmd
);
10135 install_element (BGP_NODE
, &no_bgp_confederation_peers_cmd
);
10137 /* bgp max-med command */
10138 install_element (BGP_NODE
, &bgp_maxmed_admin_cmd
);
10139 install_element (BGP_NODE
, &no_bgp_maxmed_admin_cmd
);
10140 install_element (BGP_NODE
, &bgp_maxmed_admin_medv_cmd
);
10141 install_element (BGP_NODE
, &bgp_maxmed_onstartup_cmd
);
10142 install_element (BGP_NODE
, &no_bgp_maxmed_onstartup_cmd
);
10143 install_element (BGP_NODE
, &bgp_maxmed_onstartup_medv_cmd
);
10145 /* bgp disable-ebgp-connected-nh-check */
10146 install_element (BGP_NODE
, &bgp_disable_connected_route_check_cmd
);
10147 install_element (BGP_NODE
, &no_bgp_disable_connected_route_check_cmd
);
10149 /* bgp update-delay command */
10150 install_element (BGP_NODE
, &bgp_update_delay_cmd
);
10151 install_element (BGP_NODE
, &no_bgp_update_delay_cmd
);
10152 install_element (BGP_NODE
, &bgp_update_delay_establish_wait_cmd
);
10154 install_element (BGP_NODE
, &bgp_wpkt_quanta_cmd
);
10155 install_element (BGP_NODE
, &no_bgp_wpkt_quanta_cmd
);
10157 install_element (BGP_NODE
, &bgp_coalesce_time_cmd
);
10158 install_element (BGP_NODE
, &no_bgp_coalesce_time_cmd
);
10160 /* "maximum-paths" commands. */
10161 install_element (BGP_NODE
, &bgp_maxpaths_cmd
);
10162 install_element (BGP_NODE
, &no_bgp_maxpaths_cmd
);
10163 install_element (BGP_IPV4_NODE
, &bgp_maxpaths_cmd
);
10164 install_element (BGP_IPV4_NODE
, &no_bgp_maxpaths_cmd
);
10165 install_element (BGP_IPV6_NODE
, &bgp_maxpaths_cmd
);
10166 install_element (BGP_IPV6_NODE
, &no_bgp_maxpaths_cmd
);
10167 install_element (BGP_NODE
, &bgp_maxpaths_ibgp_cmd
);
10168 install_element(BGP_NODE
, &bgp_maxpaths_ibgp_cluster_cmd
);
10169 install_element (BGP_NODE
, &no_bgp_maxpaths_ibgp_cmd
);
10170 install_element (BGP_IPV4_NODE
, &bgp_maxpaths_ibgp_cmd
);
10171 install_element(BGP_IPV4_NODE
, &bgp_maxpaths_ibgp_cluster_cmd
);
10172 install_element (BGP_IPV4_NODE
, &no_bgp_maxpaths_ibgp_cmd
);
10173 install_element (BGP_IPV6_NODE
, &bgp_maxpaths_ibgp_cmd
);
10174 install_element(BGP_IPV6_NODE
, &bgp_maxpaths_ibgp_cluster_cmd
);
10175 install_element (BGP_IPV6_NODE
, &no_bgp_maxpaths_ibgp_cmd
);
10177 /* "timers bgp" commands. */
10178 install_element (BGP_NODE
, &bgp_timers_cmd
);
10179 install_element (BGP_NODE
, &no_bgp_timers_cmd
);
10181 /* route-map delay-timer commands - per instance for backwards compat. */
10182 install_element (BGP_NODE
, &bgp_set_route_map_delay_timer_cmd
);
10183 install_element (BGP_NODE
, &no_bgp_set_route_map_delay_timer_cmd
);
10185 /* "bgp client-to-client reflection" commands */
10186 install_element (BGP_NODE
, &no_bgp_client_to_client_reflection_cmd
);
10187 install_element (BGP_NODE
, &bgp_client_to_client_reflection_cmd
);
10189 /* "bgp always-compare-med" commands */
10190 install_element (BGP_NODE
, &bgp_always_compare_med_cmd
);
10191 install_element (BGP_NODE
, &no_bgp_always_compare_med_cmd
);
10193 /* "bgp deterministic-med" commands */
10194 install_element (BGP_NODE
, &bgp_deterministic_med_cmd
);
10195 install_element (BGP_NODE
, &no_bgp_deterministic_med_cmd
);
10197 /* "bgp graceful-restart" commands */
10198 install_element (BGP_NODE
, &bgp_graceful_restart_cmd
);
10199 install_element (BGP_NODE
, &no_bgp_graceful_restart_cmd
);
10200 install_element (BGP_NODE
, &bgp_graceful_restart_stalepath_time_cmd
);
10201 install_element (BGP_NODE
, &no_bgp_graceful_restart_stalepath_time_cmd
);
10202 install_element (BGP_NODE
, &bgp_graceful_restart_restart_time_cmd
);
10203 install_element (BGP_NODE
, &no_bgp_graceful_restart_restart_time_cmd
);
10205 install_element (BGP_NODE
, &bgp_graceful_restart_preserve_fw_cmd
);
10206 install_element (BGP_NODE
, &no_bgp_graceful_restart_preserve_fw_cmd
);
10208 /* "bgp fast-external-failover" commands */
10209 install_element (BGP_NODE
, &bgp_fast_external_failover_cmd
);
10210 install_element (BGP_NODE
, &no_bgp_fast_external_failover_cmd
);
10212 /* "bgp enforce-first-as" commands */
10213 install_element (BGP_NODE
, &bgp_enforce_first_as_cmd
);
10214 install_element (BGP_NODE
, &no_bgp_enforce_first_as_cmd
);
10216 /* "bgp bestpath compare-routerid" commands */
10217 install_element (BGP_NODE
, &bgp_bestpath_compare_router_id_cmd
);
10218 install_element (BGP_NODE
, &no_bgp_bestpath_compare_router_id_cmd
);
10220 /* "bgp bestpath as-path ignore" commands */
10221 install_element (BGP_NODE
, &bgp_bestpath_aspath_ignore_cmd
);
10222 install_element (BGP_NODE
, &no_bgp_bestpath_aspath_ignore_cmd
);
10224 /* "bgp bestpath as-path confed" commands */
10225 install_element (BGP_NODE
, &bgp_bestpath_aspath_confed_cmd
);
10226 install_element (BGP_NODE
, &no_bgp_bestpath_aspath_confed_cmd
);
10228 /* "bgp bestpath as-path multipath-relax" commands */
10229 install_element (BGP_NODE
, &bgp_bestpath_aspath_multipath_relax_cmd
);
10230 install_element (BGP_NODE
, &no_bgp_bestpath_aspath_multipath_relax_cmd
);
10232 /* "bgp log-neighbor-changes" commands */
10233 install_element (BGP_NODE
, &bgp_log_neighbor_changes_cmd
);
10234 install_element (BGP_NODE
, &no_bgp_log_neighbor_changes_cmd
);
10236 /* "bgp bestpath med" commands */
10237 install_element (BGP_NODE
, &bgp_bestpath_med_cmd
);
10238 install_element (BGP_NODE
, &no_bgp_bestpath_med_cmd
);
10240 /* "no bgp default ipv4-unicast" commands. */
10241 install_element (BGP_NODE
, &no_bgp_default_ipv4_unicast_cmd
);
10242 install_element (BGP_NODE
, &bgp_default_ipv4_unicast_cmd
);
10244 /* "bgp network import-check" commands. */
10245 install_element (BGP_NODE
, &bgp_network_import_check_cmd
);
10246 install_element (BGP_NODE
, &bgp_network_import_check_exact_cmd
);
10247 install_element (BGP_NODE
, &no_bgp_network_import_check_cmd
);
10249 /* "bgp default local-preference" commands. */
10250 install_element (BGP_NODE
, &bgp_default_local_preference_cmd
);
10251 install_element (BGP_NODE
, &no_bgp_default_local_preference_cmd
);
10253 /* bgp default show-hostname */
10254 install_element (BGP_NODE
, &bgp_default_show_hostname_cmd
);
10255 install_element (BGP_NODE
, &no_bgp_default_show_hostname_cmd
);
10257 /* "bgp default subgroup-pkt-queue-max" commands. */
10258 install_element (BGP_NODE
, &bgp_default_subgroup_pkt_queue_max_cmd
);
10259 install_element (BGP_NODE
, &no_bgp_default_subgroup_pkt_queue_max_cmd
);
10261 /* bgp ibgp-allow-policy-mods command */
10262 install_element (BGP_NODE
, &bgp_rr_allow_outbound_policy_cmd
);
10263 install_element (BGP_NODE
, &no_bgp_rr_allow_outbound_policy_cmd
);
10265 /* "bgp listen limit" commands. */
10266 install_element (BGP_NODE
, &bgp_listen_limit_cmd
);
10267 install_element (BGP_NODE
, &no_bgp_listen_limit_cmd
);
10269 /* "bgp listen range" commands. */
10270 install_element (BGP_NODE
, &bgp_listen_range_cmd
);
10271 install_element (BGP_NODE
, &no_bgp_listen_range_cmd
);
10273 /* "neighbor remote-as" commands. */
10274 install_element (BGP_NODE
, &neighbor_remote_as_cmd
);
10275 install_element (BGP_NODE
, &neighbor_interface_config_cmd
);
10276 install_element (BGP_NODE
, &neighbor_interface_config_v6only_cmd
);
10277 install_element (BGP_NODE
, &neighbor_interface_config_remote_as_cmd
);
10278 install_element (BGP_NODE
, &neighbor_interface_v6only_config_remote_as_cmd
);
10279 install_element (BGP_NODE
, &no_neighbor_cmd
);
10280 install_element (BGP_NODE
, &no_neighbor_interface_config_cmd
);
10282 /* "neighbor peer-group" commands. */
10283 install_element (BGP_NODE
, &neighbor_peer_group_cmd
);
10284 install_element (BGP_NODE
, &no_neighbor_peer_group_cmd
);
10285 install_element (BGP_NODE
, &no_neighbor_interface_peer_group_remote_as_cmd
);
10287 /* "neighbor local-as" commands. */
10288 install_element (BGP_NODE
, &neighbor_local_as_cmd
);
10289 install_element (BGP_NODE
, &neighbor_local_as_no_prepend_cmd
);
10290 install_element (BGP_NODE
, &neighbor_local_as_no_prepend_replace_as_cmd
);
10291 install_element (BGP_NODE
, &no_neighbor_local_as_cmd
);
10293 /* "neighbor solo" commands. */
10294 install_element (BGP_NODE
, &neighbor_solo_cmd
);
10295 install_element (BGP_NODE
, &no_neighbor_solo_cmd
);
10297 /* "neighbor password" commands. */
10298 install_element (BGP_NODE
, &neighbor_password_cmd
);
10299 install_element (BGP_NODE
, &no_neighbor_password_cmd
);
10301 /* "neighbor activate" commands. */
10302 install_element (BGP_NODE
, &neighbor_activate_cmd
);
10303 install_element (BGP_IPV4_NODE
, &neighbor_activate_cmd
);
10304 install_element (BGP_IPV4M_NODE
, &neighbor_activate_cmd
);
10305 install_element (BGP_IPV6_NODE
, &neighbor_activate_cmd
);
10306 install_element (BGP_IPV6M_NODE
, &neighbor_activate_cmd
);
10307 install_element (BGP_VPNV4_NODE
, &neighbor_activate_cmd
);
10308 install_element (BGP_VPNV6_NODE
, &neighbor_activate_cmd
);
10309 install_element (BGP_ENCAP_NODE
, &neighbor_activate_cmd
);
10310 install_element (BGP_ENCAPV6_NODE
, &neighbor_activate_cmd
);
10311 install_element (BGP_EVPN_NODE
, &neighbor_activate_cmd
);
10313 /* "no neighbor activate" commands. */
10314 install_element (BGP_NODE
, &no_neighbor_activate_cmd
);
10315 install_element (BGP_IPV4_NODE
, &no_neighbor_activate_cmd
);
10316 install_element (BGP_IPV4M_NODE
, &no_neighbor_activate_cmd
);
10317 install_element (BGP_IPV6_NODE
, &no_neighbor_activate_cmd
);
10318 install_element (BGP_IPV6M_NODE
, &no_neighbor_activate_cmd
);
10319 install_element (BGP_VPNV4_NODE
, &no_neighbor_activate_cmd
);
10320 install_element (BGP_VPNV6_NODE
, &no_neighbor_activate_cmd
);
10321 install_element (BGP_ENCAP_NODE
, &no_neighbor_activate_cmd
);
10322 install_element (BGP_ENCAPV6_NODE
, &no_neighbor_activate_cmd
);
10323 install_element (BGP_EVPN_NODE
, &no_neighbor_activate_cmd
);
10325 /* "neighbor peer-group" set commands.
10326 * Long term we should only accept this command under BGP_NODE and not all of
10327 * the afi/safi sub-contexts. For now though we need to accept it for backwards
10328 * compatibility. This changed when we stopped requiring that peers be assigned
10329 * to their peer-group under each address-family sub-context.
10331 install_element (BGP_NODE
, &neighbor_set_peer_group_cmd
);
10332 install_element (BGP_IPV4_NODE
, &neighbor_set_peer_group_cmd
);
10333 install_element (BGP_IPV4M_NODE
, &neighbor_set_peer_group_cmd
);
10334 install_element (BGP_IPV6_NODE
, &neighbor_set_peer_group_cmd
);
10335 install_element (BGP_IPV6M_NODE
, &neighbor_set_peer_group_cmd
);
10336 install_element (BGP_VPNV4_NODE
, &neighbor_set_peer_group_cmd
);
10337 install_element (BGP_VPNV6_NODE
, &neighbor_set_peer_group_cmd
);
10338 install_element (BGP_ENCAP_NODE
, &neighbor_set_peer_group_cmd
);
10339 install_element (BGP_ENCAPV6_NODE
, &neighbor_set_peer_group_cmd
);
10341 /* "no neighbor peer-group unset" commands. */
10342 install_element (BGP_NODE
, &no_neighbor_set_peer_group_cmd
);
10343 install_element (BGP_IPV4_NODE
, &no_neighbor_set_peer_group_cmd
);
10344 install_element (BGP_IPV4M_NODE
, &no_neighbor_set_peer_group_cmd
);
10345 install_element (BGP_IPV6_NODE
, &no_neighbor_set_peer_group_cmd
);
10346 install_element (BGP_IPV6M_NODE
, &no_neighbor_set_peer_group_cmd
);
10347 install_element (BGP_VPNV4_NODE
, &no_neighbor_set_peer_group_cmd
);
10348 install_element (BGP_VPNV6_NODE
, &no_neighbor_set_peer_group_cmd
);
10349 install_element (BGP_ENCAP_NODE
, &no_neighbor_set_peer_group_cmd
);
10350 install_element (BGP_ENCAPV6_NODE
, &no_neighbor_set_peer_group_cmd
);
10352 /* "neighbor softreconfiguration inbound" commands.*/
10353 install_element (BGP_NODE
, &neighbor_soft_reconfiguration_cmd
);
10354 install_element (BGP_NODE
, &no_neighbor_soft_reconfiguration_cmd
);
10355 install_element (BGP_IPV4_NODE
, &neighbor_soft_reconfiguration_cmd
);
10356 install_element (BGP_IPV4_NODE
, &no_neighbor_soft_reconfiguration_cmd
);
10357 install_element (BGP_IPV4M_NODE
, &neighbor_soft_reconfiguration_cmd
);
10358 install_element (BGP_IPV4M_NODE
, &no_neighbor_soft_reconfiguration_cmd
);
10359 install_element (BGP_IPV6_NODE
, &neighbor_soft_reconfiguration_cmd
);
10360 install_element (BGP_IPV6_NODE
, &no_neighbor_soft_reconfiguration_cmd
);
10361 install_element (BGP_IPV6M_NODE
, &neighbor_soft_reconfiguration_cmd
);
10362 install_element (BGP_IPV6M_NODE
, &no_neighbor_soft_reconfiguration_cmd
);
10363 install_element (BGP_VPNV4_NODE
, &neighbor_soft_reconfiguration_cmd
);
10364 install_element (BGP_VPNV4_NODE
, &no_neighbor_soft_reconfiguration_cmd
);
10365 install_element (BGP_VPNV6_NODE
, &neighbor_soft_reconfiguration_cmd
);
10366 install_element (BGP_VPNV6_NODE
, &no_neighbor_soft_reconfiguration_cmd
);
10367 install_element (BGP_ENCAP_NODE
, &neighbor_soft_reconfiguration_cmd
);
10368 install_element (BGP_ENCAP_NODE
, &no_neighbor_soft_reconfiguration_cmd
);
10369 install_element (BGP_ENCAPV6_NODE
, &neighbor_soft_reconfiguration_cmd
);
10370 install_element (BGP_ENCAPV6_NODE
, &no_neighbor_soft_reconfiguration_cmd
);
10372 /* "neighbor attribute-unchanged" commands. */
10373 install_element (BGP_NODE
, &neighbor_attr_unchanged_cmd
);
10374 install_element (BGP_NODE
, &no_neighbor_attr_unchanged_cmd
);
10375 install_element (BGP_IPV4_NODE
, &neighbor_attr_unchanged_cmd
);
10376 install_element (BGP_IPV4_NODE
, &no_neighbor_attr_unchanged_cmd
);
10377 install_element (BGP_IPV4M_NODE
, &neighbor_attr_unchanged_cmd
);
10378 install_element (BGP_IPV4M_NODE
, &no_neighbor_attr_unchanged_cmd
);
10379 install_element (BGP_IPV6_NODE
, &neighbor_attr_unchanged_cmd
);
10380 install_element (BGP_IPV6_NODE
, &no_neighbor_attr_unchanged_cmd
);
10381 install_element (BGP_IPV6M_NODE
, &neighbor_attr_unchanged_cmd
);
10382 install_element (BGP_IPV6M_NODE
, &no_neighbor_attr_unchanged_cmd
);
10383 install_element (BGP_VPNV4_NODE
, &neighbor_attr_unchanged_cmd
);
10384 install_element (BGP_VPNV4_NODE
, &no_neighbor_attr_unchanged_cmd
);
10385 install_element (BGP_VPNV6_NODE
, &neighbor_attr_unchanged_cmd
);
10386 install_element (BGP_VPNV6_NODE
, &no_neighbor_attr_unchanged_cmd
);
10388 install_element (BGP_ENCAP_NODE
, &neighbor_attr_unchanged_cmd
);
10389 install_element (BGP_ENCAP_NODE
, &no_neighbor_attr_unchanged_cmd
);
10391 install_element (BGP_ENCAPV6_NODE
, &neighbor_attr_unchanged_cmd
);
10392 install_element (BGP_ENCAPV6_NODE
, &no_neighbor_attr_unchanged_cmd
);
10394 install_element (BGP_EVPN_NODE
, &neighbor_attr_unchanged_cmd
);
10395 install_element (BGP_EVPN_NODE
, &no_neighbor_attr_unchanged_cmd
);
10397 /* "nexthop-local unchanged" commands */
10398 install_element (BGP_IPV6_NODE
, &neighbor_nexthop_local_unchanged_cmd
);
10399 install_element (BGP_IPV6_NODE
, &no_neighbor_nexthop_local_unchanged_cmd
);
10401 /* "neighbor next-hop-self" commands. */
10402 install_element (BGP_NODE
, &neighbor_nexthop_self_cmd
);
10403 install_element (BGP_NODE
, &no_neighbor_nexthop_self_cmd
);
10404 install_element (BGP_IPV4_NODE
, &neighbor_nexthop_self_cmd
);
10405 install_element (BGP_IPV4_NODE
, &no_neighbor_nexthop_self_cmd
);
10406 install_element (BGP_IPV4M_NODE
, &neighbor_nexthop_self_cmd
);
10407 install_element (BGP_IPV4M_NODE
, &no_neighbor_nexthop_self_cmd
);
10408 install_element (BGP_IPV6_NODE
, &neighbor_nexthop_self_cmd
);
10409 install_element (BGP_IPV6_NODE
, &no_neighbor_nexthop_self_cmd
);
10410 install_element (BGP_IPV6M_NODE
, &neighbor_nexthop_self_cmd
);
10411 install_element (BGP_IPV6M_NODE
, &no_neighbor_nexthop_self_cmd
);
10412 install_element (BGP_VPNV4_NODE
, &neighbor_nexthop_self_cmd
);
10413 install_element (BGP_VPNV4_NODE
, &no_neighbor_nexthop_self_cmd
);
10414 install_element (BGP_VPNV6_NODE
, &neighbor_nexthop_self_cmd
);
10415 install_element (BGP_VPNV6_NODE
, &no_neighbor_nexthop_self_cmd
);
10416 install_element (BGP_ENCAP_NODE
, &neighbor_nexthop_self_cmd
);
10417 install_element (BGP_ENCAP_NODE
, &no_neighbor_nexthop_self_cmd
);
10418 install_element (BGP_ENCAPV6_NODE
, &neighbor_nexthop_self_cmd
);
10419 install_element (BGP_ENCAPV6_NODE
, &no_neighbor_nexthop_self_cmd
);
10421 /* "neighbor next-hop-self force" commands. */
10422 install_element (BGP_NODE
, &neighbor_nexthop_self_force_cmd
);
10423 install_element (BGP_NODE
, &no_neighbor_nexthop_self_force_cmd
);
10424 install_element (BGP_IPV4_NODE
, &neighbor_nexthop_self_force_cmd
);
10425 install_element (BGP_IPV4_NODE
, &no_neighbor_nexthop_self_force_cmd
);
10426 install_element (BGP_IPV4M_NODE
, &neighbor_nexthop_self_force_cmd
);
10427 install_element (BGP_IPV4M_NODE
, &no_neighbor_nexthop_self_force_cmd
);
10428 install_element (BGP_IPV6_NODE
, &neighbor_nexthop_self_force_cmd
);
10429 install_element (BGP_IPV6_NODE
, &no_neighbor_nexthop_self_force_cmd
);
10430 install_element (BGP_IPV6M_NODE
, &neighbor_nexthop_self_force_cmd
);
10431 install_element (BGP_IPV6M_NODE
, &no_neighbor_nexthop_self_force_cmd
);
10432 install_element (BGP_VPNV4_NODE
, &neighbor_nexthop_self_force_cmd
);
10433 install_element (BGP_VPNV4_NODE
, &no_neighbor_nexthop_self_force_cmd
);
10434 install_element (BGP_VPNV6_NODE
, &neighbor_nexthop_self_force_cmd
);
10435 install_element (BGP_VPNV6_NODE
, &no_neighbor_nexthop_self_force_cmd
);
10437 /* "neighbor as-override" commands. */
10438 install_element (BGP_NODE
, &neighbor_as_override_cmd
);
10439 install_element (BGP_NODE
, &no_neighbor_as_override_cmd
);
10440 install_element (BGP_IPV4_NODE
, &neighbor_as_override_cmd
);
10441 install_element (BGP_IPV4_NODE
, &no_neighbor_as_override_cmd
);
10442 install_element (BGP_IPV4M_NODE
, &neighbor_as_override_cmd
);
10443 install_element (BGP_IPV4M_NODE
, &no_neighbor_as_override_cmd
);
10444 install_element (BGP_IPV6_NODE
, &neighbor_as_override_cmd
);
10445 install_element (BGP_IPV6_NODE
, &no_neighbor_as_override_cmd
);
10446 install_element (BGP_IPV6M_NODE
, &neighbor_as_override_cmd
);
10447 install_element (BGP_IPV6M_NODE
, &no_neighbor_as_override_cmd
);
10448 install_element (BGP_VPNV4_NODE
, &neighbor_as_override_cmd
);
10449 install_element (BGP_VPNV4_NODE
, &no_neighbor_as_override_cmd
);
10450 install_element (BGP_VPNV6_NODE
, &neighbor_as_override_cmd
);
10451 install_element (BGP_VPNV6_NODE
, &no_neighbor_as_override_cmd
);
10453 /* "neighbor remove-private-AS" commands. */
10454 install_element (BGP_NODE
, &neighbor_remove_private_as_cmd
);
10455 install_element (BGP_NODE
, &no_neighbor_remove_private_as_cmd
);
10456 install_element (BGP_NODE
, &neighbor_remove_private_as_all_cmd
);
10457 install_element (BGP_NODE
, &no_neighbor_remove_private_as_all_cmd
);
10458 install_element (BGP_NODE
, &neighbor_remove_private_as_replace_as_cmd
);
10459 install_element (BGP_NODE
, &no_neighbor_remove_private_as_replace_as_cmd
);
10460 install_element (BGP_NODE
, &neighbor_remove_private_as_all_replace_as_cmd
);
10461 install_element (BGP_NODE
, &no_neighbor_remove_private_as_all_replace_as_cmd
);
10462 install_element (BGP_IPV4_NODE
, &neighbor_remove_private_as_cmd
);
10463 install_element (BGP_IPV4_NODE
, &no_neighbor_remove_private_as_cmd
);
10464 install_element (BGP_IPV4_NODE
, &neighbor_remove_private_as_all_cmd
);
10465 install_element (BGP_IPV4_NODE
, &no_neighbor_remove_private_as_all_cmd
);
10466 install_element (BGP_IPV4_NODE
, &neighbor_remove_private_as_replace_as_cmd
);
10467 install_element (BGP_IPV4_NODE
, &no_neighbor_remove_private_as_replace_as_cmd
);
10468 install_element (BGP_IPV4_NODE
, &neighbor_remove_private_as_all_replace_as_cmd
);
10469 install_element (BGP_IPV4_NODE
, &no_neighbor_remove_private_as_all_replace_as_cmd
);
10470 install_element (BGP_IPV4M_NODE
, &neighbor_remove_private_as_cmd
);
10471 install_element (BGP_IPV4M_NODE
, &no_neighbor_remove_private_as_cmd
);
10472 install_element (BGP_IPV4M_NODE
, &neighbor_remove_private_as_all_cmd
);
10473 install_element (BGP_IPV4M_NODE
, &no_neighbor_remove_private_as_all_cmd
);
10474 install_element (BGP_IPV4M_NODE
, &neighbor_remove_private_as_replace_as_cmd
);
10475 install_element (BGP_IPV4M_NODE
, &no_neighbor_remove_private_as_replace_as_cmd
);
10476 install_element (BGP_IPV4M_NODE
, &neighbor_remove_private_as_all_replace_as_cmd
);
10477 install_element (BGP_IPV4M_NODE
, &no_neighbor_remove_private_as_all_replace_as_cmd
);
10478 install_element (BGP_IPV6_NODE
, &neighbor_remove_private_as_cmd
);
10479 install_element (BGP_IPV6_NODE
, &no_neighbor_remove_private_as_cmd
);
10480 install_element (BGP_IPV6_NODE
, &neighbor_remove_private_as_all_cmd
);
10481 install_element (BGP_IPV6_NODE
, &no_neighbor_remove_private_as_all_cmd
);
10482 install_element (BGP_IPV6_NODE
, &neighbor_remove_private_as_replace_as_cmd
);
10483 install_element (BGP_IPV6_NODE
, &no_neighbor_remove_private_as_replace_as_cmd
);
10484 install_element (BGP_IPV6_NODE
, &neighbor_remove_private_as_all_replace_as_cmd
);
10485 install_element (BGP_IPV6_NODE
, &no_neighbor_remove_private_as_all_replace_as_cmd
);
10486 install_element (BGP_IPV6M_NODE
, &neighbor_remove_private_as_cmd
);
10487 install_element (BGP_IPV6M_NODE
, &no_neighbor_remove_private_as_cmd
);
10488 install_element (BGP_IPV6M_NODE
, &neighbor_remove_private_as_all_cmd
);
10489 install_element (BGP_IPV6M_NODE
, &no_neighbor_remove_private_as_all_cmd
);
10490 install_element (BGP_IPV6M_NODE
, &neighbor_remove_private_as_replace_as_cmd
);
10491 install_element (BGP_IPV6M_NODE
, &no_neighbor_remove_private_as_replace_as_cmd
);
10492 install_element (BGP_IPV6M_NODE
, &neighbor_remove_private_as_all_replace_as_cmd
);
10493 install_element (BGP_IPV6M_NODE
, &no_neighbor_remove_private_as_all_replace_as_cmd
);
10494 install_element (BGP_VPNV4_NODE
, &neighbor_remove_private_as_cmd
);
10495 install_element (BGP_VPNV4_NODE
, &no_neighbor_remove_private_as_cmd
);
10496 install_element (BGP_VPNV4_NODE
, &neighbor_remove_private_as_all_cmd
);
10497 install_element (BGP_VPNV4_NODE
, &no_neighbor_remove_private_as_all_cmd
);
10498 install_element (BGP_VPNV4_NODE
, &neighbor_remove_private_as_replace_as_cmd
);
10499 install_element (BGP_VPNV4_NODE
, &no_neighbor_remove_private_as_replace_as_cmd
);
10500 install_element (BGP_VPNV4_NODE
, &neighbor_remove_private_as_all_replace_as_cmd
);
10501 install_element (BGP_VPNV4_NODE
, &no_neighbor_remove_private_as_all_replace_as_cmd
);
10502 install_element (BGP_VPNV6_NODE
, &neighbor_remove_private_as_cmd
);
10503 install_element (BGP_VPNV6_NODE
, &no_neighbor_remove_private_as_cmd
);
10504 install_element (BGP_VPNV6_NODE
, &neighbor_remove_private_as_all_cmd
);
10505 install_element (BGP_VPNV6_NODE
, &no_neighbor_remove_private_as_all_cmd
);
10506 install_element (BGP_VPNV6_NODE
, &neighbor_remove_private_as_replace_as_cmd
);
10507 install_element (BGP_VPNV6_NODE
, &no_neighbor_remove_private_as_replace_as_cmd
);
10508 install_element (BGP_VPNV6_NODE
, &neighbor_remove_private_as_all_replace_as_cmd
);
10509 install_element (BGP_VPNV6_NODE
, &no_neighbor_remove_private_as_all_replace_as_cmd
);
10510 install_element (BGP_ENCAP_NODE
, &neighbor_remove_private_as_cmd
);
10511 install_element (BGP_ENCAP_NODE
, &no_neighbor_remove_private_as_cmd
);
10512 install_element (BGP_ENCAPV6_NODE
, &neighbor_remove_private_as_cmd
);
10513 install_element (BGP_ENCAPV6_NODE
, &no_neighbor_remove_private_as_cmd
);
10515 /* "neighbor send-community" commands.*/
10516 install_element (BGP_NODE
, &neighbor_send_community_cmd
);
10517 install_element (BGP_NODE
, &neighbor_send_community_type_cmd
);
10518 install_element (BGP_NODE
, &no_neighbor_send_community_cmd
);
10519 install_element (BGP_NODE
, &no_neighbor_send_community_type_cmd
);
10520 install_element (BGP_IPV4_NODE
, &neighbor_send_community_cmd
);
10521 install_element (BGP_IPV4_NODE
, &neighbor_send_community_type_cmd
);
10522 install_element (BGP_IPV4_NODE
, &no_neighbor_send_community_cmd
);
10523 install_element (BGP_IPV4_NODE
, &no_neighbor_send_community_type_cmd
);
10524 install_element (BGP_IPV4M_NODE
, &neighbor_send_community_cmd
);
10525 install_element (BGP_IPV4M_NODE
, &neighbor_send_community_type_cmd
);
10526 install_element (BGP_IPV4M_NODE
, &no_neighbor_send_community_cmd
);
10527 install_element (BGP_IPV4M_NODE
, &no_neighbor_send_community_type_cmd
);
10528 install_element (BGP_IPV6_NODE
, &neighbor_send_community_cmd
);
10529 install_element (BGP_IPV6_NODE
, &neighbor_send_community_type_cmd
);
10530 install_element (BGP_IPV6_NODE
, &no_neighbor_send_community_cmd
);
10531 install_element (BGP_IPV6_NODE
, &no_neighbor_send_community_type_cmd
);
10532 install_element (BGP_IPV6M_NODE
, &neighbor_send_community_cmd
);
10533 install_element (BGP_IPV6M_NODE
, &neighbor_send_community_type_cmd
);
10534 install_element (BGP_IPV6M_NODE
, &no_neighbor_send_community_cmd
);
10535 install_element (BGP_IPV6M_NODE
, &no_neighbor_send_community_type_cmd
);
10536 install_element (BGP_VPNV4_NODE
, &neighbor_send_community_cmd
);
10537 install_element (BGP_VPNV4_NODE
, &neighbor_send_community_type_cmd
);
10538 install_element (BGP_VPNV4_NODE
, &no_neighbor_send_community_cmd
);
10539 install_element (BGP_VPNV4_NODE
, &no_neighbor_send_community_type_cmd
);
10540 install_element (BGP_VPNV6_NODE
, &neighbor_send_community_cmd
);
10541 install_element (BGP_VPNV6_NODE
, &neighbor_send_community_type_cmd
);
10542 install_element (BGP_VPNV6_NODE
, &no_neighbor_send_community_cmd
);
10543 install_element (BGP_VPNV6_NODE
, &no_neighbor_send_community_type_cmd
);
10544 install_element (BGP_ENCAP_NODE
, &neighbor_send_community_cmd
);
10545 install_element (BGP_ENCAP_NODE
, &neighbor_send_community_type_cmd
);
10546 install_element (BGP_ENCAP_NODE
, &no_neighbor_send_community_cmd
);
10547 install_element (BGP_ENCAP_NODE
, &no_neighbor_send_community_type_cmd
);
10548 install_element (BGP_ENCAPV6_NODE
, &neighbor_send_community_cmd
);
10549 install_element (BGP_ENCAPV6_NODE
, &neighbor_send_community_type_cmd
);
10550 install_element (BGP_ENCAPV6_NODE
, &no_neighbor_send_community_cmd
);
10551 install_element (BGP_ENCAPV6_NODE
, &no_neighbor_send_community_type_cmd
);
10553 /* "neighbor route-reflector" commands.*/
10554 install_element (BGP_NODE
, &neighbor_route_reflector_client_cmd
);
10555 install_element (BGP_NODE
, &no_neighbor_route_reflector_client_cmd
);
10556 install_element (BGP_IPV4_NODE
, &neighbor_route_reflector_client_cmd
);
10557 install_element (BGP_IPV4_NODE
, &no_neighbor_route_reflector_client_cmd
);
10558 install_element (BGP_IPV4M_NODE
, &neighbor_route_reflector_client_cmd
);
10559 install_element (BGP_IPV4M_NODE
, &no_neighbor_route_reflector_client_cmd
);
10560 install_element (BGP_IPV6_NODE
, &neighbor_route_reflector_client_cmd
);
10561 install_element (BGP_IPV6_NODE
, &no_neighbor_route_reflector_client_cmd
);
10562 install_element (BGP_IPV6M_NODE
, &neighbor_route_reflector_client_cmd
);
10563 install_element (BGP_IPV6M_NODE
, &no_neighbor_route_reflector_client_cmd
);
10564 install_element (BGP_VPNV4_NODE
, &neighbor_route_reflector_client_cmd
);
10565 install_element (BGP_VPNV4_NODE
, &no_neighbor_route_reflector_client_cmd
);
10566 install_element (BGP_VPNV6_NODE
, &neighbor_route_reflector_client_cmd
);
10567 install_element (BGP_VPNV6_NODE
, &no_neighbor_route_reflector_client_cmd
);
10568 install_element (BGP_ENCAP_NODE
, &neighbor_route_reflector_client_cmd
);
10569 install_element (BGP_ENCAP_NODE
, &no_neighbor_route_reflector_client_cmd
);
10570 install_element (BGP_ENCAPV6_NODE
, &neighbor_route_reflector_client_cmd
);
10571 install_element (BGP_ENCAPV6_NODE
, &no_neighbor_route_reflector_client_cmd
);
10573 /* "neighbor route-server" commands.*/
10574 install_element (BGP_NODE
, &neighbor_route_server_client_cmd
);
10575 install_element (BGP_NODE
, &no_neighbor_route_server_client_cmd
);
10576 install_element (BGP_IPV4_NODE
, &neighbor_route_server_client_cmd
);
10577 install_element (BGP_IPV4_NODE
, &no_neighbor_route_server_client_cmd
);
10578 install_element (BGP_IPV4M_NODE
, &neighbor_route_server_client_cmd
);
10579 install_element (BGP_IPV4M_NODE
, &no_neighbor_route_server_client_cmd
);
10580 install_element (BGP_IPV6_NODE
, &neighbor_route_server_client_cmd
);
10581 install_element (BGP_IPV6_NODE
, &no_neighbor_route_server_client_cmd
);
10582 install_element (BGP_IPV6M_NODE
, &neighbor_route_server_client_cmd
);
10583 install_element (BGP_IPV6M_NODE
, &no_neighbor_route_server_client_cmd
);
10584 install_element (BGP_VPNV4_NODE
, &neighbor_route_server_client_cmd
);
10585 install_element (BGP_VPNV4_NODE
, &no_neighbor_route_server_client_cmd
);
10586 install_element (BGP_VPNV6_NODE
, &neighbor_route_server_client_cmd
);
10587 install_element (BGP_VPNV6_NODE
, &no_neighbor_route_server_client_cmd
);
10588 install_element (BGP_ENCAP_NODE
, &neighbor_route_server_client_cmd
);
10589 install_element (BGP_ENCAP_NODE
, &no_neighbor_route_server_client_cmd
);
10590 install_element (BGP_ENCAPV6_NODE
, &neighbor_route_server_client_cmd
);
10591 install_element (BGP_ENCAPV6_NODE
, &no_neighbor_route_server_client_cmd
);
10593 /* "neighbor addpath-tx-all-paths" commands.*/
10594 install_element (BGP_NODE
, &neighbor_addpath_tx_all_paths_cmd
);
10595 install_element (BGP_NODE
, &no_neighbor_addpath_tx_all_paths_cmd
);
10596 install_element (BGP_IPV4_NODE
, &neighbor_addpath_tx_all_paths_cmd
);
10597 install_element (BGP_IPV4_NODE
, &no_neighbor_addpath_tx_all_paths_cmd
);
10598 install_element (BGP_IPV4M_NODE
, &neighbor_addpath_tx_all_paths_cmd
);
10599 install_element (BGP_IPV4M_NODE
, &no_neighbor_addpath_tx_all_paths_cmd
);
10600 install_element (BGP_IPV6_NODE
, &neighbor_addpath_tx_all_paths_cmd
);
10601 install_element (BGP_IPV6_NODE
, &no_neighbor_addpath_tx_all_paths_cmd
);
10602 install_element (BGP_IPV6M_NODE
, &neighbor_addpath_tx_all_paths_cmd
);
10603 install_element (BGP_IPV6M_NODE
, &no_neighbor_addpath_tx_all_paths_cmd
);
10604 install_element (BGP_VPNV4_NODE
, &neighbor_addpath_tx_all_paths_cmd
);
10605 install_element (BGP_VPNV4_NODE
, &no_neighbor_addpath_tx_all_paths_cmd
);
10606 install_element (BGP_VPNV6_NODE
, &neighbor_addpath_tx_all_paths_cmd
);
10607 install_element (BGP_VPNV6_NODE
, &no_neighbor_addpath_tx_all_paths_cmd
);
10609 /* "neighbor addpath-tx-bestpath-per-AS" commands.*/
10610 install_element (BGP_NODE
, &neighbor_addpath_tx_bestpath_per_as_cmd
);
10611 install_element (BGP_NODE
, &no_neighbor_addpath_tx_bestpath_per_as_cmd
);
10612 install_element (BGP_IPV4_NODE
, &neighbor_addpath_tx_bestpath_per_as_cmd
);
10613 install_element (BGP_IPV4_NODE
, &no_neighbor_addpath_tx_bestpath_per_as_cmd
);
10614 install_element (BGP_IPV4M_NODE
, &neighbor_addpath_tx_bestpath_per_as_cmd
);
10615 install_element (BGP_IPV4M_NODE
, &no_neighbor_addpath_tx_bestpath_per_as_cmd
);
10616 install_element (BGP_IPV6_NODE
, &neighbor_addpath_tx_bestpath_per_as_cmd
);
10617 install_element (BGP_IPV6_NODE
, &no_neighbor_addpath_tx_bestpath_per_as_cmd
);
10618 install_element (BGP_IPV6M_NODE
, &neighbor_addpath_tx_bestpath_per_as_cmd
);
10619 install_element (BGP_IPV6M_NODE
, &no_neighbor_addpath_tx_bestpath_per_as_cmd
);
10620 install_element (BGP_VPNV4_NODE
, &neighbor_addpath_tx_bestpath_per_as_cmd
);
10621 install_element (BGP_VPNV4_NODE
, &no_neighbor_addpath_tx_bestpath_per_as_cmd
);
10622 install_element (BGP_VPNV6_NODE
, &neighbor_addpath_tx_bestpath_per_as_cmd
);
10623 install_element (BGP_VPNV6_NODE
, &no_neighbor_addpath_tx_bestpath_per_as_cmd
);
10625 /* "neighbor passive" commands. */
10626 install_element (BGP_NODE
, &neighbor_passive_cmd
);
10627 install_element (BGP_NODE
, &no_neighbor_passive_cmd
);
10630 /* "neighbor shutdown" commands. */
10631 install_element (BGP_NODE
, &neighbor_shutdown_cmd
);
10632 install_element (BGP_NODE
, &no_neighbor_shutdown_cmd
);
10633 install_element (BGP_NODE
, &neighbor_shutdown_msg_cmd
);
10634 install_element (BGP_NODE
, &no_neighbor_shutdown_msg_cmd
);
10636 /* "neighbor capability extended-nexthop" commands.*/
10637 install_element (BGP_NODE
, &neighbor_capability_enhe_cmd
);
10638 install_element (BGP_NODE
, &no_neighbor_capability_enhe_cmd
);
10640 /* "neighbor capability orf prefix-list" commands.*/
10641 install_element (BGP_NODE
, &neighbor_capability_orf_prefix_cmd
);
10642 install_element (BGP_NODE
, &no_neighbor_capability_orf_prefix_cmd
);
10643 install_element (BGP_IPV4_NODE
, &neighbor_capability_orf_prefix_cmd
);
10644 install_element (BGP_IPV4_NODE
, &no_neighbor_capability_orf_prefix_cmd
);
10645 install_element (BGP_IPV4M_NODE
, &neighbor_capability_orf_prefix_cmd
);
10646 install_element (BGP_IPV4M_NODE
, &no_neighbor_capability_orf_prefix_cmd
);
10647 install_element (BGP_IPV6_NODE
, &neighbor_capability_orf_prefix_cmd
);
10648 install_element (BGP_IPV6_NODE
, &no_neighbor_capability_orf_prefix_cmd
);
10649 install_element (BGP_IPV6M_NODE
, &neighbor_capability_orf_prefix_cmd
);
10650 install_element (BGP_IPV6M_NODE
, &no_neighbor_capability_orf_prefix_cmd
);
10652 /* "neighbor capability dynamic" commands.*/
10653 install_element (BGP_NODE
, &neighbor_capability_dynamic_cmd
);
10654 install_element (BGP_NODE
, &no_neighbor_capability_dynamic_cmd
);
10656 /* "neighbor dont-capability-negotiate" commands. */
10657 install_element (BGP_NODE
, &neighbor_dont_capability_negotiate_cmd
);
10658 install_element (BGP_NODE
, &no_neighbor_dont_capability_negotiate_cmd
);
10660 /* "neighbor ebgp-multihop" commands. */
10661 install_element (BGP_NODE
, &neighbor_ebgp_multihop_cmd
);
10662 install_element (BGP_NODE
, &neighbor_ebgp_multihop_ttl_cmd
);
10663 install_element (BGP_NODE
, &no_neighbor_ebgp_multihop_cmd
);
10665 /* "neighbor disable-connected-check" commands. */
10666 install_element (BGP_NODE
, &neighbor_disable_connected_check_cmd
);
10667 install_element (BGP_NODE
, &no_neighbor_disable_connected_check_cmd
);
10669 /* "neighbor description" commands. */
10670 install_element (BGP_NODE
, &neighbor_description_cmd
);
10671 install_element (BGP_NODE
, &no_neighbor_description_cmd
);
10673 /* "neighbor update-source" commands. "*/
10674 install_element (BGP_NODE
, &neighbor_update_source_cmd
);
10675 install_element (BGP_NODE
, &no_neighbor_update_source_cmd
);
10677 /* "neighbor default-originate" commands. */
10678 install_element (BGP_NODE
, &neighbor_default_originate_cmd
);
10679 install_element (BGP_NODE
, &neighbor_default_originate_rmap_cmd
);
10680 install_element (BGP_NODE
, &no_neighbor_default_originate_cmd
);
10681 install_element (BGP_IPV4_NODE
, &neighbor_default_originate_cmd
);
10682 install_element (BGP_IPV4_NODE
, &neighbor_default_originate_rmap_cmd
);
10683 install_element (BGP_IPV4_NODE
, &no_neighbor_default_originate_cmd
);
10684 install_element (BGP_IPV4M_NODE
, &neighbor_default_originate_cmd
);
10685 install_element (BGP_IPV4M_NODE
, &neighbor_default_originate_rmap_cmd
);
10686 install_element (BGP_IPV4M_NODE
, &no_neighbor_default_originate_cmd
);
10687 install_element (BGP_IPV6_NODE
, &neighbor_default_originate_cmd
);
10688 install_element (BGP_IPV6_NODE
, &neighbor_default_originate_rmap_cmd
);
10689 install_element (BGP_IPV6_NODE
, &no_neighbor_default_originate_cmd
);
10690 install_element (BGP_IPV6M_NODE
, &neighbor_default_originate_cmd
);
10691 install_element (BGP_IPV6M_NODE
, &neighbor_default_originate_rmap_cmd
);
10692 install_element (BGP_IPV6M_NODE
, &no_neighbor_default_originate_cmd
);
10694 /* "neighbor port" commands. */
10695 install_element (BGP_NODE
, &neighbor_port_cmd
);
10696 install_element (BGP_NODE
, &no_neighbor_port_cmd
);
10698 /* "neighbor weight" commands. */
10699 install_element (BGP_NODE
, &neighbor_weight_cmd
);
10700 install_element (BGP_NODE
, &no_neighbor_weight_cmd
);
10702 install_element (BGP_IPV4_NODE
, &neighbor_weight_cmd
);
10703 install_element (BGP_IPV4_NODE
, &no_neighbor_weight_cmd
);
10704 install_element (BGP_IPV4M_NODE
, &neighbor_weight_cmd
);
10705 install_element (BGP_IPV4M_NODE
, &no_neighbor_weight_cmd
);
10706 install_element (BGP_IPV6_NODE
, &neighbor_weight_cmd
);
10707 install_element (BGP_IPV6_NODE
, &no_neighbor_weight_cmd
);
10708 install_element (BGP_IPV6M_NODE
, &neighbor_weight_cmd
);
10709 install_element (BGP_IPV6M_NODE
, &no_neighbor_weight_cmd
);
10710 install_element (BGP_VPNV4_NODE
, &neighbor_weight_cmd
);
10711 install_element (BGP_VPNV4_NODE
, &no_neighbor_weight_cmd
);
10712 install_element (BGP_VPNV6_NODE
, &neighbor_weight_cmd
);
10713 install_element (BGP_VPNV6_NODE
, &no_neighbor_weight_cmd
);
10714 install_element (BGP_ENCAP_NODE
, &neighbor_weight_cmd
);
10715 install_element (BGP_ENCAP_NODE
, &no_neighbor_weight_cmd
);
10716 install_element (BGP_ENCAPV6_NODE
, &neighbor_weight_cmd
);
10717 install_element (BGP_ENCAPV6_NODE
, &no_neighbor_weight_cmd
);
10719 /* "neighbor override-capability" commands. */
10720 install_element (BGP_NODE
, &neighbor_override_capability_cmd
);
10721 install_element (BGP_NODE
, &no_neighbor_override_capability_cmd
);
10723 /* "neighbor strict-capability-match" commands. */
10724 install_element (BGP_NODE
, &neighbor_strict_capability_cmd
);
10725 install_element (BGP_NODE
, &no_neighbor_strict_capability_cmd
);
10727 /* "neighbor timers" commands. */
10728 install_element (BGP_NODE
, &neighbor_timers_cmd
);
10729 install_element (BGP_NODE
, &no_neighbor_timers_cmd
);
10731 /* "neighbor timers connect" commands. */
10732 install_element (BGP_NODE
, &neighbor_timers_connect_cmd
);
10733 install_element (BGP_NODE
, &no_neighbor_timers_connect_cmd
);
10735 /* "neighbor advertisement-interval" commands. */
10736 install_element (BGP_NODE
, &neighbor_advertise_interval_cmd
);
10737 install_element (BGP_NODE
, &no_neighbor_advertise_interval_cmd
);
10739 /* "neighbor interface" commands. */
10740 install_element (BGP_NODE
, &neighbor_interface_cmd
);
10741 install_element (BGP_NODE
, &no_neighbor_interface_cmd
);
10743 /* "neighbor distribute" commands. */
10744 install_element (BGP_NODE
, &neighbor_distribute_list_cmd
);
10745 install_element (BGP_NODE
, &no_neighbor_distribute_list_cmd
);
10746 install_element (BGP_IPV4_NODE
, &neighbor_distribute_list_cmd
);
10747 install_element (BGP_IPV4_NODE
, &no_neighbor_distribute_list_cmd
);
10748 install_element (BGP_IPV4M_NODE
, &neighbor_distribute_list_cmd
);
10749 install_element (BGP_IPV4M_NODE
, &no_neighbor_distribute_list_cmd
);
10750 install_element (BGP_IPV6_NODE
, &neighbor_distribute_list_cmd
);
10751 install_element (BGP_IPV6_NODE
, &no_neighbor_distribute_list_cmd
);
10752 install_element (BGP_IPV6M_NODE
, &neighbor_distribute_list_cmd
);
10753 install_element (BGP_IPV6M_NODE
, &no_neighbor_distribute_list_cmd
);
10754 install_element (BGP_VPNV4_NODE
, &neighbor_distribute_list_cmd
);
10755 install_element (BGP_VPNV4_NODE
, &no_neighbor_distribute_list_cmd
);
10756 install_element (BGP_VPNV6_NODE
, &neighbor_distribute_list_cmd
);
10757 install_element (BGP_VPNV6_NODE
, &no_neighbor_distribute_list_cmd
);
10758 install_element (BGP_ENCAP_NODE
, &neighbor_distribute_list_cmd
);
10759 install_element (BGP_ENCAP_NODE
, &no_neighbor_distribute_list_cmd
);
10760 install_element (BGP_ENCAPV6_NODE
, &neighbor_distribute_list_cmd
);
10761 install_element (BGP_ENCAPV6_NODE
, &no_neighbor_distribute_list_cmd
);
10763 /* "neighbor prefix-list" commands. */
10764 install_element (BGP_NODE
, &neighbor_prefix_list_cmd
);
10765 install_element (BGP_NODE
, &no_neighbor_prefix_list_cmd
);
10766 install_element (BGP_IPV4_NODE
, &neighbor_prefix_list_cmd
);
10767 install_element (BGP_IPV4_NODE
, &no_neighbor_prefix_list_cmd
);
10768 install_element (BGP_IPV4M_NODE
, &neighbor_prefix_list_cmd
);
10769 install_element (BGP_IPV4M_NODE
, &no_neighbor_prefix_list_cmd
);
10770 install_element (BGP_IPV6_NODE
, &neighbor_prefix_list_cmd
);
10771 install_element (BGP_IPV6_NODE
, &no_neighbor_prefix_list_cmd
);
10772 install_element (BGP_IPV6M_NODE
, &neighbor_prefix_list_cmd
);
10773 install_element (BGP_IPV6M_NODE
, &no_neighbor_prefix_list_cmd
);
10774 install_element (BGP_VPNV4_NODE
, &neighbor_prefix_list_cmd
);
10775 install_element (BGP_VPNV4_NODE
, &no_neighbor_prefix_list_cmd
);
10776 install_element (BGP_VPNV6_NODE
, &neighbor_prefix_list_cmd
);
10777 install_element (BGP_VPNV6_NODE
, &no_neighbor_prefix_list_cmd
);
10778 install_element (BGP_ENCAP_NODE
, &neighbor_prefix_list_cmd
);
10779 install_element (BGP_ENCAP_NODE
, &no_neighbor_prefix_list_cmd
);
10780 install_element (BGP_ENCAPV6_NODE
, &neighbor_prefix_list_cmd
);
10781 install_element (BGP_ENCAPV6_NODE
, &no_neighbor_prefix_list_cmd
);
10783 /* "neighbor filter-list" commands. */
10784 install_element (BGP_NODE
, &neighbor_filter_list_cmd
);
10785 install_element (BGP_NODE
, &no_neighbor_filter_list_cmd
);
10786 install_element (BGP_IPV4_NODE
, &neighbor_filter_list_cmd
);
10787 install_element (BGP_IPV4_NODE
, &no_neighbor_filter_list_cmd
);
10788 install_element (BGP_IPV4M_NODE
, &neighbor_filter_list_cmd
);
10789 install_element (BGP_IPV4M_NODE
, &no_neighbor_filter_list_cmd
);
10790 install_element (BGP_IPV6_NODE
, &neighbor_filter_list_cmd
);
10791 install_element (BGP_IPV6_NODE
, &no_neighbor_filter_list_cmd
);
10792 install_element (BGP_IPV6M_NODE
, &neighbor_filter_list_cmd
);
10793 install_element (BGP_IPV6M_NODE
, &no_neighbor_filter_list_cmd
);
10794 install_element (BGP_VPNV4_NODE
, &neighbor_filter_list_cmd
);
10795 install_element (BGP_VPNV4_NODE
, &no_neighbor_filter_list_cmd
);
10796 install_element (BGP_VPNV6_NODE
, &neighbor_filter_list_cmd
);
10797 install_element (BGP_VPNV6_NODE
, &no_neighbor_filter_list_cmd
);
10798 install_element (BGP_ENCAP_NODE
, &neighbor_filter_list_cmd
);
10799 install_element (BGP_ENCAP_NODE
, &no_neighbor_filter_list_cmd
);
10800 install_element (BGP_ENCAPV6_NODE
, &neighbor_filter_list_cmd
);
10801 install_element (BGP_ENCAPV6_NODE
, &no_neighbor_filter_list_cmd
);
10803 /* "neighbor route-map" commands. */
10804 install_element (BGP_NODE
, &neighbor_route_map_cmd
);
10805 install_element (BGP_NODE
, &no_neighbor_route_map_cmd
);
10806 install_element (BGP_IPV4_NODE
, &neighbor_route_map_cmd
);
10807 install_element (BGP_IPV4_NODE
, &no_neighbor_route_map_cmd
);
10808 install_element (BGP_IPV4M_NODE
, &neighbor_route_map_cmd
);
10809 install_element (BGP_IPV4M_NODE
, &no_neighbor_route_map_cmd
);
10810 install_element (BGP_IPV6_NODE
, &neighbor_route_map_cmd
);
10811 install_element (BGP_IPV6_NODE
, &no_neighbor_route_map_cmd
);
10812 install_element (BGP_IPV6M_NODE
, &neighbor_route_map_cmd
);
10813 install_element (BGP_IPV6M_NODE
, &no_neighbor_route_map_cmd
);
10814 install_element (BGP_VPNV4_NODE
, &neighbor_route_map_cmd
);
10815 install_element (BGP_VPNV4_NODE
, &no_neighbor_route_map_cmd
);
10816 install_element (BGP_VPNV6_NODE
, &neighbor_route_map_cmd
);
10817 install_element (BGP_VPNV6_NODE
, &no_neighbor_route_map_cmd
);
10818 install_element (BGP_ENCAP_NODE
, &neighbor_route_map_cmd
);
10819 install_element (BGP_ENCAP_NODE
, &no_neighbor_route_map_cmd
);
10820 install_element (BGP_ENCAPV6_NODE
, &neighbor_route_map_cmd
);
10821 install_element (BGP_ENCAPV6_NODE
, &no_neighbor_route_map_cmd
);
10823 /* "neighbor unsuppress-map" commands. */
10824 install_element (BGP_NODE
, &neighbor_unsuppress_map_cmd
);
10825 install_element (BGP_NODE
, &no_neighbor_unsuppress_map_cmd
);
10826 install_element (BGP_IPV4_NODE
, &neighbor_unsuppress_map_cmd
);
10827 install_element (BGP_IPV4_NODE
, &no_neighbor_unsuppress_map_cmd
);
10828 install_element (BGP_IPV4M_NODE
, &neighbor_unsuppress_map_cmd
);
10829 install_element (BGP_IPV4M_NODE
, &no_neighbor_unsuppress_map_cmd
);
10830 install_element (BGP_IPV6_NODE
, &neighbor_unsuppress_map_cmd
);
10831 install_element (BGP_IPV6_NODE
, &no_neighbor_unsuppress_map_cmd
);
10832 install_element (BGP_IPV6M_NODE
, &neighbor_unsuppress_map_cmd
);
10833 install_element (BGP_IPV6M_NODE
, &no_neighbor_unsuppress_map_cmd
);
10834 install_element (BGP_VPNV4_NODE
, &neighbor_unsuppress_map_cmd
);
10835 install_element (BGP_VPNV4_NODE
, &no_neighbor_unsuppress_map_cmd
);
10836 install_element (BGP_VPNV6_NODE
, &neighbor_unsuppress_map_cmd
);
10837 install_element (BGP_VPNV6_NODE
, &no_neighbor_unsuppress_map_cmd
);
10838 install_element (BGP_ENCAP_NODE
, &neighbor_unsuppress_map_cmd
);
10839 install_element (BGP_ENCAP_NODE
, &no_neighbor_unsuppress_map_cmd
);
10840 install_element (BGP_ENCAPV6_NODE
, &neighbor_unsuppress_map_cmd
);
10841 install_element (BGP_ENCAPV6_NODE
, &no_neighbor_unsuppress_map_cmd
);
10843 /* "neighbor maximum-prefix" commands. */
10844 install_element (BGP_NODE
, &neighbor_maximum_prefix_cmd
);
10845 install_element (BGP_NODE
, &neighbor_maximum_prefix_threshold_cmd
);
10846 install_element (BGP_NODE
, &neighbor_maximum_prefix_warning_cmd
);
10847 install_element (BGP_NODE
, &neighbor_maximum_prefix_threshold_warning_cmd
);
10848 install_element (BGP_NODE
, &neighbor_maximum_prefix_restart_cmd
);
10849 install_element (BGP_NODE
, &neighbor_maximum_prefix_threshold_restart_cmd
);
10850 install_element (BGP_NODE
, &no_neighbor_maximum_prefix_cmd
);
10851 install_element (BGP_IPV4_NODE
, &neighbor_maximum_prefix_cmd
);
10852 install_element (BGP_IPV4_NODE
, &neighbor_maximum_prefix_threshold_cmd
);
10853 install_element (BGP_IPV4_NODE
, &neighbor_maximum_prefix_warning_cmd
);
10854 install_element (BGP_IPV4_NODE
, &neighbor_maximum_prefix_threshold_warning_cmd
);
10855 install_element (BGP_IPV4_NODE
, &neighbor_maximum_prefix_restart_cmd
);
10856 install_element (BGP_IPV4_NODE
, &neighbor_maximum_prefix_threshold_restart_cmd
);
10857 install_element (BGP_IPV4_NODE
, &no_neighbor_maximum_prefix_cmd
);
10858 install_element (BGP_IPV4M_NODE
, &neighbor_maximum_prefix_cmd
);
10859 install_element (BGP_IPV4M_NODE
, &neighbor_maximum_prefix_threshold_cmd
);
10860 install_element (BGP_IPV4M_NODE
, &neighbor_maximum_prefix_warning_cmd
);
10861 install_element (BGP_IPV4M_NODE
, &neighbor_maximum_prefix_threshold_warning_cmd
);
10862 install_element (BGP_IPV4M_NODE
, &neighbor_maximum_prefix_restart_cmd
);
10863 install_element (BGP_IPV4M_NODE
, &neighbor_maximum_prefix_threshold_restart_cmd
);
10864 install_element (BGP_IPV4M_NODE
, &no_neighbor_maximum_prefix_cmd
);
10865 install_element (BGP_IPV6_NODE
, &neighbor_maximum_prefix_cmd
);
10866 install_element (BGP_IPV6_NODE
, &neighbor_maximum_prefix_threshold_cmd
);
10867 install_element (BGP_IPV6_NODE
, &neighbor_maximum_prefix_warning_cmd
);
10868 install_element (BGP_IPV6_NODE
, &neighbor_maximum_prefix_threshold_warning_cmd
);
10869 install_element (BGP_IPV6_NODE
, &neighbor_maximum_prefix_restart_cmd
);
10870 install_element (BGP_IPV6_NODE
, &neighbor_maximum_prefix_threshold_restart_cmd
);
10871 install_element (BGP_IPV6_NODE
, &no_neighbor_maximum_prefix_cmd
);
10872 install_element (BGP_IPV6M_NODE
, &neighbor_maximum_prefix_cmd
);
10873 install_element (BGP_IPV6M_NODE
, &neighbor_maximum_prefix_threshold_cmd
);
10874 install_element (BGP_IPV6M_NODE
, &neighbor_maximum_prefix_warning_cmd
);
10875 install_element (BGP_IPV6M_NODE
, &neighbor_maximum_prefix_threshold_warning_cmd
);
10876 install_element (BGP_IPV6M_NODE
, &neighbor_maximum_prefix_restart_cmd
);
10877 install_element (BGP_IPV6M_NODE
, &neighbor_maximum_prefix_threshold_restart_cmd
);
10878 install_element (BGP_IPV6M_NODE
, &no_neighbor_maximum_prefix_cmd
);
10879 install_element (BGP_VPNV4_NODE
, &neighbor_maximum_prefix_cmd
);
10880 install_element (BGP_VPNV4_NODE
, &neighbor_maximum_prefix_threshold_cmd
);
10881 install_element (BGP_VPNV4_NODE
, &neighbor_maximum_prefix_warning_cmd
);
10882 install_element (BGP_VPNV4_NODE
, &neighbor_maximum_prefix_threshold_warning_cmd
);
10883 install_element (BGP_VPNV4_NODE
, &neighbor_maximum_prefix_restart_cmd
);
10884 install_element (BGP_VPNV4_NODE
, &neighbor_maximum_prefix_threshold_restart_cmd
);
10885 install_element (BGP_VPNV4_NODE
, &no_neighbor_maximum_prefix_cmd
);
10886 install_element (BGP_VPNV6_NODE
, &neighbor_maximum_prefix_cmd
);
10887 install_element (BGP_VPNV6_NODE
, &neighbor_maximum_prefix_threshold_cmd
);
10888 install_element (BGP_VPNV6_NODE
, &neighbor_maximum_prefix_warning_cmd
);
10889 install_element (BGP_VPNV6_NODE
, &neighbor_maximum_prefix_threshold_warning_cmd
);
10890 install_element (BGP_VPNV6_NODE
, &neighbor_maximum_prefix_restart_cmd
);
10891 install_element (BGP_VPNV6_NODE
, &neighbor_maximum_prefix_threshold_restart_cmd
);
10892 install_element (BGP_VPNV6_NODE
, &no_neighbor_maximum_prefix_cmd
);
10894 install_element (BGP_ENCAP_NODE
, &neighbor_maximum_prefix_cmd
);
10895 install_element (BGP_ENCAP_NODE
, &neighbor_maximum_prefix_threshold_cmd
);
10896 install_element (BGP_ENCAP_NODE
, &neighbor_maximum_prefix_warning_cmd
);
10897 install_element (BGP_ENCAP_NODE
, &neighbor_maximum_prefix_threshold_warning_cmd
);
10898 install_element (BGP_ENCAP_NODE
, &neighbor_maximum_prefix_restart_cmd
);
10899 install_element (BGP_ENCAP_NODE
, &neighbor_maximum_prefix_threshold_restart_cmd
);
10900 install_element (BGP_ENCAP_NODE
, &no_neighbor_maximum_prefix_cmd
);
10902 install_element (BGP_ENCAPV6_NODE
, &neighbor_maximum_prefix_cmd
);
10903 install_element (BGP_ENCAPV6_NODE
, &neighbor_maximum_prefix_threshold_cmd
);
10904 install_element (BGP_ENCAPV6_NODE
, &neighbor_maximum_prefix_warning_cmd
);
10905 install_element (BGP_ENCAPV6_NODE
, &neighbor_maximum_prefix_threshold_warning_cmd
);
10906 install_element (BGP_ENCAPV6_NODE
, &neighbor_maximum_prefix_restart_cmd
);
10907 install_element (BGP_ENCAPV6_NODE
, &neighbor_maximum_prefix_threshold_restart_cmd
);
10908 install_element (BGP_ENCAPV6_NODE
, &no_neighbor_maximum_prefix_cmd
);
10910 /* "neighbor allowas-in" */
10911 install_element (BGP_NODE
, &neighbor_allowas_in_cmd
);
10912 install_element (BGP_NODE
, &no_neighbor_allowas_in_cmd
);
10913 install_element (BGP_IPV4_NODE
, &neighbor_allowas_in_cmd
);
10914 install_element (BGP_IPV4_NODE
, &no_neighbor_allowas_in_cmd
);
10915 install_element (BGP_IPV4M_NODE
, &neighbor_allowas_in_cmd
);
10916 install_element (BGP_IPV4M_NODE
, &no_neighbor_allowas_in_cmd
);
10917 install_element (BGP_IPV6_NODE
, &neighbor_allowas_in_cmd
);
10918 install_element (BGP_IPV6_NODE
, &no_neighbor_allowas_in_cmd
);
10919 install_element (BGP_IPV6M_NODE
, &neighbor_allowas_in_cmd
);
10920 install_element (BGP_IPV6M_NODE
, &no_neighbor_allowas_in_cmd
);
10921 install_element (BGP_VPNV4_NODE
, &neighbor_allowas_in_cmd
);
10922 install_element (BGP_VPNV4_NODE
, &no_neighbor_allowas_in_cmd
);
10923 install_element (BGP_VPNV6_NODE
, &neighbor_allowas_in_cmd
);
10924 install_element (BGP_VPNV6_NODE
, &no_neighbor_allowas_in_cmd
);
10925 install_element (BGP_ENCAP_NODE
, &neighbor_allowas_in_cmd
);
10926 install_element (BGP_ENCAP_NODE
, &no_neighbor_allowas_in_cmd
);
10927 install_element (BGP_ENCAPV6_NODE
, &neighbor_allowas_in_cmd
);
10928 install_element (BGP_ENCAPV6_NODE
, &no_neighbor_allowas_in_cmd
);
10930 /* address-family commands. */
10931 install_element (BGP_NODE
, &address_family_ipv4_safi_cmd
);
10932 install_element (BGP_NODE
, &address_family_ipv6_safi_cmd
);
10933 #ifdef KEEP_OLD_VPN_COMMANDS
10934 install_element (BGP_NODE
, &address_family_vpnv4_cmd
);
10935 install_element (BGP_NODE
, &address_family_vpnv6_cmd
);
10936 #endif /* KEEP_OLD_VPN_COMMANDS */
10938 install_element (BGP_NODE
, &address_family_encap_cmd
);
10939 install_element (BGP_NODE
, &address_family_encapv6_cmd
);
10941 install_element (BGP_NODE
, &address_family_evpn_cmd
);
10943 /* "exit-address-family" command. */
10944 install_element (BGP_IPV4_NODE
, &exit_address_family_cmd
);
10945 install_element (BGP_IPV4M_NODE
, &exit_address_family_cmd
);
10946 install_element (BGP_IPV6_NODE
, &exit_address_family_cmd
);
10947 install_element (BGP_IPV6M_NODE
, &exit_address_family_cmd
);
10948 install_element (BGP_VPNV4_NODE
, &exit_address_family_cmd
);
10949 install_element (BGP_VPNV6_NODE
, &exit_address_family_cmd
);
10950 install_element (BGP_ENCAP_NODE
, &exit_address_family_cmd
);
10951 install_element (BGP_ENCAPV6_NODE
, &exit_address_family_cmd
);
10952 install_element (BGP_EVPN_NODE
, &exit_address_family_cmd
);
10954 /* "clear ip bgp commands" */
10955 install_element (ENABLE_NODE
, &clear_ip_bgp_all_cmd
);
10957 /* clear ip bgp prefix */
10958 install_element (ENABLE_NODE
, &clear_ip_bgp_prefix_cmd
);
10959 install_element (ENABLE_NODE
, &clear_bgp_ipv6_safi_prefix_cmd
);
10960 install_element (ENABLE_NODE
, &clear_bgp_instance_ipv6_safi_prefix_cmd
);
10962 /* "show [ip] bgp summary" commands. */
10963 install_element (VIEW_NODE
, &show_bgp_instance_all_ipv6_updgrps_cmd
);
10964 install_element (VIEW_NODE
, &show_bgp_instance_updgrps_adj_cmd
);
10965 install_element (VIEW_NODE
, &show_bgp_instance_updgrps_adj_s_cmd
);
10966 install_element (VIEW_NODE
, &show_bgp_instance_updgrps_stats_cmd
);
10967 install_element (VIEW_NODE
, &show_bgp_updgrps_adj_cmd
);
10968 install_element (VIEW_NODE
, &show_bgp_updgrps_adj_s_cmd
);
10969 install_element (VIEW_NODE
, &show_bgp_updgrps_afi_adj_cmd
);
10970 install_element (VIEW_NODE
, &show_bgp_updgrps_afi_adj_s_cmd
);
10971 install_element (VIEW_NODE
, &show_bgp_updgrps_stats_cmd
);
10972 install_element (VIEW_NODE
, &show_ip_bgp_instance_updgrps_adj_cmd
);
10973 install_element (VIEW_NODE
, &show_ip_bgp_instance_updgrps_adj_s_cmd
);
10974 install_element (VIEW_NODE
, &show_ip_bgp_summary_cmd
);
10975 install_element (VIEW_NODE
, &show_ip_bgp_updgrps_adj_cmd
);
10976 install_element (VIEW_NODE
, &show_ip_bgp_updgrps_adj_s_cmd
);
10977 install_element (VIEW_NODE
, &show_ip_bgp_updgrps_cmd
);
10979 /* "show [ip] bgp neighbors" commands. */
10980 install_element (VIEW_NODE
, &show_ip_bgp_neighbors_cmd
);
10982 /* "show [ip] bgp peer-group" commands. */
10983 install_element (VIEW_NODE
, &show_ip_bgp_peer_groups_cmd
);
10985 /* "show [ip] bgp paths" commands. */
10986 install_element (VIEW_NODE
, &show_ip_bgp_paths_cmd
);
10988 /* "show [ip] bgp community" commands. */
10989 install_element (VIEW_NODE
, &show_ip_bgp_community_info_cmd
);
10991 /* "show ip bgp large-community" commands. */
10992 install_element (VIEW_NODE
, &show_ip_bgp_lcommunity_info_cmd
);
10993 /* "show [ip] bgp attribute-info" commands. */
10994 install_element (VIEW_NODE
, &show_ip_bgp_attr_info_cmd
);
10996 /* "redistribute" commands. */
10997 install_element (BGP_NODE
, &bgp_redistribute_ipv4_cmd
);
10998 install_element (BGP_NODE
, &no_bgp_redistribute_ipv4_cmd
);
10999 install_element (BGP_NODE
, &bgp_redistribute_ipv4_rmap_cmd
);
11000 install_element (BGP_NODE
, &bgp_redistribute_ipv4_metric_cmd
);
11001 install_element (BGP_NODE
, &bgp_redistribute_ipv4_rmap_metric_cmd
);
11002 install_element (BGP_NODE
, &bgp_redistribute_ipv4_metric_rmap_cmd
);
11003 install_element (BGP_NODE
, &bgp_redistribute_ipv4_ospf_cmd
);
11004 install_element (BGP_NODE
, &no_bgp_redistribute_ipv4_ospf_cmd
);
11005 install_element (BGP_NODE
, &bgp_redistribute_ipv4_ospf_rmap_cmd
);
11006 install_element (BGP_NODE
, &bgp_redistribute_ipv4_ospf_metric_cmd
);
11007 install_element (BGP_NODE
, &bgp_redistribute_ipv4_ospf_rmap_metric_cmd
);
11008 install_element (BGP_NODE
, &bgp_redistribute_ipv4_ospf_metric_rmap_cmd
);
11009 install_element (BGP_IPV4_NODE
, &bgp_redistribute_ipv4_cmd
);
11010 install_element (BGP_IPV4_NODE
, &no_bgp_redistribute_ipv4_cmd
);
11011 install_element (BGP_IPV4_NODE
, &bgp_redistribute_ipv4_rmap_cmd
);
11012 install_element (BGP_IPV4_NODE
, &bgp_redistribute_ipv4_metric_cmd
);
11013 install_element (BGP_IPV4_NODE
, &bgp_redistribute_ipv4_rmap_metric_cmd
);
11014 install_element (BGP_IPV4_NODE
, &bgp_redistribute_ipv4_metric_rmap_cmd
);
11015 install_element (BGP_IPV4_NODE
, &bgp_redistribute_ipv4_ospf_cmd
);
11016 install_element (BGP_IPV4_NODE
, &no_bgp_redistribute_ipv4_ospf_cmd
);
11017 install_element (BGP_IPV4_NODE
, &bgp_redistribute_ipv4_ospf_rmap_cmd
);
11018 install_element (BGP_IPV4_NODE
, &bgp_redistribute_ipv4_ospf_metric_cmd
);
11019 install_element (BGP_IPV4_NODE
, &bgp_redistribute_ipv4_ospf_rmap_metric_cmd
);
11020 install_element (BGP_IPV4_NODE
, &bgp_redistribute_ipv4_ospf_metric_rmap_cmd
);
11021 install_element (BGP_IPV6_NODE
, &bgp_redistribute_ipv6_cmd
);
11022 install_element (BGP_IPV6_NODE
, &no_bgp_redistribute_ipv6_cmd
);
11023 install_element (BGP_IPV6_NODE
, &bgp_redistribute_ipv6_rmap_cmd
);
11024 install_element (BGP_IPV6_NODE
, &bgp_redistribute_ipv6_metric_cmd
);
11025 install_element (BGP_IPV6_NODE
, &bgp_redistribute_ipv6_rmap_metric_cmd
);
11026 install_element (BGP_IPV6_NODE
, &bgp_redistribute_ipv6_metric_rmap_cmd
);
11028 /* ttl_security commands */
11029 install_element (BGP_NODE
, &neighbor_ttl_security_cmd
);
11030 install_element (BGP_NODE
, &no_neighbor_ttl_security_cmd
);
11032 /* "show [ip] bgp memory" commands. */
11033 install_element (VIEW_NODE
, &show_bgp_memory_cmd
);
11035 /* "show [ip] bgp views" commands. */
11036 install_element (VIEW_NODE
, &show_bgp_views_cmd
);
11038 /* "show [ip] bgp vrfs" commands. */
11039 install_element (VIEW_NODE
, &show_bgp_vrfs_cmd
);
11041 /* Community-list. */
11042 community_list_vty ();
11045 #include "memory.h"
11046 #include "bgp_regex.h"
11047 #include "bgp_clist.h"
11048 #include "bgp_ecommunity.h"
11050 /* VTY functions. */
11052 /* Direction value to string conversion. */
11053 static const char *
11054 community_direct_str (int direct
)
11058 case COMMUNITY_DENY
:
11060 case COMMUNITY_PERMIT
:
11067 /* Display error string. */
11069 community_list_perror (struct vty
*vty
, int ret
)
11073 case COMMUNITY_LIST_ERR_CANT_FIND_LIST
:
11074 vty_out (vty
, "%% Can't find community-list%s", VTY_NEWLINE
);
11076 case COMMUNITY_LIST_ERR_MALFORMED_VAL
:
11077 vty_out (vty
, "%% Malformed community-list value%s", VTY_NEWLINE
);
11079 case COMMUNITY_LIST_ERR_STANDARD_CONFLICT
:
11080 vty_out (vty
, "%% Community name conflict, previously defined as standard community%s", VTY_NEWLINE
);
11082 case COMMUNITY_LIST_ERR_EXPANDED_CONFLICT
:
11083 vty_out (vty
, "%% Community name conflict, previously defined as expanded community%s", VTY_NEWLINE
);
11088 /* "community-list" keyword help string. */
11089 #define COMMUNITY_LIST_STR "Add a community list entry\n"
11092 /* ip community-list standard */
11093 DEFUN (ip_community_list_standard
,
11094 ip_community_list_standard_cmd
,
11095 "ip community-list <(1-99)|standard WORD> <deny|permit> AA:NN...",
11098 "Community list number (standard)\n"
11099 "Add an standard community-list entry\n"
11100 "Community list name\n"
11101 "Specify community to reject\n"
11102 "Specify community to accept\n"
11105 char *cl_name_or_number
= NULL
;
11107 int style
= COMMUNITY_LIST_STANDARD
;
11110 argv_find (argv
, argc
, "(1-99)", &idx
);
11111 argv_find (argv
, argc
, "WORD", &idx
);
11112 cl_name_or_number
= argv
[idx
]->arg
;
11113 direct
= argv_find (argv
, argc
, "permit", &idx
) ? COMMUNITY_PERMIT
: COMMUNITY_DENY
;
11114 argv_find (argv
, argc
, "AA:NN", &idx
);
11115 char *str
= argv_concat (argv
, argc
, idx
);
11117 int ret
= community_list_set (bgp_clist
, cl_name_or_number
, str
, direct
, style
);
11119 XFREE (MTYPE_TMP
, str
);
11123 /* Display error string. */
11124 community_list_perror (vty
, ret
);
11125 return CMD_WARNING
;
11128 return CMD_SUCCESS
;
11131 DEFUN (no_ip_community_list_standard_all
,
11132 no_ip_community_list_standard_all_cmd
,
11133 "no ip community-list <(1-99)|standard WORD> <deny|permit> AA:NN...",
11137 "Community list number (standard)\n"
11138 "Add an standard community-list entry\n"
11139 "Community list name\n"
11140 "Specify community to reject\n"
11141 "Specify community to accept\n"
11144 int delete_all
= 0;
11146 char *cl_name_or_number
= NULL
;
11148 int style
= COMMUNITY_LIST_STANDARD
;
11151 argv_find (argv
, argc
, "(1-99)", &idx
);
11152 argv_find (argv
, argc
, "WORD", &idx
);
11153 cl_name_or_number
= argv
[idx
]->arg
;
11154 direct
= argv_find (argv
, argc
, "permit", &idx
) ? COMMUNITY_PERMIT
: COMMUNITY_DENY
;
11155 argv_find (argv
, argc
, "AA:NN", &idx
);
11156 char *str
= argv_concat (argv
, argc
, idx
);
11158 int ret
= community_list_unset (bgp_clist
, cl_name_or_number
, str
, direct
, style
, delete_all
);
11160 XFREE (MTYPE_TMP
, str
);
11164 community_list_perror (vty
, ret
);
11165 return CMD_WARNING
;
11168 return CMD_SUCCESS
;
11171 /* ip community-list expanded */
11172 DEFUN (ip_community_list_expanded_all
,
11173 ip_community_list_expanded_all_cmd
,
11174 "ip community-list <(100-500)|expanded WORD> <deny|permit> AA:NN...",
11177 "Community list number (expanded)\n"
11178 "Add an expanded community-list entry\n"
11179 "Community list name\n"
11180 "Specify community to reject\n"
11181 "Specify community to accept\n"
11184 char *cl_name_or_number
= NULL
;
11186 int style
= COMMUNITY_LIST_EXPANDED
;
11189 argv_find (argv
, argc
, "(100-500)", &idx
);
11190 argv_find (argv
, argc
, "WORD", &idx
);
11191 cl_name_or_number
= argv
[idx
]->arg
;
11192 direct
= argv_find (argv
, argc
, "permit", &idx
) ? COMMUNITY_PERMIT
: COMMUNITY_DENY
;
11193 argv_find (argv
, argc
, "AA:NN", &idx
);
11194 char *str
= argv_concat (argv
, argc
, idx
);
11196 int ret
= community_list_set (bgp_clist
, cl_name_or_number
, str
, direct
, style
);
11198 XFREE (MTYPE_TMP
, str
);
11202 /* Display error string. */
11203 community_list_perror (vty
, ret
);
11204 return CMD_WARNING
;
11207 return CMD_SUCCESS
;
11210 DEFUN (no_ip_community_list_expanded_all
,
11211 no_ip_community_list_expanded_all_cmd
,
11212 "no ip community-list <(100-500)|expanded WORD> <deny|permit> AA:NN...",
11216 "Community list number (expanded)\n"
11217 "Add an expanded community-list entry\n"
11218 "Community list name\n"
11219 "Specify community to reject\n"
11220 "Specify community to accept\n"
11223 int delete_all
= 0;
11225 char *cl_name_or_number
= NULL
;
11227 int style
= COMMUNITY_LIST_EXPANDED
;
11230 argv_find (argv
, argc
, "(100-500)", &idx
);
11231 argv_find (argv
, argc
, "WORD", &idx
);
11232 cl_name_or_number
= argv
[idx
]->arg
;
11233 direct
= argv_find (argv
, argc
, "permit", &idx
) ? COMMUNITY_PERMIT
: COMMUNITY_DENY
;
11234 argv_find (argv
, argc
, "AA:NN", &idx
);
11235 char *str
= argv_concat (argv
, argc
, idx
);
11237 int ret
= community_list_unset (bgp_clist
, cl_name_or_number
, str
, direct
, style
, delete_all
);
11239 XFREE (MTYPE_TMP
, str
);
11243 community_list_perror (vty
, ret
);
11244 return CMD_WARNING
;
11247 return CMD_SUCCESS
;
11251 community_list_show (struct vty
*vty
, struct community_list
*list
)
11253 struct community_entry
*entry
;
11255 for (entry
= list
->head
; entry
; entry
= entry
->next
)
11257 if (entry
== list
->head
)
11259 if (all_digit (list
->name
))
11260 vty_out (vty
, "Community %s list %s%s",
11261 entry
->style
== COMMUNITY_LIST_STANDARD
?
11262 "standard" : "(expanded) access",
11263 list
->name
, VTY_NEWLINE
);
11265 vty_out (vty
, "Named Community %s list %s%s",
11266 entry
->style
== COMMUNITY_LIST_STANDARD
?
11267 "standard" : "expanded",
11268 list
->name
, VTY_NEWLINE
);
11271 vty_out (vty
, " %s%s",
11272 community_direct_str (entry
->direct
), VTY_NEWLINE
);
11274 vty_out (vty
, " %s %s%s",
11275 community_direct_str (entry
->direct
),
11276 entry
->style
== COMMUNITY_LIST_STANDARD
11277 ? community_str (entry
->u
.com
) : entry
->config
,
11282 DEFUN (show_ip_community_list
,
11283 show_ip_community_list_cmd
,
11284 "show ip community-list",
11287 "List community-list\n")
11289 struct community_list
*list
;
11290 struct community_list_master
*cm
;
11292 cm
= community_list_master_lookup (bgp_clist
, COMMUNITY_LIST_MASTER
);
11294 return CMD_SUCCESS
;
11296 for (list
= cm
->num
.head
; list
; list
= list
->next
)
11297 community_list_show (vty
, list
);
11299 for (list
= cm
->str
.head
; list
; list
= list
->next
)
11300 community_list_show (vty
, list
);
11302 return CMD_SUCCESS
;
11305 DEFUN (show_ip_community_list_arg
,
11306 show_ip_community_list_arg_cmd
,
11307 "show ip community-list <(1-500)|WORD>",
11310 "List community-list\n"
11311 "Community-list number\n"
11312 "Community-list name\n")
11314 int idx_comm_list
= 3;
11315 struct community_list
*list
;
11317 list
= community_list_lookup (bgp_clist
, argv
[idx_comm_list
]->arg
, COMMUNITY_LIST_MASTER
);
11320 vty_out (vty
, "%% Can't find community-list%s", VTY_NEWLINE
);
11321 return CMD_WARNING
;
11324 community_list_show (vty
, list
);
11326 return CMD_SUCCESS
;
11330 * Large Community code.
11333 lcommunity_list_set_vty (struct vty
*vty
, int argc
, struct cmd_token
**argv
,
11334 int style
, int reject_all_digit_name
)
11342 direct
= argv_find (argv
, argc
, "permit", &idx
) ? COMMUNITY_PERMIT
: COMMUNITY_DENY
;
11344 /* All digit name check. */
11346 argv_find (argv
, argc
, "WORD", &idx
);
11347 argv_find (argv
, argc
, "(1-99)", &idx
);
11348 argv_find (argv
, argc
, "(100-500)", &idx
);
11349 cl_name
= argv
[idx
]->arg
;
11350 if (reject_all_digit_name
&& all_digit (cl_name
))
11352 vty_out (vty
, "%% Community name cannot have all digits%s", VTY_NEWLINE
);
11353 return CMD_WARNING
;
11356 argv_find (argv
, argc
, "AA:BB:CC", &idx
);
11357 argv_find (argv
, argc
, "LINE", &idx
);
11358 /* Concat community string argument. */
11360 str
= argv_concat (argv
, argc
, idx
);
11364 ret
= lcommunity_list_set (bgp_clist
, cl_name
, str
, direct
, style
);
11366 /* Free temporary community list string allocated by
11369 XFREE (MTYPE_TMP
, str
);
11373 community_list_perror (vty
, ret
);
11374 return CMD_WARNING
;
11376 return CMD_SUCCESS
;
11380 lcommunity_list_unset_vty (struct vty
*vty
, int argc
, struct cmd_token
**argv
,
11388 argv_find (argv
, argc
, "permit", &idx
);
11389 argv_find (argv
, argc
, "deny", &idx
);
11393 /* Check the list direct. */
11394 if (strncmp (argv
[idx
]->arg
, "p", 1) == 0)
11395 direct
= COMMUNITY_PERMIT
;
11397 direct
= COMMUNITY_DENY
;
11400 argv_find (argv
, argc
, "LINE", &idx
);
11401 argv_find (argv
, argc
, "AA:AA:NN", &idx
);
11402 /* Concat community string argument. */
11403 str
= argv_concat (argv
, argc
, idx
);
11407 argv_find (argv
, argc
, "(1-99)", &idx
);
11408 argv_find (argv
, argc
, "(100-500)", &idx
);
11409 argv_find (argv
, argc
, "WORD", &idx
);
11411 /* Unset community list. */
11412 ret
= lcommunity_list_unset (bgp_clist
, argv
[idx
]->arg
, str
, direct
, style
);
11414 /* Free temporary community list string allocated by
11417 XFREE (MTYPE_TMP
, str
);
11421 community_list_perror (vty
, ret
);
11422 return CMD_WARNING
;
11425 return CMD_SUCCESS
;
11428 /* "large-community-list" keyword help string. */
11429 #define LCOMMUNITY_LIST_STR "Add a large community list entry\n"
11430 #define LCOMMUNITY_VAL_STR "large community in 'aa:bb:cc' format\n"
11432 DEFUN (ip_lcommunity_list_standard
,
11433 ip_lcommunity_list_standard_cmd
,
11434 "ip large-community-list (1-99) <deny|permit>",
11436 LCOMMUNITY_LIST_STR
11437 "Large Community list number (standard)\n"
11438 "Specify large community to reject\n"
11439 "Specify large community to accept\n"
11440 LCOMMUNITY_VAL_STR
)
11442 return lcommunity_list_set_vty (vty
, argc
, argv
, LARGE_COMMUNITY_LIST_STANDARD
, 0);
11445 DEFUN (ip_lcommunity_list_standard1
,
11446 ip_lcommunity_list_standard1_cmd
,
11447 "ip large-community-list (1-99) <deny|permit> AA:BB:CC...",
11449 LCOMMUNITY_LIST_STR
11450 "Large Community list number (standard)\n"
11451 "Specify large community to reject\n"
11452 "Specify large community to accept\n"
11453 LCOMMUNITY_VAL_STR
)
11455 return lcommunity_list_set_vty (vty
, argc
, argv
, LARGE_COMMUNITY_LIST_STANDARD
, 0);
11458 DEFUN (ip_lcommunity_list_expanded
,
11459 ip_lcommunity_list_expanded_cmd
,
11460 "ip large-community-list (100-500) <deny|permit> LINE...",
11462 LCOMMUNITY_LIST_STR
11463 "Large Community list number (expanded)\n"
11464 "Specify large community to reject\n"
11465 "Specify large community to accept\n"
11466 "An ordered list as a regular-expression\n")
11468 return lcommunity_list_set_vty (vty
, argc
, argv
, LARGE_COMMUNITY_LIST_EXPANDED
, 0);
11471 DEFUN (ip_lcommunity_list_name_standard
,
11472 ip_lcommunity_list_name_standard_cmd
,
11473 "ip large-community-list standard WORD <deny|permit>",
11475 LCOMMUNITY_LIST_STR
11476 "Specify standard large-community-list\n"
11477 "Large Community list name\n"
11478 "Specify large community to reject\n"
11479 "Specify large community to accept\n")
11481 return lcommunity_list_set_vty (vty
, argc
, argv
, LARGE_COMMUNITY_LIST_STANDARD
, 1);
11484 DEFUN (ip_lcommunity_list_name_standard1
,
11485 ip_lcommunity_list_name_standard1_cmd
,
11486 "ip large-community-list standard WORD <deny|permit> AA:BB:CC...",
11488 LCOMMUNITY_LIST_STR
11489 "Specify standard large-community-list\n"
11490 "Large Community list name\n"
11491 "Specify large community to reject\n"
11492 "Specify large community to accept\n"
11493 LCOMMUNITY_VAL_STR
)
11495 return lcommunity_list_set_vty (vty
, argc
, argv
, LARGE_COMMUNITY_LIST_STANDARD
, 1);
11498 DEFUN (ip_lcommunity_list_name_expanded
,
11499 ip_lcommunity_list_name_expanded_cmd
,
11500 "ip large-community-list expanded WORD <deny|permit> LINE...",
11502 LCOMMUNITY_LIST_STR
11503 "Specify expanded large-community-list\n"
11504 "Large Community list name\n"
11505 "Specify large community to reject\n"
11506 "Specify large community to accept\n"
11507 "An ordered list as a regular-expression\n")
11509 return lcommunity_list_set_vty (vty
, argc
, argv
, LARGE_COMMUNITY_LIST_EXPANDED
, 1);
11512 DEFUN (no_ip_lcommunity_list_standard_all
,
11513 no_ip_lcommunity_list_standard_all_cmd
,
11514 "no ip large-community-list <(1-99)|(100-500)|WORD>",
11517 LCOMMUNITY_LIST_STR
11518 "Large Community list number (standard)\n"
11519 "Large Community list number (expanded)\n"
11520 "Large Community list name\n")
11522 return lcommunity_list_unset_vty (vty
, argc
, argv
, LARGE_COMMUNITY_LIST_STANDARD
);
11525 DEFUN (no_ip_lcommunity_list_name_expanded_all
,
11526 no_ip_lcommunity_list_name_expanded_all_cmd
,
11527 "no ip large-community-list expanded WORD",
11530 LCOMMUNITY_LIST_STR
11531 "Specify expanded large-community-list\n"
11532 "Large Community list name\n")
11534 return lcommunity_list_unset_vty (vty
, argc
, argv
, LARGE_COMMUNITY_LIST_EXPANDED
);
11537 DEFUN (no_ip_lcommunity_list_standard
,
11538 no_ip_lcommunity_list_standard_cmd
,
11539 "no ip large-community-list (1-99) <deny|permit> AA:AA:NN...",
11542 LCOMMUNITY_LIST_STR
11543 "Large Community list number (standard)\n"
11544 "Specify large community to reject\n"
11545 "Specify large community to accept\n"
11546 LCOMMUNITY_VAL_STR
)
11548 return lcommunity_list_unset_vty (vty
, argc
, argv
, LARGE_COMMUNITY_LIST_STANDARD
);
11551 DEFUN (no_ip_lcommunity_list_expanded
,
11552 no_ip_lcommunity_list_expanded_cmd
,
11553 "no ip large-community-list (100-500) <deny|permit> LINE...",
11556 LCOMMUNITY_LIST_STR
11557 "Large Community list number (expanded)\n"
11558 "Specify large community to reject\n"
11559 "Specify large community to accept\n"
11560 "An ordered list as a regular-expression\n")
11562 return lcommunity_list_unset_vty (vty
, argc
, argv
, LARGE_COMMUNITY_LIST_EXPANDED
);
11565 DEFUN (no_ip_lcommunity_list_name_standard
,
11566 no_ip_lcommunity_list_name_standard_cmd
,
11567 "no ip large-community-list standard WORD <deny|permit> AA:AA:NN...",
11570 LCOMMUNITY_LIST_STR
11571 "Specify standard large-community-list\n"
11572 "Large Community list name\n"
11573 "Specify large community to reject\n"
11574 "Specify large community to accept\n"
11575 LCOMMUNITY_VAL_STR
)
11577 return lcommunity_list_unset_vty (vty
, argc
, argv
, LARGE_COMMUNITY_LIST_STANDARD
);
11580 DEFUN (no_ip_lcommunity_list_name_expanded
,
11581 no_ip_lcommunity_list_name_expanded_cmd
,
11582 "no ip large-community-list expanded WORD <deny|permit> LINE...",
11585 LCOMMUNITY_LIST_STR
11586 "Specify expanded large-community-list\n"
11587 "Large community list name\n"
11588 "Specify large community to reject\n"
11589 "Specify large community to accept\n"
11590 "An ordered list as a regular-expression\n")
11592 return lcommunity_list_unset_vty (vty
, argc
, argv
, LARGE_COMMUNITY_LIST_EXPANDED
);
11596 lcommunity_list_show (struct vty
*vty
, struct community_list
*list
)
11598 struct community_entry
*entry
;
11600 for (entry
= list
->head
; entry
; entry
= entry
->next
)
11602 if (entry
== list
->head
)
11604 if (all_digit (list
->name
))
11605 vty_out (vty
, "Large community %s list %s%s",
11606 entry
->style
== EXTCOMMUNITY_LIST_STANDARD
?
11607 "standard" : "(expanded) access",
11608 list
->name
, VTY_NEWLINE
);
11610 vty_out (vty
, "Named large community %s list %s%s",
11611 entry
->style
== EXTCOMMUNITY_LIST_STANDARD
?
11612 "standard" : "expanded",
11613 list
->name
, VTY_NEWLINE
);
11616 vty_out (vty
, " %s%s",
11617 community_direct_str (entry
->direct
), VTY_NEWLINE
);
11619 vty_out (vty
, " %s %s%s",
11620 community_direct_str (entry
->direct
),
11621 entry
->style
== EXTCOMMUNITY_LIST_STANDARD
?
11622 entry
->u
.ecom
->str
: entry
->config
,
11627 DEFUN (show_ip_lcommunity_list
,
11628 show_ip_lcommunity_list_cmd
,
11629 "show ip large-community-list",
11632 "List large-community list\n")
11634 struct community_list
*list
;
11635 struct community_list_master
*cm
;
11637 cm
= community_list_master_lookup (bgp_clist
, LARGE_COMMUNITY_LIST_MASTER
);
11639 return CMD_SUCCESS
;
11641 for (list
= cm
->num
.head
; list
; list
= list
->next
)
11642 lcommunity_list_show (vty
, list
);
11644 for (list
= cm
->str
.head
; list
; list
= list
->next
)
11645 lcommunity_list_show (vty
, list
);
11647 return CMD_SUCCESS
;
11650 DEFUN (show_ip_lcommunity_list_arg
,
11651 show_ip_lcommunity_list_arg_cmd
,
11652 "show ip large-community-list <(1-500)|WORD>",
11655 "List large-community list\n"
11656 "large-community-list number\n"
11657 "large-community-list name\n")
11659 struct community_list
*list
;
11661 list
= community_list_lookup (bgp_clist
, argv
[3]->arg
, LARGE_COMMUNITY_LIST_MASTER
);
11664 vty_out (vty
, "%% Can't find extcommunity-list%s", VTY_NEWLINE
);
11665 return CMD_WARNING
;
11668 lcommunity_list_show (vty
, list
);
11670 return CMD_SUCCESS
;
11673 /* "extcommunity-list" keyword help string. */
11674 #define EXTCOMMUNITY_LIST_STR "Add a extended community list entry\n"
11675 #define EXTCOMMUNITY_VAL_STR "Extended community attribute in 'rt aa:nn_or_IPaddr:nn' OR 'soo aa:nn_or_IPaddr:nn' format\n"
11677 DEFUN (ip_extcommunity_list_standard
,
11678 ip_extcommunity_list_standard_cmd
,
11679 "ip extcommunity-list <(1-99)|standard WORD> <deny|permit> AA:NN...",
11681 EXTCOMMUNITY_LIST_STR
11682 "Extended Community list number (standard)\n"
11683 "Specify standard extcommunity-list\n"
11684 "Community list name\n"
11685 "Specify community to reject\n"
11686 "Specify community to accept\n"
11687 EXTCOMMUNITY_VAL_STR
)
11689 int style
= EXTCOMMUNITY_LIST_STANDARD
;
11691 char *cl_number_or_name
= NULL
;
11694 argv_find (argv
, argc
, "(1-99)", &idx
);
11695 argv_find (argv
, argc
, "WORD", &idx
);
11696 cl_number_or_name
= argv
[idx
]->arg
;
11697 direct
= argv_find (argv
, argc
, "permit", &idx
) ? COMMUNITY_PERMIT
: COMMUNITY_DENY
;
11698 argv_find (argv
, argc
, "AA:NN", &idx
);
11699 char *str
= argv_concat (argv
, argc
, idx
);
11701 int ret
= extcommunity_list_set (bgp_clist
, cl_number_or_name
, str
, direct
, style
);
11703 XFREE (MTYPE_TMP
, str
);
11707 community_list_perror (vty
, ret
);
11708 return CMD_WARNING
;
11711 return CMD_SUCCESS
;
11714 DEFUN (ip_extcommunity_list_name_expanded
,
11715 ip_extcommunity_list_name_expanded_cmd
,
11716 "ip extcommunity-list <(100-500)|expanded WORD> <deny|permit> LINE...",
11718 EXTCOMMUNITY_LIST_STR
11719 "Extended Community list number (expanded)\n"
11720 "Specify expanded extcommunity-list\n"
11721 "Extended Community list name\n"
11722 "Specify community to reject\n"
11723 "Specify community to accept\n"
11724 "An ordered list as a regular-expression\n")
11726 int style
= EXTCOMMUNITY_LIST_EXPANDED
;
11728 char *cl_number_or_name
= NULL
;
11731 argv_find (argv
, argc
, "(100-500)", &idx
);
11732 argv_find (argv
, argc
, "WORD", &idx
);
11733 cl_number_or_name
= argv
[idx
]->arg
;
11734 direct
= argv_find (argv
, argc
, "permit", &idx
) ? COMMUNITY_PERMIT
: COMMUNITY_DENY
;
11735 argv_find (argv
, argc
, "LINE", &idx
);
11736 char *str
= argv_concat (argv
, argc
, idx
);
11738 int ret
= extcommunity_list_set (bgp_clist
, cl_number_or_name
, str
, direct
, style
);
11740 XFREE (MTYPE_TMP
, str
);
11744 community_list_perror (vty
, ret
);
11745 return CMD_WARNING
;
11748 return CMD_SUCCESS
;
11751 DEFUN (no_ip_extcommunity_list_standard_all
,
11752 no_ip_extcommunity_list_standard_all_cmd
,
11753 "no ip extcommunity-list <(1-99)|standard WORD> <deny|permit> AA:NN...",
11756 EXTCOMMUNITY_LIST_STR
11757 "Extended Community list number (standard)\n"
11758 "Specify standard extcommunity-list\n"
11759 "Community list name\n"
11760 "Specify community to reject\n"
11761 "Specify community to accept\n"
11762 EXTCOMMUNITY_VAL_STR
)
11766 int style
= EXTCOMMUNITY_LIST_STANDARD
;
11768 char *cl_number_or_name
= NULL
;
11771 argv_find (argv
, argc
, "(1-99)", &idx
);
11772 argv_find (argv
, argc
, "WORD", &idx
);
11773 cl_number_or_name
= argv
[idx
]->arg
;
11774 direct
= argv_find (argv
, argc
, "permit", &idx
) ? COMMUNITY_PERMIT
: COMMUNITY_DENY
;
11775 argv_find (argv
, argc
, "AA:NN", &idx
);
11776 char *str
= argv_concat (argv
, argc
, idx
);
11778 int ret
= extcommunity_list_unset (bgp_clist
, cl_number_or_name
, str
, direct
, style
, deleteall
);
11780 XFREE (MTYPE_TMP
, str
);
11784 community_list_perror (vty
, ret
);
11785 return CMD_WARNING
;
11788 return CMD_SUCCESS
;
11791 DEFUN (no_ip_extcommunity_list_expanded_all
,
11792 no_ip_extcommunity_list_expanded_all_cmd
,
11793 "no ip extcommunity-list <(100-500)|expanded WORD> <deny|permit> LINE...",
11796 EXTCOMMUNITY_LIST_STR
11797 "Extended Community list number (expanded)\n"
11798 "Specify expanded extcommunity-list\n"
11799 "Extended Community list name\n"
11800 "Specify community to reject\n"
11801 "Specify community to accept\n"
11802 "An ordered list as a regular-expression\n")
11806 int style
= EXTCOMMUNITY_LIST_EXPANDED
;
11808 char *cl_number_or_name
= NULL
;
11811 argv_find (argv
, argc
, "(100-500)", &idx
);
11812 argv_find (argv
, argc
, "WORD", &idx
);
11813 cl_number_or_name
= argv
[idx
]->arg
;
11814 direct
= argv_find (argv
, argc
, "permit", &idx
) ? COMMUNITY_PERMIT
: COMMUNITY_DENY
;
11815 argv_find (argv
, argc
, "LINE", &idx
);
11816 char *str
= argv_concat (argv
, argc
, idx
);
11818 int ret
= extcommunity_list_unset (bgp_clist
, cl_number_or_name
, str
, direct
, style
, deleteall
);
11820 XFREE (MTYPE_TMP
, str
);
11824 community_list_perror (vty
, ret
);
11825 return CMD_WARNING
;
11828 return CMD_SUCCESS
;
11832 extcommunity_list_show (struct vty
*vty
, struct community_list
*list
)
11834 struct community_entry
*entry
;
11836 for (entry
= list
->head
; entry
; entry
= entry
->next
)
11838 if (entry
== list
->head
)
11840 if (all_digit (list
->name
))
11841 vty_out (vty
, "Extended community %s list %s%s",
11842 entry
->style
== EXTCOMMUNITY_LIST_STANDARD
?
11843 "standard" : "(expanded) access",
11844 list
->name
, VTY_NEWLINE
);
11846 vty_out (vty
, "Named extended community %s list %s%s",
11847 entry
->style
== EXTCOMMUNITY_LIST_STANDARD
?
11848 "standard" : "expanded",
11849 list
->name
, VTY_NEWLINE
);
11852 vty_out (vty
, " %s%s",
11853 community_direct_str (entry
->direct
), VTY_NEWLINE
);
11855 vty_out (vty
, " %s %s%s",
11856 community_direct_str (entry
->direct
),
11857 entry
->style
== EXTCOMMUNITY_LIST_STANDARD
?
11858 entry
->u
.ecom
->str
: entry
->config
,
11863 DEFUN (show_ip_extcommunity_list
,
11864 show_ip_extcommunity_list_cmd
,
11865 "show ip extcommunity-list",
11868 "List extended-community list\n")
11870 struct community_list
*list
;
11871 struct community_list_master
*cm
;
11873 cm
= community_list_master_lookup (bgp_clist
, EXTCOMMUNITY_LIST_MASTER
);
11875 return CMD_SUCCESS
;
11877 for (list
= cm
->num
.head
; list
; list
= list
->next
)
11878 extcommunity_list_show (vty
, list
);
11880 for (list
= cm
->str
.head
; list
; list
= list
->next
)
11881 extcommunity_list_show (vty
, list
);
11883 return CMD_SUCCESS
;
11886 DEFUN (show_ip_extcommunity_list_arg
,
11887 show_ip_extcommunity_list_arg_cmd
,
11888 "show ip extcommunity-list <(1-500)|WORD>",
11891 "List extended-community list\n"
11892 "Extcommunity-list number\n"
11893 "Extcommunity-list name\n")
11895 int idx_comm_list
= 3;
11896 struct community_list
*list
;
11898 list
= community_list_lookup (bgp_clist
, argv
[idx_comm_list
]->arg
, EXTCOMMUNITY_LIST_MASTER
);
11901 vty_out (vty
, "%% Can't find extcommunity-list%s", VTY_NEWLINE
);
11902 return CMD_WARNING
;
11905 extcommunity_list_show (vty
, list
);
11907 return CMD_SUCCESS
;
11910 /* Return configuration string of community-list entry. */
11911 static const char *
11912 community_list_config_str (struct community_entry
*entry
)
11920 if (entry
->style
== COMMUNITY_LIST_STANDARD
)
11921 str
= community_str (entry
->u
.com
);
11923 str
= entry
->config
;
11928 /* Display community-list and extcommunity-list configuration. */
11930 community_list_config_write (struct vty
*vty
)
11932 struct community_list
*list
;
11933 struct community_entry
*entry
;
11934 struct community_list_master
*cm
;
11937 /* Community-list. */
11938 cm
= community_list_master_lookup (bgp_clist
, COMMUNITY_LIST_MASTER
);
11940 for (list
= cm
->num
.head
; list
; list
= list
->next
)
11941 for (entry
= list
->head
; entry
; entry
= entry
->next
)
11943 vty_out (vty
, "ip community-list %s %s %s%s",
11944 list
->name
, community_direct_str (entry
->direct
),
11945 community_list_config_str (entry
),
11949 for (list
= cm
->str
.head
; list
; list
= list
->next
)
11950 for (entry
= list
->head
; entry
; entry
= entry
->next
)
11952 vty_out (vty
, "ip community-list %s %s %s %s%s",
11953 entry
->style
== COMMUNITY_LIST_STANDARD
11954 ? "standard" : "expanded",
11955 list
->name
, community_direct_str (entry
->direct
),
11956 community_list_config_str (entry
),
11961 /* Extcommunity-list. */
11962 cm
= community_list_master_lookup (bgp_clist
, EXTCOMMUNITY_LIST_MASTER
);
11964 for (list
= cm
->num
.head
; list
; list
= list
->next
)
11965 for (entry
= list
->head
; entry
; entry
= entry
->next
)
11967 vty_out (vty
, "ip extcommunity-list %s %s %s%s",
11968 list
->name
, community_direct_str (entry
->direct
),
11969 community_list_config_str (entry
), VTY_NEWLINE
);
11972 for (list
= cm
->str
.head
; list
; list
= list
->next
)
11973 for (entry
= list
->head
; entry
; entry
= entry
->next
)
11975 vty_out (vty
, "ip extcommunity-list %s %s %s %s%s",
11976 entry
->style
== EXTCOMMUNITY_LIST_STANDARD
11977 ? "standard" : "expanded",
11978 list
->name
, community_direct_str (entry
->direct
),
11979 community_list_config_str (entry
), VTY_NEWLINE
);
11984 /* lcommunity-list. */
11985 cm
= community_list_master_lookup (bgp_clist
, LARGE_COMMUNITY_LIST_MASTER
);
11987 for (list
= cm
->num
.head
; list
; list
= list
->next
)
11988 for (entry
= list
->head
; entry
; entry
= entry
->next
)
11990 vty_out (vty
, "ip large-community-list %s %s %s%s",
11991 list
->name
, community_direct_str (entry
->direct
),
11992 community_list_config_str (entry
), VTY_NEWLINE
);
11995 for (list
= cm
->str
.head
; list
; list
= list
->next
)
11996 for (entry
= list
->head
; entry
; entry
= entry
->next
)
11998 vty_out (vty
, "ip large-community-list %s %s %s %s%s",
11999 entry
->style
== LARGE_COMMUNITY_LIST_STANDARD
12000 ? "standard" : "expanded",
12001 list
->name
, community_direct_str (entry
->direct
),
12002 community_list_config_str (entry
), VTY_NEWLINE
);
12009 static struct cmd_node community_list_node
=
12011 COMMUNITY_LIST_NODE
,
12013 1 /* Export to vtysh. */
12017 community_list_vty (void)
12019 install_node (&community_list_node
, community_list_config_write
);
12021 /* Community-list. */
12022 install_element (CONFIG_NODE
, &ip_community_list_standard_cmd
);
12023 install_element (CONFIG_NODE
, &ip_community_list_expanded_all_cmd
);
12024 install_element (CONFIG_NODE
, &no_ip_community_list_standard_all_cmd
);
12025 install_element (CONFIG_NODE
, &no_ip_community_list_expanded_all_cmd
);
12026 install_element (VIEW_NODE
, &show_ip_community_list_cmd
);
12027 install_element (VIEW_NODE
, &show_ip_community_list_arg_cmd
);
12029 /* Extcommunity-list. */
12030 install_element (CONFIG_NODE
, &ip_extcommunity_list_standard_cmd
);
12031 install_element (CONFIG_NODE
, &ip_extcommunity_list_name_expanded_cmd
);
12032 install_element (CONFIG_NODE
, &no_ip_extcommunity_list_standard_all_cmd
);
12033 install_element (CONFIG_NODE
, &no_ip_extcommunity_list_expanded_all_cmd
);
12034 install_element (VIEW_NODE
, &show_ip_extcommunity_list_cmd
);
12035 install_element (VIEW_NODE
, &show_ip_extcommunity_list_arg_cmd
);
12037 /* Large Community List */
12038 install_element (CONFIG_NODE
, &ip_lcommunity_list_standard_cmd
);
12039 install_element (CONFIG_NODE
, &ip_lcommunity_list_standard1_cmd
);
12040 install_element (CONFIG_NODE
, &ip_lcommunity_list_expanded_cmd
);
12041 install_element (CONFIG_NODE
, &ip_lcommunity_list_name_standard_cmd
);
12042 install_element (CONFIG_NODE
, &ip_lcommunity_list_name_standard1_cmd
);
12043 install_element (CONFIG_NODE
, &ip_lcommunity_list_name_expanded_cmd
);
12044 install_element (CONFIG_NODE
, &no_ip_lcommunity_list_standard_all_cmd
);
12045 install_element (CONFIG_NODE
, &no_ip_lcommunity_list_name_expanded_all_cmd
);
12046 install_element (CONFIG_NODE
, &no_ip_lcommunity_list_standard_cmd
);
12047 install_element (CONFIG_NODE
, &no_ip_lcommunity_list_expanded_cmd
);
12048 install_element (CONFIG_NODE
, &no_ip_lcommunity_list_name_standard_cmd
);
12049 install_element (CONFIG_NODE
, &no_ip_lcommunity_list_name_expanded_cmd
);
12050 install_element (VIEW_NODE
, &show_ip_lcommunity_list_cmd
);
12051 install_element (VIEW_NODE
, &show_ip_lcommunity_list_arg_cmd
);