fix nonhotpluggable networks not being brought up. Closes #2781
[openwrt/svn-archive/archive.git] / package / base-files / files / etc / init.d / network
index eab00118ad46242ee6c3e8289c12b12ab6252fa9..75103ec073d9d2ad9b59ca0b197c332f00731284 100755 (executable)
@@ -4,14 +4,29 @@
 START=40
 STOP=40
 
+config_cb() {
+       local cfg_type="$1"
+
+       case "$cfg_type" in
+               interface)
+                       append networks "$2" "$N"
+               ;;
+       esac
+}
+
 boot() {
+       uci_load network
        setup_switch() { return 0; }
 
        include /lib/network
        setup_switch
-       [ -e /etc/config/wireless ] || \
+       [ -s /etc/config/wireless ] || \
                /sbin/wifi detect > /etc/config/wireless
        /sbin/wifi up
+       for network in $networks; do
+               config_get startupcheck $network started
+               [ "$startupcheck" = "" ] && ifup $network
+       done
 }
 
 start() {
@@ -20,6 +35,10 @@ start() {
 }
 
 restart() {
+       setup_switch() { return 0; }
+       
+       include /lib/network
+       setup_switch
        ifup -a
        /sbin/wifi up
 }