Author: pluto
Date: Mon Aug  1 10:48:34 2005
New Revision: 6283

Modified:
   netfilter-2.6/patch-o-matic-ng/trunk/net/ipv4/netfilter/ipt_u32.c
   netfilter-2.6/patch-o-matic-ng/trunk/status
Log:
- fix header offset calculation (Giuseppe Della Bianca).


Modified: netfilter-2.6/patch-o-matic-ng/trunk/net/ipv4/netfilter/ipt_u32.c
==============================================================================
--- netfilter-2.6/patch-o-matic-ng/trunk/net/ipv4/netfilter/ipt_u32.c   
(original)
+++ netfilter-2.6/patch-o-matic-ng/trunk/net/ipv4/netfilter/ipt_u32.c   Mon Aug 
 1 10:48:34 2005
@@ -134,21 +134,20 @@
        int nnums, nvals;
        u_int32_t pos, val;
 
+       u_int32_t AttPos;
+
        LOCK_BH(&u32_lock);
 
        head = skb_header_pointer(skb, 0, skb->len, u32_buffer);
        BUG_ON(head == NULL);
 
-       origbase = head + (((void *)skb->nh.iph) - ((void *)skb->head));
-       end = head + (skb->end - skb->head);
-       base = origbase;
-
+       base = head;
        /* unsigned long long cycles1, cycles2, cycles3, cycles4;
           cycles1 = get_cycles(); */
        for (testind=0; testind < data->ntests; testind++) {
-               base = origbase; /* reset for each test */
+               AttPos = 0;
                pos = data->tests[testind].location[0].number;
-               if (base+pos+3 > end || base+pos < head) {
+               if (AttPos + pos + 3 > skb->len || AttPos + pos < 0){
                        UNLOCK_BH(&u32_lock);
                        return 0;
                }
@@ -168,12 +167,15 @@
                                val = val >> number; 
                                break;
                        case IPT_U32_AT:
-                               base = base + val;
+                               AttPos += val;
                                pos = number;
-                               if (base+pos+3 > end || base+pos < head) 
+                               if (AttPos + pos + 3 > skb->len || AttPos + pos 
< 0) 
                                        return 0;
-                               val = (base[pos]<<24) + (base[pos+1]<<16) +
-                                       (base[pos+2]<<8) + base[pos+3];
+
+                               val = (base[AttPos + pos]<<24) 
+                                    +(base[AttPos + pos + 1]<<16)
+                                    +(base[AttPos + pos + 2]<<8) 
+                                    + base[AttPos + pos + 3];
                                break;
                        }
                }

Modified: netfilter-2.6/patch-o-matic-ng/trunk/status
==============================================================================
--- netfilter-2.6/patch-o-matic-ng/trunk/status (original)
+++ netfilter-2.6/patch-o-matic-ng/trunk/status Mon Aug  1 10:48:34 2005
@@ -38,7 +38,7 @@
 TARPIT                 2005/07/27      added
 time                   2005/07/27      added
 TTL                    2005/07/27      added
-u32                    2005/07/27      added
+u32                    2005/08/01      updated
 ULOG                   2005/07/27      updated         (ipv6 port)
 unclean                        2005/07/27      added
 XOR                    2005/07/27      added
_______________________________________________
pld-cvs-commit mailing list
[email protected]
http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit

Reply via email to