aboutsummaryrefslogtreecommitdiffstats
path: root/main/vlan/mvlan.pre-up
diff options
context:
space:
mode:
Diffstat (limited to 'main/vlan/mvlan.pre-up')
-rw-r--r--main/vlan/mvlan.pre-up13
1 files changed, 8 insertions, 5 deletions
diff --git a/main/vlan/mvlan.pre-up b/main/vlan/mvlan.pre-up
index 8c6f67cbfa..ba8cf24b46 100644
--- a/main/vlan/mvlan.pre-up
+++ b/main/vlan/mvlan.pre-up
@@ -12,6 +12,11 @@ esac
RAW_DEVICE="${IF_MVLAN_RAW_DEVICE:-${GUESSED_RAW_DEVICE:-}}"
+device_creation_error() {
+ echo "Failed to create vlan device $IFACE on device $RAW_DEVICE with tag $VLAN_ID"
+ exit 1
+}
+
if [ -z "$RAW_DEVICE" ]; then
echo "RAW_DEVICE for $IFACE is not set"
exit 1
@@ -22,9 +27,7 @@ if ! ip link show "$RAW_DEVICE" >/dev/null; then
exit 1
fi
-ip link add link "$RAW_DEVICE" name "$IFACE" type macvlan
-
-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
+if ! ip link show "$IFACE" >/dev/null 2>&1; then
+ ip link add link "$RAW_DEVICE" name "$IFACE" type macvlan || \
+ device_creation_error
fi