Skip to content

Commit

Permalink
udhcpc: add default route if announced
Browse files Browse the repository at this point in the history
If not, no need to run an invalid command.

Signed-off-by: Matthieu Baerts (NGI0) <[email protected]>
  • Loading branch information
matttbe committed Nov 27, 2024
1 parent 4e1aa35 commit 7603efb
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion virtme/guest/virtme-udhcpc-script
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ if [[ "$1" == "deconfig" ]]; then
ip addr flush dev "$interface"
elif [[ "$1" == "bound" ]]; then
ip addr add "$ip/$mask" dev "$interface"
ip route add default via "$router" dev "$interface"
if [[ -n "$router" ]]; then
ip route add default via "$router" dev "$interface"
fi
if [[ -n "$dns" ]]; then
# A lot of systems will have /etc/resolv.conf symlinked to
# /run/NetworkManager/something_or_other. Debian symlinks to /run/resolvconf.
Expand Down

0 comments on commit 7603efb

Please sign in to comment.