48 lines
1.1 KiB
Plaintext
48 lines
1.1 KiB
Plaintext
|
#!/bin/sh
|
||
|
|
||
|
# Most of this stuff is to enable vlans
|
||
|
|
||
|
case "$IFACE" in
|
||
|
vlan0*)
|
||
|
vconfig set_name_type VLAN_PLUS_VID
|
||
|
VLANID=`echo $IFACE|sed "s/vlan0*//"`
|
||
|
;;
|
||
|
vlan*)
|
||
|
vconfig set_name_type VLAN_PLUS_VID_NO_PAD
|
||
|
VLANID=`echo $IFACE|sed "s/vlan0*//"`
|
||
|
;;
|
||
|
eth*.0*)
|
||
|
vconfig set_name_type DEV_PLUS_VID
|
||
|
VLANID=`echo $IFACE|sed "s/eth[0-9][0-9]*\.0*//g"`
|
||
|
IF_VLAN_RAW_DEVICE=`echo $IFACE|sed "s/\(eth[0-9][0-9]*\)\..*/\1/"`
|
||
|
;;
|
||
|
eth*.*)
|
||
|
vconfig set_name_type DEV_PLUS_VID_NO_PAD
|
||
|
VLANID=`echo $IFACE|sed "s/eth[0-9][0-9]*\.0*//g"`
|
||
|
IF_VLAN_RAW_DEVICE=`echo $IFACE|sed "s/\(eth[0-9][0-9]*\)\..*/\1/"`
|
||
|
;;
|
||
|
*) exit 0
|
||
|
;;
|
||
|
esac
|
||
|
|
||
|
if [ -n "$IF_VLAN_RAW_DEVICE" ]
|
||
|
then
|
||
|
if [ ! -x /sbin/vconfig ]
|
||
|
then
|
||
|
exit 0
|
||
|
fi
|
||
|
if ! ip link show dev "$IF_VLAN_RAW_DEVICE" > /dev/null
|
||
|
then
|
||
|
echo "$IF_VLAN_RAW_DEVICE does not exist, unable to create $IFACE"
|
||
|
exit 1
|
||
|
fi
|
||
|
ip link set up dev $IF_VLAN_RAW_DEVICE
|
||
|
vconfig add $IF_VLAN_RAW_DEVICE $VLANID
|
||
|
fi
|
||
|
|
||
|
# This is not vlan specific, and should actually go somewhere else.
|
||
|
if [ -n "$IF_HW_MAC_ADDRESS" ]
|
||
|
then
|
||
|
ip link set $IFACE address $IF_HW_MAC_ADDRESS
|
||
|
fi
|