[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lwip-devel] [bug #36283] PPP struct used on header size computation and
From: |
Sylvain Rochet |
Subject: |
[lwip-devel] [bug #36283] PPP struct used on header size computation and not packed |
Date: |
Tue, 15 May 2012 10:27:29 +0000 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:10.0.4) Gecko/20100101 Firefox/10.0.4 Iceweasel/10.0.4 |
Follow-up Comment #6, bug #36283 (project lwip):
I finally troubleshooted that and found why pppInputHeader must be packed.
If a structure is not packed, I guess the compiler optimize any use of this
structure in a way that the structure must be aligned everywhere it is used.
With PPPoE, if not packed:
Ethernet => +14
PPPoE header => +6
sizeof(*pih) - sizeof(inProtocol) => -6
So, pppInputHeader replaces the PPPoE header, which is good (except that we
double the inProtocol field, which is what -sizeof(inProtocol) tried to
avoid), but the *pih ptr is not aligned and some uC die because of that.
Of course, if the structure pppInputHeader is not packed, it may work I guess
if ETH_PAD_SIZE is set to 2 (if the driver support it, which mine not at the
moment), but this is just because the PPPoE header is 6 bytes long and
pppInputHeader too.
I am not a compiler expert, I guess if the structure is packed, that the
compiler does not add alignment optimisation then the structure can be used on
unaligned address.
_______________________________________________________
Reply to this item at:
<http://savannah.nongnu.org/bugs/?36283>
_______________________________________________
Message sent via/by Savannah
http://savannah.nongnu.org/