mirror of https://github.com/apache/cloudstack.git
Bug 12973: FIX : Icmp code/type validation for ingress/egress rules causing host plugin failure.
This commit is contained in:
parent
f2d927ccd4
commit
e82ec99261
|
|
@ -1286,7 +1286,7 @@ def network_rules(session, args):
|
|||
range = start + "/" + end
|
||||
if start == "-1":
|
||||
range = "any"
|
||||
iptables = ['iptables', '-I', vmchain, '-p', 'icmp', '--icmp-type', range, '-m', 'set', keyword, ipsetname, 'src', '-j', 'ACCEPT']
|
||||
iptables = ['iptables', '-I', vmchain, '-p', 'icmp', '--icmp-type', range, '-m', 'set', keyword, ipsetname, 'src', '-j', 'ACCEPT']
|
||||
cmds.append(iptables)
|
||||
util.SMlog(iptables)
|
||||
|
||||
|
|
@ -1297,7 +1297,7 @@ def network_rules(session, args):
|
|||
range = start + "/" + end
|
||||
if start == "-1":
|
||||
range = "any"
|
||||
iptables = ['iptables', '-I', vmchain, '-p', 'icmp', '--icmp-type', range, '-j', 'ACCEPT']
|
||||
iptables = ['iptables', '-I', vmchain, '-p', 'icmp', '--icmp-type', range, '-j', 'ACCEPT']
|
||||
cmds.append(iptables)
|
||||
util.SMlog(iptables)
|
||||
|
||||
|
|
|
|||
|
|
@ -564,8 +564,11 @@ public class SecurityGroupManagerImpl implements SecurityGroupManager, SecurityG
|
|||
if (icmpType == -1 && icmpCode != -1) {
|
||||
throw new InvalidParameterValueException("Invalid icmp type range");
|
||||
}
|
||||
if (icmpCode > 255) {
|
||||
throw new InvalidParameterValueException("Invalid icmp code ");
|
||||
if (icmpType != -1 && icmpCode == -1) {
|
||||
throw new InvalidParameterValueException("Invalid icmp code: need non-negative icmp code ");
|
||||
}
|
||||
if (icmpCode > 255 || icmpType > 255 || icmpCode < -1 || icmpType < -1) {
|
||||
throw new InvalidParameterValueException("Invalid icmp type/code ");
|
||||
}
|
||||
startPortOrType = icmpType;
|
||||
endPortOrCode = icmpCode;
|
||||
|
|
|
|||
Loading…
Reference in New Issue