[PATCH] wg-quick: fix darwin MTU detection

Florian Uekermann florian at uekermann.me
Mon Oct 20 14:27:53 UTC 2025


Signed-off-by: Florian Uekermann <florian at uekermann.me>
---
On macOS The set_mtu function fails to detect the default interface correctly and always sets the (potentially incorrect) default MTU as a result.

The problem is that netstat -nr -f inet returns the interface name in the 4th column, not the 6th.

I used macOS 15.4 for testing, but I am not particularly familiar with the Apple ecosystem. I'm not sure if this never worked, the netstat shipped by Apple changed at some point and how/which other platforms (iOS?) may be affected. So please keep that in mind before merging.

 src/wg-quick/darwin.bash | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/wg-quick/darwin.bash b/src/wg-quick/darwin.bash
index 1b7fe5e..0467f0e 100755
--- a/src/wg-quick/darwin.bash
+++ b/src/wg-quick/darwin.bash
@@ -177,7 +177,7 @@ set_mtu() {
 		cmd ifconfig "$REAL_INTERFACE" mtu "$MTU"
 		return
 	fi
-	while read -r destination _ _ _ _ netif _; do
+	while read -r destination _ _ netif _; do
 		if [[ $destination == default ]]; then
 			defaultif="$netif"
 			break
-- 
2.51.0



More information about the WireGuard mailing list