aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2005-07-22 15:51:38 -0400
committerDavid S. Miller <davem@davemloft.net>2005-07-22 15:51:38 -0400
commit74bb421da7f39e70ab636ad46ef85ea1178786c5 (patch)
tree11f2eba01e01f8094f57a1c16c6d454ce7b2430a /net
parent21f930e4abdcb9649f26e5b959c14dddee4e600b (diff)
[NETFILTER]: Use correct byteorder in ICMP NAT
Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/ipv4/netfilter/ip_nat_proto_icmp.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/net/ipv4/netfilter/ip_nat_proto_icmp.c b/net/ipv4/netfilter/ip_nat_proto_icmp.c
index a558cf0eee8a..6596c9ee1655 100644
--- a/net/ipv4/netfilter/ip_nat_proto_icmp.c
+++ b/net/ipv4/netfilter/ip_nat_proto_icmp.c
@@ -35,16 +35,17 @@ icmp_unique_tuple(struct ip_conntrack_tuple *tuple,
35 const struct ip_conntrack *conntrack) 35 const struct ip_conntrack *conntrack)
36{ 36{
37 static u_int16_t id; 37 static u_int16_t id;
38 unsigned int range_size 38 unsigned int range_size;
39 = (unsigned int)range->max.icmp.id - range->min.icmp.id + 1;
40 unsigned int i; 39 unsigned int i;
41 40
41 range_size = ntohs(range->max.icmp.id) - ntohs(range->min.icmp.id) + 1;
42 /* If no range specified... */ 42 /* If no range specified... */
43 if (!(range->flags & IP_NAT_RANGE_PROTO_SPECIFIED)) 43 if (!(range->flags & IP_NAT_RANGE_PROTO_SPECIFIED))
44 range_size = 0xFFFF; 44 range_size = 0xFFFF;
45 45
46 for (i = 0; i < range_size; i++, id++) { 46 for (i = 0; i < range_size; i++, id++) {
47 tuple->src.u.icmp.id = range->min.icmp.id + (id % range_size); 47 tuple->src.u.icmp.id = htons(ntohs(range->min.icmp.id) +
48 (id % range_size));
48 if (!ip_nat_used_tuple(tuple, conntrack)) 49 if (!ip_nat_used_tuple(tuple, conntrack))
49 return 1; 50 return 1;
50 } 51 }