mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-02 20:02:29 +01:00
vpc: fix acl rule with protocol number is not applied correctly in vpc vr (#3678)
When add a acl rule with protocol number, the iptables rules in vpc vr is not applied correctly.
for example, when add an ingress acl rule (protocol number:50, cidr: 2.2.2.2/32), we expect to have a iptables rule: "-A ACL_INBOUND_eth2 -s 2.2.2.2/32 -p esp -j ACCEPT"
the actual rule is "-A ACL_INBOUND_eth2 -j DROP"
It is because the rules in json are not correct.
network_acl.json.a8c52dca-0278-4e1c-b72b-987ca7121f4f.gz:{"device":"eth2","mac_address":"02:00:7d:27:00:02","private_gateway_acl":false,"nic_ip":"192.168.11.12","nic_netmask":"28","ingress_rules":[{"type":"protocol","protocol":50,"cidr":"ACCEPT","allowed":false},{"type":"all","cidr":"0.0.0.0/0","allowed":true},],"egress_rules":[],"type":"networkacl"}
Fixes: #3602
This commit is contained in:
parent
8ac25019d3
commit
dcc798d7aa
@ -79,7 +79,7 @@ public class SetNetworkAclConfigItem extends AbstractConfigItemFacade {
|
||||
// If we check the size of the array, it will fail to setup the network.
|
||||
// So, let's catch the exception and continue in the loop.
|
||||
try {
|
||||
aclRule = new ProtocolAclRule(ruleParts[5], false, Integer.parseInt(ruleParts[1]));
|
||||
aclRule = new ProtocolAclRule(ruleParts[4], "ACCEPT".equals(ruleParts[5]), Integer.parseInt(ruleParts[1]));
|
||||
} catch (final Exception e) {
|
||||
s_logger.warn("Problem occured when reading the entries in the ruleParts array. Actual array size is '" + ruleParts.length + "', but trying to read from index 5.");
|
||||
continue;
|
||||
@ -104,4 +104,4 @@ public class SetNetworkAclConfigItem extends AbstractConfigItemFacade {
|
||||
|
||||
return super.generateConfigItems(configuration);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user