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: Muhamad Ikhwan Ismail
Subject: RE: [lwip-users] udp checksum error
Date: Thu, 17 Jan 2008 12:11:29 +0000




Oh, I assumed that the way TCP and UDP handles pbufs are the same. And since DHCP works fine and it didnt
work with the socket API, your explanation fits in just nicely. But where is this copying supposed to be done ?
Is it supposed to be done in the socket layer, or netconn API layer? Thanks in advance again...
 

 

Subject: RE: [lwip-users] udp checksum error
Date: Thu, 17 Jan 2008 12:59:32 +0100
From: address@hidden
To: address@hidden

 
 >      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


Connect and share in new ways with Windows Live. Get it now!

reply via email to

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