archive mirror
 help / color / mirror / Atom feed
From: Matthieu Baerts <>
To: Florian Westphal <>
Subject: Re: [RFC] mptcp: add MPTCP_INFO getsockopt
Date: Thu, 22 Jul 2021 18:40:21 +0200	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>

Hi Florian,

Thank you for looking at that!

On 22/07/2021 17:01, Florian Westphal wrote:
> Its not compatible with kernel one:
> 1. defines 'struct mptcp_info', but we already have this for
>    inet_diag.
> 2. 'struct mptcp_info', as defined by 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 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_INFO getsockopt.

Thank you for sharing that!

(I didn't check the code yet)

Tessares | Belgium | Hybrid Access Solutions

  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 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:

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

  git send-email \ \ \ \ \
    --subject='Re: [RFC] mptcp: add MPTCP_INFO getsockopt' \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
on how to clone and mirror all data and code used for this inbox