net/wireguard: rearrange post-start duties #3206

This commit is contained in:
Franco Fichtner
2022-12-03 14:37:46 +01:00
parent 544936f451
commit 3d4205c74c
5 changed files with 15 additions and 14 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
PLUGIN_NAME= wireguard
PLUGIN_VERSION= 1.13
PLUGIN_REVISION= 2
PLUGIN_REVISION= 3
PLUGIN_COMMENT= WireGuard VPN service
PLUGIN_DEPENDS= wireguard-tools
PLUGIN_MAINTAINER= m.muenz@gmail.com
@@ -1,7 +1,4 @@
#!/bin/sh
# start again to fix problems with failed name resolution (no need to restart)
/usr/local/etc/rc.d/wireguard start
# reconfigure routing for wireguard
/usr/local/etc/rc.routing_configure
configctl -dq wireguard start
@@ -0,0 +1,11 @@
#!/bin/sh
if [ -f /etc/rc.conf.d/wireguard ]; then
. /etc/rc.conf.d/wireguard
fi
for interface in ${wireguard_interfaces}; do
ifconfig ${interface} group wireguard
done
/usr/local/etc/rc.routing_configure
@@ -1,5 +1,5 @@
[start]
command:/usr/local/etc/rc.d/wireguard start; /usr/local/etc/rc.routing_configure
command:/usr/local/etc/rc.d/wireguard start; /usr/local/opnsense/scripts/OPNsense/Wireguard/post.sh
parameters:
type:script
message:Starting WireGuard
@@ -11,7 +11,7 @@ type:script
message:Stopping WireGuard
[restart]
command:/usr/local/etc/rc.d/wireguard restart; /usr/local/etc/rc.routing_configure
command:/usr/local/etc/rc.d/wireguard restart; /usr/local/opnsense/scripts/OPNsense/Wireguard/post.sh
parameters:
type:script
message:Restarting WireGuard
@@ -10,13 +10,6 @@ wireguard_enable="YES"
{% endfor %}
{% endif %}
wireguard_interfaces="{{ activeservers | join(' ') }}"
start_postcmd=opnsense_postcmd
opnsense_postcmd()
{
for interface in ${wireguard_interfaces}; do
ifconfig ${interface} group wireguard
done
}
{% else %}
wireguard_enable="NO"
{% endif %}