diff options
| -rw-r--r-- | lib/log.c | 2 | ||||
| -rw-r--r-- | lib/zclient.c | 11 | ||||
| -rw-r--r-- | lib/zclient.h | 6 | ||||
| -rw-r--r-- | zebra/zebra_vxlan.c | 40 | ||||
| -rw-r--r-- | zebra/zserv.c | 2 | ||||
| -rw-r--r-- | zebra/zserv.h | 2 |
6 files changed, 63 insertions, 0 deletions
@@ -1068,6 +1068,8 @@ static const struct zebra_desc_table command_types[] = { DESC_ENTRY(ZEBRA_IPTABLE_DELETE), DESC_ENTRY(ZEBRA_IPTABLE_NOTIFY_OWNER), DESC_ENTRY(ZEBRA_VXLAN_FLOOD_CONTROL), + DESC_ENTRY(ZEBRA_VXLAN_SG_ADD), + DESC_ENTRY(ZEBRA_VXLAN_SG_DEL), }; #undef DESC_ENTRY diff --git a/lib/zclient.c b/lib/zclient.c index e5cab9e0f2..4901c92743 100644 --- a/lib/zclient.c +++ b/lib/zclient.c @@ -2701,6 +2701,17 @@ static int zclient_read(struct thread *thread) (*zclient->iptable_notify_owner)(command, zclient, length, vrf_id); + break; + case ZEBRA_VXLAN_SG_ADD: + if (zclient->vxlan_sg_add) + (*zclient->vxlan_sg_add)(command, zclient, length, + vrf_id); + break; + case ZEBRA_VXLAN_SG_DEL: + if (zclient->vxlan_sg_del) + (*zclient->vxlan_sg_del)(command, zclient, length, + vrf_id); + break; default: break; } diff --git a/lib/zclient.h b/lib/zclient.h index 3a054e5e72..0926281f2e 100644 --- a/lib/zclient.h +++ b/lib/zclient.h @@ -164,6 +164,8 @@ typedef enum { ZEBRA_IPTABLE_DELETE, ZEBRA_IPTABLE_NOTIFY_OWNER, ZEBRA_VXLAN_FLOOD_CONTROL, + ZEBRA_VXLAN_SG_ADD, + ZEBRA_VXLAN_SG_DEL, } zebra_message_types_t; struct redist_proto { @@ -275,6 +277,10 @@ struct zclient { struct zclient *zclient, uint16_t length, vrf_id_t vrf_id); + int (*vxlan_sg_add)(int command, struct zclient *client, + uint16_t length, vrf_id_t vrf_id); + int (*vxlan_sg_del)(int command, struct zclient *client, + uint16_t length, vrf_id_t vrf_id_t); }; /* Zebra API message flag. */ diff --git a/zebra/zebra_vxlan.c b/zebra/zebra_vxlan.c index b13b56e97f..aa85af649d 100644 --- a/zebra/zebra_vxlan.c +++ b/zebra/zebra_vxlan.c @@ -9407,6 +9407,41 @@ 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) +{ + struct zserv *client = NULL; + struct stream *s = NULL; + + client = zserv_find_client(ZEBRA_ROUTE_PIM, 0); + if (!client) + return 0; + + s = stream_new(ZEBRA_MAX_PACKET_SIZ); + + zclient_create_header(s, cmd, VRF_DEFAULT); + stream_putl(s, IPV4_MAX_BYTELEN); + stream_put(s, &sg->src.s_addr, IPV4_MAX_BYTELEN); + stream_put(s, &sg->grp.s_addr, IPV4_MAX_BYTELEN); + + /* Write packet size. */ + stream_putw_at(s, 0, stream_get_endp(s)); + + if (IS_ZEBRA_DEBUG_VXLAN) + zlog_debug( + "Send %s %s to %s", + (cmd == ZEBRA_VXLAN_SG_ADD) ? "add" : "del", sg_str, + zebra_route_string(client->proto)); + + if (cmd == ZEBRA_VXLAN_SG_ADD) + client->vxlan_sg_add_cnt++; + else + client->vxlan_sg_del_cnt++; + + return zserv_send_message(client, s); +} + static unsigned int zebra_vxlan_sg_hash_key_make(void *p) { zebra_vxlan_sg_t *vxlan_sg = p; @@ -9482,6 +9517,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); + return vxlan_sg; } @@ -9502,6 +9539,9 @@ 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); + hash_release(vxlan_sg->zvrf->vxlan_sg_table, vxlan_sg); if (IS_ZEBRA_DEBUG_VXLAN) diff --git a/zebra/zserv.c b/zebra/zserv.c index 80fdbefcd5..df5f236c04 100644 --- a/zebra/zserv.c +++ b/zebra/zserv.c @@ -970,6 +970,8 @@ static void zebra_show_client_detail(struct vty *vty, struct zserv *client) client->v4_nh_watch_add_cnt, 0, client->v4_nh_watch_rem_cnt); vty_out(vty, "NHT v6 %-12d%-12d%-12d\n", client->v6_nh_watch_add_cnt, 0, client->v6_nh_watch_rem_cnt); + vty_out(vty, "VxLAN SG %-12d%-12d%-12d\n", client->vxlan_sg_add_cnt, + 0, client->vxlan_sg_del_cnt); vty_out(vty, "Interface Up Notifications: %d\n", client->ifup_cnt); vty_out(vty, "Interface Down Notifications: %d\n", client->ifdown_cnt); vty_out(vty, "VNI add notifications: %d\n", client->vniadd_cnt); diff --git a/zebra/zserv.h b/zebra/zserv.h index 86863d961c..90fd195712 100644 --- a/zebra/zserv.h +++ b/zebra/zserv.h @@ -141,6 +141,8 @@ struct zserv { uint32_t v4_nh_watch_rem_cnt; uint32_t v6_nh_watch_add_cnt; uint32_t v6_nh_watch_rem_cnt; + uint32_t vxlan_sg_add_cnt; + uint32_t vxlan_sg_del_cnt; time_t nh_reg_time; time_t nh_dereg_time; |
