Skip to contentSkip to conversation

nft: reject: fix endianess

PATCH New Eric Leblond 2 participants 3 messages Dec 12, 2013

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

cover nft: reject: fix endianess

Hello,

Here's a small fix for 3.13. I'm not sure it is necessary but getting it in 3.13 will avoid us some possible backward compatibility issues later.

BR,
--
Eric

#1 lore raw

PATCH 1/1 netfilter: nft: fix endianness in dump function

The dump function in nft_reject_ipv4 was not converting a u32 field to network order before sending it to userspace.

---
 net/ipv4/netfilter/nft_reject_ipv4.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv4/netfilter/nft_reject_ipv4.c +1 -1
index fff5ba1..4a5e94a 100644
@@ -72,7 +72,7 @@ static int nft_reject_dump(struct sk_buff *skb, const struct nft_expr *expr)
 {
 	const struct nft_reject *priv = nft_expr_priv(expr);
 
-	if (nla_put_be32(skb, NFTA_REJECT_TYPE, priv->type))
+	if (nla_put_be32(skb, NFTA_REJECT_TYPE, htonl(priv->type)))
 		goto nla_put_failure;
 
 	switch (priv->type) {
Signature · 1 line
1.8.5.1
maintainer Applied
#2 lore raw

Re: [PATCH] netfilter: nft: fix endianness in dump function

Quoted 2 lines · Eric Leblond

The dump function in nft_reject_ipv4 was not converting a u32 field to network order before sending it to userspace.

Good catch. I've been reviewing other but I haven't seen any similar endianess issue.

Applied to the nf tree, thanks Eric.