Minor fixes to dnsupdate writer

This commit is contained in:
Ben McIlwain 2016-05-13 10:27:00 -04:00 committed by Justine Tunney
parent 1a0c282cf8
commit 030d6b92ab
8 changed files with 92 additions and 37 deletions

View file

@ -41,9 +41,9 @@ public interface DnsWriter extends AutoCloseable {
/**
* Loads {@code hostName} from datastore and publishes its A/AAAA glue records to the DNS server.
* Replaces existing records for the exact name supplied, with an A or AAAA record (as
* appropriate) for each address stored in the registry, for the supplied host name. If the host is
* deleted then the existing records are deleted. Assumes that this method will only be called for
* in-bailiwick hosts. The registry does not have addresses for other hosts.
* appropriate) for each address stored in the registry, for the supplied host name. If the host
* is deleted then the existing records are deleted. Assumes that this method will only be called
* for in-bailiwick hosts. The registry does not have addresses for other hosts.
*
* @param hostName the fully qualified host name, with no trailing dot
*/

View file

@ -2,6 +2,8 @@ package(
default_visibility = ["//java/google/registry:registry_project"],
)
licenses(["notice"]) # Apache 2.0
java_library(
name = "dnsupdate",
@ -13,14 +15,14 @@ java_library(
"//java/com/google/common/io",
"//java/com/google/common/net",
"//java/com/google/common/primitives",
"//java/google/registry/config",
"//java/google/registry/dns/writer/api",
"//java/google/registry/model",
"//java/google/registry/util",
"//third_party/java/dagger",
"//third_party/java/dnsjava",
"//third_party/java/joda_time",
"//third_party/java/jsr305_annotations",
"//third_party/java/jsr330_inject",
"//java/google/registry/config",
"//java/google/registry/dns/writer/api",
"//java/google/registry/model",
"//java/google/registry/util",
],
)

View file

@ -25,6 +25,7 @@ import google.registry.config.ConfigModule.Config;
import org.joda.time.Duration;
import org.xbill.DNS.Message;
import org.xbill.DNS.Opcode;
import org.xbill.DNS.SimpleResolver;
import java.io.DataInputStream;
import java.io.IOException;
@ -33,6 +34,7 @@ import java.io.OutputStream;
import java.net.InetAddress;
import java.net.Socket;
import java.nio.ByteBuffer;
import java.nio.channels.SocketChannel;
import javax.inject.Inject;
import javax.net.SocketFactory;

View file

@ -21,6 +21,7 @@ import google.registry.config.ConfigModule.Config;
import org.joda.time.Duration;
/** Dagger module that provides DNS configuration settings. */
@Module
public class DnsUpdateConfigModule {

View file

@ -66,8 +66,8 @@ import javax.inject.Inject;
* <p>Only NS, DS, A, and AAAA records are published, and in particular no DNSSEC signing is done
* assuming that this will be done by a third party DNS provider.
*
* <p>Each publish call is treated as an atomic update to the DNS. If an update fails an exception is
* thrown, expecting the caller to retry the update later. The SOA record serial number is
* <p>Each publish call is treated as an atomic update to the DNS. If an update fails an exception
* is thrown, expecting the caller to retry the update later. The SOA record serial number is
* implicitly incremented by the server on each UPDATE message, as required by RFC 2136. Care must
* be taken to make sure the SOA serial number does not go backwards if the entire TLD (zone) is
* "reset" to empty and republished.
@ -193,13 +193,16 @@ public class DnsUpdateWriter implements DnsWriter {
}
private RRset makeV6AddressSet(String hostName, Iterable<InetAddress> addresses)
throws TextParseException {
throws TextParseException, IOException {
RRset addressSet = new RRset();
for (InetAddress address : addresses) {
if (address instanceof Inet6Address) {
AAAARecord record =
new AAAARecord(
toAbsoluteName(hostName), DClass.IN, dnsTimeToLive.getStandardSeconds(), address);
toAbsoluteName(hostName),
DClass.IN,
dnsTimeToLive.getStandardSeconds(),
new org.xbill.DNS.Inet6Address(address.getAddress()));
addressSet.addRR(record);
}
}