]> granicus.if.org Git - strace/blobdiff - netlink_inet_diag.c
Remove linux/ptp_clock.h
[strace] / netlink_inet_diag.c
index eb216f588665aa79d24d6550a21b8d9796d3a074..cffe3f5a22f9d773391c7d8e5c173d6c3f72fcf8 100644 (file)
@@ -58,42 +58,6 @@ print_inet_diag_sockid(const struct inet_diag_sockid *id, const uint8_t family)
        tprints("}");
 }
 
-static void
-decode_inet_addr(struct tcb *const tcp,
-                const kernel_ulong_t addr,
-                const unsigned int len,
-                const int family)
-{
-       union {
-               struct in_addr  a4;
-               struct in6_addr a6;
-       } addrbuf;
-       size_t size = 0;
-
-       switch (family) {
-       case AF_INET:
-               size = sizeof(addrbuf.a4);
-               break;
-       case AF_INET6:
-               size = sizeof(addrbuf.a6);
-               break;
-       }
-
-       if (!size || len < size) {
-               tprints("addr=");
-               printstr_ex(tcp, addr, len, QUOTE_FORCE_HEX);
-               return;
-       }
-
-       if (umoven(tcp, addr, size, &addrbuf) < 0) {
-               tprints("addr=");
-               printaddr(addr);
-               return;
-       }
-
-       print_inet_addr(family, &addrbuf, size, "addr");
-}
-
 static void
 decode_inet_diag_hostcond(struct tcb *const tcp,
                          const kernel_ulong_t addr,
@@ -115,7 +79,7 @@ decode_inet_diag_hostcond(struct tcb *const tcp,
        if (len > sizeof(cond)) {
                tprints(", ");
                decode_inet_addr(tcp, addr + sizeof(cond),
-                                len - sizeof(cond), cond.family);
+                                len - sizeof(cond), cond.family, "addr");
        }
        tprints("}");
 }
@@ -255,7 +219,7 @@ decode_inet_diag_req_compat(struct tcb *const tcp,
                tprints("...");
        tprints("}");
 
-       offset = NLA_ALIGN(sizeof(req));
+       offset = NLMSG_ALIGN(sizeof(req));
        if (decode_nla && len > offset) {
                tprints(", ");
                decode_nlattr(tcp, addr + offset, len - offset,
@@ -297,7 +261,7 @@ decode_inet_diag_req_v2(struct tcb *const tcp,
                tprints("...");
        tprints("}");
 
-       offset = NLA_ALIGN(sizeof(req));
+       offset = NLMSG_ALIGN(sizeof(req));
        if (decode_nla && len > offset) {
                tprints(", ");
                decode_nlattr(tcp, addr + offset, len - offset,
@@ -424,7 +388,8 @@ static const nla_decoder_t inet_diag_msg_nla_decoders[] = {
        [INET_DIAG_PEERS]       = NULL,                 /* unimplemented */
        [INET_DIAG_PAD]         = NULL,
        [INET_DIAG_MARK]        = decode_nla_u32,
-       [INET_DIAG_BBRINFO]     = decode_tcp_bbr_info
+       [INET_DIAG_BBRINFO]     = decode_tcp_bbr_info,
+       [INET_DIAG_CLASS_ID]    = decode_nla_u32
 };
 
 DECL_NETLINK_DIAG_DECODER(decode_inet_diag_msg)
@@ -456,7 +421,7 @@ DECL_NETLINK_DIAG_DECODER(decode_inet_diag_msg)
                tprints("...");
        tprints("}");
 
-       offset = NLA_ALIGN(sizeof(msg));
+       offset = NLMSG_ALIGN(sizeof(msg));
        if (decode_nla && len > offset) {
                tprints(", ");
                decode_nlattr(tcp, addr + offset, len - offset,