CIPE and 2.3.49 (success I believe) (Heads up Russel of Netfilter, Alan Cox, Dave Miller, Olaf Titz)

From: Trever Adams (trever_Adams@bigfoot.com)
Date: Fri Mar 03 2000 - 18:57:20 EST


I have fixed the problems in CIPE. It seems the porting was indeed
straightforward and I believe I have completed it. Below is a section
of code containing a fix by Russell. You will note I forced it to use
the old code instead of the new code. Seems there is either a problem
in the method of replacement or in the kernel. As this section is, it
works perfectly, as far as I can tell in 20 minutes of testing. Sorry
about the length of this code segment. Final patches will be sent to
those requesting them and Olaf Titz.

Russell, Alan, David: I give this to you to help me check and see if
the code Russell sent me is an accurate replacement and/or if there is a
bug in skb_copy_expand, as Russell told me this was supposed to do just
what the CIPE code does. Please do look into it. Thank you so much.

Trever

/*#if LINUX_VERSION_CODE > KERNEL_VERSION(2,3,35)
       if (max_headroom > skb_headroom(skb)
           || max_tailroom > skb_tailroom(skb)) {
           struct sk_buff *n= skb_copy_expand(skb, max_headroom,
                                              max_tailroom, GFP_ATOMIC);
            if (!n) {
                printk(KERN_INFO "%s: Out of memory, dropped packet\n",
                       dev->name);
                goto tx_error;
            }
            dev_kfree_skb(skb);
            skb = n;
       }
#else */
        {
            unsigned long offset;
            struct sk_buff *n=
                alloc_skb(skb->len+max_headroom+max_tailroom,
GFP_ATOMIC);
           if (!n) {
               printk(KERN_INFO "%s: Out of memory, dropped packet\n",
                      dev->name);
               goto tx_error;
           }
            skb_reserve(n, max_headroom);
            /* Copy the packet over. From skb_realloc_headroom() */
            offset=n->data-skb->data;
            skb_put(n,skb->len);
            /* Copy the bytes */
            memcpy(n->data,skb->data,skb->len);
            n->list=NULL;
            n->sk=NULL;
            n->priority=skb->priority;
            n->protocol=skb->protocol;
            n->dev=skb->dev;
            n->dst=dst_clone(skb->dst);
            n->h.raw=skb->h.raw+offset;
            n->nh.raw=skb->nh.raw+offset;
            n->mac.raw=skb->mac.raw+offset;
            memcpy(n->cb, skb->cb, sizeof(skb->cb));
            n->used=skb->used;
            n->is_clone=0;
            atomic_set(&n->users, 1);
            n->pkt_type=skb->pkt_type;
            n->stamp=skb->stamp;
            n->destructor = NULL;
            n->security=skb->security;

            if (skb->sk)
                    skb_set_owner_w(n, skb->sk);
            dev_kfree_skb(skb);
            skb = n;
        }
/*#endif*/ /* skb_copy_expand */

-- 
For the finest in family and value oriented products:
http://www.daysofyore.com

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Tue Mar 07 2000 - 21:00:15 EST