1#!/bin/sh 2 3if [ "x`config get bridge_band_choose`" = "x2.4g" ]; then 4 old_status=`cat /proc/sys/net/ath1/status | awk 'NR==3'` 5 wlan_connected="RUN" 6 7else 8 old_status=`cat /proc/sys/net/ath0/status | awk 'NR==3'` 9 wlan_connected="RUN" 10fi 11 12while [ 1 ]; do 13 sleep 5 14 if [ "x`config get bridge_band_choose`" = "x2.4g" ]; then 15 current_status=`cat /proc/sys/net/ath1/status | awk 'NR==3'` 16 else 17 current_status=`cat /proc/sys/net/ath0/status | awk 'NR==3'` 18 fi 19 if [ "x$current_status" = "x$wlan_connected" ]; then 20 if [ "x$old_status" != "x$current_status" -o "x`ifconfig br0 | grep "inet addr:169.254"`" != "x" ]; then 21 if [ "x`pidof udhcpc`" != "x" ]; then 22 killall -SIGUSR1 udhcpc 23 else 24 # maybe udhcpc is stoped for some reason 25 udhcpc -a -b -i br0 -h "$(config get bridge_netbiosname)" -r $(config get ap_dhcp_ipaddr) & 26 fi 27 fi 28 fi 29 old_status=$current_status 30done 31