Re: [PATCH] wg-quick: fix darwin MTU detection

"Jason A. Donenfeld" <[email protected]> Mon, 4 May 2026 13:55:03 +0200
Newsgroups com.zx2c4.lists.wireguard
Message-ID <[email protected]>
Hi Florian,

Sorry I didn't see this. I filtered this out because it wasn't formatted
correctly (explanation below the break, commit subject not matching
other wg-quick commits). Some notes:

On Mon, Oct 20, 2025 at 04:22:55PM +0200, Florian Uekermann wrote:
> 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.

If you're submitting a patch with your name on it, please do the
research to make sure it's correct! Otherwise, what you're submitting is
more of a bug report than a patch.

>  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

Should this be changed for the other invocations of `netstat -nr -f ...`
in the code? It's a bit confusing because in del_route(), it looks like
the first invocation (for inet) is aware that it's the 6th parameter,
while the second invocation (for inet6) seems to stick with this
presumption that it's the 4th. So what's going on here?

Consulting the source from Apple, it looks like the 4th param is indeed
the right one?
https://github.com/apple-oss-distributions/network_cmds/blob/97e27e6244c16d399bfeb254315ddc5828711c56/netstat.tproj/route.c#L328

What circumstances cause this to change? v4 vs v6? Something else?

I'd like to get to the bottom of this before applying this patch. When
you submit a v2, please include your explanation as part of the commit
message.

Thanks,
Jason