Subject: Re: [patch 5/7] CAN: Add virtual CAN netdevice driver

From: Patrick McHardy <[email-masked]>
Date: Wed, 30 May 2007 21:58:13 +0200

Oliver Hartkopp wrote:
> Patrick McHardy wrote:
> 
>>skb->sk should work here as well since you detect these frames
>>before queueing to the receiving socket.
>>  
> 
> 
> Hm - this would indeed be much nicer than using skb->cb.
> 
> I think we just had some concerns to use skb->sk for our own
> functionality, as it might be used and dereferenced by other layers
> between the socket and the network driver ... so setting skb->sk to NULL
> (to indicate 'no loopback') smells bad if you don't really know who ever
> dereferences skb->sk.

Indeed, that will break things.

> Btw. it's really worth to look at it again. I just had the idea to
> access the loopback flag via skb->sk->opt->loopback (argpfl!) on the TX
> path and skb->sk on the RX path. This would avoid skb->sk to be set to
> NULL but need to have this loopback flag to be implemented in each CAN
> socket opt.

Yes, thats what I wanted to suggest. You should even be able
to use skb->sk->opt->loopback on the receive path before you
queue the packet to the socket.