[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lwip-users] wrong statement in lwip wiki page about structure packi
From: |
Simon Goldschmidt |
Subject: |
Re: [lwip-users] wrong statement in lwip wiki page about structure packing |
Date: |
Wed, 29 Aug 2012 08:43:42 +0200 |
jblackarty wrote:
> Current verson of http://lwip.wikia.com/wiki/Porting_for_an_OS#cc.h page
> containts a statement regarding structure packing:
> "The common case is using Ethernet interfaces and MEM_ALIGNMENT=4.
> Ethernet header without VLAN is 14 bytes, so if you can/must have
> ETH_PAD_SIZE=2,
> then IP headers and higher layers are 4 bytes aligned and you may not need
> packing !"
> It's wrong ! You need structure fields to be packed at least !
Whoever wrote that (I'm too lazy to check the wiki history right now) thought
(or maybe even checked) that inside protocol headers, all members are aligned,
so when the start of a protocol header is aligned, you wouldn't need packing.
However, this is *not* guaranteed to work by lwIP, and we do not check for this
to work when making changes to the sources. Being like that, it *might* work
(maybe depending on which protocols are used), but I would suggest to test the
stack very thoroughly when used like that!
> Otherwise wiki must be corrected.
I think so, yes.
Simon
Re: [lwip-users] wrong statement in lwip wiki page about structurepacking, Pomeroy, Marty, 2012/08/29