return ((to >= 0) && (to <= 0xffff));
}
+ public boolean isProtocolValid(String protocol) {
+ IPProtocols proto = IPProtocols.fromString(protocol);
+ return (proto != null);
+ }
+
private Status conflictWithContainerFlow(IContainer container) {
// Return true if it's default container
if (container.getName().equals(GlobalConstants.DEFAULT.toString())) {
}
}
+ if ((protocol != null) && !isProtocolValid(protocol)) {
+ return new Status(StatusCode.BADREQUEST, String.format("Protocol %s is not valid", protocol));
+ }
+
if ((tosBits != null) && !isTOSBitsValid(tosBits)) {
return new Status(StatusCode.BADREQUEST, String.format("IP ToS bits %s is not in the range 0 - 63",
tosBits));
mask = NetUtils.getInetNetworkMask(maskLen, ip instanceof Inet6Address);
match.setField(MatchType.NW_DST, ip, mask);
}
- if (this.protocol != null) {
+ if (IPProtocols.fromString(this.protocol) != IPProtocols.ANY) {
match.setField(MatchType.NW_PROTO, IPProtocols.getProtocolNumberByte(this.protocol));
}
if (this.tosBits != null) {