summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhil Sutter <phil@nwl.cc>2018-06-22 14:18:59 +0200
committerFlorian Westphal <fw@strlen.de>2018-06-26 20:19:44 +0200
commit043060b18d27f24fe723e39bc2c9e5f50dde60dd (patch)
treeeb0948442a465f52246672f5a1c28fc032778d2b
parent5d592ce6c4596b25d5779a224d03c096bc25db54 (diff)
expr/exthdr: Fix JSON parsing on big endian
When setting NFTNL_EXPR_EXTHDR_TYPE, one needs to call nftnl_expr_set_u8() and not nftnl_expr_set_u32(). Otherwise 'type' variable is assigned to uint32_t parameter before being passed to nftnl_expr_exthdr_set() as void pointer which casts it to uint8_t. On big endian systems, the latter would only consider the most significant byte instead of the least significant one. Signed-off-by: Phil Sutter <phil@nwl.cc>
-rw-r--r--src/expr/exthdr.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/expr/exthdr.c b/src/expr/exthdr.c
index 75cafbc..a351835 100644
--- a/src/expr/exthdr.c
+++ b/src/expr/exthdr.c
@@ -270,7 +270,7 @@ nftnl_expr_exthdr_json_parse(struct nftnl_expr *e, json_t *root,
type = str2exthdr_type(exthdr_type);
if (type < 0)
return -1;
- nftnl_expr_set_u32(e, NFTNL_EXPR_EXTHDR_TYPE, type);
+ nftnl_expr_set_u8(e, NFTNL_EXPR_EXTHDR_TYPE, type);
}
if (nftnl_jansson_parse_val(root, "offset", NFTNL_TYPE_U32, &uval32,