]> git.ipfire.org Git - ipfire-2.x.git/commitdiff
Merge remote-tracking branch 'ms/experimental-vlan-hotplugging' into next
authorMichael Tremer <michael.tremer@ipfire.org>
Mon, 28 Sep 2015 13:33:49 +0000 (14:33 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Mon, 28 Sep 2015 13:33:49 +0000 (14:33 +0100)
config/rootfiles/common/armv5tel/initscripts
config/rootfiles/common/i586/initscripts
config/rootfiles/common/udev
config/udev/60-net.rules
config/udev/network-hotplug-vlan [moved from src/initscripts/init.d/network-vlans with 60% similarity]
lfs/initscripts
lfs/udev

index b4cd8f857192a330af409cf004e677fd54fad7c5..a174c5b45051ad7acbf601032937aed8b5dff949 100644 (file)
@@ -62,7 +62,6 @@ etc/rc.d/init.d/mounttmpfs
 #etc/rc.d/init.d/netsnmpd
 etc/rc.d/init.d/network
 etc/rc.d/init.d/network-trigger
-etc/rc.d/init.d/network-vlans
 #etc/rc.d/init.d/networking
 etc/rc.d/init.d/networking/any
 etc/rc.d/init.d/networking/blue
@@ -232,7 +231,6 @@ etc/rc.d/rcsysinit.d/S75firstsetup
 etc/rc.d/rcsysinit.d/S80localnet
 etc/rc.d/rcsysinit.d/S85firewall
 etc/rc.d/rcsysinit.d/S90network-trigger
-etc/rc.d/rcsysinit.d/S91network-vlans
 etc/rc.d/rcsysinit.d/S92rngd
 etc/rc.d/rc3.d/S15fireinfo
 #etc/sysconfig
index 878ba667e540fbf1daaa3e825a7584f0224463a7..84c432a055303b881dc24f642ea39f372ccf16ba 100644 (file)
@@ -64,7 +64,6 @@ etc/rc.d/init.d/mounttmpfs
 #etc/rc.d/init.d/netsnmpd
 etc/rc.d/init.d/network
 etc/rc.d/init.d/network-trigger
-etc/rc.d/init.d/network-vlans
 #etc/rc.d/init.d/networking
 etc/rc.d/init.d/networking/any
 etc/rc.d/init.d/networking/blue
@@ -237,7 +236,6 @@ etc/rc.d/rcsysinit.d/S75firstsetup
 etc/rc.d/rcsysinit.d/S80localnet
 etc/rc.d/rcsysinit.d/S85firewall
 etc/rc.d/rcsysinit.d/S90network-trigger
-etc/rc.d/rcsysinit.d/S91network-vlans
 etc/rc.d/rcsysinit.d/S92rngd
 etc/rc.d/rc3.d/S15fireinfo
 #etc/sysconfig
index d01c4610158f05d6da4b1febd2f1ac5b1e6ee772..4d519544d96d5e3dde75d5cb73020fd7473ff22f 100644 (file)
@@ -29,6 +29,7 @@ lib/udev
 #lib/udev/init-net-rules.sh
 #lib/udev/mtd_probe
 #lib/udev/network-hotplug-rename
+#lib/udev/network-hotplug-vlan
 #lib/udev/rule_generator.functions
 #lib/udev/rules.d
 #lib/udev/rules.d/25-alsa.rules
index 4f22a1e306ee105561c389fb1ded8c042275d69f..dc39ff09b3c6440ef314cf0a8d11fb9460e3cc19 100644 (file)
@@ -1,3 +1,7 @@
 # Call a script that checks for the right name of the new device.
 # If it matches the configuration it will be renamed accordingly.
 ACTION=="add", SUBSYSTEM=="net", PROGRAM="/lib/udev/network-hotplug-rename", RESULT=="?*", NAME="$result"
+
+# Call a script that will create all virtual devices for a parent device
+# that has just come up.
+ACTION=="add", SUBSYSTEM=="net", PROGRAM="/lib/udev/network-hotplug-vlan"
similarity index 60%
rename from src/initscripts/init.d/network-vlans
rename to config/udev/network-hotplug-vlan
index a6a75c35f8a85aff2e43a073b98dcb6a8bb11b11..f7b6a9de1525dc5eb35604e06f8775b18696fc26 100644 (file)
 # along with IPFire; if not, write to the Free Software                    #
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA #
 #                                                                          #
-# Copyright (C) 2012 IPFire Team <info@ipfire.org>                         #
+# Copyright (C) 2015 IPFire Team <info@ipfire.org>                         #
 #                                                                          #
 ############################################################################
 
+[ -n "${INTERFACE}" ] || exit 2
+
 CONFIG_FILE="/var/ipfire/ethernet/vlans"
 
 # Skip immediately if no configuration file has been found.
@@ -28,9 +30,6 @@ CONFIG_FILE="/var/ipfire/ethernet/vlans"
 
 eval $(/usr/local/bin/readhash ${CONFIG_FILE})
 
-# This is start or stop.
-action=${1}
-
 for interface in green0 red0 blue0 orange0; do
        case "${interface}" in
                green*)
