From: Brad <brad@comstyle.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH] Fix forcing multicast msgs to loopback on OpenBSD.
Date: Fri, 29 Jul 2011 19:15:11 -0400 [thread overview]
Message-ID: <20110729231511.GA24006@rox.home.comstyle.com> (raw)
Fix forcing multicast msgs to loopback on OpenBSD.
e.g.
$ 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
Signed-off-by: Brad Smith <brad@comstyle.com>
---
net/socket.c | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/net/socket.c b/net/socket.c
index 11fe5f3..4c27097 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -154,6 +154,12 @@ static int net_socket_mcast_create(struct sockaddr_in *mcastaddr, struct in_addr
struct ip_mreq imr;
int fd;
int val, ret;
+#ifdef __OpenBSD__
+ u_char loop;
+#else
+ int loop;
+#endif
+
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),
@@ -197,9 +203,9 @@ static int net_socket_mcast_create(struct sockaddr_in *mcastaddr, struct in_addr
}
/* 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;
--
1.7.6
--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
next reply other threads:[~2011-07-29 23:15 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-29 23:15 Brad [this message]
2011-07-30 8:41 ` [Qemu-devel] [PATCH] Fix forcing multicast msgs to loopback on OpenBSD Blue Swirl
2011-07-30 23:34 ` Brad
2011-08-04 22:48 ` Brad
2011-08-07 11:10 ` Blue Swirl
2011-08-08 1:44 ` [Qemu-devel] [STABLE] " Brad
2011-08-31 20:10 ` Justin M. Forbes
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110729231511.GA24006@rox.home.comstyle.com \
--to=brad@comstyle.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).