Re: [U-Boot] IP_t should be a packed struct

2009-01-28 Thread Luigi 'Comio' Mantellini
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

Re: [U-Boot] IP_t should be a packed struct

2009-01-28 Thread Ben Warren
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

Re: [U-Boot] IP_t should be a packed struct

2009-01-28 Thread Jerry Van Baren
Ben Warren wrote: 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

Re: [U-Boot] IP_t should be a packed struct

2009-01-28 Thread Ben Warren
Jerry Van Baren wrote: Ben Warren wrote: 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

Re: [U-Boot] IP_t should be a packed struct

2009-01-28 Thread Luigi Mantellini
Dear All From my point of view, when packing is formally required (ie packets headers), the structs should be declared explicitly as __packed__. The correctness of the object code should be independent from the compiler optimizations and we should always remember that the offset of a struct field

Re: [U-Boot] IP_t should be a packed struct

2009-01-28 Thread Luigi Mantellini
2009/1/28 Ben Warren biggerbadder...@gmail.com: .. I'd focus on fixing your toolchain. Your problem will not be confined to protocol headers. my toolchain works fine ;) -- Luigi 'Comio' Mantellini RD - Software Industrie Dial Face S.p.A. Via Canzo, 4 20068 Peschiera Borromeo (MI), Italy

Re: [U-Boot] IP_t should be a packed struct

2009-01-28 Thread Ben Warren
Luigi Mantellini wrote: Dear All From my point of view, when packing is formally required (ie packets headers), the structs should be declared explicitly as __packed__. The correctness of the object code should be independent from the compiler optimizations and we should always remember that

Re: [U-Boot] IP_t should be a packed struct

2009-01-28 Thread Wolfgang Denk
Dear Luigi Mantellini, In message b73e93990901281258s37f7e4d6hc6c2ff4c5d5fa...@mail.gmail.com you wrote: I'd focus on fixing your toolchain. Your problem will not be confined to protocol headers. my toolchain works fine ;) Except that it adds padding where it doesn't make sense. I

Re: [U-Boot] IP_t should be a packed struct

2009-01-28 Thread Wolfgang Denk
Dear Ben Warren, In message 4980cc59.1070...@gmail.com you wrote: My idea should be to declare a define like this #define PKT_HEADER __attribute__((__packed__)) my 2EuroCents. best regards, luigi OK, sounds good. Send a patch please. Hm... and what does this give us?

Re: [U-Boot] IP_t should be a packed struct

2009-01-28 Thread Ben Warren
Wolfgang Denk wrote: Dear Ben Warren, In message 4980cc59.1070...@gmail.com you wrote: My idea should be to declare a define like this #define PKT_HEADER __attribute__((__packed__)) my 2EuroCents. best regards, luigi OK, sounds good. Send a patch please.

Re: [U-Boot] IP_t should be a packed struct

2009-01-28 Thread Luigi Mantellini
Dear All, 2009/1/28 Wolfgang Denk w...@denx.de: Dear Ben Warren, In message 4980cc59.1070...@gmail.com you wrote: My idea should be to declare a define like this #define PKT_HEADER __attribute__((__packed__)) my 2EuroCents. best regards, luigi OK, sounds good. Send a

Re: [U-Boot] IP_t should be a packed struct

2009-01-28 Thread Wolfgang Denk
Dear Ben, In message 4980d38f.4020...@gmail.com you wrote: Here is for example a copy of /usr/include/netinet/ip.h : ... struct iphdr ... Yeah, I made the same observation, but am not fluent enough in the black magic of Linux header files to know if packing was being enforced somewhere

Re: [U-Boot] IP_t should be a packed struct

2009-01-28 Thread Wolfgang Denk
Dear Luigi Mantellini, In message b73e93990901281416k766b2bf3qc6429f77545f9...@mail.gmail.com you wrote: I think that an audit of the code is important to understand if we have a problem (or not) and how large is the problem. We (i. e. all of us except you) do not have a problem. My

Re: [U-Boot] IP_t should be a packed struct

2009-01-28 Thread Luigi Mantellini
Dear Wolfgang, 2009/1/28 Wolfgang Denk w...@denx.de: Dear Luigi Mantellini, In message b73e93990901281416k766b2bf3qc6429f77545f9...@mail.gmail.com you wrote: I think that an audit of the code is important to understand if we have a problem (or not) and how large is the problem. We (i.

[U-Boot] IP_t should be a packed struct

2009-01-27 Thread Luigi 'Comio' Mantellini
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