summary refs log tree commit diff
path: root/nixos/modules/services/networking/nftables.nix
diff options
context:
space:
mode:
authorJess Schallenberg <jess.schallenberg@gmail.com>2022-01-30 13:59:56 +0100
committerGitHub <noreply@github.com>2022-01-30 13:59:56 +0100
commit0a16b05ea9a12e367cfe96db77429c7daf798481 (patch)
tree4e9ef2aa954e850b48ba470a9b61cb6fc21097bd /nixos/modules/services/networking/nftables.nix
parent7524067daa62c722512efbb3ce7694c1287796dc (diff)
downloadnixpkgs-0a16b05ea9a12e367cfe96db77429c7daf798481.tar
nixpkgs-0a16b05ea9a12e367cfe96db77429c7daf798481.tar.gz
nixpkgs-0a16b05ea9a12e367cfe96db77429c7daf798481.tar.bz2
nixpkgs-0a16b05ea9a12e367cfe96db77429c7daf798481.tar.lz
nixpkgs-0a16b05ea9a12e367cfe96db77429c7daf798481.tar.xz
nixpkgs-0a16b05ea9a12e367cfe96db77429c7daf798481.tar.zst
nixpkgs-0a16b05ea9a12e367cfe96db77429c7daf798481.zip
nixos/nftables: Allow use with iptables (#121517)
* nixos/nftables: Allow use with iptables

Since iptables and nftables do not actually conflict with each other, there's no real reason to artificially prevent people from combining them.
In fact, this practice is known to cause issues like #88643, which is fixed by this commit.
Diffstat (limited to 'nixos/modules/services/networking/nftables.nix')
-rw-r--r--nixos/modules/services/networking/nftables.nix16
1 files changed, 4 insertions, 12 deletions
diff --git a/nixos/modules/services/networking/nftables.nix b/nixos/modules/services/networking/nftables.nix
index eb74d373b0a..b911f97491e 100644
--- a/nixos/modules/services/networking/nftables.nix
+++ b/nixos/modules/services/networking/nftables.nix
@@ -25,9 +25,10 @@ in
           for more information.
 
           There are other programs that use iptables internally too, such as
-          libvirt.
+          libvirt. For information on how the two firewalls interact, see [2].
 
           [1]: https://github.com/NixOS/nixpkgs/issues/24318#issuecomment-289216273
+          [2]: https://wiki.nftables.org/wiki-nftables/index.php/Troubleshooting#Question_4._How_do_nftables_and_iptables_interact_when_used_on_the_same_system.3F
         '';
     };
     networking.nftables.ruleset = mkOption {
@@ -118,20 +119,11 @@ in
           flush ruleset
           include "${cfg.rulesetFile}"
         '';
-        checkScript = pkgs.writeScript "nftables-check" ''
-          #! ${pkgs.runtimeShell} -e
-          if $(${pkgs.kmod}/bin/lsmod | grep -q ip_tables); then
-            echo "Unload ip_tables before using nftables!" 1>&2
-            exit 1
-          else
-            ${rulesScript}
-          fi
-        '';
       in {
         Type = "oneshot";
         RemainAfterExit = true;
-        ExecStart = checkScript;
-        ExecReload = checkScript;
+        ExecStart = rulesScript;
+        ExecReload = rulesScript;
         ExecStop = "${pkgs.nftables}/bin/nft flush ruleset";
       };
     };