diff mbox

netfilter: nft: fix endianness in dump function

Message ID 1386834719-29204-2-git-send-email-eric@regit.org
State Accepted
Headers show

Commit Message

Eric Leblond Dec. 12, 2013, 7:51 a.m. UTC
The dump function in nft_reject_ipv4 was not converting a u32
field to network order before sending it to userspace.

Signed-off-by: Eric Leblond <eric@regit.org>
---
 net/ipv4/netfilter/nft_reject_ipv4.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Pablo Neira Ayuso Dec. 12, 2013, 8:41 a.m. UTC | #1
On Thu, Dec 12, 2013 at 08:51:59AM +0100, Eric Leblond wrote:
> 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.
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/net/ipv4/netfilter/nft_reject_ipv4.c b/net/ipv4/netfilter/nft_reject_ipv4.c
index fff5ba1..4a5e94a 100644
--- a/net/ipv4/netfilter/nft_reject_ipv4.c
+++ b/net/ipv4/netfilter/nft_reject_ipv4.c
@@ -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) {