netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Guillaume Nault <g.nault@alphalink.fr>
To: James Chapman <jchapman@katalix.com>
Cc: David Miller <davem@davemloft.net>,
	Tom Herbert <tom@herbertland.com>,
	netdev@vger.kernel.org
Subject: Re: [PATCH net-next] kcm: do not attach sockets if sk_user_data is already used
Date: Thu, 18 Jan 2018 17:29:33 +0100	[thread overview]
Message-ID: <20180118162933.GM1422@alphalink.fr> (raw)
In-Reply-To: <CAEwTi7QwzrBfUT44EuZWcTviJPy25f29sSceVug7xGeTwQuHLw@mail.gmail.com>

On Thu, Jan 18, 2018 at 03:40:52PM +0000, James Chapman wrote:
> On 18 January 2018 at 15:18, Guillaume Nault <g.nault@alphalink.fr> wrote:
> > On Wed, Jan 17, 2018 at 02:25:38PM -0500, David Miller wrote:
> >> If all else was equal, even though it doesn't make much sense to KCM
> >> attach L2TP sockets to KCM, I would suggest to change L2TP to store
> >> it's private stuff elsewhere.
> >>
> >> But that is not the case.  Anything using the generic UDP
> >> encapsulation layer is going to make use of sk->sk_user_data like this
> >> (see setup_udp_tunnel_sock).
> >>
> > Most UDP encapsulations only use kernel sockets though. It seems that
> > only L2TP and GTP use setup_udp_tunnel_sock() with userpsace sockets.
> > So it might be feasible to restrict usage of sk_user_data to kernel
> > sockets only.
> >
> > For L2TP, we probably can adapt l2tp_sock_to_tunnel() so that it does
> > a lookup in a hashtable indexed by the socket pointer, rather than
> > dereferencing sk_user_data. That doesn't look very satisfying to me,
> > but that's the only way I found so far.
> 
> L2TP needs a way to get at its local data from the socket in the data path.
> 
Did I miss something? On xmit, the session is provided by l2tp_ppp or
l2tp_eth, which is enough to get access to the parent tunnel.
For reception, l2tp_udp_encap_recv() receives the socket pointer as
parameter and could get enough information from the headers to retrieve the
tunnel structure anymay (l2tp_ip and l2tp_ip6 use the headers).

l2tp_ppp also uses sk_user_data for its PPPOX sockets, but we probably
can handle this case more easily.

  reply	other threads:[~2018-01-18 16:29 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-14 11:32 [PATCH net-next] kcm: do not attach sockets if sk_user_data is already used James Chapman
2018-01-16 10:44 ` Guillaume Nault
2018-01-16 17:10   ` Eric Dumazet
2018-01-16 17:36 ` Tom Herbert
2018-01-16 19:00   ` David Miller
2018-01-17 11:13     ` James Chapman
2018-01-17 19:25       ` David Miller
2018-01-18 15:18         ` Guillaume Nault
2018-01-18 15:40           ` James Chapman
2018-01-18 16:29             ` Guillaume Nault [this message]
2018-01-18 17:30               ` James Chapman
2018-01-18 17:46             ` Tom Herbert
2018-01-18 18:08               ` Eric Dumazet
2018-01-18 19:26                 ` Tom Herbert
2018-01-18 19:46                   ` Eric Dumazet
2018-01-18 17:40         ` Tom Herbert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180118162933.GM1422@alphalink.fr \
    --to=g.nault@alphalink.fr \
    --cc=davem@davemloft.net \
    --cc=jchapman@katalix.com \
    --cc=netdev@vger.kernel.org \
    --cc=tom@herbertland.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).