From e252552d6595cc4ec06366a85a9c4cebcd12f811 Mon Sep 17 00:00:00 2001 From: sthen Date: Wed, 26 Jan 2011 13:51:43 +0000 Subject: [PATCH] - fix multicast virtual networks; setsockopt(SOL_IP, IP_MULTICAST_LOOP) takes a u_char, not int as in the 0.13.0 qemu code. from mcbride@ with name change by fgsch@. - fix copy-and-pasto in the sample qemu-ifdown script resulting in tun interface not being removed and errors when qemu closes. from me. ok mcbride@(first part) fgsch@ ajacoutot@ landry@ --- emulators/qemu/Makefile | 4 ++-- emulators/qemu/files/qemu-ifdown | 2 +- emulators/qemu/patches/patch-net_socket_c | 23 +++++++++++++++++++++++ 3 files changed, 26 insertions(+), 3 deletions(-) create mode 100644 emulators/qemu/patches/patch-net_socket_c diff --git a/emulators/qemu/Makefile b/emulators/qemu/Makefile index b06533a13ae..0aab3ccfeda 100644 --- a/emulators/qemu/Makefile +++ b/emulators/qemu/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.60 2011/01/19 16:22:31 sthen Exp $ +# $OpenBSD: Makefile,v 1.61 2011/01/26 13:51:43 sthen Exp $ # no success building on other archs yet ONLY_FOR_ARCHS = i386 amd64 sparc64 @@ -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/ diff --git a/emulators/qemu/files/qemu-ifdown b/emulators/qemu/files/qemu-ifdown index 1ed7f33b96c..24be8f5dd82 100644 --- a/emulators/qemu/files/qemu-ifdown +++ b/emulators/qemu/files/qemu-ifdown @@ -11,4 +11,4 @@ if test `id -u` -ne 0; then SUDO=sudo fi -$SUDO ifconfig $brif del $1 > /dev/null 2>&1 +$SUDO ifconfig $BRIDGE del $1 > /dev/null 2>&1 diff --git a/emulators/qemu/patches/patch-net_socket_c b/emulators/qemu/patches/patch-net_socket_c new file mode 100644 index 00000000000..48048182a43 --- /dev/null +++ b/emulators/qemu/patches/patch-net_socket_c @@ -0,0 +1,23 @@ +$OpenBSD: patch-net_socket_c,v 1.1 2011/01/26 13:51:43 sthen Exp $ +--- 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 loop; + 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; ++ loop = 1; + ret=setsockopt(fd, IPPROTO_IP, IP_MULTICAST_LOOP, +- (const char *)&val, sizeof(val)); ++ (const char *)&loop, sizeof(loop)); + if (ret < 0) { + perror("setsockopt(SOL_IP, IP_MULTICAST_LOOP)"); + goto fail;