From: Harald Hoyer Date: Wed, 18 Jan 2017 14:16:01 +0000 (+0100) Subject: network: fixup VLAN handling X-Git-Tag: 045~39 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e7838a8312a1a8aed0f2cc7322eb4428dc711d19;p=thirdparty%2Fdracut.git network: fixup VLAN handling --- diff --git a/modules.d/40network/ifup.sh b/modules.d/40network/ifup.sh index de8f8616d..655ce93e5 100755 --- a/modules.d/40network/ifup.sh +++ b/modules.d/40network/ifup.sh @@ -144,6 +144,7 @@ get_vid() { # check, if we need VLAN's for this interface if [ -z "$DO_VLAN_PHY" ] && [ -e /tmp/vlan.${netif}.phy ]; then + unset DO_VLAN NO_AUTO_DHCP=yes DO_VLAN_PHY=yes ifup "$netif" modprobe -b -q 8021q @@ -161,6 +162,16 @@ if [ -z "$DO_VLAN_PHY" ] && [ -e /tmp/vlan.${netif}.phy ]; then exit 0 fi +# Check, if interface is VLAN interface +if ! [ -e /tmp/vlan.${netif}.phy ]; then + for i in /tmp/vlan.${netif}.*; do + [ -e "$i" ] || continue + export DO_VLAN=yes + break + done +fi + + # bridge this interface? if [ -z "$NO_BRIDGE_MASTER" ]; then for i in /tmp/bridge.*.info; do @@ -321,6 +332,7 @@ if [ -n "$manualup" ]; then rm -f /tmp/net.${netif}.did-setup else [ -e /tmp/net.${netif}.did-setup ] && exit 0 + [ -z "$DO_VLAN" ] && \ [ -e /sys/class/net/$netif/address ] && \ [ -e /tmp/net.$(cat /sys/class/net/$netif/address).did-setup ] && exit 0 fi @@ -393,7 +405,7 @@ for p in $(getargs ip=); do if [ $ret -eq 0 ]; then > /tmp/net.${netif}.up - if [ -e /sys/class/net/${netif}/address ]; then + if [ -z "$DO_VLAN" ] && [ -e /sys/class/net/${netif}/address ]; then > /tmp/net.$(cat /sys/class/net/${netif}/address).up fi diff --git a/modules.d/40network/net-lib.sh b/modules.d/40network/net-lib.sh index 69d96aa43..d52682827 100755 --- a/modules.d/40network/net-lib.sh +++ b/modules.d/40network/net-lib.sh @@ -101,7 +101,8 @@ ifdown() { ip addr flush dev $netif echo "#empty" > /etc/resolv.conf rm -f -- /tmp/net.$netif.did-setup - [ -e /sys/class/net/$netif/address ] && \ + [ -z "$DO_VLAN" ] && \ + [ -e /sys/class/net/$netif/address ] && \ rm -f -- /tmp/net.$(cat /sys/class/net/$netif/address).did-setup # TODO: send "offline" uevent? } @@ -110,7 +111,8 @@ setup_net() { local netif="$1" f="" gw_ip="" netroot_ip="" iface="" IFACES="" local _p [ -e /tmp/net.$netif.did-setup ] && return - [ -e /sys/class/net/$netif/address ] && \ + [ -z "$DO_VLAN" ] && \ + [ -e /sys/class/net/$netif/address ] && \ [ -e /tmp/net.$(cat /sys/class/net/$netif/address).did-setup ] && return [ -e "/tmp/net.ifaces" ] && read IFACES < /tmp/net.ifaces [ -z "$IFACES" ] && IFACES="$netif" @@ -178,7 +180,8 @@ setup_net() { unset layer2 > /tmp/net.$netif.did-setup - [ -e /sys/class/net/$netif/address ] && \ + [ -z "$DO_VLAN" ] && \ + [ -e /sys/class/net/$netif/address ] && \ > /tmp/net.$(cat /sys/class/net/$netif/address).did-setup } diff --git a/modules.d/40network/parse-vlan.sh b/modules.d/40network/parse-vlan.sh index 29200ee5e..afc890a59 100755 --- a/modules.d/40network/parse-vlan.sh +++ b/modules.d/40network/parse-vlan.sh @@ -23,7 +23,7 @@ for vlan in $(getargs vlan=); do unset vlanname unset phydevice if [ ! "$vlan" = "vlan" ]; then - parsevlan "$(getarg vlan=)" + parsevlan "$vlan" fi echo "phydevice=\"$phydevice\"" > /tmp/vlan.${phydevice}.phy diff --git a/modules.d/45ifcfg/write-ifcfg.sh b/modules.d/45ifcfg/write-ifcfg.sh index 16835467c..cae196ddf 100755 --- a/modules.d/45ifcfg/write-ifcfg.sh +++ b/modules.d/45ifcfg/write-ifcfg.sh @@ -156,7 +156,7 @@ for netup in /tmp/net.*.did-setup ; do { echo "# Generated by dracut initrd" echo "NAME=\"$netif\"" - interface_bind "$netif" "$macaddr" + [ -z "$vlan" ] && interface_bind "$netif" "$macaddr" echo "ONBOOT=yes" echo "NETBOOT=yes" echo "UUID=\"$uuid\""