@@ -55,59 +54,34 @@ for interface in green0 red0 blue0 orange0; do
                        ;;
        esac
 
-       case "${action}" in
-               start)
-                       # If no parent device has been configured, we assume
-                       # that this interface is not set up for VLANs and
-                       # silently go on.
-                       [ -z "${PARENT_DEV}" ] && continue
-
-                       # Check if the interface does already exists.
-                       # If so, we skip creating it.
-                       if [ -d "/sys/class/net/${interface}" ]; then
-                               echo "Interface ${interface} already exists." >&2
-                               continue
-                       fi
-
-                       # Check if the parent interface exists.
-                       if [ ! -d "/sys/class/net/${PARENT_DEV}" ]; then
-                               echo "${interface}: Parent device is not set or does not exist: ${PARENT_DEV}" >&2
-                               continue
-                       fi
-
-                       if [ -z "${VLAN_ID}" ]; then
-                               echo "${interface}: You did not set the VLAN ID." >&2
-                               continue
-                       fi
+       # If the parent device does not match the interface that
+       # has just come up, we will go on for the next one.
+       [ "${PARENT_DEV}" = "${INTERFACE}" ] || continue
 
-                       # Build command line.
-                       command="ip link add link ${PARENT_DEV} name ${interface}"
-                       if [ -n "${MAC_ADDRESS}" ]; then
-                               command="${command} address ${MAC_ADDRESS}"
-                       fi
-                       command="${command} type vlan id ${VLAN_ID}"
+       # Check if the interface does already exists.
+       # If so, we skip creating it.
+       if [ -d "/sys/class/net/${interface}" ]; then
+               echo "Interface ${interface} already exists." >&2
+               continue
+       fi
 
-                       echo "Creating VLAN interface ${interface}..."
-                       ${command}
+       if [ -z "${VLAN_ID}" ]; then
+               echo "${interface}: You did not set the VLAN ID." >&2
+               continue
+       fi
 
-                       # Bring up the parent device.
-                       ip link set ${PARENT_DEV} up
-                       ;;
+       # Build command line.
+       command="ip link add link ${PARENT_DEV} name ${interface}"
+       if [ -n "${MAC_ADDRESS}" ]; then
+               command="${command} address ${MAC_ADDRESS}"
+       fi
+       command="${command} type vlan id ${VLAN_ID}"
 
-               stop)
-                       if [ ! -e "/proc/net/vlan/${interface}" ]; then
-                               echo "${interface} is not a VLAN interface. Skipping."
-                               continue
-                       fi
+       echo "Creating VLAN interface ${interface}..."
+       ${command}
 
-                       echo "Removing VLAN interface ${interface}..."
-                       ip link set ${interface} down
-                       ip link delete ${interface}
-                       ;;
-               
-               *)
-                       echo "Invalid action: ${action}"
-                       exit 1
-                       ;;
-       esac
+       # Bring up the parent device.
+       ip link set ${PARENT_DEV} up
 done
+
+exit 0
index 400594136230363a5ea32c29bab06658cffbe7bb..141fd66d8dd2caf9bd81b82a7397e0adcdb605b1 100755 (executable)
@@ -177,7 +177,6 @@ $(TARGET) :
        ln -sf ../init.d/localnet    /etc/rc.d/rcsysinit.d/S80localnet
        ln -sf ../init.d/firewall    /etc/rc.d/rcsysinit.d/S85firewall
        ln -sf ../init.d/network-trigger /etc/rc.d/rcsysinit.d/S90network-trigger
-       ln -sf ../init.d/network-vlans /etc/rc.d/rcsysinit.d/S91network-vlans
        ln -sf ../init.d/rngd        /etc/rc.d/rcsysinit.d/S92rngd
        ln -sf ../init.d/wlanclient  /etc/rc.d/rc0.d/K82wlanclient
        ln -sf ../init.d/wlanclient  /etc/rc.d/rc3.d/S19wlanclient
index e58839c405e93a214b37774d3cb06cf83fe1a996..7d5bdbca19106b427367a7f1903aff517536f6d0 100644 (file)
--- a/lfs/udev
+++ b/lfs/udev
@@ -107,6 +107,8 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
        # Install network rules.
        install -v -m 755 $(DIR_SRC)/config/udev/network-hotplug-rename \
                /lib/udev/network-hotplug-rename
+       install -v -m 755 $(DIR_SRC)/config/udev/network-hotplug-vlan \
+               /lib/udev/network-hotplug-vlan
        install -v -m 644 $(DIR_SRC)/config/udev/60-net.rules \
                /lib/udev/rules.d