Re: TCP bug?

Alexey Kuznetsov (kuznet@ms2.inr.ac.ru)
Tue, 27 Oct 1998 22:56:37 +0300 (MSK)


Hello!

> OK. Because it can happen that I need to copy the skb for another
> reason (too little space for additional headers) I can just do
> something like
>
> if (skb_cloned(skb) || toosmall(skb)) {
> skn = skb_copy(skb, GFP_KERNEL);
> /* etc */
> }
>
> and this would be safe? Nice to know. :-)

Well, you will get after skb_copy() skb with the same
space for headers.

Actually, there are ready to use primitives to make this:

/* Not checks for sharing */
struct sk_buff *skb_realloc_headroom(skb, required_header_space);

/* Checks for sharing */
struct sk_buff *skb_cow(skb, required_header_space);

Also, it is unlikely that you may use GFP_KERNEL allocations
anywhere but socket code.

Alexey

-
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/