mptcp.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: Matthieu Baerts <matthieu.baerts@tessares.net>
To: Florian Westphal <fw@strlen.de>
Cc: mptcp@lists.linux.dev
Subject: Re: [RFC] mptcp: add MPTCP_INFO getsockopt
Date: Thu, 22 Jul 2021 18:40:21 +0200	[thread overview]
Message-ID: <ff3627c3-7e0d-b374-3532-a5d93f7455af@tessares.net> (raw)
In-Reply-To: <20210722150154.10608-1-fw@strlen.de>

Hi Florian,

Thank you for looking at that!

On 22/07/2021 17:01, Florian Westphal wrote:
> Its not compatible with mptcp.org kernel one:
> 1. mptcp.org defines 'struct mptcp_info', but we already have this for
>    inet_diag.
> 
> 2. 'struct mptcp_info', as defined by mptcp.org has different layout for
>    32/64 bit arches.
>    This is a problem for 32bit binaries on 64bit kernels.
> 
> For those reasons a new 'struct mptcp_info_opt' is added which contains
> aligned_u64 fields to store the userspace buffer addresses.

Thank you for the explanation, it makes sense!

> 'struct mptcp_sub_info' is added as per mptcp.org kernel, but I don't
> like this structure.  I think 'src' and 'dst' are confusing terms.

Do you prefer 'local' and 'remote'?
Good time to change!

> AFAICS 'src' really is 'local address' (getsockname) and 'dst' is peer
> (getpeername).
> 
> Given mptcp-next has IPPROTO_MPTCP, this adds SOL_MPTCP.
> This also gives ample space to add mptcp specific sockopts.

Very good idea!

> In light of this, I wonder if it would make more sense to split the
> functionality.

Would it not start to be a bit costly to get all details if the
userspace has do a few syscalls?
- general info
- get subflow IDs
- for each suflow, call subflow info + peer/sock names

With the full structure, we could eventually allow userspace programs to
set some "*_len" members to 0 not to get all info, e.g. only get the
general info without peer/sock names for all subflows. Or without
TCP_INFO for each subflow. No?

> 
> Examples:
> 
> getsockopt(fd, SOL_MPTCP, SUBFLOW_ID, subflow_ids, &count);
> 
> sa.sa_family = subflow_ids[0];
> getsockopt(fd, SOL_MPTCP, SUBFLOW_GETPEERNAME, &sa, &len);
> ..
> sa.sa_family = subflow_ids[0];
> getsockopt(fd, SOL_MPTCP, SUBFLOW_GETSOCKNAME, &sa, &len);
> 
> tcp_info.tcpi_state = subflow_ids[0];
> getsockopt(fd, SOL_MPTCP, SUBFLOW_TCP_INFO, &tcp_info, &len);
> 
> ...
> 
> and so on.

This could be interesting if there is a demand to get info only for some
specific subflows :)

> 
> Alternatively one could overload e.g. the upper 8 bit:
> 
> getsockopt(fd, SOL_MPTCP, subflow_ids[0] << 24 | SUBFLOW_FOO, ...);

Maybe a "cleaner" workaround to set the ID? :)

> In any case, here is a tentative patch to add a mptcp.org-alike
> MPTCP_INFO getsockopt.

Thank you for sharing that!

(I didn't check the code yet)

Cheers,
Matt
-- 
Tessares | Belgium | Hybrid Access Solutions
www.tessares.net

  reply	other threads:[~2021-07-22 16:40 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-22 15:01 [RFC] mptcp: add MPTCP_INFO getsockopt Florian Westphal
2021-07-22 16:40 ` Matthieu Baerts [this message]
2021-07-22 20:53   ` Florian Westphal
2021-07-23  8:49 ` Paolo Abeni
2021-07-23  8:56   ` Matthieu Baerts

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=ff3627c3-7e0d-b374-3532-a5d93f7455af@tessares.net \
    --to=matthieu.baerts@tessares.net \
    --cc=fw@strlen.de \
    --cc=mptcp@lists.linux.dev \
    /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).