Tuesday, March 9, 2010

Disable UDP checksum

UDP checksum is a 16bit checksum calculated over a part of IP header and UDP data.
Normally a kernel recieving a UDP packet calcuate the checksum of the UDP packet excluding the checksum field. An "OR" with the checksum with the packet should yeild 16'b1111111111111111

Kernel can however discard the checksum if the field is set to 0x0000..
This set at the client which sends UDP Packet. When creating a socket at the client side set option SO_NO_CHECK for the socket

this is done by
 optval=1;  if (setsockopt(sock_info->socket, SOL_SOCKET, SO_NO_CHECK , (void*)&optval,
 sizeof(optval) ==-1)
printf("ERROR SETTING SO_NO_CHECK");

SO_NO_CHECK is defined in  A server recieving these packets, ignore udp checksum.



No comments: