[systemd-devel] How to get a useful peer address when doing accept(3, ...) on a systemd supplied listening socket

Klaus Ebbe Grue grue at di.ku.dk
Thu Oct 27 13:14:33 UTC 2022


Hi Mantas


> I have a feeling it "changes" because you're trying to give the whole
> struct sockaddr to inet_pton() instead of giving just the .sin6_addr field,
> so your program is trying to interpret the *port number*
> (i.e. the .sin6_port which precedes .sin_addr) as part of the address...

That was exactly my mistake! Thanks.

At some point in my hopeless odyssey down a wrong track I tried giving the whole struct to inet_ntop() and forgot to change it back when I got everything else to work.

Thanks for your help and sorry for the inconvenience.

Cheers,
Klaus

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20221027/996f2e47/attachment.htm>


More information about the systemd-devel mailing list