On Wed, Aug 1, 2018 at 6:10 AM Peter Maydell <peter.mayd...@linaro.org> wrote:
> On 1 August 2018 at 00:25, Andrew Oates <aoa...@google.com> wrote: > > Both CONFIG_BSD and not-CONFIG_LINUX work on macOS. I unfortunately > don't > > have access to any other BSDs to test them, though. > > Is there an easy way to test it? The QEMU makefiles have some > runes for setting up a BSD VM... > Ok, it turns out that SOCK_DGRAM+IPPROTO_ICMP isn't actually supported on FreeBSD---tested in qemu (thanks for the tip!). I didn't actually boot up NetBSD or OpenBSD, but poking around the kernel source I found for them it appears they have the same restriction: https://github.com/freebsd/freebsd/blob/master/sys/netinet/in_proto.c https://github.com/openbsd/src/blob/master/sys/netinet/in_proto.c http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/netinet/in_proto.c?rev=1.128&content-type=text/x-cvsweb-markup (search for SOCK_DGRAM and IPPROTO_ICMP in the above). So I don't think ICMP via SLIRP would work at all in the other BSDs, meaning this patch is a no-op for them either way. If we _were_ to make SLIRP+ICMP work in *BSD, we'd presumably want to do it with a SOCK_RAW+IPPROTO_ICMP socket (which would require special permissions to create), which would mean an included IP header---so I think that #ifdef CONFIG_BSD here is defensible. I did some poking for Solaris and Haiku and didn't find much, though it looks like the version of ping included w/ Haiku uses SOCK_RAW rather than SOCK_DGRAM, so it may be in the same boat as non-OSX-BSDs ( https://github.com/haiku/haiku/blob/master/src/bin/network/ping/ping.c#L205 ). ~Andrew > > thanks > -- PMM >