diff options
Diffstat (limited to 'bgpd/bgp_vty.c')
-rw-r--r-- | bgpd/bgp_vty.c | 224 |
1 files changed, 186 insertions, 38 deletions
diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 9a4e4b7af..e574ae780 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -78,6 +78,8 @@ #ifdef ENABLE_BGP_VNC #include "bgpd/rfapi/bgp_rfapi_cfg.h" #endif +#include "bgpd/bgp_orr.h" + FRR_CFG_DEFAULT_BOOL(BGP_IMPORT_CHECK, { @@ -295,10 +297,9 @@ static int bgp_srv6_locator_unset(struct bgp *bgp) { int ret; struct listnode *node, *nnode; - struct srv6_locator_chunk *chunk; + struct srv6_locator_chunk *chunk, *tovpn_sid_locator; struct bgp_srv6_function *func; struct bgp *bgp_vrf; - struct in6_addr *tovpn_sid; /* release chunk notification via ZAPI */ ret = bgp_zebra_srv6_manager_release_locator_chunk( @@ -324,16 +325,12 @@ static int bgp_srv6_locator_unset(struct bgp *bgp) continue; /* refresh vpnv4 tovpn_sid */ - tovpn_sid = bgp_vrf->vpn_policy[AFI_IP].tovpn_sid; - if (tovpn_sid) - XFREE(MTYPE_BGP_SRV6_SID, - bgp_vrf->vpn_policy[AFI_IP].tovpn_sid); + XFREE(MTYPE_BGP_SRV6_SID, + bgp_vrf->vpn_policy[AFI_IP].tovpn_sid); /* refresh vpnv6 tovpn_sid */ - tovpn_sid = bgp_vrf->vpn_policy[AFI_IP6].tovpn_sid; - if (tovpn_sid) - XFREE(MTYPE_BGP_SRV6_SID, - bgp_vrf->vpn_policy[AFI_IP6].tovpn_sid); + XFREE(MTYPE_BGP_SRV6_SID, + bgp_vrf->vpn_policy[AFI_IP6].tovpn_sid); } /* update vpn bgp processes */ @@ -345,12 +342,20 @@ static int bgp_srv6_locator_unset(struct bgp *bgp) continue; /* refresh vpnv4 tovpn_sid_locator */ - XFREE(MTYPE_BGP_SRV6_SID, - bgp_vrf->vpn_policy[AFI_IP].tovpn_sid_locator); + tovpn_sid_locator = + bgp_vrf->vpn_policy[AFI_IP].tovpn_sid_locator; + if (tovpn_sid_locator) { + srv6_locator_chunk_free(tovpn_sid_locator); + bgp_vrf->vpn_policy[AFI_IP].tovpn_sid_locator = NULL; + } /* refresh vpnv6 tovpn_sid_locator */ - XFREE(MTYPE_BGP_SRV6_SID, - bgp_vrf->vpn_policy[AFI_IP6].tovpn_sid_locator); + tovpn_sid_locator = + bgp_vrf->vpn_policy[AFI_IP6].tovpn_sid_locator; + if (tovpn_sid_locator) { + srv6_locator_chunk_free(tovpn_sid_locator); + bgp_vrf->vpn_policy[AFI_IP6].tovpn_sid_locator = NULL; + } } /* clear locator name */ @@ -873,9 +878,6 @@ int bgp_vty_return(struct vty *vty, enum bgp_create_error_code ret) case BGP_ERR_REMOVE_PRIVATE_AS: str = "remove-private-AS cannot be configured for IBGP peers"; break; - case BGP_ERR_LOCAL_AS_ALLOWED_ONLY_FOR_EBGP: - str = "Local-AS allowed only for EBGP peers"; - break; case BGP_ERR_CANNOT_HAVE_LOCAL_AS_SAME_AS: str = "Cannot have local-as same as BGP AS number"; break; @@ -936,9 +938,6 @@ int bgp_vty_return(struct vty *vty, enum bgp_create_error_code ret) case BGP_ERR_AF_UNCONFIGURED: str = "AFI/SAFI specified is not currently configured."; break; - case BGP_ERR_CANNOT_HAVE_LOCAL_AS_SAME_AS_REMOTE_AS: - str = "AS specified for local as is the same as the remote as and this is not allowed."; - break; case BGP_ERR_INVALID_AS: str = "Confederation AS specified is the same AS as our AS."; break; @@ -948,6 +947,9 @@ int bgp_vty_return(struct vty *vty, enum bgp_create_error_code ret) case BGP_ERR_INVALID_INTERNAL_ROLE: str = "External roles can be set only on eBGP session"; break; + case BGP_ERR_PEER_ORR_CONFIGURED: + str = "Deconfigure optimal-route-reflection on this peer first"; + break; } if (str) { vty_out(vty, "%% %s\n", str); @@ -2354,6 +2356,15 @@ void bgp_config_write_coalesce_time(struct vty *vty, struct bgp *bgp) vty_out(vty, " coalesce-time %u\n", bgp->coalesce_time); } +/* BGP TCP keepalive */ +static void bgp_config_tcp_keepalive(struct vty *vty, struct bgp *bgp) +{ + if (bgp->tcp_keepalive_idle) { + vty_out(vty, " bgp tcp-keepalive %u %u %u\n", + bgp->tcp_keepalive_idle, bgp->tcp_keepalive_intvl, + bgp->tcp_keepalive_probes); + } +} DEFUN (bgp_coalesce_time, bgp_coalesce_time_cmd, @@ -2577,6 +2588,38 @@ DEFUN(no_bgp_minimum_holdtime, no_bgp_minimum_holdtime_cmd, return CMD_SUCCESS; } +DEFPY(bgp_tcp_keepalive, bgp_tcp_keepalive_cmd, + "bgp tcp-keepalive (1-65535)$idle (1-65535)$intvl (1-30)$probes", + BGP_STR + "TCP keepalive parameters\n" + "TCP keepalive idle time (seconds)\n" + "TCP keepalive interval (seconds)\n" + "TCP keepalive maximum probes\n") +{ + VTY_DECLVAR_CONTEXT(bgp, bgp); + + bgp_tcp_keepalive_set(bgp, (uint16_t)idle, (uint16_t)intvl, + (uint16_t)probes); + + return CMD_SUCCESS; +} + +DEFPY(no_bgp_tcp_keepalive, no_bgp_tcp_keepalive_cmd, + "no bgp tcp-keepalive [(1-65535) (1-65535) (1-30)]", + NO_STR + BGP_STR + "TCP keepalive parameters\n" + "TCP keepalive idle time (seconds)\n" + "TCP keepalive interval (seconds)\n" + "TCP keepalive maximum probes\n") +{ + VTY_DECLVAR_CONTEXT(bgp, bgp); + + bgp_tcp_keepalive_unset(bgp); + + return CMD_SUCCESS; +} + DEFUN (bgp_client_to_client_reflection, bgp_client_to_client_reflection_cmd, "bgp client-to-client reflection", @@ -6163,6 +6206,43 @@ ALIAS_HIDDEN(no_neighbor_route_reflector_client, NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Configure a neighbor as Route Reflector client\n") +/* optimal-route-reflection Root Routers configuration */ +DEFPY (optimal_route_reflection, + optimal_route_reflection_cmd, + "[no$no] optimal-route-reflection WORD$orr_group [<A.B.C.D|X:X::X:X>$primary [<A.B.C.D|X:X::X:X>$secondary [<A.B.C.D|X:X::X:X>$tertiary]]]", + NO_STR + "Create ORR group and assign root router(s)\n" + "ORR Group name\n" + "Primary Root address\n" + "Primary Root IPv6 address\n" + "Secondary Root address\n" + "Secondary Root IPv6 address\n" + "Tertiary Root address\n" + "Tertiary Root IPv6 address\n") +{ + if (!no && !primary) { + vty_out(vty, "%% Specify Primary Root address\n"); + return CMD_WARNING_CONFIG_FAILED; + } + return bgp_afi_safi_orr_group_set_vty( + vty, bgp_node_afi(vty), bgp_node_safi(vty), orr_group, + primary_str, secondary_str, tertiary_str, !!no); +} + +/* neighbor optimal-route-reflection group*/ +DEFPY (neighbor_optimal_route_reflection, + neighbor_optimal_route_reflection_cmd, + "[no$no] neighbor <A.B.C.D|X:X::X:X|WORD>$neighbor optimal-route-reflection WORD$orr_group", + NO_STR + NEIGHBOR_STR + NEIGHBOR_ADDR_STR2 + "Apply ORR group configuration to the neighbor\n" + "ORR group name\n") +{ + return peer_orr_group_set_vty(vty, neighbor, bgp_node_afi(vty), + bgp_node_safi(vty), orr_group, !!no); +} + /* neighbor route-server-client. */ DEFUN (neighbor_route_server_client, neighbor_route_server_client_cmd, @@ -8247,6 +8327,32 @@ ALIAS_HIDDEN( "Only give warning message when limit is exceeded\n" "Force checking all received routes not only accepted\n") +/* "neighbor accept-own" */ +DEFPY (neighbor_accept_own, + neighbor_accept_own_cmd, + "[no$no] neighbor <A.B.C.D|X:X::X:X|WORD>$neighbor accept-own", + NO_STR + NEIGHBOR_STR + NEIGHBOR_ADDR_STR2 + "Enable handling of self-originated VPN routes containing ACCEPT_OWN community\n") +{ + struct peer *peer; + afi_t afi = bgp_node_afi(vty); + safi_t safi = bgp_node_safi(vty); + int ret; + + peer = peer_and_group_lookup_vty(vty, neighbor); + if (!peer) + return CMD_WARNING_CONFIG_FAILED; + + if (no) + ret = peer_af_flag_unset(peer, afi, safi, PEER_FLAG_ACCEPT_OWN); + else + ret = peer_af_flag_set(peer, afi, safi, PEER_FLAG_ACCEPT_OWN); + + return bgp_vty_return(vty, ret); +} + /* "neighbor soo" */ DEFPY (neighbor_soo, neighbor_soo_cmd, @@ -8860,7 +8966,7 @@ DEFPY (af_label_vpn_export, DEFPY (af_sid_vpn_export, af_sid_vpn_export_cmd, - "[no] sid vpn export <(1-255)$sid_idx|auto$sid_auto>", + "[no] sid vpn export <(1-1048575)$sid_idx|auto$sid_auto>", NO_STR "sid value for VRF\n" "Between current address-family and vpn\n" @@ -9637,11 +9743,7 @@ DEFPY (show_bgp_srv6, struct listnode *node; struct srv6_locator_chunk *chunk; struct bgp_srv6_function *func; - struct in6_addr *tovpn4_sid; - struct in6_addr *tovpn6_sid; char buf[256]; - char buf_tovpn4_sid[256]; - char buf_tovpn6_sid[256]; bgp = bgp_get_default(); if (!bgp) @@ -9664,19 +9766,10 @@ DEFPY (show_bgp_srv6, vty_out(vty, "- name: %s\n", bgp->name ? bgp->name : "default"); - tovpn4_sid = bgp->vpn_policy[AFI_IP].tovpn_sid; - tovpn6_sid = bgp->vpn_policy[AFI_IP6].tovpn_sid; - if (tovpn4_sid) - inet_ntop(AF_INET6, tovpn4_sid, buf_tovpn4_sid, - sizeof(buf_tovpn4_sid)); - if (tovpn6_sid) - inet_ntop(AF_INET6, tovpn6_sid, buf_tovpn6_sid, - sizeof(buf_tovpn6_sid)); - - vty_out(vty, " vpn_policy[AFI_IP].tovpn_sid: %s\n", - tovpn4_sid ? buf_tovpn4_sid : "none"); - vty_out(vty, " vpn_policy[AFI_IP6].tovpn_sid: %s\n", - tovpn6_sid ? buf_tovpn6_sid : "none"); + vty_out(vty, " vpn_policy[AFI_IP].tovpn_sid: %pI6\n", + bgp->vpn_policy[AFI_IP].tovpn_sid); + vty_out(vty, " vpn_policy[AFI_IP6].tovpn_sid: %pI6\n", + bgp->vpn_policy[AFI_IP6].tovpn_sid); } return CMD_SUCCESS; @@ -12363,6 +12456,11 @@ static void bgp_show_peer_afi(struct vty *vty, struct peer *p, afi_t afi, if (CHECK_FLAG(p->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT)) vty_out(vty, " Route-Server Client\n"); + + if (peer_af_flag_check(p, afi, safi, PEER_FLAG_ORR_GROUP)) + vty_out(vty, " ORR group (configured) : %s\n", + p->orr_group_name[afi][safi]); + if (CHECK_FLAG(p->af_flags[afi][safi], PEER_FLAG_SOFT_RECONFIG)) vty_out(vty, " Inbound soft reconfiguration allowed\n"); @@ -17290,6 +17388,10 @@ static void bgp_config_write_peer_af(struct vty *vty, struct bgp *bgp, } } + /* accept-own */ + if (peergroup_af_flag_check(peer, afi, safi, PEER_FLAG_ACCEPT_OWN)) + vty_out(vty, " neighbor %s accept-own\n", addr); + /* soo */ if (peergroup_af_flag_check(peer, afi, safi, PEER_FLAG_SOO)) { char *soo_str = ecommunity_ecom2str( @@ -17339,6 +17441,10 @@ static void bgp_config_write_peer_af(struct vty *vty, struct bgp *bgp, : ""); } } + + if (peer_af_flag_check(peer, afi, safi, PEER_FLAG_ORR_GROUP)) + vty_out(vty, " neighbor %s optimal-route-reflection %s\n", + addr, peer->orr_group_name[afi][safi]); } static void bgp_vpn_config_write(struct vty *vty, struct bgp *bgp, afi_t afi, @@ -17445,6 +17551,9 @@ static void bgp_config_write_family(struct vty *vty, struct bgp *bgp, afi_t afi, } } + /* Optimal Route Reflection */ + bgp_config_write_orr(vty, bgp, afi, safi); + vty_endframe(vty, " exit-address-family\n"); } @@ -17717,6 +17826,9 @@ int bgp_config_write(struct vty *vty) vty_out(vty, " bgp graceful-restart preserve-fw-state\n"); + /* BGP TCP keepalive */ + bgp_config_tcp_keepalive(vty, bgp); + /* Stale timer for RIB */ if (bgp->rib_stale_time != BGP_DEFAULT_RIB_STALE_TIME) vty_out(vty, @@ -18951,6 +19063,34 @@ void bgp_vty_init(void) install_element(BGP_EVPN_NODE, &neighbor_route_reflector_client_cmd); install_element(BGP_EVPN_NODE, &no_neighbor_route_reflector_client_cmd); + /* "optimal-route-reflection" commands */ + install_element(BGP_IPV4_NODE, &optimal_route_reflection_cmd); + install_element(BGP_IPV4M_NODE, &optimal_route_reflection_cmd); + install_element(BGP_IPV4L_NODE, &optimal_route_reflection_cmd); + install_element(BGP_IPV6_NODE, &optimal_route_reflection_cmd); + install_element(BGP_IPV6M_NODE, &optimal_route_reflection_cmd); + install_element(BGP_IPV6L_NODE, &optimal_route_reflection_cmd); + install_element(BGP_VPNV4_NODE, &optimal_route_reflection_cmd); + install_element(BGP_VPNV6_NODE, &optimal_route_reflection_cmd); + install_element(BGP_FLOWSPECV4_NODE, &optimal_route_reflection_cmd); + install_element(BGP_FLOWSPECV6_NODE, &optimal_route_reflection_cmd); + install_element(BGP_EVPN_NODE, &optimal_route_reflection_cmd); + + /* "neighbor optimal-route-reflection" commands */ + install_element(BGP_IPV4_NODE, &neighbor_optimal_route_reflection_cmd); + install_element(BGP_IPV4M_NODE, &neighbor_optimal_route_reflection_cmd); + install_element(BGP_IPV4L_NODE, &neighbor_optimal_route_reflection_cmd); + install_element(BGP_IPV6_NODE, &neighbor_optimal_route_reflection_cmd); + install_element(BGP_IPV6M_NODE, &neighbor_optimal_route_reflection_cmd); + install_element(BGP_IPV6L_NODE, &neighbor_optimal_route_reflection_cmd); + install_element(BGP_VPNV4_NODE, &neighbor_optimal_route_reflection_cmd); + install_element(BGP_VPNV6_NODE, &neighbor_optimal_route_reflection_cmd); + install_element(BGP_FLOWSPECV4_NODE, + &neighbor_optimal_route_reflection_cmd); + install_element(BGP_FLOWSPECV6_NODE, + &neighbor_optimal_route_reflection_cmd); + install_element(BGP_EVPN_NODE, &neighbor_optimal_route_reflection_cmd); + /* "neighbor route-server" commands.*/ install_element(BGP_NODE, &neighbor_route_server_client_hidden_cmd); install_element(BGP_NODE, &no_neighbor_route_server_client_hidden_cmd); @@ -19461,6 +19601,10 @@ void bgp_vty_init(void) install_element(BGP_EVPN_NODE, &neighbor_allowas_in_cmd); install_element(BGP_EVPN_NODE, &no_neighbor_allowas_in_cmd); + /* neighbor accept-own */ + install_element(BGP_VPNV4_NODE, &neighbor_accept_own_cmd); + install_element(BGP_VPNV6_NODE, &neighbor_accept_own_cmd); + /* "neighbor soo" */ install_element(BGP_IPV4_NODE, &neighbor_soo_cmd); install_element(BGP_IPV4_NODE, &no_neighbor_soo_cmd); @@ -19596,6 +19740,10 @@ void bgp_vty_init(void) install_element(BGP_NODE, &neighbor_ttl_security_cmd); install_element(BGP_NODE, &no_neighbor_ttl_security_cmd); + /* "bgp tcp-keepalive" commands */ + install_element(BGP_NODE, &bgp_tcp_keepalive_cmd); + install_element(BGP_NODE, &no_bgp_tcp_keepalive_cmd); + /* "show [ip] bgp memory" commands. */ install_element(VIEW_NODE, &show_bgp_memory_cmd); |