mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-28 13:08:06 +00:00
add --ipv6only=no test
This commit is contained in:
parent
69e77384fa
commit
415eeebda4
@ -15,6 +15,7 @@
|
||||
|
||||
#include <isc/print.h>
|
||||
#include <isc/util.h>
|
||||
#include <isc/net.h>
|
||||
#include <dns/edns.h>
|
||||
|
||||
#ifdef WIN32
|
||||
@ -33,15 +34,16 @@ static void
|
||||
usage() {
|
||||
fprintf(stderr, "usage: feature-test <arg>\n");
|
||||
fprintf(stderr, "args:\n");
|
||||
fprintf(stderr, " --enable-filter-aaaa\n");
|
||||
fprintf(stderr, " --edns-version\n");
|
||||
fprintf(stderr, " --enable-filter-aaaa\n");
|
||||
fprintf(stderr, " --gethostname\n");
|
||||
fprintf(stderr, " --gssapi\n");
|
||||
fprintf(stderr, " --have-dlopen\n");
|
||||
fprintf(stderr, " --have-geoip\n");
|
||||
fprintf(stderr, " --have-libxml2\n");
|
||||
fprintf(stderr, " --rpz-nsip\n");
|
||||
fprintf(stderr, " --ipv6only=no\n");
|
||||
fprintf(stderr, " --rpz-nsdname\n");
|
||||
fprintf(stderr, " --rpz-nsip\n");
|
||||
fprintf(stderr, " --with-idn\n");
|
||||
}
|
||||
|
||||
@ -154,6 +156,25 @@ main(int argc, char **argv) {
|
||||
#endif
|
||||
}
|
||||
|
||||
if (strcmp(argv[1], "--ipv6only=no") == 0) {
|
||||
#ifdef WIN32
|
||||
return (0);
|
||||
#elif defined(IPPROTO_IPV6) && defined(IPV6_V6ONLY)
|
||||
int s;
|
||||
int n;
|
||||
int v6only = -1;
|
||||
ISC_SOCKADDR_LEN_T len = sizeof(v6only);
|
||||
|
||||
s = socket(AF_INET6, SOCK_DGRAM, IPPROTO_UDP);
|
||||
n = getsockopt(s, IPPROTO_IPV6, IPV6_V6ONLY,
|
||||
(void *)&v6only, &len);
|
||||
close(s);
|
||||
return ((n == 0 && v6only == 0) ? 0 : 1);
|
||||
#else
|
||||
return (1);
|
||||
#endif
|
||||
}
|
||||
|
||||
fprintf(stderr, "unknown arg: %s\n", argv[1]);
|
||||
usage();
|
||||
return (1);
|
||||
|
Loading…
x
Reference in New Issue
Block a user