summary refs log tree commit diff
path: root/nixos/modules/services/networking/helpers.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixos/modules/services/networking/helpers.nix')
-rw-r--r--nixos/modules/services/networking/helpers.nix11
1 files changed, 11 insertions, 0 deletions
diff --git a/nixos/modules/services/networking/helpers.nix b/nixos/modules/services/networking/helpers.nix
new file mode 100644
index 00000000000..d7d42de0e3a
--- /dev/null
+++ b/nixos/modules/services/networking/helpers.nix
@@ -0,0 +1,11 @@
+{ config, lib, ... }: ''
+  # Helper command to manipulate both the IPv4 and IPv6 tables.
+  ip46tables() {
+    iptables -w "$@"
+    ${
+      lib.optionalString config.networking.enableIPv6 ''
+        ip6tables -w "$@"
+      ''
+    }
+  }
+''