Linux 和 IGMPv3 上的多播加入

发布于 2024-07-07 08:12:00 字数 1176 浏览 9 评论 0原文

我们遇到了一个棘手的问题。 我们正在编写一个接收多播 UDP 流量的 C++ 程序。 我们正在将应用程序迁移到不同的网络环境,并且我们的运营团队已要求我们支持应用程序中的 IGMPv3 成员资格公告。 初步调查表明 Linux 2.6 内核确实支持 IGMPv3。 因此,我很困惑,当我们运行 tcpdump 时,我们会看到以下输出跟踪:

[rtv@myhost]$ sudo /usr/sbin/tcpdump -i eth1.22 igmp
tcpdump: listening on eth1.22
00:20:09.007094 switch-a.stage > ALL-SYSTEMS.MCAST.NET: igmp query v2 [max resp time 20] [ttl 1]
00:20:09.241946 10.129.22.236 > 232.0.1.10: igmp v2 report 232.0.1.10 (DF) [tos 0xc0]  [ttl 1]
00:20:10.472159 10.129.22.236 > 236.0.1.101: igmp v2 report 236.0.1.101 (DF) [tos 0xc0]  [ttl 1]

44 packets received by filter

我的理解是,可以通过在文件 /proc/sys/net 中指定非零值来强制内核使用较低版本的 IGMP /ipv4/conf/eth1.22/force_igmp_version; 但是,我已确认该文件具有零值配置。

我们的应用程序使用以下代码加入多播组:

... joinMulticast(in_addr mcast_addr, in_addr interface_addr)
{
  struct ip_mreq  mcast_req;

  mcast_req.imr_multiaddr.s_addr = mcast_addr;
  mcast_req.imr_interface.s_addr = interface_addr;
  int err = setsockopt(fFileDesc, IPPROTO_IP, IP_ADD_MEMBERSHIP,
    (char*)&theMulti, sizeof(theMulti));
  // handle errors etc.
  // ...
}

我们是否需要在源程序中包含一些额外的内容来强制使用 IGMPv3?

We've run into a thorny problem. We are writing a c++ program that receives multicast UDP traffic. We're in the process of moving our applications to a different network environment and our operations team has requested that we support IGMPv3 membership announcements from our applications. Initial investigations indicate that Linux 2.6 kernels do support IGMPv3. Therefore, I'm puzzled that when we run tcpdump we see the following output traces:

[rtv@myhost]$ sudo /usr/sbin/tcpdump -i eth1.22 igmp
tcpdump: listening on eth1.22
00:20:09.007094 switch-a.stage > ALL-SYSTEMS.MCAST.NET: igmp query v2 [max resp time 20] [ttl 1]
00:20:09.241946 10.129.22.236 > 232.0.1.10: igmp v2 report 232.0.1.10 (DF) [tos 0xc0]  [ttl 1]
00:20:10.472159 10.129.22.236 > 236.0.1.101: igmp v2 report 236.0.1.101 (DF) [tos 0xc0]  [ttl 1]

44 packets received by filter

My understanding is that one could force the kernel to use a lower version of IGMP by specifying a non-zero value in the file /proc/sys/net/ipv4/conf/eth1.22/force_igmp_version; however, I've confirmed that the file has a zero value configuration.

Our application is using the following code to join the multicast group:

... joinMulticast(in_addr mcast_addr, in_addr interface_addr)
{
  struct ip_mreq  mcast_req;

  mcast_req.imr_multiaddr.s_addr = mcast_addr;
  mcast_req.imr_interface.s_addr = interface_addr;
  int err = setsockopt(fFileDesc, IPPROTO_IP, IP_ADD_MEMBERSHIP,
    (char*)&theMulti, sizeof(theMulti));
  // handle errors etc.
  // ...
}

Is there something extra that we need to include in the source program to force IGMPv3?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

玩套路吗 2024-07-14 08:12:00

有几件事需要注意。

第一个是(据我所知)将 /proc/sys/net/ipv4/conf/eth1.22/force_igmp_version 设置为 0 并不意味着“使用 v3”,但实际上设置它到“自动”。 我相信您可以将其设置为 3 以强制它使用 igmp v3。

然而,另一件事需要注意的是 igmp 堆栈的行为是由它所处的环境决定的。如果您的 Linux 机器正在从上游 igmp 路由器接收 igmp v2 成员资格查询,那么我相信默认情况Linux 行为(根据 igmp v3 rfc 的规定)是仅使用 igmp v2 进行报告。

据我了解,当您将 /proc/sys/net/ipv4/conf/eth1.22/force_igmp_version 设置为 0 时,它会使用此行为。

Couple of things to be aware of.

The first is that (as I understand it) setting the /proc/sys/net/ipv4/conf/eth1.22/force_igmp_version to 0 doesn't mean "use v3", but actually sets it to "auto". I beleive that you can set it to 3 to force it use igmp v3.

However, the other thing to be aware of is that the behavior of the igmp stack is determined by the environment that it finds itself in. If your linux box is receiving igmp v2 membership queries from an upstream igmp router, then I believe that the default linux behavior (as mandated by the igmp v3 rfc) is to use only igmp v2 for reports.

As I understand it when you set /proc/sys/net/ipv4/conf/eth1.22/force_igmp_version to 0 it uses this behavior.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文