避免PortStart为-1时未正确设置PortRange参数

This commit is contained in:
屈轩
2019-01-10 17:54:13 +08:00
parent ea1bbc2444
commit e267a7064e
+3 -3
View File
@@ -248,7 +248,7 @@ func (self *SRegion) modifySecurityGroupRule(secGrpId string, rule *secrules.Sec
protocol = "all"
}
params["IpProtocol"] = protocol
if rule.PortStart == 0 && rule.PortEnd == 0 {
if rule.PortStart < 1 && rule.PortEnd < 1 {
if protocol == "udp" || protocol == "tcp" {
params["PortRange"] = "1/65535"
} else {
@@ -320,7 +320,7 @@ func (self *SRegion) addSecurityGroupRule(secGrpId string, rule *secrules.Securi
protocol = "all"
}
params["IpProtocol"] = protocol
if rule.PortStart == 0 && rule.PortEnd == 0 {
if rule.PortStart < 1 && rule.PortEnd < 1 {
if protocol == "udp" || protocol == "tcp" {
params["PortRange"] = "1/65535"
} else {
@@ -363,7 +363,7 @@ func (self *SRegion) delSecurityGroupRule(secGrpId string, rule *secrules.Securi
protocol = "all"
}
params["IpProtocol"] = protocol
if rule.PortStart == 0 && rule.PortEnd == 0 {
if rule.PortStart < 1 && rule.PortEnd < 1 {
if protocol == "udp" || protocol == "tcp" {
params["PortRange"] = "1/65535"
} else {