the gateway mask cannot be 0 or 32
Change-Id: I78a4174c7800fcca7bdd95d03a520db5db01983d
Signed-off-by: Asad Ahmed <asaahmed@cisco.com>
if (!NetUtils.isIPAddressValid(subnet)) {
return new Status(StatusCode.BADREQUEST, String.format("Invalid Subnet configuration: Invalid address: %s", subnet));
}
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) {
byte[] bytePrefix = NetUtils.getSubnetPrefix(this.getIPAddress(), this.getIPMaskLen()).getAddress();
long prefix = BitBufferHelper.getLong(bytePrefix);
if (prefix == 0) {