Initial VLAN support via boot option "vlan" mika/vlan_support
authorMichael Prokop <mika@grml.org>
Thu, 13 Mar 2014 15:02:51 +0000 (16:02 +0100)
committerMichael Prokop <mika@grml.org>
Thu, 13 Mar 2014 17:20:06 +0000 (18:20 +0100)
This provides support for something like:

  ip=10.10.10.42::10.10.10.1:255.255.255.0:grml:eth0:off vlan=301,eth0

Development sponsored by Sipwise Gmbh

debian/patches/29_support_dns_in_initramfs.patch
debian/patches/series
debian/patches/vlan_support [new file with mode: 0644]

index 501c607..f481eea 100644 (file)
@@ -6,11 +6,9 @@ Date:   Fri Mar 25 23:02:38 2011 +0100
     
     Thanks to Ulrich Dangel for discovering this. [Closes: issue848]
 
-Index: live-boot-grml/backend/initramfs-tools/live.hook
-===================================================================
---- live-boot-grml.orig/backend/initramfs-tools/live.hook      2014-03-08 13:36:37.835196873 +0100
-+++ live-boot-grml/backend/initramfs-tools/live.hook   2014-03-08 13:36:37.835196873 +0100
-@@ -228,23 +228,19 @@
+--- a/backend/initramfs-tools/live.hook
++++ b/backend/initramfs-tools/live.hook
+@@ -228,23 +228,26 @@
  
  # Some experimental stuff
  
@@ -46,5 +44,12 @@ Index: live-boot-grml/backend/initramfs-tools/live.hook
 +# might be needed if /etc/hosts is used
 +#mkdir -p "${DESTDIR}/etc"
 +#cp -p /etc/nsswitch.conf "${DESTDIR}/etc"
++
++# vlan support
++if [ -x /sbin/vconfig ]
++then
++      copy_exec /sbin/vconfig
++      manual_add_modules 8021q
++fi
  
  [ "${QUIET}" ] || echo .
index 6bfd3cb..0b38384 100644 (file)
@@ -16,3 +16,4 @@ grml-specific/package_rename.patch
 40_support_multiple_hooks.patch
 reverts/drop_nameserver_from_ip_option.patch
 reverts/restore_support_for_old_persistence.patch
+vlan_support
diff --git a/debian/patches/vlan_support b/debian/patches/vlan_support
new file mode 100644 (file)
index 0000000..6e72f73
--- /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=<vlanname>:<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