mirror of
https://github.com/DanielLavrushin/b4.git
synced 2026-08-18 05:23:51 +00:00
feat: add logic to remove specific NFQUEUE rules from mangle OUTPUT chain
This commit is contained in:
parent
4ed534e343
commit
a53ef6afbc
1 changed files with 20 additions and 0 deletions
|
|
@ -888,6 +888,26 @@ func (ipt *IPTablesManager) clearB4JumpRules() {
|
|||
}
|
||||
}
|
||||
|
||||
for {
|
||||
out, _ := run(iptBin, "-w", "-t", "mangle", "--line-numbers", "-nL", "OUTPUT")
|
||||
lines := strings.Split(out, "\n")
|
||||
removed := false
|
||||
for _, line := range lines {
|
||||
if strings.Contains(line, "spt:53") && strings.Contains(line, "NFQUEUE") {
|
||||
parts := strings.Fields(line)
|
||||
if len(parts) > 0 {
|
||||
if _, err := run(iptBin, "-w", "-t", "mangle", "-D", "OUTPUT", parts[0]); err == nil {
|
||||
removed = true
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if !removed {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
// Clean nat POSTROUTING masquerade rules
|
||||
for {
|
||||
_, err := run(iptBin, "-w", "-t", "nat", "-D", "POSTROUTING", "-j", "MASQUERADE")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue