Package: vlan
Version: 2.0.5+nmu3
Followup-For: Bug #456309

Hi,

I have an alternative implementation for the freeform-vlan-interface-name
feature suggested by Michael Gebetsroither in 2008.

His documentation patch
(https://bugs.debian.org/cgi-bin/bugreport.cgi?att=2;bug=456309;filename=0002-Add-documentation-to-manpage-for-free-named-vlan-int.patch;msg=20)
also covers this implementation.

Basically, if in `iface IFACE inet ...`, you specify "vlan-raw-interface"
AND "vlan-id", IFACE can be any valid Linux interface name and doesn't have
to follow a specific naming convention.

The following minimalistic patch adds this feature:

--- a/vlan      2026-04-06 12:19:20.417752254 +0200
+++ b/vlan      2026-04-06 12:29:28.398940902 +0200
@@ -51,10 +51,15 @@
     mkdir -p "$STATEDIR" && echo "DEV_PLUS_VID_NO_PAD" > "$STATEDIR/name-type"
     VLANID=`echo $IFACE|sed "s/[^.]*\.0*//g"`
   ;;
-  
   *)
+    # Interfaces whose name doesn't follow a specific naming convention can 
still be created if both raw-device and vlan ID are specified
+    if [ -n "$IF_VLAN_ID" -a -n "$IF_VLAN_RAW_DEVICE" ]; then
+       VLANID="$IF_VLAN_ID"
+    else
        exit 0
+    fi
   ;;
+
 esac

 if [ -n "$IF_MTU" -a -n "$IF_VLAN_RAW_DEVICE" ]; then
@@ -73,7 +78,11 @@
     if [ ! -e "/sys/class/net/$IFACE" ]; then
         ip link set up dev $IF_VLAN_RAW_DEVICE
         #vconfig add $IF_VLAN_RAW_DEVICE $VLANID
+        if [ -n "$IF_VLAN_ID" ]; then
+            NAME_TYPE=FREEFORM
+        else
             NAME_TYPE=DEV_PLUS_VID_NO_PAD
+        fi
         [ -r "$STATEDIR/name-type" ] && NAME_TYPE=$(cat "$STATEDIR/name-type")
         case "$NAME_TYPE" in
             VLAN_PLUS_VID)
@@ -88,6 +97,9 @@
             DEV_PLUS_VID_NO_PAD)
                 NAME="$IF_VLAN_RAW_DEVICE.$VLANID"
                 ;;
+            FREEFORM)
+               NAME="$IFACE"
+               ;;
         esac
         ip link add link "$IF_VLAN_RAW_DEVICE" name "$NAME" \
             type vlan id "$VLANID"



AndrĂ¡s

Ps. (Incidentally, there seems to be no reason for the STATEDIR/name-type
file; you could just set the NAME_TYPE variable directly.)

-- System Information:
Debian Release: forky/sid
  APT prefers stable-security
  APT policy: (500, 'stable-security'), (350, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 6.19.10+deb14-amd64 (SMP w/8 CPU threads; PREEMPT)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_OOT_MODULE, 
TAINT_UNSIGNED_MODULE
Locale: LANG=C.UTF-8, LC_CTYPE=hu_HU.UTF-8 (charmap=UTF-8), LANGUAGE=en_US.UTF-8
Shell: /bin/sh linked to /usr/bin/dash
Init: runit (via /run/runit.stopit)
LSM: AppArmor: enabled

Versions of packages vlan depends on:
ii  iproute2  6.19.0-1

vlan recommends no packages.

vlan suggests no packages.

-- Configuration Files:
/etc/network/if-pre-up.d/vlan changed [not included]

-- no debconf information

-- 
                Energizer Bunny arrested. Charged with battery.

Reply via email to