All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] Fix forcing multicast msgs to loopback on OpenBSD.
@ 2011-07-29 23:15 Brad
  2011-07-30  8:41 ` Blue Swirl
  2011-07-30 23:34 ` Brad
  0 siblings, 2 replies; 7+ messages in thread
From: Brad @ 2011-07-29 23:15 UTC (permalink / raw)
  To: qemu-devel

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.

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [PATCH] Fix forcing multicast msgs to loopback on OpenBSD.
  2011-07-29 23:15 [Qemu-devel] [PATCH] Fix forcing multicast msgs to loopback on OpenBSD Brad
@ 2011-07-30  8:41 ` Blue Swirl
  2011-07-30 23:34 ` Brad
  1 sibling, 0 replies; 7+ messages in thread
From: Blue Swirl @ 2011-07-30  8:41 UTC (permalink / raw)
  To: Brad; +Cc: qemu-devel

On Sat, Jul 30, 2011 at 2:15 AM, Brad <brad@comstyle.com> wrote:
> 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;

Please use plain char, nonstandard types like u_char should not be used.

> +#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.
>
>
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [PATCH] Fix forcing multicast msgs to loopback on OpenBSD.
  2011-07-29 23:15 [Qemu-devel] [PATCH] Fix forcing multicast msgs to loopback on OpenBSD Brad
  2011-07-30  8:41 ` Blue Swirl
@ 2011-07-30 23:34 ` Brad
  2011-08-04 22:48   ` Brad
  2011-08-07 11:10   ` Blue Swirl
  1 sibling, 2 replies; 7+ messages in thread
From: Brad @ 2011-07-30 23:34 UTC (permalink / raw)
  To: qemu-devel

On Fri, Jul 29, 2011 at 07:15:11PM -0400, Brad wrote:
> 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>

An updated diff taking Blue Swirl's comment into consideration.


---
 net/socket.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/net/socket.c b/net/socket.c
index 11fe5f3..5cd0b9a 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__
+    unsigned 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.

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [PATCH] Fix forcing multicast msgs to loopback on OpenBSD.
  2011-07-30 23:34 ` Brad
@ 2011-08-04 22:48   ` Brad
  2011-08-07 11:10   ` Blue Swirl
  1 sibling, 0 replies; 7+ messages in thread
From: Brad @ 2011-08-04 22:48 UTC (permalink / raw)
  To: qemu-devel

----- Original message -----
> On Fri, Jul 29, 2011 at 07:15:11PM -0400, Brad wrote:
> > 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>
> 
> An updated diff taking Blue Swirl's comment into consideration.

ping.

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [PATCH] Fix forcing multicast msgs to loopback on OpenBSD.
  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
  1 sibling, 1 reply; 7+ messages in thread
From: Blue Swirl @ 2011-08-07 11:10 UTC (permalink / raw)
  To: Brad; +Cc: qemu-devel

Thanks, applied.

On Sat, Jul 30, 2011 at 11:34 PM, Brad <brad@comstyle.com> wrote:
> On Fri, Jul 29, 2011 at 07:15:11PM -0400, Brad wrote:
>> 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>
>
> An updated diff taking Blue Swirl's comment into consideration.
>
>
> ---
>  net/socket.c |   10 ++++++++--
>  1 files changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/net/socket.c b/net/socket.c
> index 11fe5f3..5cd0b9a 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__
> +    unsigned 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.
>
>
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Qemu-devel] [STABLE] Fix forcing multicast msgs to loopback on OpenBSD.
  2011-08-07 11:10   ` Blue Swirl
@ 2011-08-08  1:44     ` Brad
  2011-08-31 20:10       ` Justin M. Forbes
  0 siblings, 1 reply; 7+ messages in thread
From: Brad @ 2011-08-08  1:44 UTC (permalink / raw)
  To: jmforbes, qemu-devel

Could this please be pulled back to the 0.15 branch?


commit b49b710aae35add54321e4ba1b338cf6db25c2a2
Author: Brad Smith <brad@comstyle.com>
Date:   Sat Jul 30 19:08:51 2011 -0400

     Fix forcing multicast msgs to loopback on OpenBSD.


On 07/08/11 7:10 AM, Blue Swirl wrote:
> Thanks, applied.
>
> On Sat, Jul 30, 2011 at 11:34 PM, Brad<brad@comstyle.com>  wrote:
>> On Fri, Jul 29, 2011 at 07:15:11PM -0400, Brad wrote:
>>> 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>
>>
>> An updated diff taking Blue Swirl's comment into consideration.
>>
>>
>> ---
>>   net/socket.c |   10 ++++++++--
>>   1 files changed, 8 insertions(+), 2 deletions(-)
>>
>> diff --git a/net/socket.c b/net/socket.c
>> index 11fe5f3..5cd0b9a 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__
>> +    unsigned 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.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [STABLE] Fix forcing multicast msgs to loopback on OpenBSD.
  2011-08-08  1:44     ` [Qemu-devel] [STABLE] " Brad
@ 2011-08-31 20:10       ` Justin M. Forbes
  0 siblings, 0 replies; 7+ messages in thread
From: Justin M. Forbes @ 2011-08-31 20:10 UTC (permalink / raw)
  To: Brad; +Cc: qemu-devel

On Sun, 2011-08-07 at 21:44 -0400, Brad wrote:
> Could this please be pulled back to the 0.15 branch?
> 
> 
> commit b49b710aae35add54321e4ba1b338cf6db25c2a2
> Author: Brad Smith <brad@comstyle.com>
> Date:   Sat Jul 30 19:08:51 2011 -0400
> 
>      Fix forcing multicast msgs to loopback on OpenBSD.
> 

Pulled, thanks.


Justin

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-08-31 20:10 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-29 23:15 [Qemu-devel] [PATCH] Fix forcing multicast msgs to loopback on OpenBSD Brad
2011-07-30  8:41 ` 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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.