Re: [patch 5/7] CAN: Add virtual CAN netdevice driver
From: Patrick McHardy <hidden>
Date: 2007-05-30 19:58:19
Oliver Hartkopp wrote:
Patrick McHardy wrote:quoted
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.