A customer noticed that UDP reads returned EADDRNOTAVAIL during a link
change while the interface had no IPv4 address. magicsock returned the
error to wireguard-go, which treated it as permanent and shut down the
receive loop.
magicsock now retries the read when EADDRNOTAVAIL is returned on Unix.
Each error is counted in the magicsock_recv_udp_error_unknown metric.
EADDRNOTAVAIL isn't a documented result of a UDP recv. We suspect that
certain macOS network extensions return it while the network interface
is mid-change and has no address. We expect the error to stop once the
interface has an address again. A short delay between retries prevents
magicsock from spinning when the address doesn't come back right away.
Updates #22097
Change-Id: I70790f78d9488999ce00f9685aec3f0fabc15699
Signed-off-by: Nick Beirne <[email protected]>