summaryrefslogtreecommitdiff
path: root/src/regress/lib/libc/getaddrinfo
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/regress/lib/libc/getaddrinfo/Makefile10
-rw-r--r--src/regress/lib/libc/getaddrinfo/answer110
-rw-r--r--src/regress/lib/libc/getaddrinfo/gaitest.c193
-rw-r--r--src/regress/lib/libc/getaddrinfo/testsuite.sh89
4 files changed, 0 insertions, 402 deletions
diff --git a/src/regress/lib/libc/getaddrinfo/Makefile b/src/regress/lib/libc/getaddrinfo/Makefile
deleted file mode 100644
index 7a78438a12..0000000000
--- a/src/regress/lib/libc/getaddrinfo/Makefile
+++ /dev/null
@@ -1,10 +0,0 @@
1# $OpenBSD: Makefile,v 1.5 2017/07/27 17:43:24 bluhm Exp $
2
3PROG = gaitest
4CLEANFILES = out
5
6run-regress-${PROG}: ${PROG}
7 sh ${.CURDIR}/testsuite.sh >out 2>&1
8 diff -u10 out ${.CURDIR}/answer
9
10.include <bsd.regress.mk>
diff --git a/src/regress/lib/libc/getaddrinfo/answer b/src/regress/lib/libc/getaddrinfo/answer
deleted file mode 100644
index af6d069bbe..0000000000
--- a/src/regress/lib/libc/getaddrinfo/answer
+++ /dev/null
@@ -1,110 +0,0 @@
1== basic ones
2arg: flags 0x2 family 0 socktype 0 protocol 0 addrlen 0 host ::1 serv http
3ai1: flags 0x2 family 24 socktype 1 protocol 6 addrlen 28 host ::1 serv 80
4arg: flags 0x2 family 0 socktype 0 protocol 0 addrlen 0 host 127.0.0.1 serv http
5ai1: flags 0x2 family 2 socktype 1 protocol 6 addrlen 16 host 127.0.0.1 serv 80
6arg: flags 0x2 family 0 socktype 0 protocol 0 addrlen 0 host localhost serv http
7ai1: flags 0x2 family 2 socktype 1 protocol 6 addrlen 16 host 127.0.0.1 serv 80
8ai2: flags 0x2 family 24 socktype 1 protocol 6 addrlen 28 host ::1 serv 80
9arg: flags 0x2 family 0 socktype 0 protocol 0 addrlen 0 host ::1 serv tftp
10ai1: flags 0x2 family 24 socktype 2 protocol 17 addrlen 28 host ::1 serv 69
11arg: flags 0x2 family 0 socktype 0 protocol 0 addrlen 0 host 127.0.0.1 serv tftp
12ai1: flags 0x2 family 2 socktype 2 protocol 17 addrlen 16 host 127.0.0.1 serv 69
13arg: flags 0x2 family 0 socktype 0 protocol 0 addrlen 0 host localhost serv tftp
14ai1: flags 0x2 family 2 socktype 2 protocol 17 addrlen 16 host 127.0.0.1 serv 69
15ai2: flags 0x2 family 24 socktype 2 protocol 17 addrlen 28 host ::1 serv 69
16arg: flags 0x2 family 0 socktype 0 protocol 0 addrlen 0 host ::1 serv echo
17ai1: flags 0x2 family 24 socktype 2 protocol 17 addrlen 28 host ::1 serv 7
18ai2: flags 0x2 family 24 socktype 1 protocol 6 addrlen 28 host ::1 serv 7
19arg: flags 0x2 family 0 socktype 0 protocol 0 addrlen 0 host 127.0.0.1 serv echo
20ai1: flags 0x2 family 2 socktype 2 protocol 17 addrlen 16 host 127.0.0.1 serv 7
21ai2: flags 0x2 family 2 socktype 1 protocol 6 addrlen 16 host 127.0.0.1 serv 7
22arg: flags 0x2 family 0 socktype 0 protocol 0 addrlen 0 host localhost serv echo
23ai1: flags 0x2 family 2 socktype 2 protocol 17 addrlen 16 host 127.0.0.1 serv 7
24ai2: flags 0x2 family 2 socktype 1 protocol 6 addrlen 16 host 127.0.0.1 serv 7
25ai3: flags 0x2 family 24 socktype 2 protocol 17 addrlen 28 host ::1 serv 7
26ai4: flags 0x2 family 24 socktype 1 protocol 6 addrlen 28 host ::1 serv 7
27
28== specific address family
29arg: flags 0x2 family 2 socktype 0 protocol 0 addrlen 0 host localhost serv http
30ai1: flags 0x2 family 2 socktype 1 protocol 6 addrlen 16 host 127.0.0.1 serv 80
31arg: flags 0x2 family 24 socktype 0 protocol 0 addrlen 0 host localhost serv http
32ai1: flags 0x2 family 24 socktype 1 protocol 6 addrlen 28 host ::1 serv 80
33
34== empty hostname
35arg: flags 0x2 family 0 socktype 0 protocol 0 addrlen 0 host (empty) serv http
36ai1: flags 0x2 family 2 socktype 1 protocol 6 addrlen 16 host 127.0.0.1 serv 80
37ai2: flags 0x2 family 24 socktype 1 protocol 6 addrlen 28 host ::1 serv 80
38arg: flags 0x2 family 0 socktype 0 protocol 0 addrlen 0 host (empty) serv echo
39ai1: flags 0x2 family 2 socktype 2 protocol 17 addrlen 16 host 127.0.0.1 serv 7
40ai2: flags 0x2 family 2 socktype 1 protocol 6 addrlen 16 host 127.0.0.1 serv 7
41ai3: flags 0x2 family 24 socktype 2 protocol 17 addrlen 28 host ::1 serv 7
42ai4: flags 0x2 family 24 socktype 1 protocol 6 addrlen 28 host ::1 serv 7
43arg: flags 0x2 family 0 socktype 0 protocol 0 addrlen 0 host (empty) serv tftp
44ai1: flags 0x2 family 2 socktype 2 protocol 17 addrlen 16 host 127.0.0.1 serv 69
45ai2: flags 0x2 family 24 socktype 2 protocol 17 addrlen 28 host ::1 serv 69
46arg: flags 0x2 family 0 socktype 0 protocol 0 addrlen 0 host (empty) serv 80
47ai1: flags 0x2 family 2 socktype 2 protocol 17 addrlen 16 host 127.0.0.1 serv 80
48ai2: flags 0x2 family 2 socktype 1 protocol 6 addrlen 16 host 127.0.0.1 serv 80
49ai3: flags 0x2 family 24 socktype 2 protocol 17 addrlen 28 host ::1 serv 80
50ai4: flags 0x2 family 24 socktype 1 protocol 6 addrlen 28 host ::1 serv 80
51arg: flags 0x3 family 0 socktype 0 protocol 0 addrlen 0 host (empty) serv http
52ai1: flags 0x3 family 2 socktype 1 protocol 6 addrlen 16 host 0.0.0.0 serv 80
53ai2: flags 0x3 family 24 socktype 1 protocol 6 addrlen 28 host :: serv 80
54arg: flags 0x3 family 0 socktype 0 protocol 0 addrlen 0 host (empty) serv echo
55ai1: flags 0x3 family 2 socktype 2 protocol 17 addrlen 16 host 0.0.0.0 serv 7
56ai2: flags 0x3 family 2 socktype 1 protocol 6 addrlen 16 host 0.0.0.0 serv 7
57ai3: flags 0x3 family 24 socktype 2 protocol 17 addrlen 28 host :: serv 7
58ai4: flags 0x3 family 24 socktype 1 protocol 6 addrlen 28 host :: serv 7
59arg: flags 0x3 family 0 socktype 0 protocol 0 addrlen 0 host (empty) serv tftp
60ai1: flags 0x3 family 2 socktype 2 protocol 17 addrlen 16 host 0.0.0.0 serv 69
61ai2: flags 0x3 family 24 socktype 2 protocol 17 addrlen 28 host :: serv 69
62arg: flags 0x3 family 0 socktype 0 protocol 0 addrlen 0 host (empty) serv 80
63ai1: flags 0x3 family 2 socktype 2 protocol 17 addrlen 16 host 0.0.0.0 serv 80
64ai2: flags 0x3 family 2 socktype 1 protocol 6 addrlen 16 host 0.0.0.0 serv 80
65ai3: flags 0x3 family 24 socktype 2 protocol 17 addrlen 28 host :: serv 80
66ai4: flags 0x3 family 24 socktype 1 protocol 6 addrlen 28 host :: serv 80
67arg: flags 0x2 family 0 socktype 1 protocol 0 addrlen 0 host (empty) serv 80
68ai1: flags 0x2 family 2 socktype 1 protocol 6 addrlen 16 host 127.0.0.1 serv 80
69ai2: flags 0x2 family 24 socktype 1 protocol 6 addrlen 28 host ::1 serv 80
70arg: flags 0x2 family 0 socktype 2 protocol 0 addrlen 0 host (empty) serv 80
71ai1: flags 0x2 family 2 socktype 2 protocol 17 addrlen 16 host 127.0.0.1 serv 80
72ai2: flags 0x2 family 24 socktype 2 protocol 17 addrlen 28 host ::1 serv 80
73
74== empty servname
75arg: flags 0x2 family 0 socktype 0 protocol 0 addrlen 0 host ::1 serv (empty)
76ai1: flags 0x2 family 24 socktype 2 protocol 17 addrlen 28 host ::1 serv 0
77ai2: flags 0x2 family 24 socktype 1 protocol 6 addrlen 28 host ::1 serv 0
78arg: flags 0x2 family 0 socktype 0 protocol 0 addrlen 0 host 127.0.0.1 serv (empty)
79ai1: flags 0x2 family 2 socktype 2 protocol 17 addrlen 16 host 127.0.0.1 serv 0
80ai2: flags 0x2 family 2 socktype 1 protocol 6 addrlen 16 host 127.0.0.1 serv 0
81arg: flags 0x2 family 0 socktype 0 protocol 0 addrlen 0 host localhost serv (empty)
82ai1: flags 0x2 family 2 socktype 2 protocol 17 addrlen 16 host 127.0.0.1 serv 0
83ai2: flags 0x2 family 2 socktype 1 protocol 6 addrlen 16 host 127.0.0.1 serv 0
84ai3: flags 0x2 family 24 socktype 2 protocol 17 addrlen 28 host ::1 serv 0
85ai4: flags 0x2 family 24 socktype 1 protocol 6 addrlen 28 host ::1 serv 0
86arg: flags 0x2 family 0 socktype 0 protocol 0 addrlen 0 host (empty) serv (empty)
87name or service is not known
88
89== sock_raw
90arg: flags 0x2 family 0 socktype 3 protocol 0 addrlen 0 host localhost serv (empty)
91ai1: flags 0x2 family 2 socktype 3 protocol 0 addrlen 16 host 127.0.0.1 serv 0
92ai2: flags 0x2 family 24 socktype 3 protocol 0 addrlen 28 host ::1 serv 0
93arg: flags 0x2 family 0 socktype 3 protocol 59 addrlen 0 host localhost serv (empty)
94ai1: flags 0x2 family 2 socktype 3 protocol 59 addrlen 16 host 127.0.0.1 serv 0
95ai2: flags 0x2 family 24 socktype 3 protocol 59 addrlen 28 host ::1 serv 0
96arg: flags 0x2 family 0 socktype 3 protocol 59 addrlen 0 host localhost serv 80
97service not supported for ai_socktype
98arg: flags 0x2 family 0 socktype 3 protocol 59 addrlen 0 host localhost serv www
99service not supported for ai_socktype
100arg: flags 0x2 family 0 socktype 3 protocol 59 addrlen 0 host ::1 serv (empty)
101ai1: flags 0x2 family 24 socktype 3 protocol 59 addrlen 28 host ::1 serv 0
102
103== unsupported family
104arg: flags 0x2 family 99 socktype 0 protocol 0 addrlen 0 host localhost serv (empty)
105ai_family not supported
106
107== the following items are specified in jinmei scopeaddr format doc.
108arg: flags 0x2 family 0 socktype 0 protocol 0 addrlen 0 host fe80::1%lo0 serv http
109ai1: flags 0x2 family 24 socktype 1 protocol 6 addrlen 28 host fe80::1%lo0 serv 80
110
diff --git a/src/regress/lib/libc/getaddrinfo/gaitest.c b/src/regress/lib/libc/getaddrinfo/gaitest.c
deleted file mode 100644
index 2508c05e02..0000000000
--- a/src/regress/lib/libc/getaddrinfo/gaitest.c
+++ /dev/null
@@ -1,193 +0,0 @@
1/* $OpenBSD: gaitest.c,v 1.7 2020/02/14 19:17:33 schwarze Exp $ */
2/* $NetBSD: gaitest.c,v 1.3 2002/07/05 15:47:43 itojun Exp $ */
3
4/*
5 * Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, and 2002 WIDE Project.
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. Neither the name of the project nor the names of its contributors
17 * may be used to endorse or promote products derived from this software
18 * without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
21 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
24 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 * SUCH DAMAGE.
31 */
32
33/*
34 * Please note: the order of the responses (and the regress test)
35 * is dependent on the "family" keywords in resolv.conf.
36 *
37 * This expects the default behaviour of "family inet4 inet6"
38 */
39
40#include <sys/types.h>
41#include <sys/socket.h>
42#include <netinet/in.h>
43#include <arpa/inet.h>
44#include <netdb.h>
45#include <stdio.h>
46#include <stdlib.h>
47#include <string.h>
48#include <unistd.h>
49
50struct addrinfo ai;
51
52char host[NI_MAXHOST];
53char serv[NI_MAXSERV];
54int vflag = 0;
55
56static void usage(void);
57static void print1(const char *, const struct addrinfo *, char *, char *);
58int main(int, char *[]);
59
60static void
61usage()
62{
63 fprintf(stderr, "usage: test [-f family] [-s socktype] [-p proto] [-DPRSv46] host serv\n");
64}
65
66static void
67print1(title, res, h, s)
68 const char *title;
69 const struct addrinfo *res;
70 char *h;
71 char *s;
72{
73 char *start, *end;
74 int error;
75 const int niflag = NI_NUMERICHOST | NI_NUMERICSERV;
76
77 if (res->ai_addr) {
78 error = getnameinfo(res->ai_addr, res->ai_addr->sa_len,
79 host, sizeof(host), serv, sizeof(serv),
80 niflag);
81 h = host;
82 s = serv;
83 } else
84 error = 0;
85
86 if (vflag) {
87 start = "\t";
88 end = "\n";
89 } else {
90 start = " ";
91 end = "";
92 }
93 printf("%s%s", title, end);
94 printf("%sflags 0x%x%s", start, res->ai_flags, end);
95 printf("%sfamily %d%s", start, res->ai_family, end);
96 printf("%ssocktype %d%s", start, res->ai_socktype, end);
97 printf("%sprotocol %d%s", start, res->ai_protocol, end);
98 printf("%saddrlen %d%s", start, res->ai_addrlen, end);
99 if (error)
100 printf("%serror %d%s", start, error, end);
101 else {
102 printf("%shost %s%s", start, h, end);
103 printf("%sserv %s%s", start, s, end);
104 }
105#if 0
106 if (res->ai_canonname)
107 printf("%scname \"%s\"%s", start, res->ai_canonname, end);
108#endif
109 if (!vflag)
110 printf("\n");
111
112}
113
114int
115main(argc, argv)
116 int argc;
117 char *argv[];
118{
119 struct addrinfo *res;
120 int error, i;
121 char *p, *q;
122 int c;
123 char nbuf[10];
124
125 memset(&ai, 0, sizeof(ai));
126 ai.ai_family = PF_UNSPEC;
127 ai.ai_flags |= AI_CANONNAME;
128 while ((c = getopt(argc, argv, "Df:p:PRs:Sv46")) != -1) {
129 switch (c) {
130 case 'D':
131 ai.ai_socktype = SOCK_DGRAM;
132 break;
133 case 'f':
134 ai.ai_family = atoi(optarg);
135 break;
136 case 'p':
137 ai.ai_protocol = atoi(optarg);
138 break;
139 case 'P':
140 ai.ai_flags |= AI_PASSIVE;
141 break;
142 case 'R':
143 ai.ai_socktype = SOCK_RAW;
144 break;
145 case 's':
146 ai.ai_socktype = atoi(optarg);
147 break;
148 case 'S':
149 ai.ai_socktype = SOCK_STREAM;
150 break;
151 case 'v':
152 vflag++;
153 break;
154 case '4':
155 ai.ai_family = PF_INET;
156 break;
157 case '6':
158 ai.ai_family = PF_INET6;
159 break;
160 default:
161 usage();
162 exit(1);
163 }
164 }
165 argc -= optind;
166 argv += optind;
167
168 if (argc != 2){
169 usage();
170 exit(1);
171 }
172
173 p = *argv[0] ? argv[0] : NULL;
174 q = *argv[1] ? argv[1] : NULL;
175
176 print1("arg:", &ai, p ? p : "(empty)", q ? q : "(empty)");
177
178 error = getaddrinfo(p, q, &ai, &res);
179 if (error) {
180 printf("%s\n", gai_strerror(error));
181 exit(1);
182 }
183
184 i = 1;
185 do {
186 snprintf(nbuf, sizeof(nbuf), "ai%d:", i);
187 print1(nbuf, res, NULL, NULL);
188
189 i++;
190 } while ((res = res->ai_next) != NULL);
191
192 exit(0);
193}
diff --git a/src/regress/lib/libc/getaddrinfo/testsuite.sh b/src/regress/lib/libc/getaddrinfo/testsuite.sh
deleted file mode 100644
index 1e4e524054..0000000000
--- a/src/regress/lib/libc/getaddrinfo/testsuite.sh
+++ /dev/null
@@ -1,89 +0,0 @@
1# $OpenBSD: testsuite.sh,v 1.1 2002/07/05 15:54:30 itojun Exp $
2# $NetBSD: testsuite.sh,v 1.3 2002/07/05 15:49:11 itojun Exp $
3
4#
5# Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, and 2002 WIDE Project.
6# All rights reserved.
7#
8# Redistribution and use in source and binary forms, with or without
9# modification, are permitted provided that the following conditions
10# are met:
11# 1. Redistributions of source code must retain the above copyright
12# notice, this list of conditions and the following disclaimer.
13# 2. Redistributions in binary form must reproduce the above copyright
14# notice, this list of conditions and the following disclaimer in the
15# documentation and/or other materials provided with the distribution.
16# 3. Neither the name of the project nor the names of its contributors
17# may be used to endorse or promote products derived from this software
18# without specific prior written permission.
19#
20# THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
21# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23# ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
24# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30# SUCH DAMAGE.
31#
32
33TEST=./gaitest
34#TEST='./test -v'
35#IF=`ifconfig -a | grep -v '^ ' | sed -e 's/:.*//' | head -1 | awk '{print $1}'`
36
37echo '== basic ones'
38$TEST ::1 http
39$TEST 127.0.0.1 http
40$TEST localhost http
41$TEST ::1 tftp
42$TEST 127.0.0.1 tftp
43$TEST localhost tftp
44$TEST ::1 echo
45$TEST 127.0.0.1 echo
46$TEST localhost echo
47echo
48
49echo '== specific address family'
50$TEST -4 localhost http
51$TEST -6 localhost http
52echo
53
54echo '== empty hostname'
55$TEST '' http
56$TEST '' echo
57$TEST '' tftp
58$TEST '' 80
59$TEST -P '' http
60$TEST -P '' echo
61$TEST -P '' tftp
62$TEST -P '' 80
63$TEST -S '' 80
64$TEST -D '' 80
65echo
66
67echo '== empty servname'
68$TEST ::1 ''
69$TEST 127.0.0.1 ''
70$TEST localhost ''
71$TEST '' ''
72echo
73
74echo '== sock_raw'
75$TEST -R -p 0 localhost ''
76$TEST -R -p 59 localhost ''
77$TEST -R -p 59 localhost 80
78$TEST -R -p 59 localhost www
79$TEST -R -p 59 ::1 ''
80echo
81
82echo '== unsupported family'
83$TEST -f 99 localhost ''
84echo
85
86echo '== the following items are specified in jinmei scopeaddr format doc.'
87$TEST fe80::1%lo0 http
88#$TEST fe80::1%$IF http
89echo