Open SandipJunghare opened 3 years ago
Hi Sandip,
This library only implements the router-side state machines of IGMP. The goal is just for a router to be able to determine if there are hosts in the same L2 broadcast domain interested in receiving multicast traffic - basically this library interprets received IGMP packets from directly connected hosts. This library won't help in the manifestation of multicast interest.
To manifest interest (to send IGMP Reports) you will use the client-side state machines of IGMP specification which are already pre-installed in the Linux kernel. Basically you just open a socket and specify some multicast options and the kernel will handle all IGMP stuff for you (sending IGMP Reports/Leaves & react to IGMP Queries). See the following example for the required options for your multicast socket: https://github.com/pedrofran12/hpim_dm/blob/Test_IGMP/emulation/client1/root/client.py
I saw that you posted a similar question in my HPIM-DM repo. Please confirm if you want your multicast receiver to just be a simple receiver or if you intend to receive/consume multicast traffic as well as forward multicast traffic between different interfaces.
Best regards, Pedro
Hi Pedro,
I want my multicast receiver device to receive and forward the traffic between interfaces.
Topologies i am going to use are ring, star, mesh, linear basically any possible way. There are no routers between the devices, multicast receiver devices are going to connect each other in above mentioned topologies. Preferably one of multicast receiver devices needs to be configured as router so that it can forward traffic to destination multicast group.
And the device which we will configure as router, will generate its own traffic/packets and forward to the multicast receivers.
Any doubts, please feel free to ping back.
Thanks, Sandip.
Hi Sandip,
From your message it looks like everyone is on the same subnet (same L2 broadcast domain).
If you have multicast sources and multicast receivers inside the same subnet, you don't need a multicast router. Basically you can have switches between devices and forward/switch multicast traffic.
Multicast traffic is similar to broadcast traffic inside an L2 segment. However you can have your switches with IGMP snooping so that multicast traffic is only switched to intended receivers inside the same L2.
If that is the case you only need some settings for your switches and that's it. Multicast receivers will open sockets with multicast options to join the intended multicast group and multicast sources the same thing but to send multicast traffic.
You can take a look at some topologies that I have used to test my implementations of IGMP/PIM-DM/HPIM-DM. These repos have branches with the code that I used for my topologies. The following was for testing my IGMP implementation: https://github.com/pedrofran12/hpim_dm/tree/Test_IGMP/emulation
And if you don't need a multicast router, you won't need any of my packages... You will use what already comes with Linux.
Let me know if this helped or if I was too vague. Next week I can test things and send some examples.
Best regards, Pedro
Hi Pedro,
We do have multiple subnets and they will communicate with one another. I think i need to implement igmp in one or more devices so that different subnets can communicate with each other.
For igmp implementation for router side, do i need to create separate C/Python file and implement API's of igmp package in it. Means through C/python file, i can communicate with .so or .a library.
Please correct me if my understanding of implementation is not correct. For your information i am native C- programmer. Not into Python that much.
Thanks.
Hi Sandip,
In that case you will also need a multicast routing protocol... Or you can implement your own multicast routing protocol and manipulate the multicast routing table. IGMP is just intended to detect interest inside the same subnet. (btw... Implementation for me is writing the software and not enabling already programmed processes... When you say implementing are you talking about code or enabling processes?).
I see that your questions are more developer oriented. Do you really want to implement everything from scratch or leverage from existing open sourced work (IGMP + Multicast routing) just to forward multicast traffic? Unless you are doing something novel (trying something new that was never done or you want to implement by yourself something that is not implemented for Linux) I don't see the point of having all that work. In my case I have done this work (PIM-DM/HPIM-DM/IGMP) for my MSc dissertation because at that time there was no open sourced implementation of PIM-DM according to the latest RFC... And for this reason I have implemented IGMP as well.
To be honest I have never had Python interacting with C... If you are more familiar and want to code in C maybe it is better to leverage code that is already written in C. pimd from @troglobit implements PIM-SM/PIM-SSM and IGMP in C language... Maybe that's a good starting point as you are more familiar with the language and might be easier to integrate with your actual code.
Do you want to have all the hard work of learning how to manipulate the Linux multicast routing table so that you can forward multicast traffic between interfaces. Or do you simply want to enable already cooked packages that already do this for you dynamically?
Sorry if I am being a bit negative in my answer but it is still not clear to me why you would want to implement or interact with IGMP packages.
Best regards, Pedro
Hi Pedro,
Yes, I want to leverage from existing open sourced work (IGMP + Multicast routing). Not going to write any new protocol. By implementation, i meant to say to write a small C/python program to leverage existing source code or to integrate in my code.
We want less traffic on our networks and also don't want to waste devices' CPU time on processing unwanted traffic. We want to keep check on bandwidth consumed by limiting traffic.
So, i am not going to implement/create new IGMP package, just want to use the already available package for my application. So, i want my application to have values for list of multicast groups or interested client and want these values using IGMP/PIM package. Also want to receive/forward traffic using these packages.
I think, we have a communication barrier to understand exact details of IGMP but lets not stop asking questions. Feel free to ask any not understood part.
Thanks, Sandip.
Hi Sandip,
Ok, I think I am understanding now what you want to accomplish.
The packages that I have referred (my PIM-DM/HPIM-DM/IGMP and pimd) are control plane packages and their function is to just exchange control packets and manipulate accordingly the Linux multicast routing table.
At least my implementations of PIM-DM/HPIM-DM they accept all multicast traffic as valid and possible to forward according to the interest of hosts and routers.
If you want to block/filter unwanted multicast traffic I think this is more an ACL problem than a multicast routing protocol problem. Linux iptables could help in this filtering. Keep in mind that if you allow all multicast traffic, the Linux kernel queries the multicast routing package everytime it receives a multicast packet for which there is no mapping in the multicast routing table... After this query, the multicast routing package sets an (S,G) entry in the multicast routing table. The solution to avoid wasting CPU cycles would be to filter this traffic before it is analyzed by the Kernel/multicast routing table. I guess an iptables entry with chain INPUT would block the traffic before this multicast processing.
If you want to control the amount of traffic consumed for all allowed multicast traffic, this is a QoS issue. I guess TC would be the solution to control the bit rate for this traffic.
My packages have "list" commands, so I guess what you are looking for is already implemented, however it only shows the existing (S,G) trees, the correspondent "iif" interface and "oil" and the state of all state machines. It doesn't show any statistic information like amount of packets or BW consumed... This would need to be implemented...
Just a note related with IGMP... if you want your application to list the clients that are interested for each multicast group, I think this would be impossible if you have multiple receivers inside the same subnet... the reason for this is because IGMP has a suppression mechanism... for a given group, only a single client needs to send a Report... other receivers hear the Report and suppress their message (because another host manifested interest for the same multicast group). From an IGMP perspective (at least for IGMPv1 and v2) you only know if the group has interested receivers or not and not the exact number of interest receivers.
Best regards, Pedro
Hi Pedro,
At least my implementations of PIM-DM/HPIM-DM they accept all multicast traffic as valid and possible to forward according to the interest of hosts and routers. ----- this functionality is enough for me as of now. Other filtering functionality i will manage when actually needed, no current focus on that.
In couple of days, i will start actual code integration and will let you know the issues if any.
Can you share the path for pimd from @troglobit implements PIM-SM/PIM-SSM and IGMP in C language, so that i can compare both IGMP/PIM packages. I did not find where exactly IGMP/PIM repo is placed for @troglobit.
Thanks for your valuable time. Sandip.
https://github.com/troglobit/pimd
Inside src folder you have all code. I think IGMP stuff is inside the igmp_proto.c. Also keep in mind that pimd implements PIM-SM/SSM while my implementation is for PIM-DM. In terms of scalability PIM-SSM is better as you have a multicast tree only spanning sources and interested receivers... While PIM-DM requires all routers to maintain all multicast trees even if there are no interested receivers.
Best regards, Pedro
Yes, the file to have a look at is in igmp_proto.c, please note it's still under development, and just as of last week I found a bug in the querier election that I've yet to fix. The plan is to first roll out the pimd-dense (PIM-DM) release, then pimd (PIM-SM/SSM). They will share igmp_proto.c to the extent possible. There is also the mrouted package, which is the grandfather code base to the other two. Its IGMP implementation is in igmp.c
@SandipJunghare I don't understand really why you'd want to write your own application? There's plenty of multicast routing daemons that implement what you want. If the packages I maintain aren't sufficient, I'd suggest having a look at FRR instead.
Hi @troglobit ,
Sorry for late reply, as i was out of town for personal reasons. The goal of ours is to have list of number of receivers and other topology info and as i learned from Pedro msg that its not possible but still we can get the number of multicast groups who are having traffic interest.
I want to communicate with pimd/igmp daemon to get the multicast routing info. So want to call API's in my code which can readily give info such as interfaces/neighbors/groups.
I am trying to read the info which is available in below screenshot, as mentioned, i looked into ipc.c file but i could find there only functions definition of show_interfaces/show_neighbors but could not find there calls, for this i attached 2nd screenshot as well. I know this info is already getting printed on terminal but i still want in my own code. So if possible, please share the file name from where the above mentioned API's are getting called. I am still studying your code to explore more options of it.
I am new to linux makefile/make compilation process, if any confusion from my side please excuse it. Please also share your inputs on .so/.a shared libraries of your code.
Thanks. Sandip
@SandipJunghare the only supported public API is the shell output from pimctl. There are command line switches to skip headings or disable ANSI escape characters to ease parsing the text output.
hi,
Can i use this library to setup my device as a IGMP client so that i can receive multicast traffic??
Client means device should be able to join/leave multicast group using IGMP and receive traffic addressed for multicast group.
Any suggestion on this would be helpful for implimentation.
Thanks.