修复无法添加IP到本地防火墙的问题

This commit is contained in:
刘祥超
2022-09-04 17:06:19 +08:00
parent 3fb39b479a
commit 57cb00edf0
2 changed files with 6 additions and 6 deletions

View File

@@ -170,7 +170,7 @@ func (this *Firewalld) DropSourceIP(ip string, timeoutSeconds int, async bool) e
} }
// 避免短时间内重复添加 // 避免短时间内重复添加
if this.checkLatestIP(ip) { if async && this.checkLatestIP(ip) {
return nil return nil
} }

View File

@@ -347,14 +347,14 @@ func (this *NFTablesFirewall) DropSourceIP(ip string, timeoutSeconds int, async
return errors.New("invalid ip '" + ip + "'") return errors.New("invalid ip '" + ip + "'")
} }
// 避免短时间内重复添加
if this.checkLatestIP(ip) {
return nil
}
// 尝试关闭连接 // 尝试关闭连接
conns.SharedMap.CloseIPConns(ip) conns.SharedMap.CloseIPConns(ip)
// 避免短时间内重复添加
if async && this.checkLatestIP(ip) {
return nil
}
if async { if async {
select { select {
case this.dropIPQueue <- &blockIPItem{ case this.dropIPQueue <- &blockIPItem{