troglobit / pimd

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

Translation PIM Join/Prune to IGMP Report/Leave #174

Open tluciomiranda opened 3 years ago

tluciomiranda commented 3 years ago

Hi,

Not really a problem or bug but more like a feature request. I have a network topology where there are some routers that are not pim-aware, but can deliver multicast to the network if some client issue an IGMP report. The problem is, those routers do not talk PIM and I have no control over them, so it would be great if pimd could just send an IGMP report/leave upstream upon receipt of a PIM join/prune for specific groups that it is RP of.

Detailing a bit more, below is a drawing of my network topology (hopefully you can understand!) where:

topology

What I want to achieve is have all the multicast groups available on every network segment, where a client issues an IGMP report for a group, it traverses through PIM domain and, reaching the RP to the specific group, it sends an IGMP report to the upstream non-pim-aware router, and forwards the traffic back to the client. This behavior could be enabled/disabled by config, for example.

A similar scenario is described in the following two documents by Cisco and Juniper:

I have explored a bit your code, and found that maybe the correct point to insert that logic is somewhere in pim_proto.c inside method receive_pim_join_prune(), but I can obviously be wrong.

If you need more info, or want to discuss a bit more please feel free to ask.

Regards, Tiago

troglobit commented 3 years ago

I must say, compared to just about everything else here, this was a perfectly written feature request. Thank you! :smiley:

I understand what you want to achieve, and it also looks a lot like what I've been asked about over email by others as well. It shouldn't be too difficult to add support for it either. Unfortunately I've just entered release mode (about five years later than planned), so I won't be able to work on this for the upcoming v3.0, unless you're interested in pitching in yourself?

From what I can see, we need:

For now I can only help out from the sidelines, cheering on, providing pointers and auditing code. Hope that's OK?

tluciomiranda commented 3 years ago

Thank you for your interest in the feature!

Yesterday, after your response, I have navigated a bit more over the code, to try to define a possible implementation for this, but I may confess that too many questions arose, so I kindly ask you to give me some directions on how to structure this new interaction.

Regarding your points:

A neato syntax, e.g. an igmp-proxy option to the phyint setting, perhaps?

Seems OK, something like phyint _iface_ igmp-proxy

A new passive mode to phyint's, such that we don't send PIM messages on your upstream links, e.g. from R2 to R5

Found on vif.h the following definition #define VIFF_ONEWAY 0x000800 /* Maybe one way interface */ Seems like a good mode to place the interface into

Support for (periodically) sending IGMP v2/v3 reports on igmp-proxy phyints for (*,G) we have in the MFC

This includes sending our reports/leaves upstream and answering to general queries, right ? Also, do we need two separate sockets, so we do not send reports/leaves back to PIM neighbors ?

A "hook point" for our new feature, possibly receivve_pim_join_prune() as you mention

Can you please guide me on what part of this method the code knows exacly "I am the RP of this group" ?

Apart from this, I don't mind waiting for your next release, if you prefer to develop yourself and have things structured your way.

Thanks!

troglobit commented 3 years ago

Hi again, sorry for the late reply! Been quite busy at $DAYJOB the last couple of weeks.

Huh, had forgotten about VIFF_ONEWAY, yup we could definitely reuse that. Not sure of the naming though, I think it may have been intended for declaring one-way of bidirectional distribution trees. I think renaming that define to VIFF_PASSIVE would be the best option. The code base is old, I'm just the current maintainer :)

Yes, sending IGMP reports upstream and answering general, or group-specific, queries. You're right about the socket, we should go with a separate socket for interfaces that have the VIFF_IGMP_PROXY flag.

Figuring out if I'm the RP is trickier. I'll have to dig in to the code a bit more for that, but one example of how to do it is in receive_pim_register(). Grep for "I am the RP"

https://github.com/troglobit/pimd/blob/da6f4c363709c1379271f6e7eabcb6594335ad4e/src/pim_proto.c#L737

tluciomiranda commented 3 years ago

Hi Joachim, hope your health is doing fine!

Regarding this feature, I have been digging around through the code to try to understand things and start some writing. Here is what I have done so far:

What I am trying to achieve:

Ok, so this is where I am, and kindly ask for a bit of help from you. Also, sorry for the long post and the not-so-good code debugging method :)

Regards, Tiago