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

Use PIMD to scan who is listening to the multicast and pipe out to other applcation. #140

Closed shengliu8833 closed 5 years ago

shengliu8833 commented 5 years ago

Hi Troglobit,

We would like to use PIMD to query and pipe out the message of which multicast groups are been joined and use this message as a trigger for other applications. Can you help to shed some light for how to pipe out the message?

Thank you,

Sheng

troglobit commented 5 years ago

Depends if you only want to see local joins, joins on the LAN one interface belongs to, or all LANs on a multi-homed host?

In the first case you can inspect /proc/net/igmp or ip maddr:

cat /proc/net/igmp

or

ip maddr

In the latter two cases you will not see the joins unless your device is the elected IGMP querier, if it is then you can use tcpdump on the respective interface, or use the new pimctl tool (unreleased but available on master):

pimctl show igmp groups
shengliu8833 commented 5 years ago

Thanks Troglobit.

The application ( ffmpeg based ) will be use to change the Mcast_status (enable a UDP multicast stream or disable it ) based on whether the multicast stream is joined (Igmp_Report) by players in the same LAN or not.

Here are the action rules of the application:

Mcast_Status | Igmp_Report | Action Off | Yes | To enable the streams. On | No | To disable the streams. On | Yes | No action Off | No | No action

Yes, we can run a command like netstat -g | grep "interface" to get the Mcast_Status to verify which multicast stream is enable. But we need to know if some players want to join a new stream and use the IGMP_report to trigger the application to enable it or there is no more player to join an enabled stream that we need to disable it after the IGMP query with no more Igmp_report back.

We are looking for a way to use the PIMD to capture the IGMP_report and pipe this message out to the application. Is this possible?

Thank you,

Sheng

troglobit commented 5 years ago

I see, that's not really what pimd was built for, and multicast routing with PIM also relies on a PIM router hearing the senders to be able to notify PIM neighbors. Honestly, the whole thing is a bit backwards ...

However, if you really want to use pimd for this I suggest periodically calling pimctl show igmp groups and check for changes. Anything else would require extensive code surgery to the innards of pimd

troglobit commented 5 years ago

No activity in this issue in over a week, and not really a bug/problem with pimd. Closing.