GNOME Bugzilla – Bug 762455
gssdp fails at auto-detect network device (does not detect any)
Last modified: 2019-02-22 09:29:34 UTC
gssdp_client_new() fails with the error message "No default route?". I think this is related to some IPv4/IPv6 behavior. In get_host_ip() the call to GetAdaptersAddresses() seems to return devices with IPv6 addresses as primary address only(?). At least further down this check: if (address->Address.lpSockaddr->sa_family != AF_INET) continue; always triggers as sa_family is set AF_INET6. (Tested on a Windows 7 instance) I could quickly get it to work by changing GetAdaptersAddresses() to look for AF_INET instead of AF_UNSPEC. But I have a vague feeling that the correct fix would be something different..
This code used to work on win7, maybe by luck. I think that it additionally has to iterate through all the unicast addresses, not just looking at the first only.
See https://msdn.microsoft.com/de-de/library/windows/desktop/aa366058%28v=vs.85%29.aspx, the "Next" member I currently don't have a working windows build env, if you can cook a patch and test that would be great.
Created attachment 321943 [details] [review] iterate over all addresses and prefixes Here is my attempt from a semi working mingw installation from a virtual machine.. I iterate over all addresses and pick the first AF_INET one. Note that the same seems to be needed for the prefix as well. Again I just iterate over these prefixes and try to find the first AF_INET one. I have no idea on how these addresses are supposed to map to each other though. Looks like I just cross my fingers and hope for the best the match up. Any better way? At least the patch compiles and the resulting code was working on a native Windows 7 machine.
I think the two lists are considered to match and can be iterated in parallel, I have to check that.
Unfortunately, I think they can't. If I remember correctly they were different in my case. For the interface I found my desired AF_INET one after skipping just the first AF_INET6. For the prefix the first two at least (maybe even 3, unsure) were AF_INET6 ones before I found my AF_INET.
I can confirm that this patch works in my Windows 10 MSYS2/MinGW64 environment.