From: Fan Du <fan.du@windriver.com>
To: Ben Hutchings <bhutchings@solarflare.com>
Cc: steffen.klassert@secunet.com, stephen@networkplumber.org,
davem@davemloft.net, dev@lists.strongswan.org,
netdev@vger.kernel.org
Subject: Re: [PATCH net-next 2/2] include/uapi/linux/xfrm.h: Pack struct xfrm_usersa_info
Date: Thu, 9 Jan 2014 16:24:26 +0800 [thread overview]
Message-ID: <52CE5CBA.9000200@windriver.com> (raw)
In-Reply-To: <1389213183.1644.31.camel@bwh-desktop.uk.level5networks.com>
On 2014年01月09日 04:33, Ben Hutchings wrote:
> On Tue, 2014-01-07 at 14:48 +0800, Fan Du wrote:
>> Otherwise 64bits kernel has sizeof(struct xfrm_usersa_info) 224 bytes,
>> while 32bits compiled iproute2 see the same structure as 220 bytes, which
>> leading deficit xfrm sa, in turn broken IPsec connectivity.
>>
>> Fix this by packing the structure.
>>
>> Signed-off-by: Fan Du<fan.du@windriver.com>
>> ---
>> include/uapi/linux/xfrm.h | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/include/uapi/linux/xfrm.h b/include/uapi/linux/xfrm.h
>> index 470bfae..61460c4 100644
>> --- a/include/uapi/linux/xfrm.h
>> +++ b/include/uapi/linux/xfrm.h
>> @@ -366,7 +366,7 @@ struct xfrm_usersa_info {
>> #define XFRM_STATE_AF_UNSPEC 32
>> #define XFRM_STATE_ALIGN4 64
>> #define XFRM_STATE_ESN 128
>> -};
>> +} __attribute__((packed));
>>
>> #define XFRM_SA_XFLAG_DONT_ENCAP_DSCP 1
>>
>
> That change will make access to the structure very slow on some
> architectures, and I suspect it will cause other compatibility problems.
>
> I think the right thing to do is to reduce the minimum length of the
> structure in the netlink policy so that padding at the end is not
> required.
Could you please be more specific about this? Thanks.
I'm afraid we can only rearrange structure member order to reduce size
on 64bits, alas that's not feasible here :(
(It looks like all field offsets will be the same on all
> 32/64-bit architecture pairs and there is only a differing amount of
> padding at the end of the structure for 32/64-bit alignment.)
>
> Ben.
>
--
浮沉随浪只记今朝笑
--fan
_______________________________________________
Dev mailing list
Dev@lists.strongswan.org
https://lists.strongswan.org/mailman/listinfo/dev
next prev parent reply other threads:[~2014-01-09 8:24 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-07 6:48 [PATCH net-next 0/2] Pack struct xfrm_usersa_info and struct xfrm_userpolicy_info Fan Du
2014-01-07 6:48 ` [PATCH net-next 1/2] include/uapi/linux/xfrm.h: Pack " Fan Du
2014-01-07 22:52 ` Sergei Shtylyov
2014-01-09 8:39 ` Fan Du
2014-01-09 22:58 ` Sergei Shtylyov
2014-01-09 23:07 ` Sergei Shtylyov
2014-01-07 6:48 ` [PATCH net-next 2/2] include/uapi/linux/xfrm.h: Pack struct xfrm_usersa_info Fan Du
2014-01-08 20:33 ` Ben Hutchings
2014-01-09 8:24 ` Fan Du [this message]
2014-01-09 18:58 ` Ben Hutchings
2014-01-07 6:55 ` [PATCH net-next 0/2] Pack struct xfrm_usersa_info and struct xfrm_userpolicy_info Fan Du
2014-01-07 7:47 ` Steffen Klassert
2014-01-07 7:59 ` Fan Du
2014-01-07 10:00 ` David Laight
2014-01-09 8:34 ` Fan Du
2014-01-09 9:07 ` David Laight
2014-01-07 18:07 ` David Miller
2014-01-09 8:24 ` Fan Du
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=52CE5CBA.9000200@windriver.com \
--to=fan.du@windriver.com \
--cc=bhutchings@solarflare.com \
--cc=davem@davemloft.net \
--cc=dev@lists.strongswan.org \
--cc=netdev@vger.kernel.org \
--cc=steffen.klassert@secunet.com \
--cc=stephen@networkplumber.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 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.