Skip to content

Commit a49c236

Browse files
committedMay 29, 2017
nixos/firewall: clean up rpfilter rules properly
The rpfilter rules wouldn't be removed if it was previously enabled but disabled in a new generation.
1 parent fde29b2 commit a49c236

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed
 

‎nixos/modules/services/networking/firewall.nix

+7-6
Original file line numberDiff line numberDiff line change
@@ -114,14 +114,15 @@ let
114114
# The "nixos-fw" chain does the actual work.
115115
ip46tables -N nixos-fw
116116
117-
# Perform a reverse-path test to refuse spoofers
118-
# For now, we just drop, as the raw table doesn't have a log-refuse yet
117+
# Clean up rpfilter rules
118+
ip46tables -t raw -D PREROUTING -j nixos-fw-rpfilter 2> /dev/null || true
119+
ip46tables -t raw -F nixos-fw-rpfilter 2> /dev/null || true
120+
ip46tables -t raw -X nixos-fw-rpfilter 2> /dev/null || true
121+
119122
${optionalString (kernelHasRPFilter && (cfg.checkReversePath != false)) ''
120-
# Clean up rpfilter rules
121-
ip46tables -t raw -D PREROUTING -j nixos-fw-rpfilter 2> /dev/null || true
122-
ip46tables -t raw -F nixos-fw-rpfilter 2> /dev/null || true
123+
# Perform a reverse-path test to refuse spoofers
124+
# For now, we just drop, as the raw table doesn't have a log-refuse yet
123125
ip46tables -t raw -N nixos-fw-rpfilter 2> /dev/null || true
124-
125126
ip46tables -t raw -A nixos-fw-rpfilter -m rpfilter ${optionalString (cfg.checkReversePath == "loose") "--loose"} -j RETURN
126127
127128
# Allows this host to act as a DHCPv4 server

0 commit comments

Comments
 (0)
Please sign in to comment.