Re: Busybox 1.16.x dnsd alignment problems

2010-05-21 Thread Mike Frysinger
On Wednesday 14 April 2010 13:14:07 Denys Vlasenko wrote: Are you saying that here: # define move_from_unaligned16(v, u16p) (memcpy((v), (u16p), 2)) memcpy may be opportunistic and if u16p has type uin16_t, memcpy will be optimized to assignment? If so, this should be prevented from

Re: Busybox 1.16.x dnsd alignment problems

2010-04-28 Thread Lars Reemts
Let me know whether this patch fixes all your problems. It fixes my busybox / dnsd related problems. I didn't really expect it to solve _all_ my problems ;-) Am 20.04.2010 22:25, schrieb Denys Vlasenko: On Sat, Apr 17, 2010 at 7:46 AM, Lars Reemts l...@reemts.de wrote: Does it work if

Re: Busybox 1.16.x dnsd alignment problems

2010-04-20 Thread Denys Vlasenko
On Sat, Apr 17, 2010 at 7:46 AM, Lars Reemts l...@reemts.de wrote: Does it work if you add PACKED here in dnsd.c? struct type_and_class {         uint16_t type PACKED;         uint16_t class PACKED; }; No, but it does work with: struct type_and_class {        uint16_t type;        

Re: Busybox 1.16.x dnsd alignment problems

2010-04-17 Thread Lars Reemts
Sorry, my mistake. Denys Vlasenko schrieb: On Thu, Apr 15, 2010 at 12:40 AM, Lars Reemts l...@reemts.de wrote: So I went with slapping ALIGN4 on the byte array instead. The ALIGN4 doesn't compile for me. gcc complains not to know the ALIGN4 macro. Had to change it to: uint8_t

Re: Busybox 1.16.x dnsd alignment problems

2010-04-17 Thread Lars Reemts
Does it work if you add PACKED here in dnsd.c? struct type_and_class { uint16_t type PACKED; uint16_t class PACKED; }; No, but it does work with: struct type_and_class { uint16_t type; uint16_t class; }PACKED; Then the disassembler also shows some calls to

Re: Busybox 1.16.x dnsd alignment problems

2010-04-16 Thread Denys Vlasenko
On Thu, Apr 15, 2010 at 12:40 AM, Lars Reemts l...@reemts.de wrote: So I went with slapping ALIGN4 on the byte array instead. The ALIGN4 doesn't compile for me. gcc complains not to know the ALIGN4 macro. Had to change it to: uint8_t buf[MAX_PACK_LEN + 1] __attribute__ ((aligned (4))); Look

Re: Busybox 1.16.x dnsd alignment problems

2010-04-16 Thread Denys Vlasenko
On Wed, Apr 14, 2010 at 6:02 AM, Lars Reemts l...@reemts.de wrote: Hello, I'm using busybox on a AT91SAM9261 (arm920t) processor with gcc 4.3.4. Yesterday I ran into some problems using dnsd. DNS queries from a windows host were not properly decoded and hence not answered. Digging into the

Re: Busybox 1.16.x dnsd alignment problems

2010-04-15 Thread Lars Reemts
Are you saying that here: # define move_from_unaligned16(v, u16p) (memcpy((v), (u16p), 2)) memcpy may be opportunistic and if u16p has type uin16_t, memcpy will be optimized to assignment? Definitely yes. Please find a way which works for your arch and compiler, and let me know. Parhaps

Re: Busybox 1.16.x dnsd alignment problems

2010-04-15 Thread Lars Reemts
Unfortunately # define move_from_unaligned16(v, u16p) {void* src=(void*)(u16p);memcpy((v), src, 2);} also didn't do it. The only solution I've found working is doing it the hard way by hand: # define move_from_unaligned16(v, u16p) do { \ *((uint8_t*)v) = *((uint8_t*)u16p); \

Re: Busybox 1.16.x dnsd alignment problems

2010-04-15 Thread Lars Reemts
So I went with slapping ALIGN4 on the byte array instead. The ALIGN4 doesn't compile for me. gcc complains not to know the ALIGN4 macro. Had to change it to: uint8_t buf[MAX_PACK_LEN + 1] __attribute__ ((aligned (4))); Denys Vlasenko schrieb: On Wed, Apr 14, 2010 at 6:02 AM, Lars Reemts

Re: Busybox 1.16.x dnsd alignment problems

2010-04-15 Thread Joakim Tjernlund
Unfortunately # define move_from_unaligned16(v, u16p) {void* src=(void*)(u16p);memcpy((v), src, 2);} also didn't do it. The only solution I've found working is doing it the hard way by hand: # define move_from_unaligned16(v, u16p) do { \ *((uint8_t*)v) = *((uint8_t*)u16p); \

Re: Busybox 1.16.x dnsd alignment problems

2010-04-14 Thread Denys Vlasenko
On Wed, Apr 14, 2010 at 6:02 AM, Lars Reemts l...@reemts.de wrote: Hello, I'm using busybox on a AT91SAM9261 (arm920t) processor with gcc 4.3.4. Yesterday I ran into some problems using dnsd. DNS queries from a windows host were not properly decoded and hence not answered. Digging into the