This is the mail archive of the libc-hacker@cygnus.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Problems with tftp on ARM systems...


Using the tftphdr structure in ./inet/arpa/tftp.h on the ARM yields incorrect
results due to the alignment of data on the ARM.  The structure as it comes
across the network is 5 bytes of packed data, while the struct on the ARM has
padding after the initial short, after the union, and at the end of the struct
to pad it out to an even number of words in length.

Adding __attribute__ ((packed)) to the struct as shown below fixes the problem. 

 typedef struct { 
   short th_opcode; 
   union { 
     unsigned short tu_block; 
     short tu_code; 
     char tu_stuff[1]; 
   } __attribute__ ((packed)) th_u 
   char th_data[1] __attribute__ ((packed)); 
 } __attribute__ ((packed)) tftphdr; 


The structure is not in an ARM specific header file.  If I submit a patch to
alter this header in this manner will it affect any of the other ports?  Does
anyone have another better solution?  

Scott


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]