]> granicus.if.org Git - strace/commit
Use the protocol name of a socket as a hint for peer address resolution
authorMasatake YAMATO <yamato@redhat.com>
Wed, 10 Dec 2014 03:55:06 +0000 (12:55 +0900)
committerDmitry V. Levin <ldv@altlinux.org>
Tue, 16 Dec 2014 04:08:20 +0000 (04:08 +0000)
commitf605e92365c7479d59ccfac3a294089f89359715
tree84d2d6ee0877506df49648ec8d072555cb98feeb
parent530bed0ca8285188ce6cbc9406e817da0ef4828b
Use the protocol name of a socket as a hint for peer address resolution

To resolve the peer address of socket, all combinations of families
(AF_INET, AF_INET6) and protocols(IPPROTO_TCP, IPPROTO_UDP) were tried.
This change utilizes the protocol name obtained via getxattr to specify
the right combination.

* socketutils.c (inet_print): New helper function.
(print_sockaddr_by_inode): Use it.  Utilize the protocol name
associated with the given inode for resolving the peer socket
address.  If the protocol name is NULL, resolve the address
by trying combinations of families and protocols as before.
* defs.h (print_sockaddr_by_inode): Update prototype.
* util.c (printfd): Pass the protocol name associated with
the given path to print_sockaddr_by_inode as the 2nd argument.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
defs.h
socketutils.c
util.c