top | item 23769679

(no title)

aszlig | 5 years ago

If programs call getsockname() the result is not a sockaddr_un, but instead sockaddr_in(6) is used from the original call to bind(). If the socket was implicitly bound, a random[1] address is generated.

Things are a bit trickier if it gets to getpeername(), since we want to have somewhat stable addresses. This is done by querying SO_PEERCRED and encoding[2] the pid for IPv4 or pid, uid and gid for IPv6 into the address.

In summary: Programs shouldn't get confused, but if they do, it's certainly a bug in ip2unix. Feel free to open an issue :-)

[1]: https://github.com/nixcloud/ip2unix/blob/d7d297ed68cdadc65dc...

[2]: https://github.com/nixcloud/ip2unix/blob/d7d297ed68cdadc65dc...

discuss

order

No comments yet.