skb_copy v.s. skb_clone
skb_clone 和 skb_copy 有甚麼不一樣? 從字面上來看,差不多啊,但實際上就是有差,先來看看 Man 吧~ struct sk_buff * skb_clone (struct sk_buff * skb, int gfp_mask); Duplicate an &sk_buff. The new one is not owned by a socket. Both copies share the same packet data but not structure. The new buffer has a reference count of 1. If the allocation fails the function returns NULL otherwise the new buffer is returned. If this function is called from an interrupt gfp_mask must be GFP_ATOMIC. struct sk_buff * skb_copy (const struct sk_buff * skb, int gfp_mask); Make a copy of both an &sk_buff and its data. This is used when the caller wishes to modify the data and needs a private copy of the data to alter. Returns NULL on failure or the pointer to the buffer on success. The returned buffer has a reference count of 1. As by-product this function converts non-linear &sk_buff to linear one, so that &sk_buff becomes completely private and caller is allowed to modify all the data of returned buffer. This means that t...