Sending multicast datagrams broken (regression)

From: Pieter de Goeje <pieter_at_degoeje.nl>
Date: Sat, 18 Jul 2009 20:56:47 +0200
I'm observing that multicast IPv4 UDP datagrams sent from the latest 8.0-BETA2 
are being discarded. The code below used to work with 7.2.

Sender Receiver Result
----------------------
8.0    8.0      Broken, but loop back traffic works
8.0    7.2      Broken
7.2    8.0      Works

Oddly enough, when I run tcpdump on a 8.0 sender, it shows packets being sent, 
but on the receiver tcpdump shows no activity whatsoever.

The receiver was properly registering it's membership (which was verified with 
ifmcstat).

Testing was done on three hosts, two of which are running 8.0 and one 7.2. The 
hosts are connected using a single switch. I've tried if_em and if_re NICs, 
both with the same results.

Kind regards,

Pieter de Goeje

PS. 
I can post complete code if necessary.

----
fd is initialized with a freshly created AF_INET datagram socket, maddr 
contains the group address (239.255.9.9 in the test case, but I've tried 
multiple different addresses).

void doit(int fd, in_addr_t maddr, int port)
{
     struct sockaddr_in addr;
     int cnt;
     struct ip_mreq mreq;
     char message[] = "Hello";

     memset(&addr, 0, sizeof(addr));
     addr.sin_family=AF_INET;
     addr.sin_addr.s_addr=maddr;
     addr.sin_port=htons(port);

     u_char ttl = 2;
     if(setsockopt(fd, IPPROTO_IP, IP_MULTICAST_TTL, &ttl,
                   sizeof(ttl)) == -1) {
          err(1, "setsockopt");
     }

     for(;;) {
          if(sendto(fd, message, sizeof(message) - 1, 0,
                     (struct sockaddr *)&addr, sizeof(addr)) == -1) {
               err(1, "sendto");
          }
          sleep(1);
     }
}
Received on Sat Jul 18 2009 - 16:56:57 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:52 UTC