From: Bruce Allan <bwa@us.ibm.com>
To: Jon Grimm <jgrimm2@us.ibm.com>
Cc: lksctp-developers@lists.sourceforge.net,
linux-net@vger.kernel.org, netdev@oss.sgi.com
Subject: Re: [Lksctp-developers] Re: [PATCH] subset of RFC2553
Date: Thu, 20 Feb 2003 12:53:55 -0800 [thread overview]
Message-ID: <3E554063.3010008@us.ibm.com> (raw)
In-Reply-To: <3E542F52.50001@us.ibm.com>
After re-reading this thread, I think what Dave didn't like about the
original definition of sockaddr_storage was the unnecessary use of
_more_than_1_ pad field and the align field. So, the simplest
definition that Dave might approve would be:
#define _SS_MAXSIZE 128 /* Implementation specific max size */
struct sockaddr_storage {
sa_family_t ss_family;
char __data[_SS_MAXSIZE - sizeof(sa_family_t)];
} __attribute __ ((aligned(sizeof(struct sockaddr *))));
The use of the 'sizeof(struct sockaddr *)' for specifying the required
alignment is just to illustrate the second criteria for this structure
as documented in the RFC, i.e. "It is aligned at an appropriate boundary
so protocol specific socket address data structure pointers can be cast
to it and access their fields without alignment problems...".
I'll resubmit a patch tomorrow with the above definition if there are no
objections.
Bruce Allan
Jon Grimm wrote:
> Bruce,
> I removed Dave from the the cc list until we get something that
> works for us (or anyone else that wants to chime in).
> My second proposal doesn't look quite right when I reread it.
> See below.
>
> Thanks,
> Jon
>
> Jon Grimm wrote:
>
>> Or if you don't care about the alignment of the __data field at all:
>>
>> #define _SS_MAXSIZE 128
>> #if ULONG_MAX > 0xffffffff
>> #define _ALIGNSIZE ((sizeof(__u64)))
>> #else
>> #define _ALIGNSIZE ((sizeof(__u32)))
>> #endif
>> struct sockaddr_storage {
>> sa_family_t ss_family;
>> char __data[_SS_MAXSIZE-sizeof(sa_family_t)*2 +
>> _ALIGNSIZE];
>>
>
> Should be
> char __data[__SS_MAXSIZE-ALIGNSIZE];
>
>> } __attribute ((aligned(_ALIGNSIZE)));
>>
>>
>> jon
>
next prev parent reply other threads:[~2003-02-20 20:53 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-02-19 2:32 [PATCH] subset of RFC2553 Bruce Allan
2003-02-19 23:26 ` [Lksctp-developers] " Jon Grimm
2003-02-20 0:21 ` David S. Miller
2003-02-21 17:06 ` Bruce Allan
2003-02-22 7:23 ` David S. Miller
2003-02-22 7:26 ` David S. Miller
2003-02-24 17:54 ` Bruce Allan
2003-03-03 8:44 ` David S. Miller
2003-02-22 9:26 ` Pekka Savola
2003-02-20 0:23 ` [Lksctp-developers] " Jon Grimm
2003-02-20 1:28 ` Jon Grimm
2003-02-20 20:53 ` Bruce Allan [this message]
2003-02-20 21:24 ` Jon Grimm
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=3E554063.3010008@us.ibm.com \
--to=bwa@us.ibm.com \
--cc=jgrimm2@us.ibm.com \
--cc=linux-net@vger.kernel.org \
--cc=lksctp-developers@lists.sourceforge.net \
--cc=netdev@oss.sgi.com \
/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).