lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [lwip-users] udp checksum error


From: Goldschmidt Simon
Subject: RE: [lwip-users] udp checksum error
Date: Thu, 17 Jan 2008 12:59:32 +0100

 
 >      char* dummy_data = (char*)mallocx(12);
 >      for(int i =0 ; i<12;i++)
 >          dummy_data[i]= '2';
 >      
 >      while(1){
 >          lwip_sendto(socket_index,(void*)dummy_data,12,0,(struct sockaddr*)endpoint,addrlen);
 >          WaitForSingleObject(suspend_udp,SMX_MSEC_TO_TICKS(10)); 
 >      }
 >  }
 
Just found an error there: you initialize each element of dummy_data with '2', but your ethereal trace shows all frames to contain 12 bytes of 0x00! This probably means the checksum was calculated based on the '2', but it didn't get sent, which results in a wrong checksum (since it's the wrong data which is received).
 
Again, there is a significant difference between TCP and UDP in lwIP here: TCP packets are (when using the socket API) always delivered in one piece to the network driver (one single pbuf), while UDP packets are (again when using the socket API) _always_ delivered as a chain of 2 pbufs: 1 for the headers and 1 for the actual data (since this directly points to the application buffer). It seems you didn't copy the second pbuf!
 
Simon

reply via email to

[Prev in Thread] Current Thread [Next in Thread]