Update strace to 4.18.
Noteworthy changes in release 4.18 (2017-07-05)
===============================================
* Improvements
* Implemented decoding of SCM_TIMESTAMP* control messages.
* Implemented decoding of netlink NLMSG_DONE messages.
* Implemented decoding of netlink generic nlmsg_type and nlmsg_flags.
* Implemented decoding of NETLINK_AUDIT, NETLINK_NETFILTER, NETLINK_ROUTE,
NETLINK_SELINUX, NETLINK_SOCK_DIAG, and NETLINK_XFRM message types.
* Implemented decoding of NETLINK_GENERIC protocol families.
* Implemented basic protocol specific decoding of AF_INET, AF_INET6,
AF_NETLINK, AF_PACKET, AF_SMC, and AF_UNIX messages of NETLINK_SOCK_DIAG.
* Implemented basic decoding of netlink attributes.
* Implemented basic protocol specific decoding of AF_INET, AF_NETLINK,
AF_PACKET, AF_SMC, and AF_UNIX netlink attributes of NETLINK_SOCK_DIAG.
* Implemented decoding of inet_diag_msg, netlink_diag_msg, and unix_diag_msg
netlink attributes of NETLINK_SOCK_DIAG.
* Updated lists of ARPHRD_*, KEYCTL_*, NDIAG_SHOW_*, RTM_*, SCM_*, SCTP_*,
SO_*, V4L2_*, and prctl ARCH_* constants.
* Updated lists of ioctl commands from Linux 4.12.
* Bug fixes
* In interactive mode (-I2), those signals that were blocked at startup
will remain blocked for the whole period of strace execution.
* strace no longer resets SIGCHLD handler in tracees to the default action.
* When traced command is terminated by a blocked signal, strace unblocks
that signal to ensure its own termination with the same signal.
* Fixed corner cases in decoding of old sigaction syscall.
* Fixed build with old kernel headers on mips.
* Fixed build on aarch64 and tile with glibc >= 2.26.
* Fixed build on arc and nios2.
Bug: N/A
Test: strace date
Change-Id: Ib34873ff60824b04f67332380c3460721f66002e
diff --git a/sockaddr.c b/sockaddr.c
index 174108c..bfbe585 100644
--- a/sockaddr.c
+++ b/sockaddr.c
@@ -35,7 +35,7 @@
#include <netinet/in.h>
#include <arpa/inet.h>
-#include <linux/netlink.h>
+#include "netlink.h"
#include <linux/if_packet.h>
#include <linux/if_arp.h>
#include <linux/if_ether.h>
@@ -81,6 +81,34 @@
}
}
+bool
+print_inet_addr(const int af,
+ const void *const addr,
+ const unsigned int len,
+ const char *const var_name)
+{
+ const char *af_name = NULL;
+ char buf[INET6_ADDRSTRLEN];
+
+ switch (af) {
+ case AF_INET:
+ af_name = "AF_INET";
+ break;
+ case AF_INET6:
+ af_name = "AF_INET6";
+ break;
+ }
+
+ if (af_name && inet_ntop(af, addr, buf, sizeof(buf))) {
+ tprintf("inet_pton(%s, \"%s\", &%s)", af_name, buf, var_name);
+ return true;
+ } else {
+ tprintf("%s=", var_name);
+ print_quoted_string(addr, len, 0);
+ return false;
+ }
+}
+
static void
print_sockaddr_data_in(const void *const buf, const int addrlen)
{
@@ -97,13 +125,10 @@
{
const struct sockaddr_in6 *const sa_in6 = buf;
- char string_addr[100];
- inet_ntop(AF_INET6, &sa_in6->sin6_addr,
- string_addr, sizeof(string_addr));
- tprintf("sin6_port=htons(%u), inet_pton(AF_INET6"
- ", \"%s\", &sin6_addr), sin6_flowinfo=htonl(%u)",
- ntohs(sa_in6->sin6_port), string_addr,
- ntohl(sa_in6->sin6_flowinfo));
+ tprintf("sin6_port=htons(%u), ", ntohs(sa_in6->sin6_port));
+ print_inet_addr(AF_INET6, &sa_in6->sin6_addr,
+ sizeof(sa_in6->sin6_addr), "sin6_addr");
+ tprintf(", sin6_flowinfo=htonl(%u)", ntohl(sa_in6->sin6_flowinfo));
if (addrlen <= (int) SIN6_MIN_LEN)
return;