Hearing multicast in 2.6 vs. 2.4

Hearing multicast in 2.6 vs. 2.4

Post by neb.. » Sat, 22 Apr 2006 01:06:28


I have two servers, one running linux 2.4.30, the other running 2.6.15.
 I am having problems hearing multicast traffic on the one running
2.6.15.  At the end of this posting is some simple code showing my
problem.  On the 2.4.30 server, the program terminates as expected, but
on the 2.6.15 server, the program never returns from recv().  Multicast
is enabled in the kernel for both servers, they are plugged into the
same network switch, and the interface receiving multicast traffic on
both servers eth1.

Here is the output of ifconfig eth1 on my 2.6.15 server:
eth1      Link encap:Ethernet  HWaddr 00:C0:9F:05:25:D1
          inet addr:  Bcast: Mask:
          RX packets:46115978 errors:0 dropped:0 overruns:0 frame:0
          TX packets:480 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:3952568593 (3769.4 Mb)  TX bytes:40140 (39.1 Kb)

Using tcpdump, I have verified that the multicast traffic is in fact
streaming over the eth1 interface:
purple ~ # tcpdump -i eth1 -n
tcpdump: verbose output suppressed, use -v or -vv for full protocol
listening on eth1, link-type EN10MB (Ethernet), capture size 96 bytes
00:22:13.545253 IP > UDP, length
00:22:13.922034 IP > udp
00:22:13.933675 IP > UDP, length 1957
00:22:13.940815 IP > udp
00:22:13.945432 IP > UDP, length 1860
00:22:13.946038 IP > udp
00:22:13.947347 IP > UDP, length 2294
00:22:13.949881 IP > UDP, length 163
00:22:13.950742 IP > udp
00:22:13.962023 IP > UDP, length 2271

What am I doing wrong?

Thanks for any help,
Nathan Bain

------ code segment ------
#include <sys/socket.h>
#include <sys/types.h>
#include <errno.h>
#include <netdb.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>

int main(int argc, char *argv[])
        char *device_address = ""; // address on eth1
        char *group = "";
        int port = 1201;

        struct hostent *h;
        if ((h = gethostbyname(group)) == NULL)
                fprintf(stderr, "unknown host '%s'\n", group);
                return -1;

        struct in_addr mcast_address;
        memcpy(&mcast_address, h->h_addr_list[0], h->h_length);

        int s = socket(PF_INET, SOCK_DGRAM, 0);
        if (s < 0)
                return -1;

        struct sockaddr_in server_address;
        server_address.sin_family = AF_INET;
        server_address.sin_addr.s_addr = htonl(INADDR_ANY);
        server_address.sin_port = htons(port);

        if (bind(s, (struct sockaddr *) &server_address,
sizeof(server_address)) < 0)
                return -1;

        struct ip_mreq mreq;
        mreq.imr_multiaddr.s_addr = mcast_address.s_addr;
        h = gethostbyname(device_address);
        memcpy((char *) &(mreq.imr_interface.s_addr),
h->h_addr_list[0], h->h_length);
        if (setsockopt(s, IPPROTO_IP, IP_ADD_MEMBERSHIP, &mreq,
sizeof(mreq)) < 0)
                return -1;

        fprintf(stderr, "Listening on %s to %s:%d\n", device_address,
group, port);

        int buffer_length = 4096;
        unsigned char *buffer = (unsigned char *)
        int packet_length;
        if ((packet_length = recv(s, (void *) buffer, buffer_length,
0)) < 0)
                return -1;
        fprintf(stderr, "Received %d-byte packet\n", packet_length);


        return 0;



1. Jumpstart Question: Solaris 2.6 vs Solaris 2.4


We have been successfully using Jumpstart to standardize the loading and
configuring of our servers and workstations for several years.  Up until
now, the OS has been Solaris 2.4.

We are preparing to migrate to Solaris 2.6.  I've sort of taken it upon
myself to begin looking at what sort of integration problems we can
anticipate having.  My initial problem is that the same Jumpstart
diskette that worked on a Solaris 2.4 Jumpstart install does not appear
to work on a Solaris 2.6 Jumpstart installation.

For our Solaris 2.4 installations, the diskette is DOS formatted, the
rules file is good, rules.ok is good, etc.  No problems.

Basically, what we do is we have a number of already configured system
files, Tcl, Ada runtime libraries and installation scripts for various
software packages and COTS applications that we copy from the diskette
to /usr/local, and then call all our installation routines from there.

The problem is that if I use the original Solaris 2.4 Jumpstart
diskette, the rules file is read fine, the OS is installed as
configured, but when the "postinst" (post installation) script is
executed, files that had been read and copied correctly in Solaris 2.4
are not visible to Solaris 2.6.  The normal "set_root_passwd" script is
not even found by the OS even though it's in the correct directory (the
diskette is still being mounted to /tmp/install_config isn't it?).

Additionally, when I use the Solaris 2.6 File Manager to look at the
files on the Jumpstart diskette, I noticed that all the files are in
UPPER CASE when using the File Manager.

So, I read the AnswerBook for creating a Jumpstart diskette for Solaris
2.6, and the AnswerBook states to create a UFS diskette (Solaris 2.4
said the same thing as I remember...).  However, when I use a UFS
diskette for a Jumpstart diskette, the OS cannot even find the
"rules.ok" file.

Has anything changed with Jumpstart for Solaris 2.6 that I'm missing?
My hardware platform is a SS20.

Thanks for your time.


Rich Johns

2. Dial-up problems.

3. SunOS 5.6 vs Solaris 2.6 vs Solaris 7 vs Solaris 8

4. comp.unix.sco Technical FAQ (2/2)

5. Opinions Wanted: Solaris 2.4 vs. AIX vs. HP/UX vs AT&T Sys5v4

6. scsi added to rh 6.0 after install

7. Errors compiling Wingz 1.4 Add-ins (Linux 1.3.99, GCC 2.6)

8. Getting the grsecurity patch to apply with XFS

9. PGP 2.6.3i vs. 2.6.2s

10. market share of solaris versions (2.6 vs. 2.7 vs. 8)

11. Caldera vs. RedHat 5.x vs Solaris 2.6 x86

12. VM issues (2.4.8pre4 and 2.4.8pre5) vs 2.4.7

13. stability in 2.6 vs. 7 vs. 8