Garbled IPv6 printout
Kurt Roeckx
kurt at roeckx.be
Sat Mar 30 22:06:37 UTC 2019
On Sat, Mar 30, 2019 at 02:35:18PM -0700, Hal Murray via devel wrote:
> I just pushed a fix. It was an interesting quirk. The API for accepet
> includes a pointer and length to a place to put the IP Address of the remote
> site. The type of that place is struct sockaddr. sockaddr is generic,
> presumably big enough for the biggest address format. They botched something,
> I'm not sure what. A sockaddr isn't big enough for an IPv6 address.
A sockaddr is not meant to store the address, it just provides you
with fields that are there for all variants like sockaddr_in,
sockaddr_in6 and sockaddr_un, so that you can at least see which
type of address it is. You should consider using sockaddr_storage.
Kurt
More information about the devel
mailing list