sync security group bugfix

This commit is contained in:
TangBin
2018-12-05 20:48:00 +08:00
parent 749c2f1de4
commit 097ee0d67d
+4 -2
View File
@@ -226,7 +226,8 @@ func yunionPortRangeToAws(r secrules.SecurityRule) []portRange {
portranges = append(portranges, portRange{int64(start), int64(end)})
}
for _, port := range r.Ports {
for i, _ := range r.Ports {
port := r.Ports[i]
if port <= 0 && (r.Protocol == "tcp" || r.Protocol == "udp") {
portranges = append(portranges, portRange{0, 65535})
} else if port <= 0 {
@@ -322,7 +323,8 @@ func YunionSecRuleToAws(rule secrules.SecurityRule) ([]*ec2.IpPermission, error)
portranges := yunionPortRangeToAws(rule)
protocol := yunionProtocolToAws(rule)
permissions := []*ec2.IpPermission{}
for _, port := range portranges {
for i, _ := range portranges {
port := portranges[i]
permission := ec2.IpPermission{
FromPort: &port.Start,
IpProtocol: &protocol,