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 <christopher.dziomba@telekom.de>
This commit is contained in:
Christopher Dziomba 2025-04-17 10:41:06 +02:00
parent deb473ff1d
commit 0c14dd3af6
No known key found for this signature in database

View file

@ -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;