[PATCH v4 3/4] nfnetlink: introduce generic netfilter subsystem decoder

Dmitry V. Levin ldv at altlinux.org
Sat Mar 10 00:55:04 UTC 2018


On Thu, Mar 08, 2018 at 10:53:46PM +0800, Chen Jingpiao wrote:
> * 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)

NFNL_MSG_BATCH_BEGIN and NFNL_MSG_BATCH_END were introduced in linux kernel
commit v3.13-rc1~105^2~186^2~2, what if strace is being built with older
kernel headers?

We have fallback definitions for these constants in
xlat/nl_netfilter_msg_types.in, but currently they are not available
in this file.


-- 
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20180310/15bcb0d7/attachment.bin>


More information about the Strace-devel mailing list