]> git.ipfire.org Git - thirdparty/libnftnl.git/commitdiff
trace: use get_u32 to parse NFPROTO and POLICY attribute
authorLiping Zhang <liping.zhang@spreadtrum.com>
Fri, 2 Sep 2016 12:51:26 +0000 (20:51 +0800)
committerFlorian Westphal <fw@strlen.de>
Fri, 2 Sep 2016 13:02:57 +0000 (15:02 +0200)
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>
Signed-off-by: Florian Westphal <fw@strlen.de>
src/trace.c

index 2b3388d985a12c914bb4678711b2a98d0ab7c284..bd05d3c58d2fa0c439a135562ac87060d0ec1d53 100644 (file)
@@ -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);
        }