| . /etc/utils.sh |
| |
| iface=$1 |
| |
| start_dhcp() { |
| echo "Starting DHCP on $iface" |
| lock=/var/run/dhclient.${iface}.lock |
| lockfile-create $lock |
| pidfile=/var/run/dhclient6.${iface}.pid |
| if [ -e $pidfile ]; then |
| kill $(cat $pidfile) 2>&1 > /dev/null |
| rm -f $pidfile |
| fi |
| babysit 60 /usr/sbin/dhclient $iface -6 \ |
| -d \ |
| -pf $pidfile \ |
| -lf /var/run/dhclient6.${iface}.lease \ |
| -cf /etc/dhclient6.conf \ |
| --never-gonna-give-you-up 900 2>&1 | logos dhclient6 & |
| lockfile-remove $lock |
| } |
| |
| ip link set dev $iface up |
| if [ $(cat /etc/config/wanport) = $iface ]; then |
| # start dhcp if no management vlan is assigned. |
| if [ -z "$(cat /etc/config/mgmtvlan)" ]; then |
| start_dhcp |
| fi |
| elif [ "man" = "$iface" ]; then |
| start_dhcp |
| fi |