Skip to content

Commit 6007a0b

Browse files
committed
add onlink network config support
1 parent dff629d commit 6007a0b

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

os/flake.nix

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,7 @@
232232
(route: {
233233
destination = if (route.dst == "default") then "0.0.0.0/0" else route.dst;
234234
gateway = route.gateway;
235+
onlink = builtins.elem "onlink" route.flags;
235236
})
236237
(
237238
builtins.filter (
@@ -251,6 +252,7 @@
251252
routes = builtins.map (route: {
252253
Destination = route.destination;
253254
Gateway = route.gateway;
255+
GatewayOnLink = if (route.onlink) then "yes" else "no";
254256
}) interface.value.route;
255257
};
256258
}) network-config

os/installer/kexec.nix

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,13 @@
123123
continue
124124
fi
125125
126-
config="$(echo $route | jq -r '.dst') via $(echo $route | jq -r '.gateway')"
126+
args=""
127+
flags=$(echo "$route" | jq -r '.flags')
128+
if [[ $flags == *"onlink"* ]]; then
129+
args="$args onlink"
130+
fi
131+
132+
config="$(echo $route | jq -r '.dst') via $(echo $route | jq -r '.gateway') $args"
127133
ip route add $config dev $name
128134
done
129135
done

0 commit comments

Comments
 (0)