]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
network: fixup VLAN handling
authorHarald Hoyer <harald@redhat.com>
Wed, 18 Jan 2017 14:16:01 +0000 (15:16 +0100)
committerHarald Hoyer <harald@redhat.com>
Wed, 18 Jan 2017 14:16:01 +0000 (15:16 +0100)
modules.d/40network/ifup.sh
modules.d/40network/net-lib.sh
modules.d/40network/parse-vlan.sh
modules.d/45ifcfg/write-ifcfg.sh

index de8f8616d507614809c415642a987794b2714f46..655ce93e5dcee334229c2d711651f2c09966d045 100755 (executable)
@@ -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
 
index 69d96aa4344f02a33e4d8d8de382a6e253402392..d52682827758fd933c9fc080a8b928d4104725f4 100755 (executable)
@@ -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
 }
 
index 29200ee5ecfb97c360a7b901ef029f880d1b9550..afc890a5980f5e893a631a95ac0f79ddf6605ac9 100755 (executable)
@@ -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
index 16835467c6c47851e2394255eebbc7f32e15f1eb..cae196ddfa2ad466446d75edbb31d9d9e9f1a546 100755 (executable)
@@ -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\""