Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nat: add extraCommands option #32258

Merged
merged 1 commit into from Jan 2, 2018

Conversation

ryantrinkle
Copy link
Contributor

@ryantrinkle ryantrinkle commented Dec 2, 2017

Motivation for this change

Due to the order in which the iptables rules are combined, it's not possible to write some NAT rules in networking.firewall.extraCommands. This PR adds networking.nat.extraCommands, which is inserted in the appropriate place for users to add their own custom NAT commands.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option build-use-sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

@ryantrinkle
Copy link
Contributor Author

@volth extraStopCommands makes sense to me - I'll add that. I don't think mkBefore and mkAfter are quite powerful enough to do what we would need here: networking.nat uses networking.firewall.extraCommands to insert itself into the firewall code, but we need our commands to run in the middle of those inserted nat commands, not before or after the nat commands.

@ryantrinkle
Copy link
Contributor Author

@volth Do you have an example of a stop command that would be good to put in the documentation? I'm not quite sure what would make sense there.

@ryantrinkle
Copy link
Contributor Author

ryantrinkle commented Dec 6, 2017

@volth Ah ok, cool! I kept it a bit shorter here, and just made it the opposite of the example extraCommands, so hopefully that will give people a good enough sense of what to do!

(edit: @volhovm sorry for the accidental mention)

@ryantrinkle
Copy link
Contributor Author

@volth Does the extraStopCommands splice look like it's in the right place?

@ryantrinkle
Copy link
Contributor Author

It looks like there's no objection, so I'm merging this.

@ryantrinkle ryantrinkle merged commit f1a6fa6 into NixOS:master Jan 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants