From: Luigi 'Comio' Mantellini Date: Wed, 28 Jan 2009 10:42:35 +0100 Subject: [U-Boot] IP_t should be a "packed" struct In-Reply-To: <200901271932.11060.luigi.mantellini.ml@gmail.com> References: <200901271932.11060.luigi.mantellini.ml@gmail.com> Message-ID: <200901281042.36576.luigi.mantellini.ml@gmail.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi ML, I noticed that also the others headers structs have the same potential problem. I attached the patch to fix the net.h header file. best regards, luigi On Tuesday 27 January 2009 19:32:10 Luigi 'Comio' Mantellini wrote: > Hi ML, > > I'm working on a mips target and I used qemu_mips target to simulate my > target (that I hope to have in the next week...) > > Following my activities I noticed that IP_t structure is no defined with > attribute "packed". I noticed this issue because using a self-made > toolchain (gcc4.2.4+binutils2.8+uclibc0.9.30) the compiler has aligned all > bytes to 32bit boundary. This is not ok, because the packets IP_t can be > non aligned (see the /net/net.c PingSend function, for an example). > > The dirty solution is to define the structure with the > __attribute__((__packed__))... but, from my point of view, a better packet > forging mechanism should be implemented into the net.c stack. > > I attached a trivial patch that solved the issue on my target. > > Any comments is welcome. > > best regards, > > luigi -- Luigi Mantellini R&D - Software Industrie Dial Face S.p.A. Via Canzo, 4 20068 Peschiera Borromeo (MI), Italy Tel.: +39 02 5167 2813 Fax: +39 02 5167 2459 Email: luigi.mantellini at idf-hit.com -------------- next part -------------- A non-text attachment was scrubbed... Name: include_net_h_patch Type: text/x-patch Size: 1402 bytes Desc: not available Url : http://lists.denx.de/pipermail/u-boot/attachments/20090128/008175cd/attachment.bin