浏览代码

netfilter: nf_tables_trace: fix endiness when dump chain policy

NFTA_TRACE_POLICY attribute is big endian, but we forget to call
htonl to convert it. Fortunately, this attribute is parsed as big
endian in libnftnl.

Signed-off-by: Liping Zhang <liping.zhang@spreadtrum.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Liping Zhang 9 年之前
父节点
当前提交
5210d393ef
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      net/netfilter/nf_tables_trace.c

+ 1 - 1
net/netfilter/nf_tables_trace.c

@@ -237,7 +237,7 @@ void nft_trace_notify(struct nft_traceinfo *info)
 		break;
 	case NFT_TRACETYPE_POLICY:
 		if (nla_put_be32(skb, NFTA_TRACE_POLICY,
-				 info->basechain->policy))
+				 htonl(info->basechain->policy)))
 			goto nla_put_failure;
 		break;
 	}