From: Samuel Thibault <samuel.thibault@ens-lyon.org>
To: James Chapman <jchapman@katalix.com>
Cc: Tom Parkin <tparkin@katalix.com>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
netdev@vger.kernel.org
Subject: Re: [PATCH] l2tp: Support several sockets with same IP/port quadruple
Date: Mon, 6 May 2024 23:44:24 +0200 [thread overview]
Message-ID: <20240506214424.4wddiwjdpdl2gf4w@begin> (raw)
In-Reply-To: <ea4ddddc-719c-673e-7646-8f89cd341e7b@katalix.com>
Hello,
James Chapman, le ven. 03 mai 2024 12:36:14 +0100, a ecrit:
> > @@ -845,6 +846,20 @@ static int l2tp_udp_recv_core(struct l2tp_tunnel *tunnel, struct sk_buff *skb)
> > /* Extract tunnel and session ID */
> > tunnel_id = ntohs(*(__be16 *)ptr);
> > ptr += 2;
> > +
> > + if (tunnel_id != tunnel->tunnel_id && tunnel->l2tp_net) {
> Can tunnel->l2tp_net be NULL?
l2tp_tunnel_sock_create's comment says
* Since we don't want these sockets to keep a namespace alive by
* themselves, we drop the socket's namespace refcount after creation.
* These sockets are freed when the namespace exits using the pernet
* exit hook.
and l2tp_tunnel_create does not set l2tp_net, only l2tp_tunnel_register
does, so I assumed it might be NULL and preferred to stay on
the safe side. But it's l2tp_tunnel_register which adds it to
pn->l2tp_tunnel_idr, so AIUI it indeed cannot be NULL since we got it
from pn->l2tp_tunnel_idr, we can probably drop the test indeed.
> > + /* We are receiving trafic for another tunnel, probably
> > + * because we have several tunnels between the same
> > + * IP/port quadruple, look it up.
> > + */
> > + struct l2tp_tunnel *alt_tunnel;
> > +
> > + alt_tunnel = l2tp_tunnel_get(tunnel->l2tp_net, tunnel_id);
> This misses a check that alt_tunnel's protocol version matches the header.
> Move the existing header version check to after this fragment?
We need to check the version before getting the tunnel id, which we need
to look up the struct l2tp_tunnel :)
I'll add another version check.
Samuel
> > + if (!alt_tunnel)
> > + goto pass;
> > + tunnel = alt_tunnel;
> > + }
> > +
> > session_id = ntohs(*(__be16 *)ptr);
> > ptr += 2;
> > } else {
next prev parent reply other threads:[~2024-05-06 21:44 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-02 23:14 [PATCH] l2tp: Support several sockets with same IP/port quadruple Samuel Thibault
2024-05-03 11:36 ` James Chapman
2024-05-06 21:44 ` Samuel Thibault [this message]
2024-05-07 8:06 ` James Chapman
2024-05-07 10:29 ` Samuel Thibault
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=20240506214424.4wddiwjdpdl2gf4w@begin \
--to=samuel.thibault@ens-lyon.org \
--cc=edumazet@google.com \
--cc=jchapman@katalix.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=tparkin@katalix.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