Netdev List
 help / color / mirror / Atom feed
From: Hengyu Liang <hengyul@cs.unc.edu>
To: gnault@redhat.com
Cc: netdev@vger.kernel.org, davem@davemloft.net, edumazet@kernel.org,
	kuba@kernel.org, pabeni@redhat.com, horms@kernel.org,
	jchapman@katalix.com, tparkin@katalix.com
Subject: Re: [PATCH net] l2tp: only return sessions of the given tunnel in l2tp_session_get()
Date: Tue, 27 Oct 2026 00:32:54 -0400	[thread overview]
Message-ID: <20261027043254.3763123-1-hengyul@cs.unc.edu> (raw)
In-Reply-To: <at-F69h64Ineg2gp@debian>

Hi Guillaume,

Thanks, that makes the intended semantics clear.

On Mon, Oct 26, 2026 at 05:55:07PM +0100, Guillaume Nault wrote:
> The correct approach would be to pass both a session ID and a socket
> for any L2TPv3 UDP session lookup. But the netlink interface currently
> doesn't support passing a socket fd for SESSION_GET, SESSION_MODIFY
> and SESSION_DELETE operations.

In the kernel the callers already have both. They look up the tunnel by
ID and pass tunnel->sock to l2tp_session_get(). The case that is missed
is a session ID that has not collided: l2tp_v3_session_get() returns the
IDR entry without checking sk.

> This last operation could maybe be simplified to a simple tunnel ID
> check, as, in my understanding, we have an 1:1 relationship between
> tunnel IDs and their sockets (but I'm a bit wary of such shortcuts
> given that code have proved to be brittle in the past).

In v2 I will compare the session's tunnel socket with sk instead of
comparing tunnel IDs, so the check does not depend on that mapping. It
does hold today: tunnel IDs are unique per netns, and
l2tp_validate_socket() returns -EBUSY for a socket that already has a
tunnel.

I will also reword the commit message to describe session IDs as you
did: unique per netns, and per UDP socket for UDP encap.

Do you have any other comments? If not, I will send v2 with these
changes.

Thanks,
Hengyu

      reply	other threads:[~2026-10-27  4:33 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-25 14:58 [PATCH net] l2tp: only return sessions of the given tunnel in l2tp_session_get() Hengyu Liang
2026-10-25 15:01 ` netdev-bot+sinfo
2026-10-26  8:47   ` Hengyu Liang
2026-10-26 11:51 ` Guillaume Nault
2026-10-26 12:57   ` Hengyu Liang
2026-10-26 16:55     ` Guillaume Nault
2026-10-27  4:32       ` Hengyu Liang [this message]

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=20261027043254.3763123-1-hengyul@cs.unc.edu \
    --to=hengyul@cs.unc.edu \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=gnault@redhat.com \
    --cc=horms@kernel.org \
    --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