SeeCwriter wrote:The first member of the structure has __attribute__((aligned(2))) as part of it's declaration. Is that what you mean?
I think it needs to be declared on each of the (offending) structure elements. so each of the single byte entries needs to be told to align for 2 bytes.
Alternatively, you could use #pragma pack...
e.g.
#pragma pack(push, 2)
struct MyStruct
{
char first;
char second;
char third;
unsigned short fourth;
}
#pragma pack(pop)
After more investigation, the change in alignment is related to the IPADDR declaration. In 2.8.x IPADDR is a structure declared as packed. So the first change in alignment occurs when a byte declaration precedes an IPADDR declaration. In 2.8.5, no pad is inserted to put ntp_server on an even boundary because IPADDR is packed. But in 2.7.6, a pad is inserted.
IPADDR is declared packed in 2.8.x because in 2.8.x it's an IPv6 address structure containing 4 32-bit unsigned ints, whereas in 2.7.6 it's simply a typedef to a single 32-bit unsigned integer.
As an FYI...We hired a Netburner Certified consultant to do a code review. He recommended a couple of changes, but could find nothing that would cause the reboots. I purchased a commercial lint package, and spent a few weeks removing the 100's of warnings it flagged. None of which could I identify as "the problem". And after nearly 2-months now, there have been no reboots. It's disconcerting that I can't point to a definitive cause of the reboots. But thankful the problem seems to be resolved.