f-90: nft: chaînes hostsvc et md-<vm> dans la table ip two #90

Signed-off-by: GnomeZworc <nicolas.boufidjeline@g3e.fr>
This commit is contained in:
GnomeZworc 2026-10-31 14:15:01 +01:00
commit 4f7d55a9ed
Signed by: nicolas.boufideline
GPG key ID: 4406BBBF8845D632
5 changed files with 274 additions and 1 deletions

View file

@ -23,9 +23,13 @@ var natChains = []natChain{
{"in-", "filter", "input", "filter"},
}
func (c natChain) header() string {
return fmt.Sprintf("type %s hook %s priority %s; policy accept;", c.kind, c.hook, c.priority)
}
func (c natChain) declare(b *strings.Builder, iface string) string {
name := c.prefix + iface
fmt.Fprintf(b, "add chain ip %s %s { type %s hook %s priority %s; policy accept; }\n", Table, name, c.kind, c.hook, c.priority)
fmt.Fprintf(b, "add chain ip %s %s { %s }\n", Table, name, c.header())
fmt.Fprintf(b, "flush chain ip %s %s\n", Table, name)
return name
}