wok-current diff busybox/stuff/udhcp.script @ rev 20065
busybox/udhcpc6: update script
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Sat Sep 23 13:11:28 2017 +0200 (2017-09-23) |
parents | 15e6c6910ee3 |
children | 22fbe02a8c96 |
line diff
1.1 --- a/busybox/stuff/udhcp.script Thu Apr 21 09:45:48 2016 +0200 1.2 +++ b/busybox/stuff/udhcp.script Sat Sep 23 13:11:28 2017 +0200 1.3 @@ -11,35 +11,47 @@ 1.4 1.5 netfs() 1.6 { 1.7 - /bin/grep -qe '\(:.* /\|httpfs\|nfs\|smbfs\|ncp\|coda\)' /proc/mounts 1.8 + grep -qe '\(:.* /\|httpfs\|nfs\|smbfs\|ncp\|coda\)' /proc/mounts 1.9 } 1.10 1.11 -logger "$0 interface=$interface ip=$ip broadcast=$broadcast subnet=$subnet router=$router domain=$domain dns=$dns $@" 1.12 +logger "$0 interface=$interface ip=$ip ipv6=$ipv6 broadcast=$broadcast subnet=$subnet ipv6prefix=$ipv6prefix router=$router domain=$domain dns=$dns fqdn=$fqdn $@" 1.13 1.14 skip=$(sed "/skipdhcpip=/!d;s/.*skipdhcpip=\([^ ]*\).*/\1/" </proc/cmdline) 1.15 [ -n "$skip" ] && case "$ip" in $skip*) exit 0;; esac 1.16 1.17 case "$1" in 1.18 deconfig) 1.19 - netfs || /sbin/ifconfig $interface 0.0.0.0 1.20 + if !netfs; then 1.21 + ifconfig $interface 0.0.0.0 1.22 + ip -6 addr flush dev $interface 1.23 + fi 1.24 for i in /etc/ipdown.d/*; do 1.25 [ -x $i ] && $i $interface 1.26 done 1.27 ;; 1.28 1.29 renew|bound) 1.30 - /sbin/ifconfig $interface $ip $BROADCAST $NETMASK 1.31 + if [ ${ip/:/} == $ip ]; 1.32 + ifconfig $interface $ip $BROADCAST $NETMASK 1.33 + else 1.34 + ip -6 addr add ${ip}/${ipv6prefix#*/} dev $interface 1.35 + fi 1.36 1.37 if [ -n "$router" ] ; then 1.38 echo "deleting routers" 1.39 while route del default gw 0.0.0.0 dev $interface 2>/dev/null; do 1.40 : 1.41 done 1.42 + [ ${ip/:/} != $ip ] && ip -6 route flush dev $interface 1.43 1.44 metric=0 1.45 for i in $router ; do 1.46 - route add default gw $i dev $interface metric $((metric++)) 2>/dev/null 1.47 - done 1.48 + if [ ${ip/:/} == $ip ]; then 1.49 + route add default gw $i dev $interface metric $((metric++)) 1.50 + else 1.51 + route -A inet6 add default gw $i dev $interface metric $((metric++)) 1.52 + fi 1.53 + done 2>/dev/null 1.54 fi 1.55 1.56 echo -n > $RESOLV_CONF