Commit 3d53e9c2 authored by Evan Hunt's avatar Evan Hunt
Browse files

- set IPV6_V6ONLY socket option

- a few other dual-stack fixes


git-svn-id: svn://bind10.isc.org/svn/bind10/trunk@1130 e5f2f494-b856-4b98-b285-d166d9295462
parent 95a88343
......@@ -106,6 +106,13 @@ getSocket(int af, const char* port) {
return (-1);
}
if (af == AF_INET6) {
int on = 1;
if (setsockopt(s, IPPROTO_IPV6, IPV6_V6ONLY, &on, sizeof(on)) < 0) {
cerr << "couldn't set IPV6_V6ONLY socket option" << endl;
}
}
if (bind(s, res->ai_addr, res->ai_addrlen) < 0) {
cerr << "binding socket failure" << endl;
close(s);
......@@ -147,7 +154,7 @@ main(int argc, char* argv[]) {
cerr << "-4 and -6 can't coexist" << endl;
usage();
}
if (!ipv4_only) {
if (!ipv6_only) {
ps4 = getSocket(AF_INET, port);
if (ps4 < 0) {
exit(1);
......@@ -200,13 +207,17 @@ main(int argc, char* argv[]) {
throw FatalError("select error");
}
if (FD_ISSET(ps4, &fds)) {
++counter;
auth_server->processMessage(ps4);
if (ps4 >= 0) {
if (FD_ISSET(ps4, &fds)) {
++counter;
auth_server->processMessage(ps4);
}
}
if (FD_ISSET(ps6, &fds)) {
++counter;
auth_server->processMessage(ps6);
if (ps6 >= 0) {
if (FD_ISSET(ps6, &fds)) {
++counter;
auth_server->processMessage(ps6);
}
}
if (FD_ISSET(ss, &fds)) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment