Skip to content

Commit 17850c7

Browse files
Daan HooglandDaanHoogland
authored andcommitted
CLOUDSTACK-6747: call a more forgiving test on the supplied peer
cidr-list
1 parent cd3b027 commit 17850c7

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

‎api/src/org/apache/cloudstack/api/command/user/vpn/CreateVpnCustomerGatewayCmd.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public class CreateVpnCustomerGatewayCmd extends BaseAsyncCmd {
4848
private String gatewayIp;
4949

5050
@Parameter(name = ApiConstants.CIDR_LIST, type = CommandType.STRING, required = true, description = "guest cidr list of the customer gateway")
51-
private String guestCidrList;
51+
private String peerCidrList;
5252

5353
@Parameter(name = ApiConstants.IPSEC_PSK, type = CommandType.STRING, required = true, description = "IPsec Preshared-Key of the customer gateway")
5454
private String ipsecPsk;
@@ -97,7 +97,7 @@ public String getIpsecPsk() {
9797
}
9898

9999
public String getGuestCidrList() {
100-
return guestCidrList;
100+
return peerCidrList;
101101
}
102102

103103
public String getGatewayIp() {

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -185,9 +185,9 @@ public Site2SiteCustomerGateway createCustomerGateway(CreateVpnCustomerGatewayCm
185185
if (name == null) {
186186
name = "VPN-" + gatewayIp;
187187
}
188-
String guestCidrList = cmd.getGuestCidrList();
189-
if (!NetUtils.validateGuestCidrList(guestCidrList)) {
190-
throw new InvalidParameterValueException("The customer gateway guest cidr list " + guestCidrList + " is invalid guest cidr!");
188+
String peerCidrList = cmd.getGuestCidrList();
189+
if (!NetUtils.isValidCidrList(peerCidrList)) {
190+
throw new InvalidParameterValueException("The customer gateway peer cidr list " + peerCidrList + " contains an invalid cidr!");
191191
}
192192
String ipsecPsk = cmd.getIpsecPsk();
193193
String ikePolicy = cmd.getIkePolicy();
@@ -228,10 +228,10 @@ public Site2SiteCustomerGateway createCustomerGateway(CreateVpnCustomerGatewayCm
228228
throw new InvalidParameterValueException("The customer gateway with name " + name + " already existed!");
229229
}
230230

231-
checkCustomerGatewayCidrList(guestCidrList);
231+
checkCustomerGatewayCidrList(peerCidrList);
232232

233233
Site2SiteCustomerGatewayVO gw =
234-
new Site2SiteCustomerGatewayVO(name, accountId, owner.getDomainId(), gatewayIp, guestCidrList, ipsecPsk, ikePolicy, espPolicy, ikeLifetime, espLifetime, dpd);
234+
new Site2SiteCustomerGatewayVO(name, accountId, owner.getDomainId(), gatewayIp, peerCidrList, ipsecPsk, ikePolicy, espPolicy, ikeLifetime, espLifetime, dpd);
235235
_customerGatewayDao.persist(gw);
236236
return gw;
237237
}

0 commit comments

Comments
 (0)