Skip to contentSkip to conversation

trace: use get_u32 to parse NFPROTO and POLICY attribute

PATCH Applied Liping Zhang 2 participants 2 messages Sep 2, 2016 netfilter

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 trace: use get_u32 to parse NFPROTO and POLICY attribute

From: Liping Zhang <[email protected]>

NFTA_TRACE_NFPROTO and NFTA_TRACE_POLICY attribute is 32-bit value, so we should use mnl_attr_get_u32 and htonl here.

---
 src/trace.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
src/trace.c +2 -2
index 2b3388d..bd05d3c 100644
@@ -408,12 +408,12 @@ int nftnl_trace_nlmsg_parse(const struct nlmsghdr *nlh, struct nftnl_trace *t)
 		t->flags |= (1 << NFTNL_TRACE_TRANSPORT_HEADER);
 
 	if (tb[NFTA_TRACE_NFPROTO]) {
-		t->nfproto = ntohs(mnl_attr_get_u16(tb[NFTA_TRACE_NFPROTO]));
+		t->nfproto = ntohl(mnl_attr_get_u32(tb[NFTA_TRACE_NFPROTO]));
 		t->flags |= (1 << NFTNL_TRACE_NFPROTO);
 	}
 
 	if (tb[NFTA_TRACE_POLICY]) {
-		t->policy = ntohs(mnl_attr_get_u16(tb[NFTA_TRACE_POLICY]));
+		t->policy = ntohl(mnl_attr_get_u32(tb[NFTA_TRACE_POLICY]));
 		t->flags |= (1 << NFTNL_TRACE_POLICY);
 	}
 
Signature · 1 line
2.5.5
maintainer Applied
#1 lore raw
Quoted 4 lines · Liping Zhang

From: Liping Zhang <[email protected]>

NFTA_TRACE_NFPROTO and NFTA_TRACE_POLICY attribute is 32-bit value, so we should use mnl_attr_get_u32 and htonl here.

Applied, thanks.