Duplicate IP address, and permissions problems on Windows

Daniel Lenski dlenski at gmail.com
Wed Apr 7 23:00:46 UTC 2021

On Tue, Apr 6, 2021 at 5:17 PM Jason A. Donenfeld <Jason at zx2c4.com> wrote:
> It's pretty typical behavior on Windows for IP addresses to be
> exclusive per interface. WireGuard for Windows does something similar:
> https://git.zx2c4.com/wireguard-windows/tree/tunnel/addressconfig.go#n22

Thank you! That's very interesting.

Following David's initial implementation, I wrote something for
OpenConnect that's pretty much the same as yours:

1. Uses GetAdaptersAddresses to list all the addresses
2. If/when it finds a clashing address, it uses
GetUnicastIpAddressTable to determine the up/down state of the other
3. Only delete the address from the other interface if it's non-UP.

I was also annoyed that the GetAdaptersAddresses return structure
doesn't provide the adapter state, and that I had to go for this
convoluted O(n^2) design.

I guess this reassures me that there isn't an obviously-better way to do it.


More information about the WireGuard mailing list