netfilter: nf_tables_trace: fix endiness when dump chain policy
authorLiping Zhang <liping.zhang@spreadtrum.com>
Fri, 2 Sep 2016 12:49:12 +0000 (20:49 +0800)
committerPablo Neira Ayuso <pablo@netfilter.org>
Mon, 5 Sep 2016 17:28:23 +0000 (19:28 +0200)
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>
net/netfilter/nf_tables_trace.c

index 39eb1cc62e91fdda9608f96eb678f061f7b91a0c..fa24a5b398b1f889817b8873be1aa197bbf179d3 100644 (file)
@@ -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;
        }