You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This crate uses ntoh (network byte order to host byte order) when picking out the sin6_flowinfo and sin6_scope_id from SOCKADDR_IN6_LH in ptrs_to_socket_addr:
According to the Microsoft documentation these fields should indeed be "network-byte-order (big-endian)". But I don't think their documentation is correct.
Other libraries simply using them as host byte order
You end up with addr1 and addr2 being different. I guess one reason why this has not been discovered earlier is that flowinfo and scope ID very often are zero.
Yes, I did change the implementation of socket_addr_to_ptrs very recently (#39). But the same issue was there before my change. Because before my change that function just casted what the standard library had created, and the standard library does not store these fields as big endian.
The text was updated successfully, but these errors were encountered:
Some very basic testing with sockets in the standard library shows that if I bind to a link local IPv6 address, it does handle the scope_id correctly (it is set to the interface index). That's one reason why I think the standard library does the right thing. But I don't know very much about scope_id at all, and even less about flowinfo. So I could not tell. Mostly noting that miow does it differently from the rest of the ecosystem.
This crate uses
ntoh
(network byte order to host byte order) when picking out thesin6_flowinfo
andsin6_scope_id
fromSOCKADDR_IN6_LH
inptrs_to_socket_addr
:miow/src/net.rs
Lines 554 to 555 in 37225af
According to the Microsoft documentation these fields should indeed be "network-byte-order (big-endian)". But I don't think their documentation is correct.
Other libraries simply using them as host byte order
net2
- https://github.com/deprecrated/net2-rs/blob/77a6eb4d5eb36adc81ee21ab7ffebc62fdf2ab88/src/socket.rs#L131-L136This makes it so that if you call:
You end up with
addr1
andaddr2
being different. I guess one reason why this has not been discovered earlier is that flowinfo and scope ID very often are zero.Yes, I did change the implementation of
socket_addr_to_ptrs
very recently (#39). But the same issue was there before my change. Because before my change that function just casted what the standard library had created, and the standard library does not store these fields as big endian.The text was updated successfully, but these errors were encountered: