From: Patrick McHardy
Sent: 1/6/2006 5:12:33 PM
> > -static inline void *load_pointer(struct sk_buff *skb, int k,
> > -                                 unsigned int size, void *buffer)
> > +static inline void *load_pointer(struct sk_buff *skb, int k, unsigned int 
> > size)
> >  {
> > -   if (k >= 0)
> > +   if (k >= 0) {
> > +           u32 *buffer = NULL;
> >             return skb_header_pointer(skb, k, size, buffer);
> 
> This is wrong, skb_header_pointer needs a pointer to a buffer
> to which it can copy the packet contents if they are located
> in the non-linear area.

Ah, gotcha.

--- x/net/core/filter.c 2006-01-06 19:14:34.000000000 -0600
+++ y/net/core/filter.c 2006-01-06 19:14:26.000000000 -0600
@@ -51,12 +51,12 @@ static void *__load_pointer(struct sk_bu
        return NULL;
 }
 
-static inline void *load_pointer(struct sk_buff *skb, int k,
-                                 unsigned int size, void *buffer)
+static inline void *load_pointer(struct sk_buff *skb, int k, unsigned int size)
 {
-       if (k >= 0)
-               return skb_header_pointer(skb, k, size, buffer);
-       else {
+       if (k >= 0) {
+               u32 buffer;
+               return skb_header_pointer(skb, k, size, &buffer);
+       } else {
                if (k >= SKF_AD_OFF)
                        return NULL;
                return __load_pointer(skb, k);
@@ -82,7 +82,6 @@ unsigned int sk_run_filter(struct sk_buf
        u32 A = 0;                      /* Accumulator */
        u32 X = 0;                      /* Index Register */
        u32 mem[BPF_MEMWORDS];          /* Scratch Memory Store */
-       u32 tmp;
        int k;
        int pc;
 
@@ -176,7 +175,7 @@ unsigned int sk_run_filter(struct sk_buf
                case BPF_LD|BPF_W|BPF_ABS:
                        k = fentry->k;
  load_w:
-                       ptr = load_pointer(skb, k, 4, &tmp);
+                       ptr = load_pointer(skb, k, 4);
                        if (ptr != NULL) {
                                A = ntohl(*(u32 *)ptr);
                                continue;
@@ -185,7 +184,7 @@ unsigned int sk_run_filter(struct sk_buf
                case BPF_LD|BPF_H|BPF_ABS:
                        k = fentry->k;
  load_h:
-                       ptr = load_pointer(skb, k, 2, &tmp);
+                       ptr = load_pointer(skb, k, 2);
                        if (ptr != NULL) {
                                A = ntohs(*(u16 *)ptr);
                                continue;
@@ -194,7 +193,7 @@ unsigned int sk_run_filter(struct sk_buf
                case BPF_LD|BPF_B|BPF_ABS:
                        k = fentry->k;
 load_b:
-                       ptr = load_pointer(skb, k, 1, &tmp);
+                       ptr = load_pointer(skb, k, 1);
                        if (ptr != NULL) {
                                A = *(u8 *)ptr;
                                continue;
@@ -216,7 +215,7 @@ load_b:
                        k = X + fentry->k;
                        goto load_b;
                case BPF_LDX|BPF_B|BPF_MSH:
-                       ptr = load_pointer(skb, fentry->k, 1, &tmp);
+                       ptr = load_pointer(skb, fentry->k, 1);
                        if (ptr != NULL) {
                                X = (*(u8 *)ptr & 0xf) << 2;
                                continue;


-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to