mirror of
https://github.com/isc-projects/bind9.git
synced 2026-03-13 22:22:08 -04:00
add --ipv6only=no test
This commit is contained in:
parent
2be1086433
commit
cc857f5058
1 changed files with 22 additions and 1 deletions
|
|
@ -23,6 +23,7 @@
|
|||
|
||||
#include <isc/print.h>
|
||||
#include <isc/util.h>
|
||||
#include <isc/net.h>
|
||||
|
||||
#ifdef WIN32
|
||||
#include <Winsock2.h>
|
||||
|
|
@ -47,8 +48,9 @@ usage() {
|
|||
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");
|
||||
}
|
||||
|
||||
|
|
@ -160,6 +162,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…
Reference in a new issue