diff options
Diffstat (limited to 'meta/packages/udev/files/network.sh')
| -rw-r--r-- | meta/packages/udev/files/network.sh | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/meta/packages/udev/files/network.sh b/meta/packages/udev/files/network.sh new file mode 100644 index 0000000000..5016328df4 --- /dev/null +++ b/meta/packages/udev/files/network.sh | |||
| @@ -0,0 +1,55 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | |||
| 3 | # Do not run when pcmcia-cs is installed | ||
| 4 | test -x /sbin/cardctl && exit 0 | ||
| 5 | |||
| 6 | # We get two "add" events for hostap cards due to wifi0 | ||
| 7 | echo "$INTERFACE" | grep -q wifi && exit 0 | ||
| 8 | |||
| 9 | |||
| 10 | # Check if /etc/init.d/network has been run yet to see if we are | ||
| 11 | # called by starting /etc/rcS.d/S03udev and not by hotplugging a device | ||
| 12 | # | ||
| 13 | # At this stage, network interfaces should not be brought up | ||
| 14 | # automatically because: | ||
| 15 | # a) /etc/init.d/network has not been run yet (security issue) | ||
| 16 | # b) /var has not been populated yet so /etc/resolv,conf points to | ||
| 17 | # oblivion, making the network unusable | ||
| 18 | # | ||
| 19 | |||
| 20 | spoofp="`grep ^spoofprotect /etc/network/options`" | ||
| 21 | if test -z "$spoofp" | ||
| 22 | then | ||
| 23 | # This is the default from /etc/init.d/network | ||
| 24 | spoofp_val=yes | ||
| 25 | else | ||
| 26 | spoofp_val=${spoofp#spoofprotect=} | ||
| 27 | fi | ||
| 28 | |||
| 29 | test "$spoofp_val" = yes && spoofp_val=1 || spoofp_val=0 | ||
| 30 | |||
| 31 | # I think it is safe to assume that "lo" will always be there ;) | ||
| 32 | if test "`cat /proc/sys/net/ipv4/conf/lo/rp_filter`" != "$spoofp_val" -a -n "$spoofp_val" | ||
| 33 | then | ||
| 34 | echo "$INTERFACE" >> /dev/udev_network_queue | ||
| 35 | exit 0 | ||
| 36 | fi | ||
| 37 | |||
| 38 | # | ||
| 39 | # Code taken from pcmcia-cs:/etc/pcmcia/network | ||
| 40 | # | ||
| 41 | |||
| 42 | # if this interface has an entry in /etc/network/interfaces, let ifupdown | ||
| 43 | # handle it | ||
| 44 | if grep -q "iface \+$INTERFACE" /etc/network/interfaces; then | ||
| 45 | case $ACTION in | ||
| 46 | add) | ||
| 47 | ifconfig | grep -q "^$INTERFACE" || ifup $INTERFACE | ||
| 48 | ;; | ||
| 49 | remove) | ||
| 50 | ifdown $INTERFACE | ||
| 51 | ;; | ||
| 52 | esac | ||
| 53 | |||
| 54 | exit 0 | ||
| 55 | fi | ||
