Skip to content
Permalink
Browse files

net/wireguard: wg-quick: freebsd: workaround SIOCGIFSTATUS race in Fr…

…eeBSD kernel
  • Loading branch information...
decke committed Apr 23, 2019
1 parent 64507cc commit 92d48bb5e86d8fdc0584d6ac1a4a449ea2e34462
@@ -1,21 +1,22 @@
From 69ffe5b7f58ce6f55dda2b9e13ff364a0d9b3dcd Mon Sep 17 00:00:00 2001
From 90c546598c0a9d9da82c138c6c9c1396c453368e Mon Sep 17 00:00:00 2001
From: "Jason A. Donenfeld" <Jason@zx2c4.com>
Date: Sun, 21 Apr 2019 10:11:36 +0900
Subject: wg-quick: freebsd: workaround SIOCGIFSTATUS race in FreeBSD kernel

---
src/tools/wg-quick/freebsd.bash | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
src/tools/wg-quick/freebsd.bash | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/tools/wg-quick/freebsd.bash b/src/tools/wg-quick/freebsd.bash
index 9d3a4026..a1a80d36 100755
index 9d3a4026..54a08f7b 100755
--- wg-quick/freebsd.bash
+++ wg-quick/freebsd.bash
@@ -274,7 +274,13 @@ monitor_daemon() {
@@ -274,7 +274,14 @@ monitor_daemon() {
# endpoints change.
while read -r event; do
[[ $event == RTM_* ]] || continue
- ifconfig "$INTERFACE" >/dev/null 2>&1 || break
+ [[ -e /var/run/wireguard/$INTERFACE.sock ]] || break
+ # The goal is simply to determine whether or not the interface exists. The
+ # straight-forward way of doing this would be `ifconfig $INTERFACE`, but this
+ # invokes the SIOCGIFSTATUS ioctl, which races with interface shutdown inside

0 comments on commit 92d48bb

Please sign in to comment.
You can’t perform that action at this time.