mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-06-28 21:29:44 +00:00
zebra: trigger SG update on l2-vni<=>mcast-grp changes
An SG entry is added (if one doesn't already exist) when a l2-VNI is associated with a mcast-grp and local-vtep-ip. And viceversa; when the last l2-vni using a MDT is removed the SG entry is deleted. Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
This commit is contained in:
parent
015d264c85
commit
abfa0a9651
@ -219,6 +219,11 @@ static void zebra_vxlan_sg_do_deref(struct zebra_vrf *zvrf,
|
|||||||
struct in_addr sip, struct in_addr mcast_grp);
|
struct in_addr sip, struct in_addr mcast_grp);
|
||||||
static zebra_vxlan_sg_t *zebra_vxlan_sg_do_ref(struct zebra_vrf *vrf,
|
static zebra_vxlan_sg_t *zebra_vxlan_sg_do_ref(struct zebra_vrf *vrf,
|
||||||
struct in_addr sip, struct in_addr mcast_grp);
|
struct in_addr sip, struct in_addr mcast_grp);
|
||||||
|
static void zebra_vxlan_sg_deref(struct in_addr local_vtep_ip,
|
||||||
|
struct in_addr mcast_grp);
|
||||||
|
static void zebra_vxlan_sg_ref(struct in_addr local_vtep_ip,
|
||||||
|
struct in_addr mcast_grp);
|
||||||
|
static void zebra_vxlan_sg_cleanup(struct hash_backet *backet, void *arg);
|
||||||
|
|
||||||
/* Private functions */
|
/* Private functions */
|
||||||
static int host_rb_entry_compare(const struct host_rb_entry *hle1,
|
static int host_rb_entry_compare(const struct host_rb_entry *hle1,
|
||||||
@ -3909,6 +3914,9 @@ static int zvni_del(zebra_vni_t *zvni)
|
|||||||
|
|
||||||
zvni->vxlan_if = NULL;
|
zvni->vxlan_if = NULL;
|
||||||
|
|
||||||
|
/* Remove references to the BUM mcast grp */
|
||||||
|
zebra_vxlan_sg_deref(zvni->local_vtep_ip, zvni->mcast_grp);
|
||||||
|
|
||||||
/* Free the neighbor hash table. */
|
/* Free the neighbor hash table. */
|
||||||
hash_free(zvni->neigh_table);
|
hash_free(zvni->neigh_table);
|
||||||
zvni->neigh_table = NULL;
|
zvni->neigh_table = NULL;
|
||||||
@ -4066,8 +4074,15 @@ static void zvni_build_hash_table(void)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
zvni->local_vtep_ip = vxl->vtep_ip;
|
if (zvni->local_vtep_ip.s_addr != vxl->vtep_ip.s_addr ||
|
||||||
zvni->mcast_grp = vxl->mcast_grp;
|
zvni->mcast_grp.s_addr != vxl->mcast_grp.s_addr) {
|
||||||
|
zebra_vxlan_sg_deref(zvni->local_vtep_ip,
|
||||||
|
zvni->mcast_grp);
|
||||||
|
zebra_vxlan_sg_ref(vxl->vtep_ip,
|
||||||
|
vxl->mcast_grp);
|
||||||
|
zvni->local_vtep_ip = vxl->vtep_ip;
|
||||||
|
zvni->mcast_grp = vxl->mcast_grp;
|
||||||
|
}
|
||||||
zvni->vxlan_if = ifp;
|
zvni->vxlan_if = ifp;
|
||||||
vlan_if = zvni_map_to_svi(vxl->access_vlan,
|
vlan_if = zvni_map_to_svi(vxl->access_vlan,
|
||||||
zif->brslave_info.br_if);
|
zif->brslave_info.br_if);
|
||||||
@ -8527,8 +8542,14 @@ int zebra_vxlan_if_update(struct interface *ifp, uint16_t chgflags)
|
|||||||
zvni_mac_del_all(zvni, 0, 1, DEL_LOCAL_MAC);
|
zvni_mac_del_all(zvni, 0, 1, DEL_LOCAL_MAC);
|
||||||
}
|
}
|
||||||
|
|
||||||
zvni->local_vtep_ip = vxl->vtep_ip;
|
if (zvni->local_vtep_ip.s_addr != vxl->vtep_ip.s_addr ||
|
||||||
zvni->mcast_grp = vxl->mcast_grp;
|
zvni->mcast_grp.s_addr != vxl->mcast_grp.s_addr) {
|
||||||
|
zebra_vxlan_sg_deref(zvni->local_vtep_ip,
|
||||||
|
zvni->mcast_grp);
|
||||||
|
zebra_vxlan_sg_ref(vxl->vtep_ip, vxl->mcast_grp);
|
||||||
|
zvni->local_vtep_ip = vxl->vtep_ip;
|
||||||
|
zvni->mcast_grp = vxl->mcast_grp;
|
||||||
|
}
|
||||||
zvni->vxlan_if = ifp;
|
zvni->vxlan_if = ifp;
|
||||||
|
|
||||||
/* Take further actions needed.
|
/* Take further actions needed.
|
||||||
@ -8632,8 +8653,14 @@ int zebra_vxlan_if_add(struct interface *ifp)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
zvni->local_vtep_ip = vxl->vtep_ip;
|
if (zvni->local_vtep_ip.s_addr != vxl->vtep_ip.s_addr ||
|
||||||
zvni->mcast_grp = vxl->mcast_grp;
|
zvni->mcast_grp.s_addr != vxl->mcast_grp.s_addr) {
|
||||||
|
zebra_vxlan_sg_deref(zvni->local_vtep_ip,
|
||||||
|
zvni->mcast_grp);
|
||||||
|
zebra_vxlan_sg_ref(vxl->vtep_ip, vxl->mcast_grp);
|
||||||
|
zvni->local_vtep_ip = vxl->vtep_ip;
|
||||||
|
zvni->mcast_grp = vxl->mcast_grp;
|
||||||
|
}
|
||||||
zvni->vxlan_if = ifp;
|
zvni->vxlan_if = ifp;
|
||||||
vlan_if = zvni_map_to_svi(vxl->access_vlan,
|
vlan_if = zvni_map_to_svi(vxl->access_vlan,
|
||||||
zif->brslave_info.br_if);
|
zif->brslave_info.br_if);
|
||||||
@ -9218,6 +9245,7 @@ void zebra_vxlan_cleanup_tables(struct zebra_vrf *zvrf)
|
|||||||
if (!zvrf)
|
if (!zvrf)
|
||||||
return;
|
return;
|
||||||
hash_iterate(zvrf->vni_table, zvni_cleanup_all, zvrf);
|
hash_iterate(zvrf->vni_table, zvni_cleanup_all, zvrf);
|
||||||
|
hash_iterate(zvrf->vxlan_sg_table, zebra_vxlan_sg_cleanup, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Close all VNI handling */
|
/* Close all VNI handling */
|
||||||
@ -9519,3 +9547,39 @@ static zebra_vxlan_sg_t *zebra_vxlan_sg_do_ref(struct zebra_vrf *zvrf,
|
|||||||
|
|
||||||
return vxlan_sg;
|
return vxlan_sg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void zebra_vxlan_sg_deref(struct in_addr local_vtep_ip,
|
||||||
|
struct in_addr mcast_grp)
|
||||||
|
{
|
||||||
|
struct zebra_vrf *zvrf;
|
||||||
|
|
||||||
|
if (!local_vtep_ip.s_addr || !mcast_grp.s_addr)
|
||||||
|
return;
|
||||||
|
|
||||||
|
zvrf = vrf_info_lookup(VRF_DEFAULT);
|
||||||
|
if (!zvrf)
|
||||||
|
return;
|
||||||
|
|
||||||
|
zebra_vxlan_sg_do_deref(zvrf, local_vtep_ip, mcast_grp);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void zebra_vxlan_sg_ref(struct in_addr local_vtep_ip,
|
||||||
|
struct in_addr mcast_grp)
|
||||||
|
{
|
||||||
|
struct zebra_vrf *zvrf;
|
||||||
|
|
||||||
|
if (!local_vtep_ip.s_addr || !mcast_grp.s_addr)
|
||||||
|
return;
|
||||||
|
|
||||||
|
zvrf = vrf_info_lookup(VRF_DEFAULT);
|
||||||
|
if (!zvrf)
|
||||||
|
return;
|
||||||
|
zebra_vxlan_sg_do_ref(zvrf, local_vtep_ip, mcast_grp);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void zebra_vxlan_sg_cleanup(struct hash_backet *backet, void *arg)
|
||||||
|
{
|
||||||
|
zebra_vxlan_sg_t *vxlan_sg = (zebra_vxlan_sg_t *)backet->data;
|
||||||
|
|
||||||
|
zebra_vxlan_sg_del(vxlan_sg);
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user