troglobit / pimd

PIM-SM/SSM multicast routing for UNIX and Linux
http://troglobit.com/projects/pimd/
BSD 3-Clause "New" or "Revised" License
194 stars 86 forks source link

Update upstream PIM neighbor when incoming interface changes #184

Closed brun064 closed 3 years ago

brun064 commented 3 years ago

Environment is several Linux routers running in mesh connected to a Cisco router with the Cisco router acting as the RP advertised over BSR.

During start up PIMD registers an interface toward the RP as the "incoming" interface on an mroute, even though it's actually downstream. Eventually the age_routes function catches this and updates the iif using change_interfaces. However this only sets the mrt->incoming, but doesn't update mrt->upstream.

Current solution is to add the following to the top of route.c/change_interfaces ~line 577:

 if(new_iif != mrt->incoming && mrt->source && mrt->source->address) 
          mrt->upstream = find_pim_nbr(mrt->source->address);

There might be a better place to perform this action, but I'll leave that up to you.

Thank you and happy holidays!

troglobit commented 3 years ago

Happy holidays to you too! :)

This is very interesting, do you think you could submit a proper patch or pull request?

brun064 commented 3 years ago

Sure thing. Here is the patch:

diff -Bbru pimd-3.0/src/route.c pimd-3.0-iface-change-nbr-fix/src/route.c
--- pimd-3.0/src/route.c    2020-12-21 20:18:11.623320864 +0000
+++ pimd-3.0-iface-change-nbr-fix/src/route.c   2021-01-04 21:11:03.715895004 +0000
@@ -577,6 +577,10 @@
     if (!mrt)
    return 0;

+     /*When iif changes, discover new upstream pim nbr*/
+    if(new_iif != mrt->incoming && mrt->source && mrt->source->address)
+        mrt->upstream = find_pim_nbr(mrt->source->address);
+
     PIMD_VIFM_COPY(new_joined_oifs_, new_joined_oifs);
     PIMD_VIFM_COPY(new_leaves_, new_leaves);
troglobit commented 3 years ago

Thanks, I'll give it a spin!

Since you're very anonymous, I'm guessing you don't want any attribution, right?

brun064 commented 3 years ago

No need for attribution. Thanks though.