diff options
author | Donald Sharp <sharpd@cumulusnetworks.com> | 2018-05-11 21:04:10 +0200 |
---|---|---|
committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2018-05-12 00:38:01 +0200 |
commit | 26bb1fd528d92d52ecdf94e070d43e69d6f2d32b (patch) | |
tree | 5c29f345be53864c5ad941eb93552c50b4fe0865 /pimd/pim_zebra.c | |
parent | pimd: Cleanup all pim_ifp pointers on termination (diff) | |
download | frr-26bb1fd528d92d52ecdf94e070d43e69d6f2d32b.tar.xz frr-26bb1fd528d92d52ecdf94e070d43e69d6f2d32b.zip |
pimd: Allow interface to move in and out of vrfs
When we get an interface move event track the correct
pim instance.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'pimd/pim_zebra.c')
-rw-r--r-- | pimd/pim_zebra.c | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/pimd/pim_zebra.c b/pimd/pim_zebra.c index 6cce69720..ae7f61c8e 100644 --- a/pimd/pim_zebra.c +++ b/pimd/pim_zebra.c @@ -69,6 +69,7 @@ static int pim_zebra_if_add(int command, struct zclient *zclient, zebra_size_t length, vrf_id_t vrf_id) { struct interface *ifp; + struct pim_instance *pim; /* zebra api adds/dels interfaces using the same call @@ -78,6 +79,7 @@ static int pim_zebra_if_add(int command, struct zclient *zclient, if (!ifp) return 0; + pim = pim_get_pim_instance(vrf_id); if (PIM_DEBUG_ZEBRA) { zlog_debug( "%s: %s index %d(%u) flags %ld metric %d mtu %d operative %d", @@ -86,8 +88,19 @@ static int pim_zebra_if_add(int command, struct zclient *zclient, if_is_operative(ifp)); } - if (if_is_operative(ifp)) + if (if_is_operative(ifp)) { + struct pim_interface *pim_ifp; + + pim_ifp = ifp->info; + /* + * If we have a pim_ifp already and this is an if_add + * that means that we probably have a vrf move event + * If that is the case, set the proper vrfness. + */ + if (pim_ifp) + pim_ifp->pim = pim; pim_if_addr_add_all(ifp); + } /* * If we are a vrf device that is up, open up the pim_socket for @@ -145,6 +158,7 @@ static int pim_zebra_if_del(int command, struct zclient *zclient, static int pim_zebra_if_state_up(int command, struct zclient *zclient, zebra_size_t length, vrf_id_t vrf_id) { + struct pim_instance *pim; struct interface *ifp; uint32_t table_id; @@ -164,7 +178,19 @@ static int pim_zebra_if_state_up(int command, struct zclient *zclient, if_is_operative(ifp)); } + pim = pim_get_pim_instance(vrf_id); if (if_is_operative(ifp)) { + struct pim_interface *pim_ifp; + + pim_ifp = ifp->info; + /* + * If we have a pim_ifp already and this is an if_add + * that means that we probably have a vrf move event + * If that is the case, set the proper vrfness. + */ + if (pim_ifp) + pim_ifp->pim = pim; + /* pim_if_addr_add_all() suffices for bringing up both IGMP and PIM @@ -274,6 +300,7 @@ static int pim_zebra_if_address_add(int command, struct zclient *zclient, struct connected *c; struct prefix *p; struct pim_interface *pim_ifp; + struct pim_instance *pim; /* zebra api notifies address adds/dels events by using the same call @@ -327,8 +354,12 @@ static int pim_zebra_if_address_add(int command, struct zclient *zclient, } pim_if_addr_add(c); - if (pim_ifp) + if (pim_ifp) { + pim = pim_get_pim_instance(vrf_id); + pim_ifp->pim = pim; + pim_rp_check_on_if_add(pim_ifp); + } if (if_is_loopback(c->ifp)) { struct vrf *vrf = vrf_lookup_by_id(VRF_DEFAULT); |