]> git.puffer.fish Git - mirror/frr.git/commitdiff
pimd: handle VxLAN SG notifications from zebra
authorAnuradha Karuppiah <anuradhak@cumulusnetworks.com>
Thu, 21 Mar 2019 15:49:09 +0000 (08:49 -0700)
committerAnuradha Karuppiah <anuradhak@cumulusnetworks.com>
Sat, 20 Apr 2019 15:33:21 +0000 (08:33 -0700)
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>
pimd/pim_zebra.c

index b20f31082d955ce9bb74b0c6c8cd1a399bb58336..552bda2e77f4114bc9c4241a6933fa6152dce1f5 100644 (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) {