diff options
Diffstat (limited to 'main/vlan/vlan.pre-up')
-rw-r--r-- | main/vlan/vlan.pre-up | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/main/vlan/vlan.pre-up b/main/vlan/vlan.pre-up index bdb07fb8ff..f72f7cb666 100644 --- a/main/vlan/vlan.pre-up +++ b/main/vlan/vlan.pre-up @@ -17,11 +17,6 @@ esac RAW_DEVICE="${IF_VLAN_RAW_DEVICE:-${GUESSED_RAW_DEVICE:-}}" VLAN_ID="$(expr ${IF_VLAN_ID:-${GUESSED_VLAN_ID:-0}} + 0 || :)" -device_creation_error() { - echo "Failed to create vlan device $IFACE on device $RAW_DEVICE with tag $VLAN_ID" - exit 1 -} - if ! [ "$VLAN_ID" -gt 0 ]; then echo "VLAN_ID for $IFACE is not set" exit 1 @@ -41,8 +36,12 @@ if ! [ -d /proc/net/vlan ]; then modprobe 8021q fi -trap "device_creation_error" ERR -ip link set dev "$RAW_DEVICE" up -if [ ! -e "/proc/net/vlan/${IFACE}" ]; then +if ! [ -e /sys/class/net/$IFACE ]; then + ip link set dev "$RAW_DEVICE" up ip link add link "$RAW_DEVICE" name "$IFACE" type vlan id "$VLAN_ID" fi + +if ! ip link show "$IFACE" >/dev/null; then + echo "Failed to create vlan device $IFACE on device $RAW_DEVICE with tag $VLAN_ID" + exit 1 +fi |