Reading through the mailing list archive from two years ago refreshed
my memory a bit.
For the Texas DSP+compiler the problem was that it do not support
packed structs.
Several people had the same or similar problems related to unaligned
fields in the structs.
The 04/27/04 fix of bug #8708 solves all this by doing two things:
A 2 byte pad is added at the very beginning of the packet. This makes
all the header fields problerly aligned, with one exception: The IP
fields in the ARP header.
This is why ip_addr2 is there. By splitting the 32bit ip_addr into
two 16bit fields all fields are properly aligned so that the packed
struct attribute is no longer required for most compilers.
This solved the problem for everyone back then.
The 2 byte pad should actually improve performance a bit as well
since it makes all the IP and TCP headers nice and aligned.
I have to agree with you that the code must be fixed to comply with C
standards. I guess memcpy is fine.
But replacing ip_addr2 with ip_addr will break things on all
compilers that do not support packed structs. Possibly others as well.
If your compiler generates special code to handle potential alignment
problems whenever packed structs are used even if there are no
alignment issues, then I suggest you try disabling packed structs.
lwip in its current state should compile fine on most compilers even
without packed structs.