Skip to contentSkip to conversation

netfilter: nf_tables_trace: fix endiness when dump chain policy

PATCH Applied Liping Zhang 3 participants 3 messages Sep 2, 2016 – Sep 5, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 netfilter: nf_tables_trace: fix endiness when dump chain policy

From: Liping Zhang <[email protected]>

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.

---
 net/netfilter/nf_tables_trace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/netfilter/nf_tables_trace.c +1 -1
index 39eb1cc..fa24a5b 100644
@@ -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;
 	}
Signature · 1 line
2.5.5
maintainer
#1 lore raw
Quoted 5 lines · Liping Zhang

From: Liping Zhang <[email protected]>

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.

It is however handled as u16, not u32. Care to send a patch for this as well? Thanks!