more reliable fix for handling ppp
[openwrt-10.03/.git] / package / base-files / files / etc / hotplug.d / net / 10-net
1 # Copyright (C) 2006 OpenWrt.org
2
3 include /lib/network
4
5 addif() {
6         # PPP devices are configured by pppd, no need to run setup_interface here
7         case "$INTERFACE" in
8                 ppp*) return 0;;
9         esac
10
11         scan_interfaces
12         local cfg="$(find_config "$INTERFACE")"
13
14         # check the autoload setting
15         config_get auto "$cfg" auto
16         case "$auto" in
17                 1|on|enabled) setup_interface "$INTERFACE";;
18         esac
19
20
21         # find all vlan configurations for this interface and set them up as well
22         for ifc in $interfaces; do
23                 config_get iftype "$ifc" type
24                 config_get ifs "$ifc" device
25                 for dev in $ifs; do
26                         [ "${dev%%\.*}" = "$INTERFACE" -a "$dev" != "$INTERFACE" ] && {
27                                 add_vlan "$dev"
28                         }
29                 done
30         done
31 }
32
33 case "$ACTION" in
34         add|register)
35                 case "$PHYSDEVDRIVER" in
36                         natsemi) sleep 1;;
37                 esac
38                 addif
39         ;;
40 esac