Hello!

> I'm just wondering if recycling of skb's can be harmful?

Yes, if you make it incorrectly, it is fatal, rather than harmful.

> In the IrDA stack
> I often need to send out a nearly exact copy of a received frame, so it's
> tempting to just reuse the received frame. But then I started thinking
> about packet sniffers that have just cloned the incomming frame and queued
> it at some socket. Changing the skb would confuse packet sniffer
> applications (yes we now have irdadump and irdaping :-) 

If you modify skb data, you have to make skb_cow() on it.
Actually, in output path one optimization is used widely:
if you add something to skb head, you may avoid data copying.
It is correct, if skb is queued inside IP{v6} and packet socket, at least.

> Maybe the worst problem is that af_packet.c uses the skb->cb field for

No, it cannot be problem. Packet socket uses private copy of struct skb.
The same is true about all the protocols. This operation can be done
with skb_clone(), which is fast enough.

Alexey Kuznetsov
-
To unsubscribe from this list: send the line "unsubscribe linux-net" in
the body of a message to [EMAIL PROTECTED]

Reply via email to