mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-15 18:56:40 +00:00
zebra: add knob to accept lower seq in evpn
Add a knob to accept lower seq number in evpn updates from BGP in Zebra. Note: Knob is enabled by default Signed-off-by: Stephen Worley <sworley@nvidia.com>
This commit is contained in:
parent
9daf964bc8
commit
7d99ad7f93
@ -1597,6 +1597,7 @@ static inline bool zebra_evpn_mac_is_bgp_seq_ok(struct zebra_evpn *zevpn,
|
||||
bool sync)
|
||||
{
|
||||
char ipbuf[INET6_ADDRSTRLEN];
|
||||
char mac_buf[MAC_BUF_SIZE];
|
||||
uint32_t tmp_seq;
|
||||
const char *n_type;
|
||||
|
||||
@ -1611,19 +1612,14 @@ static inline bool zebra_evpn_mac_is_bgp_seq_ok(struct zebra_evpn *zevpn,
|
||||
if (seq < tmp_seq) {
|
||||
/* if the mac was never advertised to bgp we must accept
|
||||
* whatever sequence number bgp sends
|
||||
* XXX - check with Vivek
|
||||
*/
|
||||
if (CHECK_FLAG(mac->flags, ZEBRA_MAC_LOCAL)
|
||||
&& !zebra_evpn_mac_is_ready_for_bgp(mac->flags)) {
|
||||
if (IS_ZEBRA_DEBUG_EVPN_MH_MAC
|
||||
|| IS_ZEBRA_DEBUG_VXLAN) {
|
||||
char mac_buf[MAC_BUF_SIZE];
|
||||
|
||||
if (zebra_vxlan_accept_bgp_seq()) {
|
||||
if (IS_ZEBRA_DEBUG_EVPN_MH_MAC ||
|
||||
IS_ZEBRA_DEBUG_VXLAN) {
|
||||
zlog_debug(
|
||||
"%s-macip accept vni %u %s-mac %pEA%s%s lower seq %u f %s",
|
||||
sync ? "sync" : "rem", zevpn->vni,
|
||||
n_type,
|
||||
&mac->macaddr,
|
||||
n_type, &mac->macaddr,
|
||||
ipa_len ? " IP " : "",
|
||||
ipa_len ? ipaddr2str(ipaddr, ipbuf,
|
||||
sizeof(ipbuf))
|
||||
@ -1637,8 +1633,6 @@ static inline bool zebra_evpn_mac_is_bgp_seq_ok(struct zebra_evpn *zevpn,
|
||||
}
|
||||
|
||||
if (IS_ZEBRA_DEBUG_EVPN_MH_MAC || IS_ZEBRA_DEBUG_VXLAN) {
|
||||
char mac_buf[MAC_BUF_SIZE];
|
||||
|
||||
zlog_debug(
|
||||
"%s-macip ignore vni %u %s-mac %pEA%s%s as existing has higher seq %u f %s",
|
||||
sync ? "sync" : "rem", zevpn->vni, n_type,
|
||||
@ -1651,6 +1645,7 @@ static inline bool zebra_evpn_mac_is_bgp_seq_ok(struct zebra_evpn *zevpn,
|
||||
zebra_evpn_zebra_mac_flag_dump(
|
||||
mac, mac_buf, sizeof(mac_buf)));
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -513,10 +513,8 @@ bool zebra_evpn_neigh_is_bgp_seq_ok(struct zebra_evpn *zevpn,
|
||||
if (seq < tmp_seq) {
|
||||
/* if the neigh was never advertised to bgp we must accept
|
||||
* whatever sequence number bgp sends
|
||||
* XXX - check with Vivek
|
||||
*/
|
||||
if (CHECK_FLAG(n->flags, ZEBRA_NEIGH_LOCAL)
|
||||
&& !zebra_evpn_neigh_is_ready_for_bgp(n)) {
|
||||
if (zebra_vxlan_accept_bgp_seq()) {
|
||||
if (IS_ZEBRA_DEBUG_EVPN_MH_NEIGH
|
||||
|| IS_ZEBRA_DEBUG_VXLAN)
|
||||
zlog_debug(
|
||||
|
@ -3740,6 +3740,27 @@ DEFPY (clear_evpn_dup_addr,
|
||||
return ret;
|
||||
}
|
||||
|
||||
DEFPY_HIDDEN (evpn_accept_bgp_seq,
|
||||
evpn_accept_bgp_seq_cmd,
|
||||
"evpn accept-bgp-seq",
|
||||
"EVPN\n"
|
||||
"Accept all sequence numbers from BGP\n")
|
||||
{
|
||||
zebra_vxlan_set_accept_bgp_seq(true);
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
DEFPY_HIDDEN (no_evpn_accept_bgp_seq,
|
||||
no_evpn_accept_bgp_seq_cmd,
|
||||
"no evpn accept-bgp-seq",
|
||||
NO_STR
|
||||
"EVPN\n"
|
||||
"Accept all sequence numbers from BGP\n")
|
||||
{
|
||||
zebra_vxlan_set_accept_bgp_seq(false);
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
/* Static ip route configuration write function. */
|
||||
static int zebra_ip_config(struct vty *vty)
|
||||
{
|
||||
@ -3945,6 +3966,9 @@ static int config_write_protocol(struct vty *vty)
|
||||
|
||||
zebra_pbr_config_write(vty);
|
||||
|
||||
if (!zebra_vxlan_accept_bgp_seq())
|
||||
vty_out(vty, "no evpn accept-bgp-seq\n");
|
||||
|
||||
/* Include nexthop-group config */
|
||||
if (!zebra_nhg_kernel_nexthops_enabled())
|
||||
vty_out(vty, "no zebra nexthop kernel enable\n");
|
||||
@ -4582,6 +4606,8 @@ void zebra_vty_init(void)
|
||||
install_element(VIEW_NODE, &show_evpn_neigh_vni_dad_cmd);
|
||||
install_element(VIEW_NODE, &show_evpn_neigh_vni_all_dad_cmd);
|
||||
install_element(ENABLE_NODE, &clear_evpn_dup_addr_cmd);
|
||||
install_element(CONFIG_NODE, &evpn_accept_bgp_seq_cmd);
|
||||
install_element(CONFIG_NODE, &no_evpn_accept_bgp_seq_cmd);
|
||||
|
||||
install_element(VIEW_NODE, &show_neigh_cmd);
|
||||
|
||||
|
@ -69,6 +69,9 @@ DEFINE_HOOK(zebra_rmac_update,
|
||||
const char *reason),
|
||||
(rmac, zl3vni, delete, reason));
|
||||
|
||||
/* config knobs */
|
||||
static bool accept_bgp_seq = true;
|
||||
|
||||
/* static function declarations */
|
||||
static void zevpn_print_neigh_hash_all_evpn(struct hash_bucket *bucket,
|
||||
void **args);
|
||||
@ -6284,6 +6287,17 @@ extern void zebra_vxlan_handle_result(struct zebra_dplane_ctx *ctx)
|
||||
return;
|
||||
}
|
||||
|
||||
/* Config knob for accepting lower sequence numbers */
|
||||
void zebra_vxlan_set_accept_bgp_seq(bool set)
|
||||
{
|
||||
accept_bgp_seq = set;
|
||||
}
|
||||
|
||||
bool zebra_vxlan_accept_bgp_seq(void)
|
||||
{
|
||||
return accept_bgp_seq;
|
||||
}
|
||||
|
||||
/* Cleanup BGP EVPN configuration upon client disconnect */
|
||||
extern void zebra_evpn_init(void)
|
||||
{
|
||||
|
@ -225,6 +225,9 @@ extern int zebra_vxlan_dp_network_mac_del(struct interface *ifp,
|
||||
struct ethaddr *macaddr,
|
||||
vlanid_t vid);
|
||||
|
||||
extern void zebra_vxlan_set_accept_bgp_seq(bool set);
|
||||
extern bool zebra_vxlan_accept_bgp_seq(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user