networking/nftables: only delete our tables if flushRuleset is set to false

This commit is contained in:
Maciej Krüger 2022-12-28 02:52:26 +01:00
parent d5a0826686
commit 5f300ad70c
No known key found for this signature in database
GPG key ID: 0D948CE19CF49C5F

View file

@ -248,7 +248,11 @@ in
RemainAfterExit = true;
ExecStart = rulesScript;
ExecReload = rulesScript;
ExecStop = "${pkgs.nftables}/bin/nft flush ruleset";
ExecStop = "${pkgs.nftables}/bin/nft ${
if cfg.flushRuleset then "flush ruleset"
else escapeShellArg (concatStringsSep "; " (
mapAttrsToList (_: table: "delete table ${table.family} ${table.name}") enabledTables
))}";
};
};
};