From: Asad Ahmed Date: Tue, 5 Nov 2013 19:37:40 +0000 (-0800) Subject: Added an extra validation check so that X-Git-Tag: jenkins-controller-bulk-release-prepare-only-2-1~498 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=commitdiff_plain;h=7018901bccdf38d7245feac729e674b433168d65 Added an extra validation check so that the gateway mask cannot be 0 or 32 Change-Id: I78a4174c7800fcca7bdd95d03a520db5db01983d Signed-off-by: Asad Ahmed --- diff --git a/opendaylight/switchmanager/api/src/main/java/org/opendaylight/controller/switchmanager/SubnetConfig.java b/opendaylight/switchmanager/api/src/main/java/org/opendaylight/controller/switchmanager/SubnetConfig.java index b0d586152c..577c039530 100644 --- a/opendaylight/switchmanager/api/src/main/java/org/opendaylight/controller/switchmanager/SubnetConfig.java +++ b/opendaylight/switchmanager/api/src/main/java/org/opendaylight/controller/switchmanager/SubnetConfig.java @@ -104,6 +104,9 @@ public class SubnetConfig implements Cloneable, Serializable { if (!NetUtils.isIPAddressValid(subnet)) { return new Status(StatusCode.BADREQUEST, String.format("Invalid Subnet configuration: Invalid address: %s", subnet)); } + if((this.getIPMaskLen() == 0) || (this.getIPMaskLen() == 32)) { + return new Status(StatusCode.BADREQUEST, String.format("Invalid Subnet configuration: Invalid mask: /%s", this.getIPMaskLen())); + } byte[] bytePrefix = NetUtils.getSubnetPrefix(this.getIPAddress(), this.getIPMaskLen()).getAddress(); long prefix = BitBufferHelper.getLong(bytePrefix); if (prefix == 0) {