Date: Wed, 16 Feb 2011 08:58:53 -0500 From: John Baldwin <jhb@freebsd.org> To: Bruce Simpson <bms@incunabulum.net> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Bruce M Simpson <bms@freebsd.org> Subject: Re: svn commit: r191651 - head/usr.sbin/mtest Message-ID: <201102160858.53577.jhb@freebsd.org> In-Reply-To: <4D5BBF76.40409@incunabulum.net> References: <200904290950.n3T9o46f075350@svn.freebsd.org> <201102151034.46242.jhb@freebsd.org> <4D5BBF76.40409@incunabulum.net>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wednesday, February 16, 2011 7:13:42 am Bruce Simpson wrote: > John, > > That's news to me. I'm pretty sure I tested this code with and without > INET6 when I checked it in, given I was mostly testing without INET6. > > This was a very long time ago, so I was surprised to receive your > message. Could something have changed to have broken mtest? I think the code was always busted (and I just tried to use mtest on 8 for the first time today with a kernel that had INET6 compiled out): int main(int argc, char **argv) { char line[LINE_LENGTH]; char *p; int i, s, s6; s = -1; s6 = -1; #ifdef INET s = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); if (s == -1) err(1, "can't open IPv4 socket"); #endif #ifdef INET6 s6 = socket(AF_INET6, SOCK_DGRAM, IPPROTO_UDP); if (s6 == -1) err(1, "can't open IPv6 socket"); #endif With INET6 enabled in userland but a kernel not built with INET6, then the call to socket() for s6 will fail causing it to exit right away. Presumably the code should be changed to do something more like: #ifdef INET s = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); #else s = -1; #endif #ifdef INET6 s6 = socket(AF_INET6, SOCK_DGRAM, IPPROTO_UDP); #else s6 = -1; #endif if (s < 0 && s6 < 0) err(1, "can't open socket"); However, the rest of the code in mtest needs to be updated as well to not assume that 's' and 's6' are always valid so it would be a fair amount of work. > thanks > BMS > > John Baldwin wrote: > > On Wednesday, April 29, 2009 5:50:04 am Bruce M Simpson wrote: > >> Author: bms > >> Date: Wed Apr 29 09:50:04 2009 > >> New Revision: 191651 > >> URL: http://svn.freebsd.org/changeset/base/191651 > >> > >> Log: > >> Merge IPv6-capable mtest(8) from MLDv2 branch. > >> > >> Modified: > >> head/usr.sbin/mtest/Makefile > >> head/usr.sbin/mtest/mtest.8 > >> head/usr.sbin/mtest/mtest.c > > > > This is completely broken as it fails to work if you don't have INET6 compiled > > into the kernel, even if all you want to do is test joining IPv4 multicast > > groups. > > > -- John Baldwin
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201102160858.53577.jhb>