aboutsummaryrefslogtreecommitdiffstats
path: root/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/node/IP.java
diff options
context:
space:
mode:
authorHåkon Hallingstad <hakon@yahooinc.com>2023-06-19 11:24:51 +0200
committerHåkon Hallingstad <hakon@yahooinc.com>2023-06-19 11:24:51 +0200
commit316d672042b9159cf3f19fefcbcb81472d9b1bda (patch)
tree226238d95869ff0a71c73b251008afa89044c473 /node-repository/src/main/java/com/yahoo/vespa/hosted/provision/node/IP.java
parent2dbee348336346b42e7cacc22d80ce24e1730c23 (diff)
Avoid forward resolving to IPv4 in exclave GCP
Diffstat (limited to 'node-repository/src/main/java/com/yahoo/vespa/hosted/provision/node/IP.java')
-rw-r--r--node-repository/src/main/java/com/yahoo/vespa/hosted/provision/node/IP.java14
1 files changed, 8 insertions, 6 deletions
diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/node/IP.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/node/IP.java
index 3ef1951c19c..3f236b9d8a5 100644
--- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/node/IP.java
+++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/node/IP.java
@@ -395,12 +395,14 @@ public record IP() {
}
/** Verify DNS configuration of given hostname and IP address */
- public static void verifyDns(String hostname, String ipAddress, NameResolver resolver, boolean hasPtr) {
- RecordType recordType = isV6(ipAddress) ? RecordType.AAAA : RecordType.A;
- Set<String> addresses = resolver.resolve(hostname, recordType);
- if (!addresses.equals(Set.of(ipAddress)))
- throw new IllegalArgumentException("Expected " + hostname + " to resolve to " + ipAddress +
- ", but got " + addresses);
+ public static void verifyDns(String hostname, String ipAddress, NameResolver resolver, boolean hasForward, boolean hasPtr) {
+ if (hasForward) {
+ RecordType recordType = isV6(ipAddress) ? RecordType.AAAA : RecordType.A;
+ Set<String> addresses = resolver.resolve(hostname, recordType);
+ if (!addresses.equals(Set.of(ipAddress)))
+ throw new IllegalArgumentException("Expected " + hostname + " to resolve to " + ipAddress +
+ ", but got " + addresses);
+ }
if (hasPtr) {
Optional<String> reverseHostname = resolver.resolveHostname(ipAddress);