vserver 1.9.5.x5
[linux-2.6.git] / net / ipv4 / netfilter / ip_nat_proto_icmp.c
index f7d31f8..a558cf0 100644 (file)
@@ -53,21 +53,23 @@ icmp_unique_tuple(struct ip_conntrack_tuple *tuple,
 
 static int
 icmp_manip_pkt(struct sk_buff **pskb,
-              unsigned int hdroff,
-              const struct ip_conntrack_manip *manip,
+              unsigned int iphdroff,
+              const struct ip_conntrack_tuple *tuple,
               enum ip_nat_manip_type maniptype)
 {
+       struct iphdr *iph = (struct iphdr *)((*pskb)->data + iphdroff);
        struct icmphdr *hdr;
+       unsigned int hdroff = iphdroff + iph->ihl*4;
 
        if (!skb_ip_make_writable(pskb, hdroff + sizeof(*hdr)))
                return 0;
 
-       hdr = (void *)(*pskb)->data + hdroff;
+       hdr = (struct icmphdr *)((*pskb)->data + hdroff);
 
        hdr->checksum = ip_nat_cheat_check(hdr->un.echo.id ^ 0xFFFF,
-                                           manip->u.icmp.id,
+                                           tuple->src.u.icmp.id,
                                            hdr->checksum);
-       hdr->un.echo.id = manip->u.icmp.id;
+       hdr->un.echo.id = tuple->src.u.icmp.id;
        return 1;
 }
 
@@ -104,7 +106,7 @@ icmp_print_range(char *buffer, const struct ip_nat_range *range)
 }
 
 struct ip_nat_protocol ip_nat_protocol_icmp
-= { { NULL, NULL }, "ICMP", IPPROTO_ICMP,
+= { "ICMP", IPPROTO_ICMP,
     icmp_manip_pkt,
     icmp_in_range,
     icmp_unique_tuple,