diff options
author | William A. Kennington III <william@wkennington.com> | 2014-07-13 10:39:59 -0500 |
---|---|---|
committer | William A. Kennington III <william@wkennington.com> | 2014-08-30 07:33:38 -0700 |
commit | 1ff4b838758f36dc8c54995e104dd17ba08a65a4 (patch) | |
tree | 5ab7586666517c620f6b9591735c76becb23fffd | |
parent | 098c8f4c77b1ed9ea28b5aabadde24b17df8d568 (diff) | |
download | nixpkgs-1ff4b838758f36dc8c54995e104dd17ba08a65a4.tar nixpkgs-1ff4b838758f36dc8c54995e104dd17ba08a65a4.tar.gz nixpkgs-1ff4b838758f36dc8c54995e104dd17ba08a65a4.tar.bz2 nixpkgs-1ff4b838758f36dc8c54995e104dd17ba08a65a4.tar.lz nixpkgs-1ff4b838758f36dc8c54995e104dd17ba08a65a4.tar.xz nixpkgs-1ff4b838758f36dc8c54995e104dd17ba08a65a4.tar.zst nixpkgs-1ff4b838758f36dc8c54995e104dd17ba08a65a4.zip |
nixos/network-interfaces: Add flush upon interface going down
-rw-r--r-- | nixos/modules/tasks/network-interfaces.nix | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/nixos/modules/tasks/network-interfaces.nix b/nixos/modules/tasks/network-interfaces.nix index 30e2a143419..e8c770d077c 100644 --- a/nixos/modules/tasks/network-interfaces.nix +++ b/nixos/modules/tasks/network-interfaces.nix @@ -639,6 +639,19 @@ in '' echo 1 > /proc/sys/net/ipv6/conf/${i.name}/proxy_ndp ''; + preStop = + '' + echo "releasing configured ip's..." + '' + + flip concatMapStrings (i.ip4 ++ optionals cfg.enableIPv6 i.ip6) (ip: + let + address = "${ip.address}/${toString ip.prefixLength}"; + in + '' + echo -n "Deleting ${address}..." + ip addr del "${address}" dev "${i.name}" >/dev/null 2>&1 || echo -n " Failed" + echo "" + ''); }; createTunDevice = i: nameValuePair "${i.name}" |