IGMP proxy Development notes

Source: Internet
Author: User

Original link http://f0g.is-programmer.com/posts/5458.html

 

These two days have been overwhelmed by IGMP proxy, sometimes working, sometimes not working. Finally, I am very worried aboutCodeI finally found the problem and summarized it.

The principle of IGMP proxy is to receive IGMP Report on the downstream interface, and then broadcast it from the upstream interface. At the same time, add the corresponding Virtual Interface (vif) on the router) ). Finally, the multicast packet received from the upstream interface can be sent to the network corresponding to the downstream interface.

In the standard Linux kernel implementation, when the MFC (Multicast forward cache) Table is added, a hash value is generated by using the src ip and dest ip (that is, the Group IP) as the index. However, because the IGMP proxy must process all the SRC Ip's multicast packages (add the MFC entry), the hash method must be modified, for example, in my kernel, the Dest IP and interface index are used to generate the hash. Of course, you can also use other functions to ensure that the kernel corresponds to the app.

During the test, I found that there were too few test tools available. I only found a Microsoft tool on Windows. To facilitate future tests, I wrote another one myself. The tool is simple. It provides two functions: sending a multicast UDP packet and receiving a multicast UDP packet. Note that you must set ip_multicast_ttl to modify the TTL value of the IP package during packet sending. Otherwise, the default TTL of Linux is 1, and the router is lost. In addition, ethereal is untrusted and always tells me that the checksum error is actually good.

 

These two days have been overwhelmed by IGMP proxy, sometimes working, sometimes not working. Finally, I found the problem by turning out the code and finally finding out the problem.

The principle of IGMP proxy is to receive IGMP Report on the downstream interface, and then broadcast it from the upstream interface. At the same time, add the corresponding Virtual Interface (vif) on the router) ). Finally, the multicast packet received from the upstream interface can be sent to the network corresponding to the downstream interface.

In the standard Linux kernel implementation, when the MFC (Multicast forward cache) Table is added, a hash value is generated by using the src ip and dest ip (that is, the Group IP) as the index. However, because the IGMP proxy must process all the SRC Ip's multicast packages (add the MFC entry), the hash method must be modified, for example, in my kernel, the Dest IP and interface index are used to generate the hash. Of course, you can also use other functions to ensure that the kernel corresponds to the app.

During the test, I found that there were too few test tools available. I only found a Microsoft tool on Windows. To facilitate future tests, I wrote another one myself. The tool is simple. It provides two functions: sending a multicast UDP packet and receiving a multicast UDP packet. Note that you must set ip_multicast_ttl to modify the TTL value of the IP package during packet sending. Otherwise, the default TTL of Linux is 1, and the router is lost. In addition, ethereal is untrusted and always tells me that the checksum error is actually good.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.