summaryrefslogtreecommitdiff
path: root/zebra/zebra_vxlan.c
diff options
context:
space:
mode:
authorJafar Al-Gharaibeh <Jafaral@users.noreply.github.com>2019-07-15 15:40:12 -0500
committerGitHub <noreply@github.com>2019-07-15 15:40:12 -0500
commit5f7faeb041c75c01641c6d8bb29617a014b6a8ac (patch)
tree869c4c26eb046741140a88e84cdab14757b5f2dc /zebra/zebra_vxlan.c
parentad79beb1dd082cbc5f7d3e41676e372b4e351f38 (diff)
parentecbbc3a750f055d1ea8adc2da2c6225840696b13 (diff)
Merge pull request #4635 from AnuradhaKaruppiah/evpn-pim-replay
pimd, zebra: request for replay of VxLAN SG entries on pimd startup
Diffstat (limited to 'zebra/zebra_vxlan.c')
-rw-r--r--zebra/zebra_vxlan.c69
1 files changed, 60 insertions, 9 deletions
diff --git a/zebra/zebra_vxlan.c b/zebra/zebra_vxlan.c
index d551fa8842..dff50ceef4 100644
--- a/zebra/zebra_vxlan.c
+++ b/zebra/zebra_vxlan.c
@@ -9481,8 +9481,9 @@ static int zebra_vxlan_dad_mac_auto_recovery_exp(struct thread *t)
/************************** vxlan SG cache management ************************/
/* Inform PIM about the mcast group */
-static int zebra_vxlan_sg_send(struct prefix_sg *sg,
- char *sg_str, uint16_t cmd)
+static int zebra_vxlan_sg_send(struct zebra_vrf *zvrf,
+ struct prefix_sg *sg,
+ char *sg_str, uint16_t cmd)
{
struct zserv *client = NULL;
struct stream *s = NULL;
@@ -9491,6 +9492,9 @@ static int zebra_vxlan_sg_send(struct prefix_sg *sg,
if (!client)
return 0;
+ if (!CHECK_FLAG(zvrf->flags, ZEBRA_PIM_SEND_VXLAN_SG))
+ return 0;
+
s = stream_new(ZEBRA_MAX_PACKET_SIZ);
zclient_create_header(s, cmd, VRF_DEFAULT);
@@ -9590,7 +9594,8 @@ static zebra_vxlan_sg_t *zebra_vxlan_sg_add(struct zebra_vrf *zvrf,
return vxlan_sg;
}
- zebra_vxlan_sg_send(sg, vxlan_sg->sg_str, ZEBRA_VXLAN_SG_ADD);
+ zebra_vxlan_sg_send(zvrf, sg, vxlan_sg->sg_str,
+ ZEBRA_VXLAN_SG_ADD);
return vxlan_sg;
}
@@ -9612,8 +9617,8 @@ static void zebra_vxlan_sg_del(zebra_vxlan_sg_t *vxlan_sg)
zebra_vxlan_sg_do_deref(zvrf, sip, vxlan_sg->sg.grp);
}
- zebra_vxlan_sg_send(&vxlan_sg->sg, vxlan_sg->sg_str,
- ZEBRA_VXLAN_SG_DEL);
+ zebra_vxlan_sg_send(zvrf, &vxlan_sg->sg,
+ vxlan_sg->sg_str, ZEBRA_VXLAN_SG_DEL);
hash_release(vxlan_sg->zvrf->vxlan_sg_table, vxlan_sg);
@@ -9697,6 +9702,31 @@ static void zebra_vxlan_sg_cleanup(struct hash_backet *backet, void *arg)
zebra_vxlan_sg_del(vxlan_sg);
}
+static void zebra_vxlan_sg_replay_send(struct hash_backet *backet, void *arg)
+{
+ zebra_vxlan_sg_t *vxlan_sg = (zebra_vxlan_sg_t *)backet->data;
+
+ zebra_vxlan_sg_send(vxlan_sg->zvrf, &vxlan_sg->sg,
+ vxlan_sg->sg_str, ZEBRA_VXLAN_SG_ADD);
+}
+
+/* Handle message from client to replay vxlan SG entries */
+void zebra_vxlan_sg_replay(ZAPI_HANDLER_ARGS)
+{
+ if (IS_ZEBRA_DEBUG_VXLAN)
+ zlog_debug("VxLAN SG updates to PIM, start");
+
+ SET_FLAG(zvrf->flags, ZEBRA_PIM_SEND_VXLAN_SG);
+
+ if (!EVPN_ENABLED(zvrf)) {
+ zlog_debug("VxLAN SG replay request on unexpected vrf %d",
+ zvrf->vrf->vrf_id);
+ return;
+ }
+
+ hash_iterate(zvrf->vxlan_sg_table, zebra_vxlan_sg_replay_send, NULL);
+}
+
/************************** EVPN BGP config management ************************/
/* Notify Local MACs to the clienti, skips GW MAC */
static void zvni_send_mac_hash_entry_to_client(struct hash_bucket *bucket,
@@ -9804,14 +9834,11 @@ static void zebra_evpn_vrf_cfg_cleanup(struct zebra_vrf *zvrf)
}
/* Cleanup BGP EVPN configuration upon client disconnect */
-static int zebra_evpn_cfg_clean_up(struct zserv *client)
+static int zebra_evpn_bgp_cfg_clean_up(struct zserv *client)
{
struct vrf *vrf;
struct zebra_vrf *zvrf;
- if (client->proto != ZEBRA_ROUTE_BGP)
- return 0;
-
RB_FOREACH (vrf, vrf_id_head, &vrfs_by_id) {
zvrf = vrf->info;
if (zvrf)
@@ -9821,6 +9848,30 @@ static int zebra_evpn_cfg_clean_up(struct zserv *client)
return 0;
}
+static int zebra_evpn_pim_cfg_clean_up(struct zserv *client)
+{
+ struct zebra_vrf *zvrf = zebra_vrf_get_evpn();
+
+ if (CHECK_FLAG(zvrf->flags, ZEBRA_PIM_SEND_VXLAN_SG)) {
+ if (IS_ZEBRA_DEBUG_VXLAN)
+ zlog_debug("VxLAN SG updates to PIM, stop");
+ UNSET_FLAG(zvrf->flags, ZEBRA_PIM_SEND_VXLAN_SG);
+ }
+
+ return 0;
+}
+
+static int zebra_evpn_cfg_clean_up(struct zserv *client)
+{
+ if (client->proto == ZEBRA_ROUTE_BGP)
+ return zebra_evpn_bgp_cfg_clean_up(client);
+
+ if (client->proto == ZEBRA_ROUTE_PIM)
+ return zebra_evpn_pim_cfg_clean_up(client);
+
+ return 0;
+}
+
/* Cleanup BGP EVPN configuration upon client disconnect */
extern void zebra_evpn_init(void)
{