From 7603efb2590468347e660c41e46a9bf1cca5bd62 Mon Sep 17 00:00:00 2001 From: "Matthieu Baerts (NGI0)" Date: Wed, 27 Nov 2024 13:26:49 +0100 Subject: [PATCH] udhcpc: add default route if announced If not, no need to run an invalid command. Signed-off-by: Matthieu Baerts (NGI0) --- virtme/guest/virtme-udhcpc-script | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/virtme/guest/virtme-udhcpc-script b/virtme/guest/virtme-udhcpc-script index 8f75ce8..244f1a5 100755 --- a/virtme/guest/virtme-udhcpc-script +++ b/virtme/guest/virtme-udhcpc-script @@ -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.