[ntp:questions] Pool returns IPv6 address to IPv4 query

Rob nomail at example.com
Thu Nov 21 10:10:05 UTC 2013

Uwe Klein <uwe at klein-habertwedt.de> wrote:
>> However, what I don't understand is why an IPv6 address does not fit
>> into a struct sockaddr, and why this fact is so badly documented.
>> It took me a lot of time to find why my queried IPv6 addresses were
>> truncated.
> struct sockaddr was a catch all and you had to also hand the size of the
> storage  into the call.
> forex:
>         int getpeername(int s, struct sockaddr *name, socklen_t *namelen);

Yes, that is what I mean.  But it no longer works.

You need to jump through different hoops now, and the man page will
tell you *nothing* about that.  Neither will the abundant examples on
the net.  You will need to bump into exactly the right comment on an
obscure forum (as it is today...) to know about sockaddr_storage, and
even then it is unclear how you should use that in your code.

More information about the questions mailing list