From 0c14dd3af605efd9fafbf224069806ed5ff03d02 Mon Sep 17 00:00:00 2001 From: Christopher Dziomba Date: Thu, 17 Apr 2025 10:41:06 +0200 Subject: [PATCH] zebra: add vtep_ip to rmac nh_list in all cases zebra rmac has a nh_list which tracks the assigned VTEP IPs to RMACs. It can also receive IPv6 encoded IPv4 addresses as VTEPs. Changing/ Installing the RMAC into the Kernel is only important when the IPv4 address changes. However because nh_list is a nodup list used to track usage or RMACs by VTEP IPs, both IP addresses (IPv4 and IPv6 encoded IPv4) should be written into it, as both could be removed in l3vni_rmac_nh_list_nh_delete independently. Signed-off-by: Christopher Dziomba --- zebra/zebra_vxlan.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/zebra/zebra_vxlan.c b/zebra/zebra_vxlan.c index 6a0cee6ced..1dd212cea1 100644 --- a/zebra/zebra_vxlan.c +++ b/zebra/zebra_vxlan.c @@ -1390,23 +1390,22 @@ static int zl3vni_remote_rmac_add(struct zebra_l3vni *zl3vni, /* install rmac in kernel */ zl3vni_rmac_install(zl3vni, zrmac); - } else if (!IPV4_ADDR_SAME(&zrmac->fwd_info.r_vtep_ip, - &(ipv4_vtep.ipaddr_v4))) { - if (IS_ZEBRA_DEBUG_VXLAN) - zlog_debug( - "L3VNI %u Remote VTEP change(%pI4 -> %pIA) for RMAC %pEA", - zl3vni->vni, &zrmac->fwd_info.r_vtep_ip, - vtep_ip, rmac); + } else { + if (!IPV4_ADDR_SAME(&zrmac->fwd_info.r_vtep_ip, &(ipv4_vtep.ipaddr_v4))) { + if (IS_ZEBRA_DEBUG_VXLAN) + zlog_debug("L3VNI %u Remote VTEP change(%pI4 -> %pIA) for RMAC %pEA", + zl3vni->vni, &zrmac->fwd_info.r_vtep_ip, vtep_ip, rmac); - zrmac->fwd_info.r_vtep_ip = ipv4_vtep.ipaddr_v4; + zrmac->fwd_info.r_vtep_ip = ipv4_vtep.ipaddr_v4; + + /* install rmac in kernel */ + zl3vni_rmac_install(zl3vni, zrmac); + } vtep = XCALLOC(MTYPE_EVPN_VTEP, sizeof(struct ipaddr)); memcpy(vtep, vtep_ip, sizeof(struct ipaddr)); if (!listnode_add_sort_nodup(zrmac->nh_list, (void *)vtep)) XFREE(MTYPE_EVPN_VTEP, vtep); - - /* install rmac in kernel */ - zl3vni_rmac_install(zl3vni, zrmac); } return 0; -- 2.39.5