I want to extend socketsnoop.d with local/remote addresses to identify also another side of socketpair. For AF_INET and AF_INET6 families everything is easy, sonode.so_[lf]addr.soa_sa are struct sockaddr_in/sockaddr_in6 in probes fbt:sockfs:socktpi_write:entry, fbt:sockfs:socktpi_read:entry. But for AF_UNIX it seems not so easy to get some unique identification for sender/reciver pairs. In general, I want to see something like: pid1 writes n bytes to uniq1 for uniq2 pid2 reads n bytes from uniq2 came from uniq1 What can I use as uniq1/uniq2 for AF_UNIX sockets when I have only vnode/sonode from one side (sender or reciver)? This message posted from opensolaris.org
> I want to extend socketsnoop.d with local/remote addresses to identify also another side of socketpair. > > For AF_INET and AF_INET6 families everything is easy, sonode.so_[lf]addr.soa_sa are struct sockaddr_in/sockaddr_in6 in probes fbt:sockfs:socktpi_write:entry, fbt:sockfs:socktpi_read:entry. But for AF_UNIX it seems not so easy to get some unique identification for sender/reciver pairs. > > In general, I want to see something like: > pid1 writes n bytes to uniq1 for uniq2 > pid2 reads n bytes from uniq2 came from uniq1 > > What can I use as uniq1/uniq2 for AF_UNIX sockets when I have only vnode/sonode from one side (sender or reciver)?After the socket bind is complete, the unix address for the client side should have value soua_magic equal to SOU_MAGIC_IMPLICIT and soua_vp set to a unique number identifying connection. For the listener, soua_magic is set to the SOU_MAGIC_EXPLICIT and soua_vp points to the vnode pointing to the socket file in the file system. - Alexander Kolbasov
I would not ask if it would be so easy. I guess even sonode pointer is a good uniq number. But how can I get sonode of reciver in socktpi_write and sonode of sender in socktpi_read? This is a result of comunication between sockets created by socketpair: PID DIR SONODE sonode->so_ux_laddr.soua_vp sonode->so_ux_faddr.soua_vp 5528 W 0x30005dd5c88 0x130 0 5527 R 0x30005dd4f08 0x12f 0 5527 R 0x30005dd4f08 0x12f 0 This message posted from opensolaris.org
> I would not ask if it would be so easy. I guess even sonode pointer is a good uniq number. But how can I get sonode of reciver in socktpi_write and sonode of sender in socktpi_read? > > This is a result of comunication between sockets created by socketpair: > > PID DIR SONODE sonode->so_ux_laddr.soua_vp sonode->so_ux_faddr.soua_vp > 5528 W 0x30005dd5c88 0x130 0 > 5527 R 0x30005dd4f08 0x12f 0 > 5527 R 0x30005dd4f08 0x12f 0 > This message posted from opensolaris.org > _______________________________________________The peer address for a socket is placed at so->so_faddr_sa field. Can you use that to uniquely identify the peer? - Alexander Kolbasov