mirror of
https://github.com/google/nomulus.git
synced 2025-05-22 04:09:46 +02:00
Fix CloudDnsWriter glue record A/AAAA arguments
Previously, CloudDnsWriter used InetAddress.toString() to produce the ipv4/6 address string (i.e. 127.0.0.1 or 0:0:0:0:0:0:0:1) used as an argument to the Cloud DNS API. However, this fails because InetAddress uses the format "HostName/IpAddress" for toString(), which uses the empty string as a HostName if unspecified. This resulted in the erroneous use of a prefix slash (i.e. "/127.0.01") as an InetAddress argument, causing all glue record updates to fail. This change replaces InetAddress.toString() with InetAddress.getHostAddress(), which properly generates the IP address for the InetAddress. This also replaces a lot of logic in the corresponding test with concrete equivalents, preventing obvious errors like this from creeping up on us in the future. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=184708896
This commit is contained in:
parent
5f218b4a8b
commit
6280d74f1c
2 changed files with 12 additions and 19 deletions
|
@ -207,10 +207,10 @@ public class CloudDnsWriter extends BaseDnsWriter {
|
|||
HashSet<String> aaaaRrData = new HashSet<>();
|
||||
for (InetAddress ip : host.get().getInetAddresses()) {
|
||||
if (ip instanceof Inet4Address) {
|
||||
aRrData.add(ip.toString());
|
||||
aRrData.add(ip.getHostAddress());
|
||||
} else {
|
||||
checkArgument(ip instanceof Inet6Address);
|
||||
aaaaRrData.add(ip.toString());
|
||||
aaaaRrData.add(ip.getHostAddress());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue