# HG changeset patch # User Pascal Bellard # Date 1506178183 -7200 # Node ID 3437359e0ac3f912d1a6fa2ca0856cd9d7db8e58 # Parent 78a25960b7ef27ecceefca899ace6d2fd2f9a8b2 busybox/udhcpc6: update script (again) diff -r 78a25960b7ef -r 3437359e0ac3 busybox/stuff/udhcp.script --- a/busybox/stuff/udhcp.script Sat Sep 23 15:53:27 2017 +0200 +++ b/busybox/stuff/udhcp.script Sat Sep 23 16:49:43 2017 +0200 @@ -8,6 +8,7 @@ RESOLV_CONF="/etc/resolv.conf" [ -n "$broadcast" ] && BROADCAST="broadcast $broadcast" [ -n "$subnet" ] && NETMASK="netmask $subnet" +DEV="dev $interface" netfs() { @@ -16,14 +17,14 @@ logger "$0 interface=$interface ip=$ip ipv6=$ipv6 broadcast=$broadcast subnet=$subnet ipv6prefix=$ipv6prefix router=$router domain=$domain dns=$dns fqdn=$fqdn $@" -skip=$(sed "/skipdhcpip=/!d;s/.*skipdhcpip=\([^ ]*\).*/\1/" /dev/null; do + while route del default gw 0.0.0.0 $DEV ; do : done - [ ${ip/:/} != $ip ] && ip -6 route flush dev $interface - + t= + [ ${ip/:/} != $ip ] && t="-A inet6" && ip -6 route flush $DEV metric=0 for i in $router ; do - if [ ${ip/:/} == $ip ]; then - route add default gw $i dev $interface metric $((metric++)) - else - route -A inet6 add default gw $i dev $interface metric $((metric++)) - fi - done 2>/dev/null - fi + route $t add default gw $i $DEV metric $((metric++)) + done + fi 2>/dev/null - echo -n > $RESOLV_CONF - [ -n "$domain" ] && echo search $domain >> $RESOLV_CONF + echo -en ${domain:+search $domain \\n} > $RESOLV_CONF for i in $dns ; do - echo adding dns $i - echo nameserver $i >> $RESOLV_CONF - done + echo nameserver $i + done >> $RESOLV_CONF [ "$1" == "bound" ] && for i in /etc/ipup.d/*; do [ -x $i ] && $i $interface $ip $dns done