On Monday, 17 May 2021 00:33:09 CEST Linus Lüssing wrote:
/* __batadv_forw_bcast_packet clones, make sure original
* skb stays writeable
*/
return (skb_cow(skb, 0) < 0) ? NETDEV_TX_BUSY : NETDEV_TX_OK;
Just because we had this discussion a couple of hours ago: My last comment from May was that the skb_cow might be unnecessary - not that you need a skb_copy.
You wrote (for situation B):
a packet is additionally decapsulated and is sent up the stack through batadv_recv_bcast_packet()->batadv_interface_rx(). Which needs an unshared skb data for potential modifications from other protocols.
And my reply to this was:
Take for example the bridge code. You can find the skb_share_check in br_handle_frame. Afterwards, it knows that it has a clone of the skb (but not necessarily a private copy of the actual data). If it needs to modify the data then it is copying the skb.
Another example is the IPv4 code. One of the first things it does is to check in ip_rcv_core for the shared skb. And if it needs to modify it (for example by forwarding it in ip_forward), it uses skb_cow directly.
Kind regards, Sven