Skip to content

Commit

Permalink
Merge pull request #4 from bamboo-firewall/feature/INFP-2721-improve-…
Browse files Browse the repository at this point in the history
…bbfw

INFP-2721-improve-bbfw ignore default chain when clean policy
  • Loading branch information
bienkma authored Nov 25, 2024
2 parents 153df4a + 1268e6b commit f593a0b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/iptables/table.go
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,11 @@ func (t *Table) Clean() error {
continue
}

// ignore default chain
if _, ok := t.defaultOurRuleOfDefaultChain[chainName]; ok {
continue
}

buf.WriteChain(chainName)
buf.WriteRule(fmt.Sprintf("--delete-chain %s", chainName))
}
Expand Down Expand Up @@ -521,7 +526,6 @@ func (t *Table) readHashesAndRulesFrom(r io.ReadCloser) (map[string][]string, ma
// Look for lines of the form "-A chainName something", which are rules of the chain
captures = ruleAppendRegexp.FindSubmatch(line)
if captures == nil {
//slog.Debug("Not an append rule", "line", string(line))
continue
}
chainName := string(captures[1])
Expand Down

0 comments on commit f593a0b

Please sign in to comment.