tools: macos: broken default interface MTU detection

Florian Uekermann florian at uekermann.me
Sat Sep 13 15:51:25 UTC 2025


On macOS The set_mtu function [1] fails to detect the default interface 
MTU correctly and sets an incorrect MTU as a result.

The issue is that "netstat -nr -f inet" returns in the 4th column, not 
the 5th.

I used macOS 15.4 for testing, but I am not particularly familiar with 
the Apple ecosystem. So I'm not sure if this never worked or if the 
netstat shipped by Apple changed at some point and how/which other 
platforms my be affected. So take the patch below with a grain of salt.

[1] https://git.zx2c4.com/wireguard-tools/tree/src/wg-quick/darwin.bash#n17

diff --git a/src/wg-quick/darwin.bash b/src/wg-quick/darwin.bash
index 1b7fe5e..a1ec54c 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