opnsense / ports

OPNsense ports on top of FreeBSD
https://opnsense.org/
Other
157 stars 112 forks source link

Wireguard-Interfaces may not come up at Boot-Time #171

Closed cocker-cc closed 8 months ago

cocker-cc commented 1 year ago

Wireguard-Interfaces may not come up at Boot-Time, as the WAN-Interface may not be ready yet.
Working Solution, tested on OpnSense:

diff --git a/net/wireguard-tools/files/wireguard_wgquick.in b/net/wireguard-tools/files/wireguard_wgquick.in
index c6680e08c5e..1669676e097 100644
--- a/net/wireguard-tools/files/wireguard_wgquick.in
+++ b/net/wireguard-tools/files/wireguard_wgquick.in
@@ -29,7 +29,12 @@ wireguard_start()
        ${wireguard_env:+eval export $wireguard_env}

        for interface in ${wireguard_interfaces}; do
-               %%PREFIX%%/bin/wg-quick up ${interface}
+               # wait in Background for Interface to show up
+               # this may take a While as WAN may not yet be ready
+               while ! %%PREFIX%%/bin/wg show ${interface} >/dev/null 2>&1; do
+                       %%PREFIX%%/bin/wg-quick up ${interface}
+                       /bin/sleep 1
+               done &
        done
 }

Feel free to use this Patch. Contribution-Policy is too cumbersome for me.

fichtner commented 1 year ago

Might be suitable for FreeBSD ports, but we can't hold this patch. Leaving open for now, but don't expect any progress.

fichtner commented 8 months ago

Otherwise fixed nowadays.