On Mon, Jan 24, 2011 at 05:03:23PM +0900, Ryan McBride wrote:
> $ sudo qemu -m 128 -no-fd-bootchk \
>         -hda virtual.img -boot n -nographic \
>         -net nic,vlan=0,model=rtl8139,macaddr=52:54:00:12:34:03 \
>         -net user -tftp /usr/src/sys/arch/i386/compile/TEST -bootp pxeboot \
>         -net nic,vlan=1,model=rtl8139,macaddr=52:54:00:23:03:01 \
>         -net tap,vlan=1,script=no \
>         -net nic,vlan=3,model=rtl8139,macaddr=52:54:00:23:03:03 \
>         -net socket,vlan=3,mcast=230.0.0.1:10003 
> setsockopt(SOL_IP, IP_MULTICAST_LOOP): Invalid argument
> qemu: -net socket,vlan=3,mcast=230.0.0.1:10003: Device 'socket' could not be 
> initialized
> 
> Works fine if I comment out the last two lines.

setsockopt(SOL_IP, IP_MULTICAST_LOOP) takes a u_char, not int as in the
0.13.0 qemu code.

The patch to net/socket.c below fixes this, which lets me test the
pthreads changes properly with my setup.

Index: Makefile
===================================================================
RCS file: /cvs/ports/emulators/qemu/Makefile,v
retrieving revision 1.60
diff -u -p -r1.60 Makefile
--- Makefile    19 Jan 2011 16:22:31 -0000      1.60
+++ Makefile    24 Jan 2011 23:40:48 -0000
@@ -6,7 +6,7 @@ ONLY_FOR_ARCHS =        i386 amd64 sparc64
 COMMENT =              multi system emulator
 
 DISTNAME =             qemu-0.13.0
-REVISION =             0
+REVISION =             1
 CATEGORIES =           emulators
 
 HOMEPAGE =             http://www.qemu.org/
--- /dev/null   Tue Jan 25 08:41:19 2011
+++ patches/patch-net_socket_c  Tue Jan 25 05:57:22 2011
@@ -0,0 +1,23 @@
+$OpenBSD$
+--- net/socket.c.orig  Sat Oct 16 05:56:09 2010
++++ net/socket.c       Tue Jan 25 05:57:04 2011
+@@ -154,6 +154,7 @@ static int net_socket_mcast_create(struct sockaddr_in 
+     struct ip_mreq imr;
+     int fd;
+     int val, ret;
++    u_char val2;
+     if (!IN_MULTICAST(ntohl(mcastaddr->sin_addr.s_addr))) {
+       fprintf(stderr, "qemu: error: specified mcastaddr \"%s\" (0x%08x) does 
not contain a multicast address\n",
+               inet_ntoa(mcastaddr->sin_addr),
+@@ -193,9 +194,9 @@ static int net_socket_mcast_create(struct sockaddr_in 
+     }
+ 
+     /* Force mcast msgs to loopback (eg. several QEMUs in same host */
+-    val = 1;
++    val2 = 1;
+     ret=setsockopt(fd, IPPROTO_IP, IP_MULTICAST_LOOP,
+-                   (const char *)&val, sizeof(val));
++                   (const char *)&val2, sizeof(val2));
+     if (ret < 0) {
+       perror("setsockopt(SOL_IP, IP_MULTICAST_LOOP)");
+       goto fail;

Reply via email to