mirror of https://github.com/bjdgyc/anylink.git
添加acl协议支持
This commit is contained in:
parent
5b498cbc59
commit
76779de80a
|
@ -178,6 +178,9 @@ func SetGroup(g *Group) error {
|
||||||
v.IpProto = waterutil.UDP
|
v.IpProto = waterutil.UDP
|
||||||
case ICMP:
|
case ICMP:
|
||||||
v.IpProto = waterutil.ICMP
|
v.IpProto = waterutil.ICMP
|
||||||
|
default:
|
||||||
|
// 其他类型都是 all
|
||||||
|
v.Protocol = ALL
|
||||||
}
|
}
|
||||||
|
|
||||||
portsStr := v.Port
|
portsStr := v.Port
|
||||||
|
|
|
@ -86,27 +86,26 @@ func checkLinkAcl(group *dbdata.Group, pl *sessdata.Payload) bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, v := range group.LinkAcl {
|
for _, v := range group.LinkAcl {
|
||||||
// 循环判断ip和端口
|
// 放行允许ip的ping
|
||||||
if v.IpNet.Contains(ipDst) {
|
// 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 {
|
||||||
|
// return false
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// } else {
|
||||||
|
|
||||||
// 放行允许ip的ping
|
// 先判断协议
|
||||||
// if v.Ports == nil || len(v.Ports) == 0 {
|
// 兼容旧数据 v.Protocol == ""
|
||||||
// //单端口历史数据兼容
|
if v.Protocol == "" || v.Protocol == dbdata.ALL || v.IpProto == ipProto {
|
||||||
// port := uint16(v.Port.(float64))
|
// 循环判断ip和端口
|
||||||
// if port == ipPort || port == 0 || ipProto == waterutil.ICMP {
|
if v.IpNet.Contains(ipDst) {
|
||||||
// if v.Action == dbdata.Allow {
|
// icmp 不判断端口
|
||||||
// return true
|
|
||||||
// } else {
|
|
||||||
// return false
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// } else {
|
|
||||||
|
|
||||||
// 先判断协议
|
|
||||||
// 兼容旧数据 v.Protocol == ""
|
|
||||||
if v.Protocol == "" || v.Protocol == dbdata.ALL || v.IpProto == ipProto {
|
|
||||||
if ipProto == waterutil.ICMP {
|
if ipProto == waterutil.ICMP {
|
||||||
// icmp 不判断端口
|
|
||||||
if v.Action == dbdata.Allow {
|
if v.Action == dbdata.Allow {
|
||||||
return true
|
return true
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue