about summary refs log tree commit diff
path: root/nixos/modules/tasks/network-interfaces-scripted.nix
diff options
context:
space:
mode:
authorAlexandru Scvortov <code@scvalex.net>2022-06-02 19:16:25 +0100
committerAlexandru Scvortov <code@scvalex.net>2022-06-02 19:16:25 +0100
commit3a09010b9d5d7dac68bfca200a9447e1eb77f3eb (patch)
tree85e73e397d8c92e77232c24eee5a2e9a81ee58b8 /nixos/modules/tasks/network-interfaces-scripted.nix
parent42cfcd1d78b0139a46396010ebf81dd38e6f76be (diff)
downloadnixlib-3a09010b9d5d7dac68bfca200a9447e1eb77f3eb.tar
nixlib-3a09010b9d5d7dac68bfca200a9447e1eb77f3eb.tar.gz
nixlib-3a09010b9d5d7dac68bfca200a9447e1eb77f3eb.tar.bz2
nixlib-3a09010b9d5d7dac68bfca200a9447e1eb77f3eb.tar.lz
nixlib-3a09010b9d5d7dac68bfca200a9447e1eb77f3eb.tar.xz
nixlib-3a09010b9d5d7dac68bfca200a9447e1eb77f3eb.tar.zst
nixlib-3a09010b9d5d7dac68bfca200a9447e1eb77f3eb.zip
nixos/network-interfaces: add networking.interfaces.<name>.ipv[46].routes.type
Diffstat (limited to 'nixos/modules/tasks/network-interfaces-scripted.nix')
-rw-r--r--nixos/modules/tasks/network-interfaces-scripted.nix5
1 files changed, 3 insertions, 2 deletions
diff --git a/nixos/modules/tasks/network-interfaces-scripted.nix b/nixos/modules/tasks/network-interfaces-scripted.nix
index b0f160c1dbf9..66fdc61d2835 100644
--- a/nixos/modules/tasks/network-interfaces-scripted.nix
+++ b/nixos/modules/tasks/network-interfaces-scripted.nix
@@ -219,14 +219,15 @@ let
                     cidr = "${route.address}/${toString route.prefixLength}";
                     via = optionalString (route.via != null) ''via "${route.via}"'';
                     options = concatStrings (mapAttrsToList (name: val: "${name} ${val} ") route.options);
+                    type = toString route.type;
                   in
                   ''
                      echo "${cidr}" >> $state
                      echo -n "adding route ${cidr}... "
-                     if out=$(ip route add "${cidr}" ${options} ${via} dev "${i.name}" proto static 2>&1); then
+                     if out=$(ip route add ${type} "${cidr}" ${options} ${via} dev "${i.name}" proto static 2>&1); then
                        echo "done"
                      elif ! echo "$out" | grep "File exists" >/dev/null 2>&1; then
-                       echo "'ip route add "${cidr}" ${options} ${via} dev "${i.name}"' failed: $out"
+                       echo "'ip route add ${type} "${cidr}" ${options} ${via} dev "${i.name}"' failed: $out"
                        exit 1
                      fi
                   ''