diff options
author | Jonathan Bauer | 2019-11-08 11:00:06 +0100 |
---|---|---|
committer | Jonathan Bauer | 2019-11-08 11:00:06 +0100 |
commit | 81ed4699fd70cad2b133e5a239165e8afbc68517 (patch) | |
tree | 49afc81c633a78460994bb5a48a1cf60fac8f165 | |
parent | [slx-addons] relative to absolute path in service (diff) | |
download | systemd-init-81ed4699fd70cad2b133e5a239165e8afbc68517.tar.gz systemd-init-81ed4699fd70cad2b133e5a239165e8afbc68517.tar.xz systemd-init-81ed4699fd70cad2b133e5a239165e8afbc68517.zip |
[slx-network] only replace route for same interface
-rwxr-xr-x | builder/modules.d/slx-network/scripts/udhcpc-trigger.stage4 | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/builder/modules.d/slx-network/scripts/udhcpc-trigger.stage4 b/builder/modules.d/slx-network/scripts/udhcpc-trigger.stage4 index b4dfeafa..d7009dc6 100755 --- a/builder/modules.d/slx-network/scripts/udhcpc-trigger.stage4 +++ b/builder/modules.d/slx-network/scripts/udhcpc-trigger.stage4 @@ -66,7 +66,11 @@ case "$1" in ip addr add "$ip/$(ipcalc -s -p "$ip" "$subnet" | sed s/.*=//)" dev "$interface" # Set default route, if given if [ -n "$router" ]; then - ip route replace default via "$router" + # Only replace route if it's the same interface as the current default route, or we don't have any + current="$( ip route show | awk '{ if ($1 == "default") {print $5; exit 0}}' )" + if [ -z "$current" ] || [ "$interface" = "$current" ]; then + ip route replace default via "$router" + fi fi # get domain, hostname and thus fqdn from DNS |