Skip to content

Commit

Permalink
Initial VLAN support via boot option "vlan"
Browse files Browse the repository at this point in the history
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
  • Loading branch information
mika committed Mar 13, 2014
1 parent 17794fa commit 4cecf89
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 5 deletions.
15 changes: 10 additions & 5 deletions debian/patches/29_support_dns_in_initramfs.patch
Expand Up @@ -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

Expand Down Expand Up @@ -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 .
1 change: 1 addition & 0 deletions debian/patches/series
Expand Up @@ -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
57 changes: 57 additions & 0 deletions debian/patches/vlan_support
@@ -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

0 comments on commit 4cecf89

Please sign in to comment.