Commit ee433530 authored by Patrick McHardy's avatar Patrick McHardy Committed by David S. Miller

[NETFILTER]: nfnetlink_log: fix byteorder confusion

flags is a u16, so use htons instead of htonl. Also avoid double
conversion.

Noticed by Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: default avatarPatrick McHardy <kaber@trash.net>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 2c8ac66b
...@@ -321,7 +321,7 @@ static int ...@@ -321,7 +321,7 @@ static int
nfulnl_set_flags(struct nfulnl_instance *inst, u_int16_t flags) nfulnl_set_flags(struct nfulnl_instance *inst, u_int16_t flags)
{ {
spin_lock_bh(&inst->lock); spin_lock_bh(&inst->lock);
inst->flags = ntohs(flags); inst->flags = flags;
spin_unlock_bh(&inst->lock); spin_unlock_bh(&inst->lock);
return 0; return 0;
...@@ -902,7 +902,7 @@ nfulnl_recv_config(struct sock *ctnl, struct sk_buff *skb, ...@@ -902,7 +902,7 @@ nfulnl_recv_config(struct sock *ctnl, struct sk_buff *skb,
if (nfula[NFULA_CFG_FLAGS-1]) { if (nfula[NFULA_CFG_FLAGS-1]) {
u_int16_t flags = u_int16_t flags =
*(u_int16_t *)NFA_DATA(nfula[NFULA_CFG_FLAGS-1]); *(u_int16_t *)NFA_DATA(nfula[NFULA_CFG_FLAGS-1]);
nfulnl_set_flags(inst, ntohl(flags)); nfulnl_set_flags(inst, ntohs(flags));
} }
out_put: out_put:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment