* [PATCH libnftnl] trace: use get_u32 to parse NFPROTO and POLICY attribute
@ 2016-09-02 12:51 Liping Zhang
2016-09-02 13:03 ` Florian Westphal
0 siblings, 1 reply; 2+ messages in thread
From: Liping Zhang @ 2016-09-02 12:51 UTC (permalink / raw)
To: pablo; +Cc: netfilter-devel, Liping Zhang
From: Liping Zhang <liping.zhang@spreadtrum.com>
NFTA_TRACE_NFPROTO and NFTA_TRACE_POLICY attribute is 32-bit
value, so we should use mnl_attr_get_u32 and htonl here.
Signed-off-by: Liping Zhang <liping.zhang@spreadtrum.com>
---
src/trace.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/trace.c b/src/trace.c
index 2b3388d..bd05d3c 100644
--- a/src/trace.c
+++ b/src/trace.c
@@ -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);
}
--
2.5.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-09-02 13:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-02 12:51 [PATCH libnftnl] trace: use get_u32 to parse NFPROTO and POLICY attribute Liping Zhang
2016-09-02 13:03 ` Florian Westphal
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).