netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Phil Sutter <phil@nwl.cc>
To: David Laight <David.Laight@ACULAB.COM>
Cc: David Miller <davem@davemloft.net>,
	Xin Long <lucien.xin@gmail.com>,
	Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: Re: [PATCH v2 1/3] sctp: Export struct sctp_info to userspace
Date: Thu, 4 Aug 2016 11:27:20 +0200	[thread overview]
Message-ID: <20160804092720.GC8988@orbyte.nwl.cc> (raw)
In-Reply-To: <063D6719AE5E284EB5DD2968C1650D6D5F509220@AcuExch.aculab.com>

On Thu, Aug 04, 2016 at 09:13:03AM +0000, David Laight wrote:
> From: Phil Sutter
> > Sent: 03 August 2016 22:23
> > This is required to correctly interpret INET_DIAG_INFO messages exported
> > by sctp_diag module.
> ...
> > diff --git a/include/linux/sctp.h b/include/linux/sctp.h
> > index de1f64318fc4e..fcb4c36461732 100644
> > --- a/include/linux/sctp.h
> > +++ b/include/linux/sctp.h
> > @@ -705,70 +705,6 @@ typedef struct sctp_auth_chunk {
> >  	sctp_authhdr_t auth_hdr;
> >  } __packed sctp_auth_chunk_t;
> > 
> > -struct sctp_info {
> > -	__u32	sctpi_tag;
> ...
> > -	__u32	__reserved3;
> > -};
> > -
> >  struct sctp_infox {
> >  	struct sctp_info *sctpinfo;
> >  	struct sctp_association *asoc;
> > diff --git a/include/uapi/linux/sctp.h b/include/uapi/linux/sctp.h
> > index d304f4c9792c4..a406adcc0793e 100644
> > --- a/include/uapi/linux/sctp.h
> > +++ b/include/uapi/linux/sctp.h
> > @@ -944,4 +944,68 @@ struct sctp_default_prinfo {
> >  	__u16 pr_policy;
> >  };
> > 
> > +struct sctp_info {
> > +	__u32	sctpi_tag;
> 
> Should these be uint32_t (etc) for userspace?

Grepping through include/uapi in my clone of net-next, I see 271 results
for uint32_t but 4595 ones for __u32. So while not necessarily correct,
it seems to be the far more popular choice. Do you see any benefit in
using the uint*_t typedefs instead?

> > +	__u32	sctpi_state;
> ...
> > +	__u16	__reserved1;
> 
> Is it worth adding some extra pad here in case anything extra needs
> to be added to this set of data?
> 
> ...
> > +	__u32	__reserved3;
> 
> Think I'd definitely add a few words of pad here.
> Or at least make absolutely sure the interface passes the buffer length and
> allows for kernels that report different length buffers.

I merely copy and pasted the struct from include/linux/sctp.h without
thinking about it's layout. Xin, what are your thoughts about this?

Thanks, Phil

  reply	other threads:[~2016-08-04  9:27 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-03 21:23 [PATCH v2 0/3] sctp_diag: A bunch of fixes for upcoming 'ss' support Phil Sutter
2016-08-03 21:23 ` [PATCH v2 1/3] sctp: Export struct sctp_info to userspace Phil Sutter
2016-08-04  9:13   ` David Laight
2016-08-04  9:27     ` Phil Sutter [this message]
2016-08-04 12:16       ` Xin Long
2016-08-03 21:23 ` [PATCH v2 2/3] sctp_diag: export timer value only if it is active Phil Sutter
2016-08-03 21:51   ` Marcelo Ricardo Leitner
2016-08-03 23:39     ` Phil Sutter
2016-08-03 21:23 ` [PATCH v2 3/3] sctp_diag: Respect ss adding TCPF_CLOSE to idiag_states Phil Sutter

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=20160804092720.GC8988@orbyte.nwl.cc \
    --to=phil@nwl.cc \
    --cc=David.Laight@ACULAB.COM \
    --cc=davem@davemloft.net \
    --cc=lucien.xin@gmail.com \
    --cc=marcelo.leitner@gmail.com \
    --cc=netdev@vger.kernel.org \
    /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).