CVS commit: src/tests/lib/libc/net
Module Name:src Committed By: kamil Date: Mon Jun 1 01:03:21 UTC 2020 Modified Files: src/tests/lib/libc/net: Makefile h_nsd_recurse.c Log Message: Avoid redefining _REENTRANT under sanitizers Switch away from -Wno-macro-redefined which was Clang specific. To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/tests/lib/libc/net/Makefile cvs rdiff -u -r1.2 -r1.3 src/tests/lib/libc/net/h_nsd_recurse.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/lib/libc/net/Makefile diff -u src/tests/lib/libc/net/Makefile:1.13 src/tests/lib/libc/net/Makefile:1.14 --- src/tests/lib/libc/net/Makefile:1.13 Sat Feb 8 00:11:18 2020 +++ src/tests/lib/libc/net/Makefile Mon Jun 1 01:03:21 2020 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.13 2020/02/08 00:11:18 kamil Exp $ +# $NetBSD: Makefile,v 1.14 2020/06/01 01:03:21 kamil Exp $ .include @@ -41,8 +41,4 @@ LDADD.h_nsd_recurse+= -lpthread CLEANFILES+= aton_ether_subr.c -.if ${MKSANITIZER:Uno} == "yes" || ${MKLIBCSANITIZER:Uno} == "yes" -COPTS.h_nsd_recurse.c+= -Wno-macro-redefined # _REENTRANT redefined -.endif - .include Index: src/tests/lib/libc/net/h_nsd_recurse.c diff -u src/tests/lib/libc/net/h_nsd_recurse.c:1.2 src/tests/lib/libc/net/h_nsd_recurse.c:1.3 --- src/tests/lib/libc/net/h_nsd_recurse.c:1.2 Thu Jan 13 02:24:51 2011 +++ src/tests/lib/libc/net/h_nsd_recurse.c Mon Jun 1 01:03:21 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: h_nsd_recurse.c,v 1.2 2011/01/13 02:24:51 pgoyette Exp $ */ +/* $NetBSD: h_nsd_recurse.c,v 1.3 2020/06/01 01:03:21 kamil Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -32,9 +32,11 @@ #include __COPYRIGHT("@(#) Copyright (c) 2008\ The NetBSD Foundation, inc. All rights reserved."); -__RCSID("$NetBSD: h_nsd_recurse.c,v 1.2 2011/01/13 02:24:51 pgoyette Exp $"); +__RCSID("$NetBSD: h_nsd_recurse.c,v 1.3 2020/06/01 01:03:21 kamil Exp $"); +#ifndef _REENTRANT #define _REENTRANT +#endif #include #include
CVS commit: src/tests/lib/libc/net/getaddrinfo
Module Name:src Committed By: pgoyette Date: Thu Jan 10 11:13:50 UTC 2019 Modified Files: src/tests/lib/libc/net/getaddrinfo: t_getaddrinfo.sh Log Message: Remove extraneous && from check_output() With this extra && the test case exits abnormally when the actual and expected outputs don't match. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/tests/lib/libc/net/getaddrinfo/t_getaddrinfo.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/lib/libc/net/getaddrinfo/t_getaddrinfo.sh diff -u src/tests/lib/libc/net/getaddrinfo/t_getaddrinfo.sh:1.2 src/tests/lib/libc/net/getaddrinfo/t_getaddrinfo.sh:1.3 --- src/tests/lib/libc/net/getaddrinfo/t_getaddrinfo.sh:1.2 Wed Jun 15 07:54:32 2011 +++ src/tests/lib/libc/net/getaddrinfo/t_getaddrinfo.sh Thu Jan 10 11:13:50 2019 @@ -1,4 +1,4 @@ -# $NetBSD: t_getaddrinfo.sh,v 1.2 2011/06/15 07:54:32 jmmv Exp $ +# $NetBSD: t_getaddrinfo.sh,v 1.3 2019/01/10 11:13:50 pgoyette Exp $ # # Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, and 2002 WIDE Project. @@ -55,7 +55,7 @@ check_output() fi cmp -s $(atf_get_srcdir)/data/${exp} out && return - diff -u $(atf_get_srcdir)/data/${exp} out && \ + diff -u $(atf_get_srcdir)/data/${exp} out atf_fail "Actual output does not match expected output" }
CVS commit: src/tests/lib/libc/net/getaddrinfo
Module Name:src Committed By: dholland Date: Tue Dec 18 08:39:03 UTC 2018 Modified Files: src/tests/lib/libc/net/getaddrinfo: no_serv_v4v6.exp Log Message: Update error string To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libc/net/getaddrinfo/no_serv_v4v6.exp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/lib/libc/net/getaddrinfo/no_serv_v4v6.exp diff -u src/tests/lib/libc/net/getaddrinfo/no_serv_v4v6.exp:1.1 src/tests/lib/libc/net/getaddrinfo/no_serv_v4v6.exp:1.2 --- src/tests/lib/libc/net/getaddrinfo/no_serv_v4v6.exp:1.1 Wed Jan 12 02:58:41 2011 +++ src/tests/lib/libc/net/getaddrinfo/no_serv_v4v6.exp Tue Dec 18 08:39:03 2018 @@ -13,4 +13,4 @@ ai3: flags 0x2 family 24 socktype 1 prot ai4: flags 0x2 family 2 socktype 1 protocol 6 addrlen 16 host 127.0.0.1 serv 0 arg: flags 0x2 family 0 socktype 0 protocol 0 addrlen 0 host (empty) serv (empty) -hostname nor servname provided, or not known +hostname or servname not provided or not known
CVS commit: src/tests/lib/libc/net/getaddrinfo
Module Name:src Committed By: dholland Date: Sun Dec 16 17:08:19 UTC 2018 Modified Files: src/tests/lib/libc/net/getaddrinfo: no_serv_v4.exp Log Message: Update error string To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libc/net/getaddrinfo/no_serv_v4.exp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/lib/libc/net/getaddrinfo/no_serv_v4.exp diff -u src/tests/lib/libc/net/getaddrinfo/no_serv_v4.exp:1.1 src/tests/lib/libc/net/getaddrinfo/no_serv_v4.exp:1.2 --- src/tests/lib/libc/net/getaddrinfo/no_serv_v4.exp:1.1 Wed Jan 12 02:58:40 2011 +++ src/tests/lib/libc/net/getaddrinfo/no_serv_v4.exp Sun Dec 16 17:08:19 2018 @@ -11,4 +11,4 @@ ai1: flags 0x2 family 2 socktype 2 proto ai2: flags 0x2 family 2 socktype 1 protocol 6 addrlen 16 host 127.0.0.1 serv 0 arg: flags 0x2 family 0 socktype 0 protocol 0 addrlen 0 host (empty) serv (empty) -hostname nor servname provided, or not known +hostname or servname not provided or not known
CVS commit: src/tests/lib/libc/net
Module Name:src Committed By: joerg Date: Tue Mar 8 08:34:17 UTC 2016 Modified Files: src/tests/lib/libc/net: t_servent.sh Log Message: libc fallback is known to not produce nice alias entries. Avoid spurious failures when testing in an empty chroot by requiring the services db. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libc/net/t_servent.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/lib/libc/net/t_servent.sh diff -u src/tests/lib/libc/net/t_servent.sh:1.1 src/tests/lib/libc/net/t_servent.sh:1.2 --- src/tests/lib/libc/net/t_servent.sh:1.1 Wed Jan 12 17:32:27 2011 +++ src/tests/lib/libc/net/t_servent.sh Tue Mar 8 08:34:17 2016 @@ -1,4 +1,4 @@ -# $NetBSD: t_servent.sh,v 1.1 2011/01/12 17:32:27 pgoyette Exp $ +# $NetBSD: t_servent.sh,v 1.2 2016/03/08 08:34:17 joerg Exp $ # # Copyright (c) 2008 The NetBSD Foundation, Inc. # All rights reserved. @@ -29,6 +29,8 @@ atf_test_case servent servent_head() { atf_set "descr" "Checks {get,set,end}servent(3)" + # libc doesn't include aliases + atf_set "require.files" "/var/db/services.cdb" } servent_body() {
CVS commit: src/tests/lib/libc/net
Module Name:src Committed By: gson Date: Sat Mar 29 16:10:54 UTC 2014 Modified Files: src/tests/lib/libc/net: h_dns_server.c Log Message: Use daemon(3) instead of the experimental daemon2_fork() and daemon2_detach(). Now that newer versions of daemon2_fork() and daemon2_detach() are used in nfsd, where two-stage daemonization is actually needed, there is no longer any reason for h_dns_server to serve as a test case and example of their use. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/tests/lib/libc/net/h_dns_server.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/lib/libc/net/h_dns_server.c diff -u src/tests/lib/libc/net/h_dns_server.c:1.3 src/tests/lib/libc/net/h_dns_server.c:1.4 --- src/tests/lib/libc/net/h_dns_server.c:1.3 Thu Jan 9 02:18:10 2014 +++ src/tests/lib/libc/net/h_dns_server.c Sat Mar 29 16:10:54 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: h_dns_server.c,v 1.3 2014/01/09 02:18:10 christos Exp $ */ +/* $NetBSD: h_dns_server.c,v 1.4 2014/03/29 16:10:54 gson Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -35,14 +35,13 @@ */ #include sys/cdefs.h -__RCSID($NetBSD: h_dns_server.c,v 1.3 2014/01/09 02:18:10 christos Exp $); +__RCSID($NetBSD: h_dns_server.c,v 1.4 2014/03/29 16:10:54 gson Exp $); #include ctype.h #include err.h #include errno.h #include fcntl.h #include memory.h -#include paths.h #include stdio.h #include stdlib.h #include unistd.h @@ -165,104 +164,6 @@ name2str(const void *v, char *buf, size_ } #endif -/* XXX the daemon2_* functions should be in a library */ - -int __daemon2_detach_pipe[2]; - -static int -daemon2_fork(void) -{ - int r; - int fd; - int i; - - /* - * Set up the pipe, making sure the write end does not - * get allocated one of the file descriptors that will - * be closed in daemon2_detach(). - */ - for (i = 0; i 3; i++) { - r = pipe(__daemon2_detach_pipe); - if (r 0) - return -1; - if (__daemon2_detach_pipe[1] = STDERR_FILENO - (fd = open(_PATH_DEVNULL, O_RDWR, 0)) != -1) { - (void)dup2(fd, __daemon2_detach_pipe[0]); - (void)dup2(fd, __daemon2_detach_pipe[1]); - if (fd STDERR_FILENO) - (void)close(fd); - continue; - } - break; - } - - r = fork(); - if (r 0) { - return -1; - } else if (r == 0) { - /* child */ - close(__daemon2_detach_pipe[0]); - return 0; - } - /* Parent */ - - (void) close(__daemon2_detach_pipe[1]); - - for (;;) { - char dummy; - r = read(__daemon2_detach_pipe[0], dummy, 1); - if (r 0) { - if (errno == EINTR) - continue; - _exit(1); - } else if (r == 0) { - _exit(1); - } else { /* r 0 */ - _exit(0); - } - } -} - -static int -daemon2_detach(int nochdir, int noclose) -{ - int r; - int fd; - - if (setsid() == -1) - return -1; - - if (!nochdir) - (void)chdir(/); - - if (!noclose (fd = open(_PATH_DEVNULL, O_RDWR, 0)) != -1) { - (void)dup2(fd, STDIN_FILENO); - (void)dup2(fd, STDOUT_FILENO); - (void)dup2(fd, STDERR_FILENO); - if (fd STDERR_FILENO) - (void)close(fd); - } - - while (1) { - r = write(__daemon2_detach_pipe[1], , 1); - if (r 0) { - if (errno == EINTR) -continue; - /* May get broken pipe here if parent is killed */ - return -1; - } else if (r == 0) { - /* Should not happen */ - return -1; - } else { - break; - } - } - - (void) close(__daemon2_detach_pipe[1]); - - return 0; -} - int main(int argc, char **argv) { int s, r, protocol; union sockaddr_either saddr; @@ -275,8 +176,6 @@ int main(int argc, char **argv) { char buf1[1024], buf2[1024]; #endif - daemon2_fork(); - if (argc 2 || ((protocol = argv[1][0]) != '4' protocol != '6')) errx(1, usage: dns_server 4 | 6); s = socket(protocol == '4' ? PF_INET : PF_INET6, SOCK_DGRAM, IPPROTO_UDP); @@ -314,9 +213,9 @@ int main(int argc, char **argv) { fprintf(f, %d, getpid()); fclose(f); #ifdef DEBUG - daemon2_detach(0, 1); + daemon(0, 1); #else - daemon2_detach(0, 0); + daemon(0, 0); #endif for (;;) {
CVS commit: src/tests/lib/libc/net
Module Name:src Committed By: gson Date: Mon Jan 13 10:49:47 UTC 2014 Modified Files: src/tests/lib/libc/net: t_hostent.sh Log Message: Add missing resolv.conf override to the gethostbyaddr6 test case. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/tests/lib/libc/net/t_hostent.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/lib/libc/net/t_hostent.sh diff -u src/tests/lib/libc/net/t_hostent.sh:1.8 src/tests/lib/libc/net/t_hostent.sh:1.9 --- src/tests/lib/libc/net/t_hostent.sh:1.8 Fri Jan 10 20:38:11 2014 +++ src/tests/lib/libc/net/t_hostent.sh Mon Jan 13 10:49:47 2014 @@ -1,4 +1,4 @@ -# $NetBSD: t_hostent.sh,v 1.8 2014/01/10 20:38:11 gson Exp $ +# $NetBSD: t_hostent.sh,v 1.9 2014/01/13 10:49:47 gson Exp $ # # Copyright (c) 2008 The NetBSD Foundation, Inc. # All rights reserved. @@ -114,7 +114,7 @@ gethostbyaddr6_head() gethostbyaddr6_body() { start_dns_server 4 - atf_check -o inline:$ans6 -x $HIJACK_DNS ${dir}/h_hostent -t auto -a $a6 + atf_check -o inline:$ans6 -x $HIJACK_DNS ${dir}/h_hostent ${res} -t auto -a $a6 } gethostbyaddr6_cleanup() {
CVS commit: src/tests/lib/libc/net
Module Name:src Committed By: gson Date: Mon Jan 13 11:08:14 UTC 2014 Modified Files: src/tests/lib/libc/net: t_hostent.sh Log Message: When using braces around shell variable names, do so consistently To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/tests/lib/libc/net/t_hostent.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/lib/libc/net/t_hostent.sh diff -u src/tests/lib/libc/net/t_hostent.sh:1.9 src/tests/lib/libc/net/t_hostent.sh:1.10 --- src/tests/lib/libc/net/t_hostent.sh:1.9 Mon Jan 13 10:49:47 2014 +++ src/tests/lib/libc/net/t_hostent.sh Mon Jan 13 11:08:14 2014 @@ -1,4 +1,4 @@ -# $NetBSD: t_hostent.sh,v 1.9 2014/01/13 10:49:47 gson Exp $ +# $NetBSD: t_hostent.sh,v 1.10 2014/01/13 11:08:14 gson Exp $ # # Copyright (c) 2008 The NetBSD Foundation, Inc. # All rights reserved. @@ -69,7 +69,7 @@ gethostbyname4_head() gethostbyname4_body() { start_dns_server 4 - atf_check -o inline:$ans4 -x $HIJACK_DNS ${dir}/h_hostent $res -t auto -4 $n4 + atf_check -o inline:$ans4 -x $HIJACK_DNS ${dir}/h_hostent ${res} -t auto -4 $n4 } gethostbyname4_cleanup() {
CVS commit: src/tests/lib/libc/net
Module Name:src Committed By: gson Date: Fri Jan 10 20:38:11 UTC 2014 Modified Files: src/tests/lib/libc/net: t_hostent.sh Log Message: Remove comment that no longer applies. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/tests/lib/libc/net/t_hostent.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/lib/libc/net/t_hostent.sh diff -u src/tests/lib/libc/net/t_hostent.sh:1.7 src/tests/lib/libc/net/t_hostent.sh:1.8 --- src/tests/lib/libc/net/t_hostent.sh:1.7 Fri Jan 10 01:43:55 2014 +++ src/tests/lib/libc/net/t_hostent.sh Fri Jan 10 20:38:11 2014 @@ -1,4 +1,4 @@ -# $NetBSD: t_hostent.sh,v 1.7 2014/01/10 01:43:55 christos Exp $ +# $NetBSD: t_hostent.sh,v 1.8 2014/01/10 20:38:11 gson Exp $ # # Copyright (c) 2008 The NetBSD Foundation, Inc. # All rights reserved. @@ -45,9 +45,7 @@ dir=$(atf_get_srcdir) res=-r ${dir}/resolv.conf # Hijack DNS traffic using a single rump server instance and a DNS -# server listening on its loopback address. Also hijack file system -# call to /etc, mapping them to the root file system of the rump -# server, so that we can control the contents of /etc/resolv.conf. +# server listening on its loopback address. start_dns_server() { export RUMP_SERVER=unix:///tmp/rumpserver
CVS commit: src/tests/lib/libc/net
Module Name:src Committed By: christos Date: Thu Jan 9 14:07:31 UTC 2014 Modified Files: src/tests/lib/libc/net: t_hostent.sh Log Message: fix copyright botch and add library for netinet6; still does not fix the problem. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/tests/lib/libc/net/t_hostent.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/lib/libc/net/t_hostent.sh diff -u src/tests/lib/libc/net/t_hostent.sh:1.5 src/tests/lib/libc/net/t_hostent.sh:1.6 --- src/tests/lib/libc/net/t_hostent.sh:1.5 Wed Jan 8 21:18:10 2014 +++ src/tests/lib/libc/net/t_hostent.sh Thu Jan 9 09:07:31 2014 @@ -1,4 +1,4 @@ -# $NetBSD: t_hostent.sh,v 1.5 2014/01/09 02:18:10 christos Exp $ +# $NetBSD: t_hostent.sh,v 1.6 2014/01/09 14:07:31 christos Exp $ # # Copyright (c) 2008 The NetBSD Foundation, Inc. # All rights reserved. @@ -13,7 +13,7 @@ #documentation and/or other materials provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS -# ``AS IS'' AND ANY EXP{res}S OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR @@ -51,9 +51,8 @@ res=-r ${dir}/resolv.conf start_dns_server() { export RUMP_SERVER=unix:///tmp/rumpserver - rump_server -lrumpdev -lrumpnet \ - -lrumpnet_net -lrumpnet_netinet -lrumpnet_local \ - $RUMP_SERVER + rump_server -lrumpdev -lrumpnet -lrumpnet_net -lrumpnet_netinet \ + -lrumpnet_netinet6 -lrumpnet_local $RUMP_SERVER HIJACK_DNS=LD_PRELOAD=/usr/lib/librumphijack.so RUMPHIJACK='socket=inet:inet6' eval $HIJACK_DNS ${dir}/h_dns_server $1 }
CVS commit: src/tests/lib/libc/net
Module Name:src Committed By: christos Date: Fri Jan 10 01:43:55 UTC 2014 Modified Files: src/tests/lib/libc/net: t_hostent.sh Log Message: Add a cleanup routine because if a test fails, the script exits and the rest of the code is not executed. Note that the cleanup routine is executed in a separate shell so environment variables are not propagated and need to be set again. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/tests/lib/libc/net/t_hostent.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/lib/libc/net/t_hostent.sh diff -u src/tests/lib/libc/net/t_hostent.sh:1.6 src/tests/lib/libc/net/t_hostent.sh:1.7 --- src/tests/lib/libc/net/t_hostent.sh:1.6 Thu Jan 9 09:07:31 2014 +++ src/tests/lib/libc/net/t_hostent.sh Thu Jan 9 20:43:55 2014 @@ -1,4 +1,4 @@ -# $NetBSD: t_hostent.sh,v 1.6 2014/01/09 14:07:31 christos Exp $ +# $NetBSD: t_hostent.sh,v 1.7 2014/01/10 01:43:55 christos Exp $ # # Copyright (c) 2008 The NetBSD Foundation, Inc. # All rights reserved. @@ -58,11 +58,12 @@ start_dns_server() { } stop_dns_server() { + export RUMP_SERVER=unix:///tmp/rumpserver kill $(cat dns_server_$1.pid) rump.halt } -atf_test_case gethostbyname4 +atf_test_case gethostbyname4 cleanup gethostbyname4_head() { atf_set descr Checks gethostbyname2(3) for AF_INET (auto, as determined by nsswitch.conf(5) @@ -71,10 +72,13 @@ gethostbyname4_body() { start_dns_server 4 atf_check -o inline:$ans4 -x $HIJACK_DNS ${dir}/h_hostent $res -t auto -4 $n4 +} +gethostbyname4_cleanup() +{ stop_dns_server 4 } -atf_test_case gethostbyname6 +atf_test_case gethostbyname6 cleanup cleanup gethostbyname6_head() { atf_set descr Checks gethostbyname2(3) for AF_INET6 (auto, as determined by nsswitch.conf(5) @@ -83,10 +87,13 @@ gethostbyname6_body() { start_dns_server 4 atf_check -o inline:$ans6 -x $HIJACK_DNS ${dir}/h_hostent ${res} -t auto -6 $n6 +} +gethostbyname6_cleanup() +{ stop_dns_server 4 } -atf_test_case gethostbyaddr4 +atf_test_case gethostbyaddr4 cleanup gethostbyaddr4_head() { atf_set descr Checks gethostbyaddr(3) for AF_INET (auto, as determined by nsswitch.conf(5) @@ -95,10 +102,13 @@ gethostbyaddr4_body() { start_dns_server 4 atf_check -o inline:$ans4 -x $HIJACK_DNS ${dir}/h_hostent ${res} -t auto -a $a4 +} +gethostbyaddr4_cleanup() +{ stop_dns_server 4 } -atf_test_case gethostbyaddr6 +atf_test_case gethostbyaddr6 cleanup gethostbyaddr6_head() { atf_set descr Checks gethostbyaddr(3) for AF_INET6 (auto, as determined by nsswitch.conf(5) @@ -107,6 +117,9 @@ gethostbyaddr6_body() { start_dns_server 4 atf_check -o inline:$ans6 -x $HIJACK_DNS ${dir}/h_hostent -t auto -a $a6 +} +gethostbyaddr6_cleanup() +{ stop_dns_server 4 } @@ -150,7 +163,7 @@ hostsbyaddrlookup6_body() atf_check -o inline:$loc6 -x ${dir}/h_hostent -f ${dir}/hosts -t file -6 -a $al6 } -atf_test_case dnsbynamelookup4 +atf_test_case dnsbynamelookup4 cleanup dnsbynamelookup4_head() { atf_set descr Checks DNS name lookup for AF_INET @@ -159,10 +172,13 @@ dnsbynamelookup4_body() { start_dns_server 4 atf_check -o inline:$ans4 -x $HIJACK_DNS ${dir}/h_hostent ${res} -t dns -4 $n4 +} +dnsbynamelookup4_cleanup() +{ stop_dns_server 4 } -atf_test_case dnsbynamelookup6 +atf_test_case dnsbynamelookup6 cleanup dnsbynamelookup6_head() { atf_set descr Checks DNS name lookup for AF_INET6 @@ -171,10 +187,13 @@ dnsbynamelookup6_body() { start_dns_server 4 atf_check -o inline:$ans6 -x $HIJACK_DNS ${dir}/h_hostent ${res} -t dns -6 $n6 +} +dnsbynamelookup6_cleanup() +{ stop_dns_server 4 } -atf_test_case dnsbyaddrlookup4 +atf_test_case dnsbyaddrlookup4 cleanup dnsbyaddrlookup4_head() { atf_set descr Checks DNS address lookup for AF_INET @@ -183,10 +202,13 @@ dnsbyaddrlookup4_body() { start_dns_server 4 atf_check -o inline:$ans4 -x $HIJACK_DNS ${dir}/h_hostent ${res} -t dns -4 -a $a4 +} +dnsbyaddrlookup4_cleanup() +{ stop_dns_server 4 } -atf_test_case dnsbyaddrlookup6 +atf_test_case dnsbyaddrlookup6 cleanup dnsbyaddrlookup6_head() { atf_set descr Checks dns address lookup for AF_INET6 @@ -195,6 +217,9 @@ dnsbyaddrlookup6_body() { start_dns_server 4 atf_check -o inline:$ans6 -x $HIJACK_DNS ${dir}/h_hostent ${res} -t dns -6 -a $a6 +} +dnsbyaddrlookup6_cleanup() +{ stop_dns_server 4 }
CVS commit: src/tests/lib/libc/net
Module Name:src Committed By: christos Date: Thu Jan 9 02:18:10 UTC 2014 Modified Files: src/tests/lib/libc/net: Makefile h_dns_server.c h_hostent.c t_hostent.sh Added Files: src/tests/lib/libc/net: resolv.conf Log Message: Use our own resolv.conf file simplifying the test to not need rump_vfs. Add debugging on the dns server One test fails (gethostbyaddr6) why? It runs without rump To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/tests/lib/libc/net/Makefile cvs rdiff -u -r1.2 -r1.3 src/tests/lib/libc/net/h_dns_server.c cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libc/net/h_hostent.c cvs rdiff -u -r0 -r1.1 src/tests/lib/libc/net/resolv.conf cvs rdiff -u -r1.4 -r1.5 src/tests/lib/libc/net/t_hostent.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/lib/libc/net/Makefile diff -u src/tests/lib/libc/net/Makefile:1.9 src/tests/lib/libc/net/Makefile:1.10 --- src/tests/lib/libc/net/Makefile:1.9 Mon Jan 6 09:50:32 2014 +++ src/tests/lib/libc/net/Makefile Wed Jan 8 21:18:10 2014 @@ -1,11 +1,11 @@ -# $NetBSD: Makefile,v 1.9 2014/01/06 14:50:32 gson Exp $ +# $NetBSD: Makefile,v 1.10 2014/01/09 02:18:10 christos Exp $ .include bsd.own.mk MKMAN= no TESTS_SUBDIRS+= getaddrinfo -FILES+=hosts +FILES+=hosts resolv.conf TESTSDIR= ${TESTSBASE}/lib/libc/net Index: src/tests/lib/libc/net/h_dns_server.c diff -u src/tests/lib/libc/net/h_dns_server.c:1.2 src/tests/lib/libc/net/h_dns_server.c:1.3 --- src/tests/lib/libc/net/h_dns_server.c:1.2 Mon Jan 6 11:42:57 2014 +++ src/tests/lib/libc/net/h_dns_server.c Wed Jan 8 21:18:10 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: h_dns_server.c,v 1.2 2014/01/06 16:42:57 gson Exp $ */ +/* $NetBSD: h_dns_server.c,v 1.3 2014/01/09 02:18:10 christos Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -35,7 +35,7 @@ */ #include sys/cdefs.h -__RCSID($NetBSD: h_dns_server.c,v 1.2 2014/01/06 16:42:57 gson Exp $); +__RCSID($NetBSD: h_dns_server.c,v 1.3 2014/01/09 02:18:10 christos Exp $); #include ctype.h #include err.h @@ -58,6 +58,12 @@ union sockaddr_either { struct sockaddr_in6 sin6; }; +#ifdef DEBUG +#define DPRINTF(...) fprintf(stderr, __VA_ARGS__) +#else +#define DPRINTF(...) +#endif + /* A DNS question and its corresponding answer */ struct dns_data { @@ -131,6 +137,34 @@ name_eq(const unsigned char *a, const un } } +#ifdef DEBUG +static char * +name2str(const void *v, char *buf, size_t buflen) { + const unsigned char *a = v; + char *b = buf; + char *eb = buf + buflen; + +#define ADDC(c) do { \ + if (b eb) \ + *b++ = c; \ + else \ + return NULL; \ + } while (/*CONSTCOND*/0) + for (int did = 0;; did++) { + int lena = *a++; + if (lena == 0) { + ADDC('\0'); + return buf; + } + if (did) + ADDC('.'); + for (int i = 0; i lena; i++) + ADDC(a[i]); + a += lena; + } +} +#endif + /* XXX the daemon2_* functions should be in a library */ int __daemon2_detach_pipe[2]; @@ -237,6 +271,9 @@ int main(int argc, char **argv) { char pidfile_name[40]; FILE *f; int one = 1; +#ifdef DEBUG + char buf1[1024], buf2[1024]; +#endif daemon2_fork(); @@ -276,7 +313,11 @@ int main(int argc, char **argv) { f = fopen(pidfile_name, w); fprintf(f, %d, getpid()); fclose(f); +#ifdef DEBUG + daemon2_detach(0, 1); +#else daemon2_detach(0, 0); +#endif for (;;) { unsigned char buf[512]; @@ -289,28 +330,47 @@ int main(int argc, char **argv) { nrecv = recvfrom(s, buf, sizeof buf, 0, from.s, fromlen); if (nrecv 0) err(1, recvfrom); - if (nrecv 12) - continue; /* Too short */ - if ((buf[2] 0x80) != 0) - continue; /* Not a query */ - if (!(buf[4] == 0 buf[5] == 1)) - continue; /* QDCOUNT is not 1 */ + if (nrecv 12) { + DPRINTF(Too short %zd\n, nrecv); + continue; + } + if ((buf[2] 0x80) != 0) { + DPRINTF(Not a query 0x%x\n, buf[2]); + continue; + } + if (!(buf[4] == 0 buf[5] == 1)) { + DPRINTF(QCOUNT is not 1 0x%x 0x%x\n, buf[4], buf[5]); + continue; /* QDCOUNT is not 1 */ + } for (dp = data; dp-qname_size != 0; dp++) { int qtype, qclass; p = buf + 12; /* Point to QNAME */ int n = name_eq(p, (const unsigned char *) dp-qname); - if (n == 0) + if (n == 0) { +DPRINTF(no match name %s != %s\n, +name2str(p, buf1, sizeof(buf1)), +name2str(dp-qname, buf2, sizeof(buf2))); continue; /* Name does not match */ + } + DPRINTF(match name %s\n, + name2str(p, buf1, sizeof(buf1))); p += n; /* Skip QNAME */ qtype = *p++ 8; qtype |= *p++; - if (qtype != dp-qtype) + if (qtype != dp-qtype) { +DPRINTF(no match name 0x%x != 0x%x\n, +qtype, dp-qtype); continue; + } + DPRINTF(match type 0x%x\n, qtype); qclass = *p++ 8; qclass |= *p++; - if (qclass != 1) /* IN */ + if (qclass != 1) { /* IN */ +DPRINTF(no match class %d != 1\n, qclass); continue; +
CVS commit: src/tests/lib/libc/net
Module Name:src Committed By: gson Date: Mon Jan 6 16:42:57 UTC 2014 Modified Files: src/tests/lib/libc/net: h_dns_server.c Log Message: Fix spelling of daemon. Pointed out by Thomas Klausner. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libc/net/h_dns_server.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/lib/libc/net/h_dns_server.c diff -u src/tests/lib/libc/net/h_dns_server.c:1.1 src/tests/lib/libc/net/h_dns_server.c:1.2 --- src/tests/lib/libc/net/h_dns_server.c:1.1 Mon Jan 6 14:50:32 2014 +++ src/tests/lib/libc/net/h_dns_server.c Mon Jan 6 16:42:57 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: h_dns_server.c,v 1.1 2014/01/06 14:50:32 gson Exp $ */ +/* $NetBSD: h_dns_server.c,v 1.2 2014/01/06 16:42:57 gson Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -35,7 +35,7 @@ */ #include sys/cdefs.h -__RCSID($NetBSD: h_dns_server.c,v 1.1 2014/01/06 14:50:32 gson Exp $); +__RCSID($NetBSD: h_dns_server.c,v 1.2 2014/01/06 16:42:57 gson Exp $); #include ctype.h #include err.h @@ -133,7 +133,7 @@ name_eq(const unsigned char *a, const un /* XXX the daemon2_* functions should be in a library */ -int __deamon2_detach_pipe[2]; +int __daemon2_detach_pipe[2]; static int daemon2_fork(void) @@ -145,16 +145,16 @@ daemon2_fork(void) /* * Set up the pipe, making sure the write end does not * get allocated one of the file descriptors that will - * be closed in deamon2_detach(). + * be closed in daemon2_detach(). */ for (i = 0; i 3; i++) { - r = pipe(__deamon2_detach_pipe); + r = pipe(__daemon2_detach_pipe); if (r 0) return -1; - if (__deamon2_detach_pipe[1] = STDERR_FILENO + if (__daemon2_detach_pipe[1] = STDERR_FILENO (fd = open(_PATH_DEVNULL, O_RDWR, 0)) != -1) { - (void)dup2(fd, __deamon2_detach_pipe[0]); - (void)dup2(fd, __deamon2_detach_pipe[1]); + (void)dup2(fd, __daemon2_detach_pipe[0]); + (void)dup2(fd, __daemon2_detach_pipe[1]); if (fd STDERR_FILENO) (void)close(fd); continue; @@ -167,16 +167,16 @@ daemon2_fork(void) return -1; } else if (r == 0) { /* child */ - close(__deamon2_detach_pipe[0]); + close(__daemon2_detach_pipe[0]); return 0; } /* Parent */ - (void) close(__deamon2_detach_pipe[1]); + (void) close(__daemon2_detach_pipe[1]); for (;;) { char dummy; - r = read(__deamon2_detach_pipe[0], dummy, 1); + r = read(__daemon2_detach_pipe[0], dummy, 1); if (r 0) { if (errno == EINTR) continue; @@ -190,7 +190,7 @@ daemon2_fork(void) } static int -deamon2_detach(int nochdir, int noclose) +daemon2_detach(int nochdir, int noclose) { int r; int fd; @@ -210,7 +210,7 @@ deamon2_detach(int nochdir, int noclose) } while (1) { - r = write(__deamon2_detach_pipe[1], , 1); + r = write(__daemon2_detach_pipe[1], , 1); if (r 0) { if (errno == EINTR) continue; @@ -224,7 +224,7 @@ deamon2_detach(int nochdir, int noclose) } } - (void) close(__deamon2_detach_pipe[1]); + (void) close(__daemon2_detach_pipe[1]); return 0; } @@ -276,7 +276,7 @@ int main(int argc, char **argv) { f = fopen(pidfile_name, w); fprintf(f, %d, getpid()); fclose(f); - deamon2_detach(0, 0); + daemon2_detach(0, 0); for (;;) { unsigned char buf[512];
CVS commit: src/tests/lib/libc/net
Module Name:src Committed By: christos Date: Fri Dec 20 20:22:26 UTC 2013 Modified Files: src/tests/lib/libc/net: t_hostent.sh Log Message: sixthavenue got upgraded To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/tests/lib/libc/net/t_hostent.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/lib/libc/net/t_hostent.sh diff -u src/tests/lib/libc/net/t_hostent.sh:1.2 src/tests/lib/libc/net/t_hostent.sh:1.3 --- src/tests/lib/libc/net/t_hostent.sh:1.2 Sun Oct 20 13:22:49 2013 +++ src/tests/lib/libc/net/t_hostent.sh Fri Dec 20 15:22:26 2013 @@ -1,4 +1,4 @@ -# $NetBSD: t_hostent.sh,v 1.2 2013/10/20 17:22:49 christos Exp $ +# $NetBSD: t_hostent.sh,v 1.3 2013/12/20 20:22:26 christos Exp $ # # Copyright (c) 2008 The NetBSD Foundation, Inc. # All rights reserved. @@ -26,11 +26,11 @@ # n6=sixthavenue.astron.com -a6=2620:106:3003:1f00:2e0:81ff:fe2f:e5d7 +a6=2620:106:3003:1f00:3e4a:92ff:fef4:e180 ans6=name=$n6, length=16, addrtype=24, aliases=[] addr_list=[$a6]\n n4=sixthavenue.astron.com -a4=38.117.134.6 +a4=38.117.134.16 ans4=name=$n4, length=4, addrtype=2, aliases=[] addr_list=[$a4]\n l6=localhost
CVS commit: src/tests/lib/libc/net
Module Name:src Committed By: christos Date: Sun Oct 20 17:22:49 UTC 2013 Modified Files: src/tests/lib/libc/net: t_hostent.sh Log Message: broadway changed addresses. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libc/net/t_hostent.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/lib/libc/net/t_hostent.sh diff -u src/tests/lib/libc/net/t_hostent.sh:1.1 src/tests/lib/libc/net/t_hostent.sh:1.2 --- src/tests/lib/libc/net/t_hostent.sh:1.1 Fri Aug 16 11:29:45 2013 +++ src/tests/lib/libc/net/t_hostent.sh Sun Oct 20 13:22:49 2013 @@ -1,4 +1,4 @@ -# $NetBSD: t_hostent.sh,v 1.1 2013/08/16 15:29:45 christos Exp $ +# $NetBSD: t_hostent.sh,v 1.2 2013/10/20 17:22:49 christos Exp $ # # Copyright (c) 2008 The NetBSD Foundation, Inc. # All rights reserved. @@ -26,11 +26,11 @@ # n6=sixthavenue.astron.com -a6=2620:106:3000:100:2e0:81ff:fe2f:e5d6 +a6=2620:106:3003:1f00:2e0:81ff:fe2f:e5d7 ans6=name=$n6, length=16, addrtype=24, aliases=[] addr_list=[$a6]\n n4=sixthavenue.astron.com -a4=208.77.212.99 +a4=38.117.134.6 ans4=name=$n4, length=4, addrtype=2, aliases=[] addr_list=[$a4]\n l6=localhost
CVS commit: src/tests/lib/libc/net
Module Name:src Committed By: christos Date: Fri Aug 16 15:29:45 UTC 2013 Modified Files: src/tests/lib/libc/net: Makefile Added Files: src/tests/lib/libc/net: h_hostent.c hosts t_hostent.sh Log Message: test harness for gethostbyname()/gethostbyaddr() and their internal bits. XXX[1]: How can we avoid using hard-coded hosts for DNS XXX[2]: How do we test NIS? To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/tests/lib/libc/net/Makefile cvs rdiff -u -r0 -r1.1 src/tests/lib/libc/net/h_hostent.c \ src/tests/lib/libc/net/hosts src/tests/lib/libc/net/t_hostent.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/lib/libc/net/Makefile diff -u src/tests/lib/libc/net/Makefile:1.7 src/tests/lib/libc/net/Makefile:1.8 --- src/tests/lib/libc/net/Makefile:1.7 Sat Sep 15 12:22:58 2012 +++ src/tests/lib/libc/net/Makefile Fri Aug 16 11:29:45 2013 @@ -1,10 +1,11 @@ -# $NetBSD: Makefile,v 1.7 2012/09/15 16:22:58 plunky Exp $ +# $NetBSD: Makefile,v 1.8 2013/08/16 15:29:45 christos Exp $ .include bsd.own.mk MKMAN= no TESTS_SUBDIRS+= getaddrinfo +FILES+=hosts TESTSDIR= ${TESTSBASE}/lib/libc/net @@ -19,12 +20,20 @@ aton_ether_subr.c: gen_ether_subr ${NETB TESTS_SH+= t_nsdispatch TESTS_SH+= t_protoent TESTS_SH+= t_servent +TESTS_SH+= t_hostent BINDIR= ${TESTSDIR} PROGS+= h_nsd_recurse PROGS+= h_protoent PROGS+= h_servent +PROGS+= h_hostent +CPPFLAGS.h_hostent.c += -I${NETBSDSRCDIR}/lib/libc/net + +# For easy debugging, without installing libc +#.PATH.c:${NETBSDSRCDIR}/lib/libc/net +#SRCS.h_hostent = h_hostent.c gethnamaddr.c +#DBG=-g3 LDADD.h_nsd_recurse+= -lpthread Added files: Index: src/tests/lib/libc/net/h_hostent.c diff -u /dev/null src/tests/lib/libc/net/h_hostent.c:1.1 --- /dev/null Fri Aug 16 11:29:45 2013 +++ src/tests/lib/libc/net/h_hostent.c Fri Aug 16 11:29:45 2013 @@ -0,0 +1,190 @@ +/* $NetBSD: h_hostent.c,v 1.1 2013/08/16 15:29:45 christos Exp $ */ + +/*- + * Copyright (c) 2013 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Christos Zoulas. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#include sys/cdefs.h +__RCSID($NetBSD: h_hostent.c,v 1.1 2013/08/16 15:29:45 christos Exp $); + +#include stdio.h +#include string.h +#include nsswitch.h +#include netdb.h +#include stdint.h +#include stdlib.h +#include unistd.h +#include err.h + +#include netinet/in.h +#include sys/types.h +#include arpa/nameser.h +#include arpa/inet.h + +#include hostent.h + +static void +phostent(const struct hostent *h) +{ + size_t i; + char buf[1024]; + const int af = h-h_length == NS_INADDRSZ ? AF_INET : AF_INET6; + + printf(name=%s, length=%d, addrtype=%d, aliases=[, + h-h_name, h-h_length, h-h_addrtype); + + for (i = 0; h-h_aliases[i]; i++) + printf(%s%s, i == 0 ? : , h-h_aliases[i]); + + printf(] addr_list=[); + + for (i = 0; h-h_addr_list[i]; i++) + printf(%s%s, i == 0 ? : , inet_ntop(af, + h-h_addr_list[i], buf, (socklen_t)sizeof(buf))); + + printf(]\n); +} + +static void +usage(void) +{ + (void)fprintf(stderr, Usage: %s [-f hostsfile] + [-t any|dns|nis|files] + [-46a] name|address\n, getprogname()); + exit(EXIT_FAILURE); +} + +static void +getby(int (*f)(void *, void *, va_list), struct getnamaddr *info, ...) +{ + va_list ap; + int e; + + va_start(ap, info); + e = (*f)(info, NULL, ap); + va_end(ap); + switch (e) { + case NS_SUCCESS: + phostent(info-hp); + break; + default: + printf(error %d\n, e); + break; + } +} + +static void +geta(struct hostent *hp) { + if (hp ==
CVS commit: src/tests/lib/libc/net
Module Name:src Committed By: plunky Date: Sat Sep 15 16:22:58 UTC 2012 Modified Files: src/tests/lib/libc/net: Makefile Log Message: correct spelling of file to clean To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/tests/lib/libc/net/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/lib/libc/net/Makefile diff -u src/tests/lib/libc/net/Makefile:1.6 src/tests/lib/libc/net/Makefile:1.7 --- src/tests/lib/libc/net/Makefile:1.6 Tue Nov 1 22:36:53 2011 +++ src/tests/lib/libc/net/Makefile Sat Sep 15 16:22:58 2012 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.6 2011/11/01 22:36:53 pgoyette Exp $ +# $NetBSD: Makefile,v 1.7 2012/09/15 16:22:58 plunky Exp $ .include bsd.own.mk @@ -28,6 +28,6 @@ PROGS+= h_servent LDADD.h_nsd_recurse+= -lpthread -CLEANFILES+= aton_ether_subr_.c +CLEANFILES+= aton_ether_subr.c .include bsd.test.mk
CVS commit: src/tests/lib/libc/net
Module Name:src Committed By: christos Date: Mon Sep 3 15:32:18 UTC 2012 Modified Files: src/tests/lib/libc/net: t_protoent.sh Log Message: whitespace To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libc/net/t_protoent.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/lib/libc/net/t_protoent.sh diff -u src/tests/lib/libc/net/t_protoent.sh:1.1 src/tests/lib/libc/net/t_protoent.sh:1.2 --- src/tests/lib/libc/net/t_protoent.sh:1.1 Wed Jan 12 12:32:27 2011 +++ src/tests/lib/libc/net/t_protoent.sh Mon Sep 3 11:32:18 2012 @@ -1,4 +1,4 @@ -# $NetBSD: t_protoent.sh,v 1.1 2011/01/12 17:32:27 pgoyette Exp $ +# $NetBSD: t_protoent.sh,v 1.2 2012/09/03 15:32:18 christos Exp $ # # Copyright (c) 2008 The NetBSD Foundation, Inc. # All rights reserved. @@ -39,29 +39,28 @@ protoent_body() # (3) prune duplicates # tr '\t' ' ' /etc/protocols | awk ' - function add(key, name, i, n, ar) { + function add(key, name, i, n, ar) { n = split(names[key], ar); - for (i=1; i=n; i++) { + for (i = 1; i = n; i++) { if (name == ar[i]) { - return; +return; } } delete ar; names[key] = names[key] name; - } - - { + } + { sub(#.*, , $0); gsub( *, , $0); - if (NF==0) { + if (NF == 0) { next; } add($2, $1, 0); - for (i=3; i=NF; i++) { + for (i = 3; i = NF; i++) { add($2, $i, 1); } - } - END { + } + END { for (key in names) { proto = key;
CVS commit: src/tests/lib/libc/net
Module Name:src Committed By: joerg Date: Wed Apr 4 10:03:54 UTC 2012 Modified Files: src/tests/lib/libc/net: t_getprotoent.c Log Message: Be UTF8 clean. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libc/net/t_getprotoent.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/lib/libc/net/t_getprotoent.c diff -u src/tests/lib/libc/net/t_getprotoent.c:1.1 src/tests/lib/libc/net/t_getprotoent.c:1.2 --- src/tests/lib/libc/net/t_getprotoent.c:1.1 Fri Jul 15 06:41:29 2011 +++ src/tests/lib/libc/net/t_getprotoent.c Wed Apr 4 10:03:53 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: t_getprotoent.c,v 1.1 2011/07/15 06:41:29 jruoho Exp $ */ +/* $NetBSD: t_getprotoent.c,v 1.2 2012/04/04 10:03:53 joerg Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -29,7 +29,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include sys/cdefs.h -__RCSID($NetBSD: t_getprotoent.c,v 1.1 2011/07/15 06:41:29 jruoho Exp $); +__RCSID($NetBSD: t_getprotoent.c,v 1.2 2012/04/04 10:03:53 joerg Exp $); #include atf-c.h #include netdb.h @@ -107,7 +107,7 @@ ATF_TC_HEAD(getprotobyname_err, tc) ATF_TC_BODY(getprotobyname_err, tc) { static const char * name[] = - { xxx, yyy, xyz, .as.d}9x.._?!!#¤,¨^//%%,, + { xxx, yyy, xyz, .as.d}9x.._?!!#\xa4,\xa8^//%%,, 0, , tCp, uDp, t c p, tcp , tcp }; size_t i;
CVS commit: src/tests/lib/libc/net
Module Name:src Committed By: pgoyette Date: Tue Nov 1 22:36:53 UTC 2011 Modified Files: src/tests/lib/libc/net: Makefile Added Files: src/tests/lib/libc/net: gen_ether_subr t_ether_aton.c Log Message: atf-ify ether_aton test To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/tests/lib/libc/net/Makefile cvs rdiff -u -r0 -r1.1 src/tests/lib/libc/net/gen_ether_subr \ src/tests/lib/libc/net/t_ether_aton.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/lib/libc/net/Makefile diff -u src/tests/lib/libc/net/Makefile:1.5 src/tests/lib/libc/net/Makefile:1.6 --- src/tests/lib/libc/net/Makefile:1.5 Fri Jul 15 06:41:29 2011 +++ src/tests/lib/libc/net/Makefile Tue Nov 1 22:36:53 2011 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.5 2011/07/15 06:41:29 jruoho Exp $ +# $NetBSD: Makefile,v 1.6 2011/11/01 22:36:53 pgoyette Exp $ .include bsd.own.mk @@ -9,6 +9,12 @@ TESTS_SUBDIRS+= getaddrinfo TESTSDIR= ${TESTSBASE}/lib/libc/net TESTS_C+= t_getprotoent +TESTS_C+= t_ether_aton + +SRCS.t_ether_aton= aton_ether_subr.c t_ether_aton.c + +aton_ether_subr.c: gen_ether_subr ${NETBSDSRCDIR}/sys/net/if_ethersubr.c + ${HOST_SH} ${.ALLSRC} ${.TARGET} TESTS_SH+= t_nsdispatch TESTS_SH+= t_protoent @@ -22,4 +28,6 @@ PROGS+= h_servent LDADD.h_nsd_recurse+= -lpthread +CLEANFILES+= aton_ether_subr_.c + .include bsd.test.mk Added files: Index: src/tests/lib/libc/net/gen_ether_subr diff -u /dev/null src/tests/lib/libc/net/gen_ether_subr:1.1 --- /dev/null Tue Nov 1 22:36:53 2011 +++ src/tests/lib/libc/net/gen_ether_subr Tue Nov 1 22:36:53 2011 @@ -0,0 +1,25 @@ +#!/bin/sh + +awk ' +BEGIN { + print + print #include ctype.h + print #include sys/types.h + print #include errno.h + print + print #define ETHER_ADDR_LEN 6 + print + print int ether_aton_r(u_char *dest, size_t len, const char *str); + print +} +/^ether_aton_r/ { + print prevline + out = 1 +} +{ + if (out) print + else prevline = $0 +} +/^}$/ { + if (out) exit(0) +}' $1 $2 Index: src/tests/lib/libc/net/t_ether_aton.c diff -u /dev/null src/tests/lib/libc/net/t_ether_aton.c:1.1 --- /dev/null Tue Nov 1 22:36:53 2011 +++ src/tests/lib/libc/net/t_ether_aton.c Tue Nov 1 22:36:53 2011 @@ -0,0 +1,104 @@ +/* $NetBSD: t_ether_aton.c,v 1.1 2011/11/01 22:36:53 pgoyette Exp $ */ + +/*- + * Copyright (c) 2010 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Christos Zoulas. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + *must display the following acknowledgement: + *This product includes software developed by the NetBSD + *Foundation, Inc. and its contributors. + * 4. Neither the name of The NetBSD Foundation nor the names of its + *contributors may be used to endorse or promote products derived + *from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#include sys/cdefs.h +__RCSID($NetBSD: t_ether_aton.c,v 1.1 2011/11/01 22:36:53 pgoyette Exp $); + +#include atf-c.h +#include stdio.h +#include ctype.h +#include sys/types.h +#include err.h +#include string.h +#include errno.h + +#define ETHER_ADDR_LEN 6 + +int ether_aton_r(u_char *dest, size_t len, const char *str); + +static const struct { + u_char res[ETHER_ADDR_LEN]; + const char *str; + int error; +} tests[] = { + { { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab }, 01:23:45:67:89:ab, 0 }, + { { 0x00, 0x01, 0x22, 0x03, 0x14, 0x05 }, 0:1:22-3:14:05, 0 }, + { { 0x00, 0x01, 0x22, 0x03, 0x14, 0x05 }, 000122031405, 0 }, + { {
CVS commit: src/tests/lib/libc/net/getaddrinfo
Module Name:src Committed By: jmmv Date: Wed Jun 15 07:54:33 UTC 2011 Modified Files: src/tests/lib/libc/net/getaddrinfo: t_getaddrinfo.sh Log Message: Fix obvious typo in test case name. Uncovered by atf 0.14. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libc/net/getaddrinfo/t_getaddrinfo.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/lib/libc/net/getaddrinfo/t_getaddrinfo.sh diff -u src/tests/lib/libc/net/getaddrinfo/t_getaddrinfo.sh:1.1 src/tests/lib/libc/net/getaddrinfo/t_getaddrinfo.sh:1.2 --- src/tests/lib/libc/net/getaddrinfo/t_getaddrinfo.sh:1.1 Wed Jan 12 02:58:41 2011 +++ src/tests/lib/libc/net/getaddrinfo/t_getaddrinfo.sh Wed Jun 15 07:54:32 2011 @@ -1,4 +1,4 @@ -# $NetBSD: t_getaddrinfo.sh,v 1.1 2011/01/12 02:58:41 pgoyette Exp $ +# $NetBSD: t_getaddrinfo.sh,v 1.2 2011/06/15 07:54:32 jmmv Exp $ # # Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, and 2002 WIDE Project. @@ -154,7 +154,7 @@ check_output sock_raw hosts } -atf_test_case unspported_family +atf_test_case unsupported_family unsupported_family_head() { atf_set descr Testing unsupported family @@ -193,6 +193,6 @@ atf_add_test_case empty_hostname atf_add_test_case empty_servname atf_add_test_case sock_raw - atf_add_test_case unspported_family + atf_add_test_case unsupported_family atf_add_test_case scopeaddr }
CVS commit: src/tests/lib/libc/net
Module Name:src Committed By: pgoyette Date: Thu Jan 13 02:24:52 UTC 2011 Modified Files: src/tests/lib/libc/net: Makefile h_nsd_recurse.c Log Message: Re-add missing -lpthread and fix some structure inializers (not sure how these ever compiled) To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/tests/lib/libc/net/Makefile cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libc/net/h_nsd_recurse.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/lib/libc/net/Makefile diff -u src/tests/lib/libc/net/Makefile:1.3 src/tests/lib/libc/net/Makefile:1.4 --- src/tests/lib/libc/net/Makefile:1.3 Thu Jan 13 01:56:44 2011 +++ src/tests/lib/libc/net/Makefile Thu Jan 13 02:24:51 2011 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.3 2011/01/13 01:56:44 pgoyette Exp $ +# $NetBSD: Makefile,v 1.4 2011/01/13 02:24:51 pgoyette Exp $ .include bsd.own.mk @@ -18,6 +18,6 @@ PROGS+= h_protoent PROGS+= h_servent -LDADD.h_nsd_dispatch+= -lpthread +LDADD.h_nsd_recurse+= -lpthread .include bsd.test.mk Index: src/tests/lib/libc/net/h_nsd_recurse.c diff -u src/tests/lib/libc/net/h_nsd_recurse.c:1.1 src/tests/lib/libc/net/h_nsd_recurse.c:1.2 --- src/tests/lib/libc/net/h_nsd_recurse.c:1.1 Thu Jan 13 01:56:44 2011 +++ src/tests/lib/libc/net/h_nsd_recurse.c Thu Jan 13 02:24:51 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: h_nsd_recurse.c,v 1.1 2011/01/13 01:56:44 pgoyette Exp $ */ +/* $NetBSD: h_nsd_recurse.c,v 1.2 2011/01/13 02:24:51 pgoyette Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -32,7 +32,7 @@ #include sys/cdefs.h __COPYRIGHT(@(#) Copyright (c) 2008\ The NetBSD Foundation, inc. All rights reserved.); -__RCSID($NetBSD: h_nsd_recurse.c,v 1.1 2011/01/13 01:56:44 pgoyette Exp $); +__RCSID($NetBSD: h_nsd_recurse.c,v 1.2 2011/01/13 02:24:51 pgoyette Exp $); #define _REENTRANT @@ -45,7 +45,7 @@ static const ns_src testsrc[] = { { test, NS_SUCCESS }, - { 0 } + { NULL, 0 } }; static int @@ -62,7 +62,7 @@ { static const ns_dtab dtab[] = { { test, func3, NULL }, - { 0 } + { NULL, NULL, NULL } }; int r; @@ -78,7 +78,7 @@ { static const ns_dtab dtab[] = { { test, func2, NULL }, - { 0 } + { NULL, NULL, NULL } }; int r;