]> git.pld-linux.org Git - projects/rc-scripts.git/commitdiff
Prefer vlan creation using iproute2, fallback to vconfig.
authorArkadiusz Miśkiewicz <arekm@maven.pl>
Thu, 22 Jan 2009 08:56:42 +0000 (08:56 +0000)
committerArkadiusz Miśkiewicz <arekm@maven.pl>
Thu, 22 Jan 2009 08:56:42 +0000 (08:56 +0000)
svn-id: @10088

sysconfig/network-scripts/functions.network
sysconfig/network-scripts/ifup-vlan

index db7b136571597a590162c1f405facc3bfc98364c..028a78079f731366cf71aba94be85d7235e5721d 100644 (file)
@@ -174,16 +174,6 @@ static_rarp()
        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 ()
 {
index a22407b1acd88c0e8cc0cd54feab00a82b6a096f..bd407195098d7a51e26375a6c2af730019eca023 100755 (executable)
@@ -51,11 +51,6 @@ if ! egrep -ql "ONBOOT=[^n][^o]" /etc/sysconfig/interfaces/ifcfg-${VLAN_DEV}; th
        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 @@ fi
 # 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
This page took 0.115585 seconds and 4 git commands to generate.