SVN: rc-scripts/trunk/sysconfig/network-scripts: functions.network ifup-vlan

arekm arekm at pld-linux.org
Thu Jan 22 09:56:42 CET 2009


Author: arekm
Date: Thu Jan 22 09:56:42 2009
New Revision: 10088

Modified:
   rc-scripts/trunk/sysconfig/network-scripts/functions.network
   rc-scripts/trunk/sysconfig/network-scripts/ifup-vlan
Log:
Prefer vlan creation using iproute2, fallback to vconfig.

Modified: rc-scripts/trunk/sysconfig/network-scripts/functions.network
==============================================================================
--- rc-scripts/trunk/sysconfig/network-scripts/functions.network	(original)
+++ rc-scripts/trunk/sysconfig/network-scripts/functions.network	Thu Jan 22 09:56:42 2009
@@ -174,16 +174,6 @@
 	fi
 }
 
-vlan_setup()
-{
-	if [ -x /sbin/vconfig -a -e /proc/net/vlan/config ] && echo $DEVICE | grep -q ^eth; then
-		/sbin/vconfig set_name_type DEV_PLUS_VID_NO_PAD 2>&1 > /dev/null
-		ETH_VLANS="yes"
-	else
-		ETH_VLANS="no"
-	fi
-}
-
 # Set up all IP && IP parameter variables
 setup_ip_param ()
 {

Modified: rc-scripts/trunk/sysconfig/network-scripts/ifup-vlan
==============================================================================
--- rc-scripts/trunk/sysconfig/network-scripts/ifup-vlan	(original)
+++ rc-scripts/trunk/sysconfig/network-scripts/ifup-vlan	Thu Jan 22 09:56:42 2009
@@ -51,11 +51,6 @@
 	exit 1
 fi
 
-if [ ! -x /sbin/vconfig ]; then
-	nls "%s is missing. Can't continue." "/sbin/vconfig"
-	exit 1
-fi
-
 modprobe -s -k 8021q
 
 if [ ! -e /proc/net/vlan/config ]; then
@@ -66,10 +61,22 @@
 # set all major variables
 setup_ip_param
 
-/sbin/vconfig set_name_type DEV_PLUS_VID_NO_PAD
-/sbin/ip link set ${VLAN_DEV} up
-/sbin/vconfig add ${VLAN_DEV} ${VLAN_ID}
-/sbin/vconfig set_flag ${DEVICE} 1 ${VLAN_REORDER_HDR:-1}
+if (ip link add type vlan help 2>&1 | grep -q "VLANID :="); then
+	/sbin/ip link set ${VLAN_DEV} up
+	/sbin/ip link add link ${VLAN_DEV} name ${DEVICE} type vlan id ${VLAN_ID}
+	# default yes
+	is_no "${VLAN_REORDER_HDR}" && VLAN_REORDER_HDR=off || VLAN_REORDER_HDR=on
+	# default no
+	is_yes "$VLAN_GVRP" && VLAN_GVRP=on || VLAN_GVRP=off
+	/sbin/ip link set ${DEVICE} type vlan reorder_hdr ${VLAN_REORDER_HDR} gvrp ${VLAN_GVRP}
+elif [ -x /sbin/vconfig ] ; then
+	/sbin/vconfig set_name_type DEV_PLUS_VID_NO_PAD
+	/sbin/ip link set ${VLAN_DEV} up
+	/sbin/vconfig add ${VLAN_DEV} ${VLAN_ID}
+	/sbin/vconfig set_flag ${DEVICE} 1 ${VLAN_REORDER_HDR:-1}
+else
+	nls "/sbin/vconfig or iproute2 with vlan support is missing. Can't continue."
+fi
 RESULT=$?
 
 # XXX: more VLAN specific options support


More information about the pld-cvs-commit mailing list