Browse Source

net/wireguard: wg-quick: freebsd: workaround SIOCGIFSTATUS race in FreeBSD kernel

master
Bernhard Fröhlich 2 months ago
parent
commit
f4454f5c1d
Signed by: Bernhard Froehlich <decke@bluelife.at> GPG Key ID: 4DD88C3F9F3B8333

+ 1
- 0
net/wireguard/Makefile View File

@@ -2,6 +2,7 @@
2 2
 
3 3
 PORTNAME=	wireguard
4 4
 PORTVERSION=	0.0.20190406
5
+PORTREVISION=	1
5 6
 CATEGORIES=	net
6 7
 MASTER_SITES=	https://git.zx2c4.com/WireGuard/snapshot/
7 8
 DISTNAME=	WireGuard-${PORTVERSION}

+ 31
- 0
net/wireguard/files/patch-69ffe5b7f58ce6f55dda2b9e13ff364a0d9b3dcd View File

@@ -0,0 +1,31 @@
1
+From 69ffe5b7f58ce6f55dda2b9e13ff364a0d9b3dcd Mon Sep 17 00:00:00 2001
2
+From: "Jason A. Donenfeld" <Jason@zx2c4.com>
3
+Date: Sun, 21 Apr 2019 10:11:36 +0900
4
+Subject: wg-quick: freebsd: workaround SIOCGIFSTATUS race in FreeBSD kernel
5
+
6
+---
7
+ src/tools/wg-quick/freebsd.bash | 8 +++++++-
8
+ 1 file changed, 7 insertions(+), 1 deletion(-)
9
+
10
+diff --git a/src/tools/wg-quick/freebsd.bash b/src/tools/wg-quick/freebsd.bash
11
+index 9d3a4026..a1a80d36 100755
12
+--- wg-quick/freebsd.bash
13
++++ wg-quick/freebsd.bash
14
+@@ -274,7 +274,13 @@ monitor_daemon() {
15
+ 	# endpoints change.
16
+ 	while read -r event; do
17
+ 		[[ $event == RTM_* ]] || continue
18
+-		ifconfig "$INTERFACE" >/dev/null 2>&1 || break
19
++		# The goal is simply to determine whether or not the interface exists. The
20
++		# straight-forward way of doing this would be `ifconfig $INTERFACE`, but this
21
++		# invokes the SIOCGIFSTATUS ioctl, which races with interface shutdown inside
22
++		# the tun driver, resulting in a kernel panic. So we work around it the stupid
23
++		# way by using the one utility that appears to call if_nametoindex fairly early
24
++		# and fails if it doesn't exist: `arp`.
25
++		arp -i "$INTERFACE" -a -n >/dev/null 2>&1 || break
26
+ 		[[ $AUTO_ROUTE4 -eq 1 || $AUTO_ROUTE6 -eq 1 ]] && set_endpoint_direct_route
27
+ 		# TODO: set the mtu as well, but only if up
28
+ 	done < <(route -n monitor)) & disown
29
+-- 
30
+cgit v1.2.1-20-gc37e
31
+

Loading…
Cancel
Save