Skip to content

Commit

Permalink
[NETFILTER]: nfnetlink_log: fix byteorder confusion
Browse files Browse the repository at this point in the history
flags is a u16, so use htons instead of htonl. Also avoid double
conversion.

Noticed by Alexey Dobriyan <adobriyan@gmail.com>

Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Patrick McHardy authored and David S. Miller committed May 19, 2006
1 parent 2c8ac66 commit ee43353
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions net/netfilter/nfnetlink_log.c
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ static int
nfulnl_set_flags(struct nfulnl_instance *inst, u_int16_t flags)
{
spin_lock_bh(&inst->lock);
inst->flags = ntohs(flags);
inst->flags = flags;
spin_unlock_bh(&inst->lock);

return 0;
Expand Down Expand Up @@ -902,7 +902,7 @@ nfulnl_recv_config(struct sock *ctnl, struct sk_buff *skb,
if (nfula[NFULA_CFG_FLAGS-1]) {
u_int16_t flags =
*(u_int16_t *)NFA_DATA(nfula[NFULA_CFG_FLAGS-1]);
nfulnl_set_flags(inst, ntohl(flags));
nfulnl_set_flags(inst, ntohs(flags));
}

out_put:
Expand Down

0 comments on commit ee43353

Please sign in to comment.