nixos/network-interfaces: add networking.interfaces.<name>.ipv[46].routes.type
This commit is contained in:
@@ -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
|
||||
''
|
||||
|
||||
Reference in New Issue
Block a user