Skip to content

Commit c4ca420

Browse files
SudharmaJainyadvr
authored andcommitted
CLOUDSTACK-8969: VPN customer gateway can't be registered with hostname (#955)
When we have VPN customer gateway which is resolved by a hostname , we should be able to register the VPN customer gateway with its hostname instead of the IP address, this would be useful in case where the remote device IP is dynamically assigned , where customers use DDNS to resolve it.
1 parent 48fa206 commit c4ca420

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

server/src/com/cloud/network/vpn/Site2SiteVpnManagerImpl.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,8 @@ public Site2SiteCustomerGateway createCustomerGateway(CreateVpnCustomerGatewayCm
177177

178178
String name = cmd.getName();
179179
String gatewayIp = cmd.getGatewayIp();
180-
if (!NetUtils.isValidIp(gatewayIp)) {
181-
throw new InvalidParameterValueException("The customer gateway ip " + gatewayIp + " is invalid!");
180+
if (!NetUtils.isValidIp(gatewayIp) && !NetUtils.verifyDomainName(gatewayIp)) {
181+
throw new InvalidParameterValueException("The customer gateway ip/Domain " + gatewayIp + " is invalid!");
182182
}
183183
if (name == null) {
184184
name = "VPN-" + gatewayIp;
@@ -431,8 +431,8 @@ public Site2SiteCustomerGateway updateCustomerGateway(UpdateVpnCustomerGatewayCm
431431
}
432432
String name = cmd.getName();
433433
String gatewayIp = cmd.getGatewayIp();
434-
if (!NetUtils.isValidIp(gatewayIp)) {
435-
throw new InvalidParameterValueException("The customer gateway ip " + gatewayIp + " is invalid!");
434+
if (!NetUtils.isValidIp(gatewayIp) && !NetUtils.verifyDomainName(gatewayIp)) {
435+
throw new InvalidParameterValueException("The customer gateway ip/Domain " + gatewayIp + " is invalid!");
436436
}
437437
if (name == null) {
438438
name = "VPN-" + gatewayIp;

0 commit comments

Comments
 (0)