fix(firewall): 删除复杂转发规则时报错 (#7791)
Some checks failed
SonarCloud Scan / SonarCloud (push) Failing after 10s

This commit is contained in:
endymx 2025-02-05 18:37:42 +08:00 committed by GitHub
parent 74583aa1aa
commit 7905dd00a6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -192,8 +192,9 @@ func (iptables *Iptables) NatRemove(num string, protocol, srcPort, dest, destPor
// 删除公网转发规则
if dest != "" && dest != "127.0.0.1" && dest != "localhost" {
if err := iptables.runf(NatTab, fmt.Sprintf(
"-D %s -p %s --dport %s -j DNAT MASQUERADE",
"-D %s -p %s -d %s --dport %s -j MASQUERADE",
PostRoutingChain,
dest,
protocol,
destPort,
)); err != nil {