From: Tom Herbert <t...@herbertland.com>
Date: Thu, 13 Oct 2016 12:29:46 -0700
> On Thu, Oct 13, 2016 at 12:17 PM, David Miller <da...@davemloft.net> wrote:
>> This socket lookup is very heavy handed, and I realize that you
>> need this because we no longer store the encapsulation socket in
>> skb->sk these days.
> I don't quite understand your point about the encapsulation socket.
On the transmit side we used to have an issue wrt. what socket lives
on skb->sk when encapsulation is involved.
The problem is that we need skb->sk to be the transport level socket,
but in the output path we used to make tests on "skb->sk" to determine
things such as the multicast loopback flag. But we should be looking
at the tunnel socket for that, otherwise we could do crazy things
like dereference an AF_PACKET socket as if it were an inet socket one.
As such we modified the output path to pass the inner tunnel socket
'sk' down through the call chain, as an argument to functions such as
ip_queue_xmit(), ip_local_out*(), etc.