diff options
author | Simon Rettberg | 2019-09-11 16:04:45 +0200 |
---|---|---|
committer | Simon Rettberg | 2019-09-11 16:04:45 +0200 |
commit | 9f10cc7e97cdaed137a2b536ef62307ebe184ff4 (patch) | |
tree | c11590279e7ffd29d21cc85cd70072e0a465f79e /core/modules/dhcpc-busybox/data/opt/openslx/scripts/udhcpc-openslx | |
parent | [run-virt] Fix execution of *.inc hooks (diff) | |
download | mltk-9f10cc7e97cdaed137a2b536ef62307ebe184ff4.tar.gz mltk-9f10cc7e97cdaed137a2b536ef62307ebe184ff4.tar.xz mltk-9f10cc7e97cdaed137a2b536ef62307ebe184ff4.zip |
[dhcpc-busybox] Fix default route setting
Diffstat (limited to 'core/modules/dhcpc-busybox/data/opt/openslx/scripts/udhcpc-openslx')
-rwxr-xr-x | core/modules/dhcpc-busybox/data/opt/openslx/scripts/udhcpc-openslx | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/core/modules/dhcpc-busybox/data/opt/openslx/scripts/udhcpc-openslx b/core/modules/dhcpc-busybox/data/opt/openslx/scripts/udhcpc-openslx index 955b8975..debe82a4 100755 --- a/core/modules/dhcpc-busybox/data/opt/openslx/scripts/udhcpc-openslx +++ b/core/modules/dhcpc-busybox/data/opt/openslx/scripts/udhcpc-openslx @@ -77,12 +77,16 @@ case "$1" in check_env "$1" mkdir -p "/run/dhcpc" # Set address on interface - ip addr add "$ip/$(ipcalc -s -p "$ip" "$subnet" | sed s/.*=//)" dev "$interface" + 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 dns_fqdn=$(busybox timeout -t 3 rdns "$ip") dns_short="${dns_fqdn%%.*}" @@ -98,7 +102,7 @@ case "$1" in : elif [ -n "$dns_fqdn" ]; then domain="${dns_fqdn#*.}" - + elif [ -n "$SLX_NET_DOMAIN" ]; then domain="$SLX_NET_DOMAIN" fi |