兼容历史单端口配置

This commit is contained in:
huweishan
2024-04-09 10:29:54 +08:00
parent 4f56ea49c3
commit 24e30509e4
2 changed files with 25 additions and 30 deletions

View File

@@ -88,9 +88,12 @@ func checkLinkAcl(group *dbdata.Group, pl *sessdata.Payload) bool {
for _, v := range group.LinkAcl {
// 循环判断ip和端口
if v.IpNet.Contains(ipDst) {
// 放行允许ip的ping
if(v.Ports==nil || len(v.Ports)==0){
if v.Port==ipPort || v.Port==0 || ipProto == waterutil.ICMP {
if v.Ports == nil || len(v.Ports) == 0 {
//单端口历史数据兼容
port := uint16(v.Port.(float64))
if port == ipPort || port == 0 || ipProto == waterutil.ICMP {
if v.Action == dbdata.Allow {
return true
} else {
@@ -98,7 +101,7 @@ func checkLinkAcl(group *dbdata.Group, pl *sessdata.Payload) bool {
}
}
} else {
if dbdata.ContainsInPorts( v.Ports , ipPort) || dbdata.ContainsInPorts( v.Ports , 0) || ipProto == waterutil.ICMP {
if dbdata.ContainsInPorts(v.Ports, ipPort) || dbdata.ContainsInPorts(v.Ports, 0) || ipProto == waterutil.ICMP {
if v.Action == dbdata.Allow {
return true
} else {