mptcp.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: Paolo Abeni <pabeni@redhat.com>
To: Florian Westphal <fw@strlen.de>, mptcp@lists.linux.dev
Subject: Re: [RFC] mptcp: add MPTCP_INFO getsockopt
Date: Fri, 23 Jul 2021 10:49:13 +0200	[thread overview]
Message-ID: <a065d16447194006a098e27238be655c901feef7.camel@redhat.com> (raw)
In-Reply-To: <20210722150154.10608-1-fw@strlen.de>

On Thu, 2021-07-22 at 17:01 +0200, 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.


I think the lack of binary compatibility with the OoO tree kernel is
nto a big deal - and anyhow is unsolvable, so we have to consider it
not a big deal ;)

I think it could *possibly* be nice to tie togethar mptcp_info
and mptcp_info_opt - e.g. pulling the second into the first and
unifying the handling, as tcp does for diag and GET_INFO. But perhpas
is just too much code/overhead?!?

> For those reasons a new 'struct mptcp_info_opt' is added which contains
> aligned_u64 fields to store the userspace buffer addresses.
> 
> '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.
> 
> AFAICS 'src' really is 'local address' (getsockname) and 'dst' is peer
> (getpeername).

+1 for 'local' and 'remote'

> Given mptcp-next has IPPROTO_MPTCP, this adds SOL_MPTCP.
> This also gives ample space to add mptcp specific sockopts.
> 
> In light of this, I wonder if it would make more sense to split the
> functionality.
> 
> 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.

+1 to fetch all the subflow info with a single syscall

+1 to pass back the user 2 sizes: one with
the "this is how much I copied to the buffer" and another with
"this is how much i would have copied".

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

What about using:

struct mptcp_subflow_info {
	u32 	id;
	struct tcp_info info;
};

mptcp_subflow_info.id = id;
getsockopt(fd, SOL_MPTCP, &mptcp_subflow_info, ...);

?

Cheers,

Paolo


  parent reply	other threads:[~2021-07-23  8:49 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
2021-07-22 20:53   ` Florian Westphal
2021-07-23  8:49 ` Paolo Abeni [this message]
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=a065d16447194006a098e27238be655c901feef7.camel@redhat.com \
    --to=pabeni@redhat.com \
    --cc=fw@strlen.de \
    --cc=mptcp@lists.linux.dev \
    --subject='Re: [RFC] mptcp: add MPTCP_INFO getsockopt' \
    /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

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