> At the moment netfilter does a skb_linearize(), and the ip_queue_xmit2
> dereferences skb->sk. Boom (thanks Anton).
But what did you make with NAT earlier, when you also need to copy skb?
It is puzzle for me.
> skb_linearize is different from skb_copy: it should copy the sk, list
> and the destructor
This is impossible to do in core. Kind of ownership is known only
from context. Users used to set correct ownership of cloned/copied
buffers themselves, which in the case of netfilter happens always
> return an int, and not free the old skb on failure (ie. int
> skb_linearize(struct sk_buff **pskb)).
And what are you going to do with this skb after failure? 8)
It is clear: to free it, you have no more variants.
Apparently, you want to do plain skb_copy to copy ownership.
Yes, seems, the function copying write ownership should be exported too.
> Oh, and inlining it seems, um, questionable.
One line function is to be inlined, is not it?