ports保存为map

兼容老的配置数据
This commit is contained in:
huweishan
2024-04-08 19:34:11 +08:00
parent e55b2b6f0a
commit 4f56ea49c3
3 changed files with 49 additions and 31 deletions

View File

@@ -89,11 +89,21 @@ func checkLinkAcl(group *dbdata.Group, pl *sessdata.Payload) bool {
// 循环判断ip和端口
if v.IpNet.Contains(ipDst) {
// 放行允许ip的ping
if dbdata.ContainsInPorts( v.Ports , ipPort) || v.Ports[0].PortFrom == 0 || ipProto == waterutil.ICMP {
if v.Action == dbdata.Allow {
return true
} else {
return false
if(v.Ports==nil || len(v.Ports)==0){
if v.Port==ipPort || v.Port==0 || ipProto == waterutil.ICMP {
if v.Action == dbdata.Allow {
return true
} else {
return false
}
}
} else {
if dbdata.ContainsInPorts( v.Ports , ipPort) || dbdata.ContainsInPorts( v.Ports , 0) || ipProto == waterutil.ICMP {
if v.Action == dbdata.Allow {
return true
} else {
return false
}
}
}
}