diff options
author | eric <> | 2013-03-28 09:36:03 +0000 |
---|---|---|
committer | eric <> | 2013-03-28 09:36:03 +0000 |
commit | ff0d1de40e1753f3ad3f490475d4624605ee6d92 (patch) | |
tree | b08c95a54d60ce4230e6540d9add290c976472f0 /src/regress/lib/libc/asr | |
parent | 4ac463dc130bdb00f62e4ece898870cfe8b51ec2 (diff) | |
download | openbsd-ff0d1de40e1753f3ad3f490475d4624605ee6d92.tar.gz openbsd-ff0d1de40e1753f3ad3f490475d4624605ee6d92.tar.bz2 openbsd-ff0d1de40e1753f3ad3f490475d4624605ee6d92.zip |
add a test case for the icmpv6 issue spotted by naddy
Diffstat (limited to 'src/regress/lib/libc/asr')
-rw-r--r-- | src/regress/lib/libc/asr/bin/common.c | 17 | ||||
-rw-r--r-- | src/regress/lib/libc/asr/bin/getaddrinfo.c | 6 | ||||
-rw-r--r-- | src/regress/lib/libc/asr/regress.sh | 10 | ||||
-rw-r--r-- | src/regress/lib/libc/asr/regress.subr | 3 |
4 files changed, 26 insertions, 10 deletions
diff --git a/src/regress/lib/libc/asr/bin/common.c b/src/regress/lib/libc/asr/bin/common.c index 4402d08373..8f2f4515b3 100644 --- a/src/regress/lib/libc/asr/bin/common.c +++ b/src/regress/lib/libc/asr/bin/common.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: common.c,v 1.1.1.1 2012/07/13 17:49:53 eric Exp $ */ | 1 | /* $OpenBSD: common.c,v 1.2 2013/03/28 09:36:03 eric Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2012 Eric Faurot <eric@openbsd.org> | 3 | * Copyright (c) 2012 Eric Faurot <eric@openbsd.org> |
4 | * | 4 | * |
@@ -69,18 +69,21 @@ struct kv kv_socktype[] = { | |||
69 | struct kv kv_protocol[] = { | 69 | struct kv kv_protocol[] = { |
70 | { IPPROTO_UDP, "udp" }, | 70 | { IPPROTO_UDP, "udp" }, |
71 | { IPPROTO_TCP, "tcp" }, | 71 | { IPPROTO_TCP, "tcp" }, |
72 | { IPPROTO_ICMP, "icmp" }, | ||
73 | { IPPROTO_ICMPV6, "icmpv6" }, | ||
72 | { 0, NULL, } | 74 | { 0, NULL, } |
73 | }; | 75 | }; |
74 | 76 | ||
75 | static const char * | 77 | static const char * |
76 | kv_lookup_name(struct kv *kv, int code) | 78 | kv_lookup_name(struct kv *kv, int code, char *buf, size_t sz) |
77 | { | 79 | { |
78 | while (kv->name) { | 80 | while (kv->name) { |
79 | if (kv->code == code) | 81 | if (kv->code == code) |
80 | return (kv->name); | 82 | return (kv->name); |
81 | kv++; | 83 | kv++; |
82 | } | 84 | } |
83 | return "???"; | 85 | snprintf(buf, sz, "%i", code); |
86 | return (buf); | ||
84 | } | 87 | } |
85 | 88 | ||
86 | struct keyval { | 89 | struct keyval { |
@@ -243,12 +246,12 @@ print_netent(struct netent *e) | |||
243 | void | 246 | void |
244 | print_addrinfo(struct addrinfo *ai) | 247 | print_addrinfo(struct addrinfo *ai) |
245 | { | 248 | { |
246 | char buf[256]; | 249 | char buf[256], bf[64], bt[64], bp[64]; |
247 | 250 | ||
248 | printf("family=%s socktype=%s protocol=%s addr=%s canonname=%s\n", | 251 | printf("family=%s socktype=%s protocol=%s addr=%s canonname=%s\n", |
249 | kv_lookup_name(kv_family, ai->ai_family), | 252 | kv_lookup_name(kv_family, ai->ai_family, bf, sizeof bf), |
250 | kv_lookup_name(kv_socktype, ai->ai_socktype), | 253 | kv_lookup_name(kv_socktype, ai->ai_socktype, bt, sizeof bt), |
251 | kv_lookup_name(kv_protocol, ai->ai_protocol), | 254 | kv_lookup_name(kv_protocol, ai->ai_protocol, bp, sizeof bp), |
252 | print_addr(ai->ai_addr, buf, sizeof buf), | 255 | print_addr(ai->ai_addr, buf, sizeof buf), |
253 | ai->ai_canonname); | 256 | ai->ai_canonname); |
254 | } | 257 | } |
diff --git a/src/regress/lib/libc/asr/bin/getaddrinfo.c b/src/regress/lib/libc/asr/bin/getaddrinfo.c index 8c4abf361e..7b8674aea9 100644 --- a/src/regress/lib/libc/asr/bin/getaddrinfo.c +++ b/src/regress/lib/libc/asr/bin/getaddrinfo.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: getaddrinfo.c,v 1.1.1.1 2012/07/13 17:49:54 eric Exp $ */ | 1 | /* $OpenBSD: getaddrinfo.c,v 1.2 2013/03/28 09:36:03 eric Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2012 Eric Faurot <eric@openbsd.org> | 3 | * Copyright (c) 2012 Eric Faurot <eric@openbsd.org> |
4 | * | 4 | * |
@@ -81,6 +81,10 @@ main(int argc, char *argv[]) | |||
81 | hints.ai_protocol = IPPROTO_UDP; | 81 | hints.ai_protocol = IPPROTO_UDP; |
82 | else if (!strcmp(optarg, "tcp")) | 82 | else if (!strcmp(optarg, "tcp")) |
83 | hints.ai_protocol = IPPROTO_TCP; | 83 | hints.ai_protocol = IPPROTO_TCP; |
84 | else if (!strcmp(optarg, "icmp")) | ||
85 | hints.ai_protocol = IPPROTO_ICMP; | ||
86 | else if (!strcmp(optarg, "icmpv6")) | ||
87 | hints.ai_protocol = IPPROTO_ICMPV6; | ||
84 | else | 88 | else |
85 | usage(); | 89 | usage(); |
86 | break; | 90 | break; |
diff --git a/src/regress/lib/libc/asr/regress.sh b/src/regress/lib/libc/asr/regress.sh index 6e41a90d12..b1bbabc1f8 100644 --- a/src/regress/lib/libc/asr/regress.sh +++ b/src/regress/lib/libc/asr/regress.sh | |||
@@ -1,4 +1,4 @@ | |||
1 | # $OpenBSD: regress.sh,v 1.4 2012/12/17 21:15:33 eric Exp $ | 1 | # $OpenBSD: regress.sh,v 1.5 2013/03/28 09:36:03 eric Exp $ |
2 | 2 | ||
3 | . regress.subr | 3 | . regress.subr |
4 | 4 | ||
@@ -67,6 +67,13 @@ test_getaddrinfo() | |||
67 | done | 67 | done |
68 | } | 68 | } |
69 | 69 | ||
70 | test_getaddrinfo2() | ||
71 | { | ||
72 | for i in $@; do | ||
73 | regress getaddrinfo -f inet6 -t raw -p icmpv6 $i | ||
74 | done | ||
75 | } | ||
76 | |||
70 | test_getnameinfo() | 77 | test_getnameinfo() |
71 | { | 78 | { |
72 | for i in $@; do | 79 | for i in $@; do |
@@ -98,6 +105,7 @@ for e in file bind local; do | |||
98 | test_gethostbyname $WEIRD $BASIC $EXTRA | 105 | test_gethostbyname $WEIRD $BASIC $EXTRA |
99 | test_gethostbyaddr $ADDRS | 106 | test_gethostbyaddr $ADDRS |
100 | test_getaddrinfo NULL $WEIRD $BASIC $EXTRA | 107 | test_getaddrinfo NULL $WEIRD $BASIC $EXTRA |
108 | test_getaddrinfo2 undeadly.org www.kame.net | ||
101 | test_getnameinfo $ADDRS | 109 | test_getnameinfo $ADDRS |
102 | test_gethostbyname $ADDRS | 110 | test_gethostbyname $ADDRS |
103 | done | 111 | done |
diff --git a/src/regress/lib/libc/asr/regress.subr b/src/regress/lib/libc/asr/regress.subr index dafb7ddf75..3e8cc0ebd5 100644 --- a/src/regress/lib/libc/asr/regress.subr +++ b/src/regress/lib/libc/asr/regress.subr | |||
@@ -1,5 +1,5 @@ | |||
1 | #!/bin/sh | 1 | #!/bin/sh |
2 | # $OpenBSD: regress.subr,v 1.1.1.1 2012/07/13 17:49:53 eric Exp $ | 2 | # $OpenBSD: regress.subr,v 1.2 2013/03/28 09:36:03 eric Exp $ |
3 | 3 | ||
4 | TOTAL=0 | 4 | TOTAL=0 |
5 | FAIL=0 | 5 | FAIL=0 |
@@ -109,6 +109,7 @@ test "$_RUNDIR" == / && fail RUNDIR is root dir: $RUNDIR | |||
109 | 109 | ||
110 | OUT=$_RUNDIR/output.log | 110 | OUT=$_RUNDIR/output.log |
111 | REG=$_RUNDIR/regress.log | 111 | REG=$_RUNDIR/regress.log |
112 | ETC=$_RUNDIR/etc | ||
112 | 113 | ||
113 | echo -n > $REG | 114 | echo -n > $REG |
114 | echo -n > $OUT | 115 | echo -n > $OUT |