pimd: handle VxLAN SG notifications from zebra

zebra sends (S, G) and (*, G) entries for BUM mcast groups to pimd. This
commit includes the changes to handle the notifications and trigger the
creation of (S, G) base cache in pimd.

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
This commit is contained in:
Anuradha Karuppiah 2019-03-21 08:49:09 -07:00
parent b583b03582
commit af7b561b9f

View File

@ -45,6 +45,7 @@
#include "pim_jp_agg.h"
#include "pim_nht.h"
#include "pim_ssm.h"
#include "pim_vxlan.h"
#undef PIM_DEBUG_IFADDR_DUMP
#define PIM_DEBUG_IFADDR_DUMP
@ -543,6 +544,41 @@ void pim_zebra_upstream_rpf_changed(struct pim_instance *pim,
pim_upstream_update_join_desired(pim, up);
}
static int pim_zebra_vxlan_sg_proc(int command, struct zclient *zclient,
zebra_size_t length, vrf_id_t vrf_id)
{
struct stream *s;
struct pim_instance *pim;
struct prefix_sg sg;
pim = pim_get_pim_instance(vrf_id);
if (!pim)
return 0;
s = zclient->ibuf;
sg.family = AF_INET;
sg.prefixlen = stream_getl(s);
stream_get(&sg.src.s_addr, s, sg.prefixlen);
stream_get(&sg.grp.s_addr, s, sg.prefixlen);
if (PIM_DEBUG_ZEBRA) {
char sg_str[PIM_SG_LEN];
pim_str_sg_set(&sg, sg_str);
zlog_debug("%u:recv SG %s %s", vrf_id,
(command == ZEBRA_VXLAN_SG_ADD)?"add":"del",
sg_str);
}
if (command == ZEBRA_VXLAN_SG_ADD)
pim_vxlan_sg_add(pim, &sg);
else
pim_vxlan_sg_del(pim, &sg);
return 0;
}
void pim_scan_individual_oil(struct channel_oil *c_oil, int in_vif_index)
{
struct in_addr vif_source;
@ -769,6 +805,8 @@ void pim_zebra_init(void)
zclient->interface_address_delete = pim_zebra_if_address_del;
zclient->interface_vrf_update = pim_zebra_interface_vrf_update;
zclient->nexthop_update = pim_parse_nexthop_update;
zclient->vxlan_sg_add = pim_zebra_vxlan_sg_proc;
zclient->vxlan_sg_del = pim_zebra_vxlan_sg_proc;
zclient_init(zclient, ZEBRA_ROUTE_PIM, 0, &pimd_privs);
if (PIM_DEBUG_PIM_TRACE) {