Fix forcing multicast msgs to loopback on OpenBSD.
Subsystems (2)
PATCH 1/1 Fix forcing multicast msgs to loopback on OpenBSD.
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--- net/socket.c | 10 ++++++++-- 1 files changed, 8 insertions(+), 2 deletions(-)
net/socket.c +8 -2
@@ -154,6 +154,12 @@ static int net_socket_mcast_create(struct sockaddr_in *mcastaddr, struct in_addrstruct 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;
Signature · 7 lines
1.7.6 -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.
Quoted 26 lines · Brad
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 initializedSigned-off-by Brad Smith <[email protected]>---
net/socket.c | 10 ++++++++--1 files changed, 8 insertions(+), 2 deletions(-)net/socket.c +0
-0
net/socket.c static int net_socket_mcast_create(struct sockaddr_in *mcastaddr, struct in_addr · line 158
Quoted 5 lines
net/socket.c +2
-0@@ -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.
Quoted 30 lines
net/socket.c +6
-3+#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.
Quoted 15 lines · Brad
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
Quoted 1 line
Signed-off-by Brad Smith <[email protected]>
An updated diff taking Blue Swirl's comment into consideration.
--- net/socket.c | 10 ++++++++-- 1 files changed, 8 insertions(+), 2 deletions(-)
net/socket.c +8 -2
@@ -154,6 +154,12 @@ static int net_socket_mcast_create(struct sockaddr_in *mcastaddr, struct in_addrstruct 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;
Signature · 7 lines
1.7.6 -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.
----- Original message -----
Quoted 17 lines · Brad
Quoted 16 lines
Fix forcing multicast msgs to loopback on OpenBSD.
e.g.
$ sudo qemu -m 128 -no-fd-bootchk \(quoted diff) +0
-7-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
Quoted 3 lines
Quoted 1 line
Signed-off-by Brad Smith <[email protected]>An updated diff taking Blue Swirl's comment into consideration.
ping.
Signature · 3 lines
This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.
Blue Swirl
AppliedThanks, applied.
Quoted 65 lines · Brad
Quoted 15 lines · Brad
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 initializedQuoted 1 line
Signed-off-by Brad Smith <[email protected]>An updated diff taking Blue Swirl's comment into consideration.
---
net/socket.c | 10 ++++++++--1 files changed, 8 insertions(+), 2 deletions(-)net/socket.c +8
-3@@ -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.
Could this please be pulled back to the 0.15 branch?
commit b49b710aae35add54321e4ba1b338cf6db25c2a2
Author: Brad Smith <[email protected]> Date: Sat Jul 30 19:08:51 2011 -0400
Fix forcing multicast msgs to loopback on OpenBSD.
Quoted 59 lines · Blue Swirl
Thanks, applied.
Quoted 56 lines · Brad
Quoted 15 lines · Brad
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 initializedQuoted 1 line
Signed-off-by Brad Smith<[email protected]>An updated diff taking Blue Swirl's comment into consideration.
--- net/socket.c | 10 ++++++++-- 1 files changed, 8 insertions(+), 2 deletions(-)net/socket.c +8
-3@@ -154,6 +154,12 @@ static int net_socket_mcast_create(struct sockaddr_in *mcastaddr, struct in_addrstruct 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
Signature · 3 lines
This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.
Quoted 9 lines · Brad
Could this please be pulled back to the 0.15 branch?
commit
b49b710aae35add54321e4ba1b338cf6db25c2a2Author: Brad Smith <[email protected]> Date: Sat Jul 30 19:08:51 2011 -0400Fix forcing multicast msgs to loopback on OpenBSD.
Pulled, thanks.
Justin