diff options
author | Jens Nolte <git@queezle.net> | 2020-12-15 02:40:12 +0100 |
---|---|---|
committer | Jens Nolte <git@queezle.net> | 2020-12-19 04:32:05 +0100 |
commit | ad6c2dea6a38e31e62ff41ecb1bcbc8d2bb58db4 (patch) | |
tree | 03e83f8d011f849475978747952b25be4cfe6d2d /nixos/modules/virtualisation/nixos-containers.nix | |
parent | c898defdbf6867dc3e90ab683375d409a66d357d (diff) | |
download | nixpkgs-ad6c2dea6a38e31e62ff41ecb1bcbc8d2bb58db4.tar nixpkgs-ad6c2dea6a38e31e62ff41ecb1bcbc8d2bb58db4.tar.gz nixpkgs-ad6c2dea6a38e31e62ff41ecb1bcbc8d2bb58db4.tar.bz2 nixpkgs-ad6c2dea6a38e31e62ff41ecb1bcbc8d2bb58db4.tar.lz nixpkgs-ad6c2dea6a38e31e62ff41ecb1bcbc8d2bb58db4.tar.xz nixpkgs-ad6c2dea6a38e31e62ff41ecb1bcbc8d2bb58db4.tar.zst nixpkgs-ad6c2dea6a38e31e62ff41ecb1bcbc8d2bb58db4.zip |
nixos/nixos-container: Always apply extraVeth ip configuration
Fixes that `containers.<name>.extraVeths.<name>` configuration was not always applied. When configuring `containers.<name>.extraVeths.<name>` and not configuring one of `containers.<name>.localAddress`, `.localAddress6`, `.hostAddress`, `.hostAddress6` or `.hostBridge` the veth was created, but otherwise no configuration (i.e. no ip) was applied. nixos-container always configures the primary veth (when `.localAddress` or `.hostAddress` is set) to be the containers default gateway, so this fix is required to create a veth in containers that use a different default gateway. To test this patch configure the following container and check if the addresses are applied: ``` containers.testveth = { extraVeths.testveth = { hostAddress = "192.168.13.2"; localAddress = "192.168.13.1"; }; config = {...}:{}; }; ```
Diffstat (limited to 'nixos/modules/virtualisation/nixos-containers.nix')
-rw-r--r-- | nixos/modules/virtualisation/nixos-containers.nix | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/nixos/modules/virtualisation/nixos-containers.nix b/nixos/modules/virtualisation/nixos-containers.nix index 26398afb3cf..757d73421b8 100644 --- a/nixos/modules/virtualisation/nixos-containers.nix +++ b/nixos/modules/virtualisation/nixos-containers.nix @@ -56,10 +56,10 @@ let ip -6 route add $HOST_ADDRESS6 dev eth0 ip -6 route add default via $HOST_ADDRESS6 fi - - ${concatStringsSep "\n" (mapAttrsToList renderExtraVeth cfg.extraVeths)} fi + ${concatStringsSep "\n" (mapAttrsToList renderExtraVeth cfg.extraVeths)} + # Start the regular stage 1 script. exec "$1" '' @@ -223,8 +223,8 @@ let ${ipcall cfg "ip route" "$LOCAL_ADDRESS" "localAddress"} ${ipcall cfg "ip -6 route" "$LOCAL_ADDRESS6" "localAddress6"} fi - ${concatStringsSep "\n" (mapAttrsToList renderExtraVeth cfg.extraVeths)} fi + ${concatStringsSep "\n" (mapAttrsToList renderExtraVeth cfg.extraVeths)} '' ); |