UDP sockets not working with IPv6
gschup opened this issue · comments
Currently, the library is completely untested with IPv6 addresses. Theoretically, rusts SocketAddr
should be able to handle both IPv6 and IPv4, but it is unclear if the current setup, especially here, works properly.
I currently have a public IPv6 IP so i decided to test if a P2PSession would work with IPv6. This results in a panic.
[RUST] file '/home/marcello/.cargo/registry/src/github.com-1ecc6299db9ec823/ggrs-0.4.4/src/network/udp_socket.rs' at line 25: panic occurred: "called `Result::unwrap()` on an `Err` value: Os { code: 97, kind: Other, message: \"Address family not supported by protocol\" }"
To reproduce it just give it the following remote player when starting a session (the actual ip is different but it's a valid IPv6 address) [2001:db8:3333:4444:5555:6666:7777:8888]:7070
.
Luckily for me i still have a IPv4 public address as well (idk how but whatever) so i was still able to test a remote session between 2 client from a long distance
Thanks for the report! I kind of expected this to happen, since the udp sockets are bound to 0.0.0.0:port. I think that binding the sockets to [::]:port instead should solve the issue. Hopefully, I can fix this later this week. Would it be okay to ask you to try again afterwards?
Sure man, once i've implemented it into my wrapper i'll try testing it once again.
Just to write an update for interested people: This still is an unresolved issue. If you want a quick fix to get IPv6 communication running, for now I recommend using the trait ggrs::NonBlockingsocket
to write your own IPv6 UDP socket.