diff options
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 |