Skip to content

Commit 080bc2e

Browse files
bvbharatJayapal
authored andcommitted
CLOUDSTACK-7536 user vm can get a gateway ip when gateway ip is a part of the guest ip range.
Signed-off-by: Jayapal <jayapal@apache.org>
1 parent 42f628c commit 080bc2e

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

‎server/src/com/cloud/configuration/ConfigurationManagerImpl.java‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3442,6 +3442,11 @@ private void checkPublicIpRangeErrors(long zoneId, String vlanId, String vlanGat
34423442
if (endIP != null && !NetUtils.sameSubnet(endIP, vlanGateway, vlanNetmask)) {
34433443
throw new InvalidParameterValueException("Please ensure that your end IP is in the same subnet as your IP range's gateway, as per the IP range's netmask.");
34443444
}
3445+
// check if the gatewayip is the part of the ip range being added.
3446+
if (NetUtils.ipRangesOverlap(startIP, endIP, vlanGateway, vlanGateway)) {
3447+
throw new InvalidParameterValueException(
3448+
"The gateway ip should not be the part of the ip range being added.");
3449+
}
34453450
}
34463451

34473452
private void checkConflictsWithPortableIpRange(long zoneId, String vlanId, String vlanGateway, String vlanNetmask, String startIP, String endIP) {

0 commit comments

Comments
 (0)