mirror of
https://github.com/fosrl/olm.git
synced 2026-03-09 07:13:10 -05:00
Olm fails to establish direct connection due to UDP port conflict during NAT holepunching on macOS #8
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @danohn on GitHub (Aug 29, 2025).
Description
When using the
--holepunchflag on macOS, olm frequently fails to establish a direct peer-to-peer connection and falls back to relay mode due to a race condition between the holepunch goroutine and WireGuard device initialization.Current Behavior
Unable to update bind: listen udp4 :55704: bind: address already in useExpected Behavior
WireGuard should successfully bind to the port after holepunching completes, enabling direct peer-to-peer connectivity without relay.
Root Cause
There's insufficient delay between
close(stopHolepunch)and WireGuard'sdev.Up()call. The current 10ms delay is not enough for macOS to release the UDP port, causing WireGuard to fail when attempting to bind.Logs
Environment
--holepunchflagSolution
Increase the delay after closing the holepunch channel from 10ms to 500ms to ensure the OS has released the port before WireGuard attempts to bind.
Reproduction Steps
sudo -E olm --holepunchon macOSImpact
@oschwartz10612 commented on GitHub (Oct 1, 2025):
I think fixed in #17?