aboutsummaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorAndrey Volkov <volkov.am@ekb-info.ru>2021-09-28 18:43:52 +0500
committerAndrey Volkov <volkov@ekb-info.ru>2024-05-24 10:51:59 +0500
commit9ef4fb84a7c1848c067f89f5510f448fb04c5c7a (patch)
tree4d57216650c7b4f758d455115018d1ff357e94b6 /net
parentAdd missing wireguard_depend program (diff)
downloadnetifrc-9ef4fb84a7c1848c067f89f5510f448fb04c5c7a.tar.gz
netifrc-9ef4fb84a7c1848c067f89f5510f448fb04c5c7a.tar.bz2
netifrc-9ef4fb84a7c1848c067f89f5510f448fb04c5c7a.zip
Add type_${IFVAR}=wireguard for arbitrary wireguard interface names
Signed-off-by: Andrey Volkov <volkov@ekb-info.ru>
Diffstat (limited to 'net')
-rw-r--r--net/wireguard.sh11
1 files changed, 9 insertions, 2 deletions
diff --git a/net/wireguard.sh b/net/wireguard.sh
index 301836d..269c8f0 100644
--- a/net/wireguard.sh
+++ b/net/wireguard.sh
@@ -9,9 +9,15 @@ wireguard_depend()
before interface
}
+_is_wireguard() {
+ is_interface_type wireguard
+}
+
wireguard_pre_start()
{
- [ "${IFACE#wg}" != "$IFACE" ] || return 0
+ local wireguard=
+ eval wireguard=\$type_${IFVAR}
+ [ "${wireguard}" = "wireguard" -o "${IFACE#wg}" != "$IFACE" ] || return 0
ip link delete dev "$IFACE" type wireguard 2>/dev/null
ebegin "Creating WireGuard interface $IFACE"
@@ -35,6 +41,7 @@ wireguard_pre_start()
e=$?
if [ $e -eq 0 ]; then
eend $e
+ set_interface_type wireguard
return $e
fi
fi
@@ -45,7 +52,7 @@ wireguard_pre_start()
wireguard_post_stop()
{
- [ "${IFACE#wg}" != "$IFACE" ] || return 0
+ _is_wireguard || [ "${IFACE#wg}" != "$IFACE" ] || return 0
ebegin "Removing WireGuard interface $IFACE"
ip link delete dev "$IFACE" type wireguard