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