
On Mon, Nov 04, 2019 at 09:28:51PM +0100, Simon Goldschmidt wrote:
Am 04.11.2019 um 20:34 schrieb Heinrich Schuchardt:
struct ip_udp_hdr is naturally packed. There is no point in adding a __packed attribute. With the attribute the network stack does not compile using GCC 9.2.1:
Is this commit message correct? In lwIP, we *do* need to pack all these network header structs as they can come in unaligned. Especially the IP header is normally 16-bit aligned if the incoming Ethernet frame is 32-bit aligned (which is a must for many DMA engines).
This is also the reason why the below code works, I guess: it is rarely totally unaligned, but nearly always at least 16-bit aligned, so dereferencing the checksum pointer as aligned u16 just works.
Nevertheless, the code is formally wrong and your patch is correct. I just don't like the commit message saying 'packed' is not required.
Perhaps we should fix the underlying code problem then? Or does that men "rewrite the whole file" ?