ad73e603755db373cb008163a0bd11434ed12b55
[openwrt/svn-archive/archive.git] / package / base-files-network / files / etc / init.d / network
1 #!/bin/sh /etc/rc.common
2 # Copyright (C) 2006-2011 OpenWrt.org
3
4 START=40
5 STOP=90
6
7 boot() {
8 setup_switch() { return 0; }
9
10 include /lib/network
11 setup_switch
12
13 grep -qs config /etc/config/wireless && {
14 /sbin/wifi up
15 }
16
17 scan_interfaces
18
19 local ifc
20 for ifc in $interfaces; do
21 local proto
22 config_get proto "$ifc" proto
23
24 local auto
25 config_get_bool auto "$ifc" auto 1
26
27 type "coldplug_interface_$proto" >/dev/null && [ "$auto" = 1 ] && \
28 coldplug_interface_$proto "$ifc"
29 done
30 }
31
32 start() {
33 setup_switch() { return 0; }
34
35 include /lib/network
36 setup_switch
37 ifup -a
38 /sbin/wifi up
39 }
40
41 stop() {
42 ifdown -a
43 }
44
45 restart() {
46 start
47 }