ACL Input param validation for L4 port

Change-Id: I5862aab56404afaf4d36e982a0259a498fdab216
This commit is contained in:
Sangyeok Sim 2018-06-08 11:27:27 +09:00 committed by Yuta HIGUCHI
parent a77e3350b8
commit cd125ded3b

View File

@ -203,12 +203,20 @@ public class AclWebResource extends AbstractWebResource {
int port = node.path("dstTpPort").asInt(0);
if (port > 0) {
rule.dstTpPort((short) port);
if ("TCP".equalsIgnoreCase(s) || "UDP".equalsIgnoreCase(s)) {
rule.dstTpPort((short) port);
} else {
throw new IllegalArgumentException("dstTpPort can be set only when ipProto is TCP or UDP");
}
}
port = node.path("srcTpPort").asInt(0);
if (port > 0) {
rule.srcTpPort((short) port);
if ("TCP".equalsIgnoreCase(s) || "UDP".equalsIgnoreCase(s)) {
rule.srcTpPort((short) port);
} else {
throw new IllegalArgumentException("srcTpPort can be set only when ipProto is TCP or UDP");
}
}
s = node.path("action").asText(null);