VLAN support via boot option "vlan=<vid>:<phydevice>"
[live-boot-grml.git] / debian / patches / 41_vlan_support.patch
diff --git a/debian/patches/41_vlan_support.patch b/debian/patches/41_vlan_support.patch
new file mode 100644 (file)
index 0000000..9551b2c
--- /dev/null
@@ -0,0 +1,57 @@
+--- a/components/9990-cmdline-old
++++ b/components/9990-cmdline-old
+@@ -266,6 +266,11 @@
+                               UNIONTYPE="${_PARAMETER#union=}"
+                               export UNIONTYPE
+                               ;;
++
++                      vlan=*)
++                              VLANS="${VLANS} ${_PARAMETER#vlan=}"
++                              export VLANS
++                              ;;
+               esac
+       done
+--- a/components/9990-grml-networking.sh
++++ b/components/9990-grml-networking.sh
+@@ -67,10 +67,39 @@
+         method="dhcp"
+     fi
+-    cat >> $IFFILE << EOF
++    if [ -n "$VLANS" ] ; then
++      modprobe 8021q
++
++      # vlan=<vid>:<phydevice>
++      for line in $(echo $VLANS | sed 's/ /\n'/) ; do
++        vlandev=${line#*:}
++        vlanid=${line%:*}
++
++        if [ -n "$vlandev" ] && [ -n "$vlanid" ] ; then
++          case "$vlandev" in
++            "$interface")
++              vlan_raw_dev=$interface
++              interface="${vlandev}.${vlanid}"
++              ;;
++          esac
++        fi
++      done
++    fi
++
++    if [ -n "$vlan_raw_dev" ] ; then
++      cat >> $IFFILE << EOF
++auto ${interface}
++iface ${interface} inet ${method}
++        vlan-raw-device $vlan_raw_dev
++EOF
++    else
++      cat >> $IFFILE << EOF
+ allow-hotplug ${interface}
+ iface ${interface} inet ${method}
+ EOF
++    fi
++
++    unset vlandev vlanid vlan_raw_dev # unset variables to have clean state for next device
+     # DNS for resolvconf and /etc/resolv.conf
+     if [ -e "${netconfig}" ]; then