mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2025-08-05 05:17:07 +02:00
Revert "main/vlan: check if subinterface already exists"
This reverts commit 6073409488
.
Reason: bashism (trap ERR)
This commit is contained in:
parent
1fe4ff55f3
commit
029a17f380
@ -2,7 +2,7 @@
|
||||
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
|
||||
pkgname=vlan
|
||||
pkgver=2.1
|
||||
pkgrel=1
|
||||
pkgrel=2
|
||||
pkgdesc="Scripts for configuring VLAN network interfaces"
|
||||
url="http://wiki.alpinelinux.org/wiki/Vlan"
|
||||
arch="noarch"
|
||||
@ -31,6 +31,6 @@ package() {
|
||||
done
|
||||
}
|
||||
sha512sums="f00c8521830b1472f1e71223943c14446d28f2667f7e2fd3690c8402c7d3f34982bc4d27201b3dc9c1eb9a635e38ea23dee6e044487615cbc68ba519d940c0f7 mvlan.post-down
|
||||
c2154978882b7c73324c32f7b899bf7c0a7f07fd379109d1f770c650e9b2755272598fd7b0e416027d135cc9a17d1a10d94f458effa627bd5f8193adf3d0b385 mvlan.pre-up
|
||||
955ccc68398ed2d515f794d5ef4164fec2dcfc4504e2e29d427c1687c8b9d6ecff1ea7247dc751963bb7be1db5025940fb66efef3fb6287aa19fe014088573ac mvlan.pre-up
|
||||
7a6e74957d2fcfb04023d2cf8246e8889a780171f669ec37a56882276d96fb0219180b37cc51ecd87421bcbd0f0d489602423859a6f5605781f703cf143e5bae vlan.post-down
|
||||
3555e5f5ad3bad5e15d01309880fd4fa3cced63ed7def1c289186f18f1c7d53b67c3d3cc7490e90055b065ede7dc094d381cb0d4ae91ab83e13e4b2e281b2bf7 vlan.pre-up"
|
||||
54af6be8962a19f5cc3781ab6e42046c2017b58adc90464fe9e1aeea0e4151792920588c84285c727e104e3232adf1d79b0b7d5edfdd53a76b02a764af555e37 vlan.pre-up"
|
||||
|
@ -12,11 +12,6 @@ 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
|
||||
@ -27,7 +22,9 @@ if ! ip link show "$RAW_DEVICE" >/dev/null; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! ip link show "$IFACE" >/dev/null 2>&1; then
|
||||
ip link add link "$RAW_DEVICE" name "$IFACE" type macvlan || \
|
||||
device_creation_error
|
||||
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
|
||||
fi
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user