Package: vlan
Version: 1.9-3
Followup-For: Bug #456309

hi,

I hit the same problems as rene with the naming convetion of vlan
interfaces in network/interfaces.
Though i've implemented complete free named vlan devices.

eg.
iface dmz inet static
  vlan-raw-device eth1
  vlan-id 66
  address 192.168.1.1
  netmask 255.255.255.0

This produces:
# ip -d link
112: [EMAIL PROTECTED]: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc 
noqueue state UP
    link/ether 00:19:d1:56:57:cf brd ff:ff:ff:ff:ff:ff
    vlan id 66 <REORDER_HDR>

michael

-- System Information:
Debian Release: lenny/sid
  APT prefers unstable
  APT policy: (991, 'unstable'), (500, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.23-grml64 (SMP w/2 CPU cores; PREEMPT)
Locale: LANG=en_US.iso885915, LC_CTYPE=en_US.iso885915 (charmap=ISO-8859-15)
Shell: /bin/sh linked to /bin/bash

Versions of packages vlan depends on:
ii  iproute                       20080725-2 networking and traffic control too
ii  libc6                         2.7-13     GNU C Library: Shared libraries

vlan recommends no packages.

vlan suggests no packages.

-- no debconf information
>From 3ba4a43c990e3100bb0faf2d13124f979a5b78c8 Mon Sep 17 00:00:00 2001
From: Michael Gebetsroither <[EMAIL PROTECTED]>
Date: Thu, 30 Oct 2008 15:44:53 +0100
Subject: [PATCH 1/2] add ifupdown infrastructure for free named vlan devices

e.g
iface dmz inet static
  vlan-raw-device eth0
  vlan-id 1
  address 192.168.1.1
  netmask 255.255.255.0

Signed-off-by: Michael Gebetsroither <[EMAIL PROTECTED]>

diff --git a/debian/network/if-pre-up.d/vlan b/debian/network/if-pre-up.d/vlan
index b977be8..dfe9147 100644
--- a/debian/network/if-pre-up.d/vlan
+++ b/debian/network/if-pre-up.d/vlan
@@ -39,7 +39,11 @@ case "$IFACE" in
   ;;
 
   *)
-    exit 0
+    if [ -n "$IF_VLAN_RAW_DEVICE" -a -n "$IF_VLAN_VID" ]; then
+      VLANID="$IF_VLAN_VID"
+    else
+      exit 0
+    fi
   ;;
 esac
 
@@ -53,6 +57,15 @@ if [ -n "$IF_VLAN_RAW_DEVICE" ]; then
     fi
     ip link set up dev $IF_VLAN_RAW_DEVICE
     vconfig add $IF_VLAN_RAW_DEVICE $VLANID
+    if [ -n "$IF_VLAN_VID" ]; then
+        # FIXME: ugly workaround for missing interface to created free named 
vlan interfaces
+        TMP_VLAN_IFACE=$(awk "/\| *$VLANID *\| *$IF_VLAN_RAW_DEVICE/ {print 
\$1}" /proc/net/vlan/config)
+        if ! ip link set $TMP_VLAN_IFACE name $IFACE; then
+            echo "Can not rename $TMP_VLAN_IFACE to $IFACE as requested"
+            vconfig rem $TMP_VLAN_IFACE
+            exit 1
+        fi
+    fi
 fi
 
 # This is not vlan specific, and should actually go somewhere else.
-- 
1.5.6.5

>From 407faf19889bc359b93794a40f39741bd2a28ed0 Mon Sep 17 00:00:00 2001
From: Michael Gebetsroither <[EMAIL PROTECTED]>
Date: Thu, 30 Oct 2008 15:45:17 +0100
Subject: [PATCH 2/2] Add documentation to manpage for free named vlan interfaces


Signed-off-by: Michael Gebetsroither <[EMAIL PROTECTED]>

diff --git a/debian/vlan-interfaces.5 b/debian/vlan-interfaces.5
index 9082ffa..4ad94c6 100644
--- a/debian/vlan-interfaces.5
+++ b/debian/vlan-interfaces.5
@@ -21,9 +21,10 @@ when using (a lot of) vlans.
 .SH VLAN CREATION
 Vlan interface definitions exist of the vlan interface name, and an optional
 \'raw-device\' parameter.  Vlan interfaces are numbered 1 to 4095.  You have
-the option to have interface names zero-padded to 4 numbers, or just the plain
-digits without leading zero.  The following example shows four ways to create a
-vlan with id 1 on interface eth0.  They all result in different names.
+the option to have interface names zero-padded to 4 numbers, just the plain
+digits without leading zero, or free named devices with the vlan-id option.
+The following example shows four ways to create a vlan with id 1 on interface
+eth0.  They all result in different names.
 
  iface eth0.1 inet static
        address 192.168.1.1
@@ -54,6 +55,13 @@ vlan with id 1 on interface eth0.  They all result in 
different names.
        address 192.168.1.1
        netmask 255.255.255.255
 
+ # Free named device
+ iface dmz inet static
+   vlan-raw-device eth0
+   vlan-id 1
+   address 192.168.1.1
+   netmask 255.255.255.0
+
 .SH EXTRA IFACE OPTIONS
 Usually someone who uses vlans also wants to do some other manipulations with
 the ip stack or interface.
@@ -62,6 +70,9 @@ the ip stack or interface.
 Indicates the device to create the vlan on.  This is ignored when the
 devicename is part of the vlan interface name.
 .TP
+.BI vlan-vid" vlan_id"
+Specifies the vlan_id of a free named vlan device.
+.TP
 .BI ip-proxy-arp " 0|1"
 Turn proxy-arp off or on for this specific interface.  This also works on plain
 ethernet like devices.
-- 
1.5.6.5

Reply via email to