[PATCH v4 3/4] nfnetlink: introduce generic netfilter subsystem decoder
Chen Jingpiao
chenjingpiao at gmail.com
Thu Mar 8 14:53:46 UTC 2018
* netlink_netfilter.c: Include "nlattr.h".
(decode_netlink_netfilter): Call decode_nlattr.
---
netlink_netfilter.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/netlink_netfilter.c b/netlink_netfilter.c
index a6028a1e5..b6c68120c 100644
--- a/netlink_netfilter.c
+++ b/netlink_netfilter.c
@@ -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>
@@ -79,8 +80,15 @@ 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
+ || subsys_id >= NFNL_SUBSYS_COUNT)
+ printstr_ex(tcp, addr + offset,
+ len - offset, QUOTE_FORCE_HEX);
+ else
+ decode_nlattr(tcp, addr + offset, len - offset,
+ NULL, NULL, NULL, 0, NULL);
}
}
--
2.16.2.348.g24cec2248.dirty
More information about the Strace-devel
mailing list