On Sun, Aug 01, 2004 at 07:08:59PM +0200, Patrick McHardy wrote: > >> struct tcphdr hdr; > >> struct tcphdr *tcph > >> > >> tcph = skb_get_bits(skb, &hdr, skb->nh.iph->ihl*4, sizeof(hdr)); > >> > >>If skb is neither shared nor cloned, this function linearize up to tcp > >>header and returns the pointer to tcp header in skb. > >>Otherwise, copies tcp header to "hdr" and return the pointer to it. > >>If error, return NULL. > > The number of copies will still depend on the ruleset with non-linear skbs. > skb_linearize_partial sounds like a much better idea to me. Oh yes, indeed. I somehow mis-interpreted Yasuyiki's approach. We should linearize with the first call, so that every 2nd, 3rd, ... call do nothing but immediately return. > Regards > Patrick -- - Harald Welte http://www.netfilter.org/ ============================================================================ "Fragmentation is like classful addressing -- an interesting early architectural error that shows how much experimentation was going on while IP was being designed." -- Paul Vixie