From 4ae5734ab061b5f2db5465b3ccb44efac216adb4 Mon Sep 17 00:00:00 2001 From: alena Date: Tue, 15 Feb 2011 18:01:49 -0800 Subject: [PATCH] createPod/editPod: don't allow gateway to overlap start-end ip range --- .../com/cloud/configuration/ConfigurationManagerImpl.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java index 7cb5fd9a60c..bbd1414f62d 100755 --- a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java +++ b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java @@ -464,6 +464,11 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura throw new InvalidParameterValueException("The gateway is not in the CIDR subnet."); } + //Don't allow gateway to overlap with start/endIp + if (NetUtils.ipRangesOverlap(startIp, endIp, gateway, gateway)) { + throw new InvalidParameterValueException("The gateway shouldn't overlap start/end ip addresses"); + } + String checkPodCIDRs = _configDao.getValue("check.pod.cidrs"); if (checkPodCIDRs == null || checkPodCIDRs.trim().isEmpty() || Boolean.parseBoolean(checkPodCIDRs)) { // Check if the CIDR conflicts with the Guest Network or other pods