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
# 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