Skip to content

Commit

Permalink
[NETFILTER]: Use correct byteorder in ICMP NAT
Browse files Browse the repository at this point in the history
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 Jul 22, 2005
1 parent 21f930e commit 74bb421
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions net/ipv4/netfilter/ip_nat_proto_icmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,17 @@ icmp_unique_tuple(struct ip_conntrack_tuple *tuple,
const struct ip_conntrack *conntrack)
{
static u_int16_t id;
unsigned int range_size
= (unsigned int)range->max.icmp.id - range->min.icmp.id + 1;
unsigned int range_size;
unsigned int i;

range_size = ntohs(range->max.icmp.id) - ntohs(range->min.icmp.id) + 1;
/* If no range specified... */
if (!(range->flags & IP_NAT_RANGE_PROTO_SPECIFIED))
range_size = 0xFFFF;

for (i = 0; i < range_size; i++, id++) {
tuple->src.u.icmp.id = range->min.icmp.id + (id % range_size);
tuple->src.u.icmp.id = htons(ntohs(range->min.icmp.id) +
(id % range_size));
if (!ip_nat_used_tuple(tuple, conntrack))
return 1;
}
Expand Down

0 comments on commit 74bb421

Please sign in to comment.