All of lore.kernel.org
 help / color / mirror / Atom feed
From: Florian Westphal <fw@strlen.de>
To: Mat Martineau <mathew.j.martineau@linux.intel.com>
Cc: Florian Westphal <fw@strlen.de>, mptcp@lists.linux.dev
Subject: Re: [PATCH mptcp-next 3/5] mptcp: add MPTCP_TCPINFO getsockopt support
Date: Thu, 12 Aug 2021 20:41:52 +0200	[thread overview]
Message-ID: <20210812184152.GE607@breakpoint.cc> (raw)
In-Reply-To: <265d1dc-7ea0-d55c-957f-8aa0eb53f094@linux.intel.com>

Mat Martineau <mathew.j.martineau@linux.intel.com> wrote:
> 
> 
> On Wed, 11 Aug 2021, Florian Westphal wrote:
> 
> > diff --git a/net/mptcp/sockopt.c b/net/mptcp/sockopt.c
> > index eba294a071c8..ac8e6823db4f 100644
> > --- a/net/mptcp/sockopt.c
> > +++ b/net/mptcp/sockopt.c
> > @@ -723,6 +723,96 @@ static int mptcp_getsockopt_info(struct mptcp_sock *msk, char __user *optval, in
> > 
> > 	if (copy_to_user(optval, &m_info, len))
> > 		return -EFAULT;
> > +	return 0;
> > +}
> > +
> > +static int mptcp_get_subflow_data(struct mptcp_subflow_data *sfd,
> > +				  char __user *optval, int __user *_u_optlen)
> > +{
> > +#define MIN_INFO_OPTLEN_SIZE	16
> 
> This caught my eye on my first quick review pass, I'm not accustomed to
> seeing inline defines like this in the kernel unless it's part of some macro
> magic. The style guide / checkpatch don't say anything, so I'll just suggest
> it would fit better outside the function scope (but no big deal).

An alternative would be to use 'sizeof struct mptcp_subflow_data' here
and change that structure a bit.

Instead of storing the size, add a 'version/flags' field.

That would also allow to extend the structure later: kernel would
expose a 'struct mptcp_subflow_data_v2' or similar if the need would
arise and userspace would tell kernel the size in indirect fashion by
setting a special 'v2 enabled' field.

  reply	other threads:[~2021-08-12 18:42 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-11 13:15 [PATCH mptcp-next 0/5] mptcp: add SOL_MPTCP getsockopt support Florian Westphal
2021-08-11 13:15 ` [PATCH mptcp-next 1/5] mptcp: add new mptcp_fill_diag helper Florian Westphal
2021-08-11 13:15 ` [PATCH mptcp-next 2/5] mptcp: add MPTCP_INFO getsockopt Florian Westphal
2021-08-12 16:46   ` Mat Martineau
2021-08-11 13:15 ` [PATCH mptcp-next 3/5] mptcp: add MPTCP_TCPINFO getsockopt support Florian Westphal
2021-08-12 17:03   ` Mat Martineau
2021-08-12 18:41     ` Florian Westphal [this message]
2021-08-11 13:15 ` [PATCH mptcp-next 4/5] mptcp: add MPTCP_SUBFLOW_ADDRS " Florian Westphal
2021-08-11 21:18   ` kernel test robot
2021-08-11 21:18     ` kernel test robot
2021-08-12  3:02   ` kernel test robot
2021-08-12  3:02     ` kernel test robot
2021-08-11 13:15 ` [PATCH mptcp-next 5/5] selftests: mptcp: add mptcp getsockopt test cases Florian Westphal
2021-08-12 11:14   ` Paolo Abeni
2021-08-12 11:28     ` Florian Westphal
2021-08-12 10:58 ` [PATCH mptcp-next 0/5] mptcp: add SOL_MPTCP getsockopt support Paolo Abeni
2021-08-12 11:07   ` Florian Westphal
  -- strict thread matches above, loose matches on Subject: below --
2021-08-11 18:26 [PATCH mptcp-next 3/5] mptcp: add MPTCP_TCPINFO " kernel test robot

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=20210812184152.GE607@breakpoint.cc \
    --to=fw@strlen.de \
    --cc=mathew.j.martineau@linux.intel.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.