]> granicus.if.org Git - strace/blobdiff - netlink_netfilter.c
nlattr: add UID/GID netlink attribute decoders
[strace] / netlink_netfilter.c
index eb361ed77ffa495d35788dbb52d3ee34f5716b85..1d59ae33a7d87b8558908a3466b00bb00f5f47d8 100644 (file)
@@ -31,6 +31,7 @@
 #ifdef HAVE_LINUX_NETFILTER_NFNETLINK_H
 
 # include "print_fields.h"
+# include "nlattr.h"
 
 # include <netinet/in.h>
 # include <arpa/inet.h>
@@ -80,8 +81,14 @@ decode_netlink_netfilter(struct tcb *const tcp,
                const size_t offset = NLMSG_ALIGN(sizeof(nfmsg));
                if (len > offset) {
                        tprints(", ");
-                       printstr_ex(tcp, addr + offset,
-                                   len - offset, QUOTE_FORCE_HEX);
+                       if ((nlmsghdr->nlmsg_type >= NFNL_MSG_BATCH_BEGIN
+                            && nlmsghdr->nlmsg_type <= NFNL_MSG_BATCH_END)
+                           || nlmsghdr->nlmsg_type < NLMSG_MIN_TYPE)
+                               printstr_ex(tcp, addr + offset,
+                                           len - offset, QUOTE_FORCE_HEX);
+                       else
+                               decode_nlattr(tcp, addr + offset, len - offset,
+                                             NULL, NULL, NULL, 0, NULL);
                }
        }