IP and port associated with a socket fd

Mike Frysinger vapier at gentoo.org
Wed Aug 6 03:58:35 UTC 2014


On Wed 06 Aug 2014 12:31:36 Masatake YAMATO wrote:
> > On Tue 05 Aug 2014 09:24:04 Zubin Mithra wrote:
> >> 2. Currently, the ip and port associated with a file descriptor is
> >> obtained in a similar way as netstat does it(print_remote_ipport of
> >> the patch corresponds to tcp_do_one in netstat;
> > 
> > i don't think we want to use that model.  the /proc net filesystem is
> > known to have limitations.  instead i think we should do what iproute2's
> > ss tool does -- use netlink sockets.
> 
> I strongly agree with Mike.
> 
> I inspected this area once. netlink is promised for this kind of
> purpose:
> 
> 	http://www.spinics.net/lists/netdev/msg265315.html
> 
> About unix socket, with netlink, you can know the peer procss for a
> given socket. unix socket is not in the scope of the patch, but it is
> wonderful if strace can attach the peer procss automatically (like -f
> option).

showing remote peers would indeed be awesome

> A problem is that many libraries wrapping netlink interface are
> distributed under term of GPL or LGPL. I'm not sure the code using the
> library is acceptable to strace project. If not acceptable, you have
> to decode the packet of netlink by yourself.

libnl is LGPL, so linking against it optionally should be OK (strace would 
still be BSD).  since it's actively developed and commonly used (by wireless 
tools), i'd start there.

not sure if Dmitry has an opinion ...
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20140805/9ef0aa09/attachment.bin>


More information about the Strace-devel mailing list