Stonebone Posted February 24, 2006 Share Posted February 24, 2006 While transfering big files with tftpds i noticed that it seemed to fail systematically. After studying the traffic in ethereal I came to the conclusion that dswifi calculates the checksum for the udp package incorrectly in some rare cases. I read here on the forum that it fails on odd-sized packages but this was an even sized package so it is not the same bug. After spending several hours tracking down this bug, my friend Gustav Munkby and I found the cause of this bug. In a few places in the checksum calculation code similar to this appears:checksum += checksum>>16; checksum &= 0xFFFF;This code is meant to take of the carries from the ones'-complement additions. The correct way of doing this is like this:while(checksum >> 16) checksum = (checksum & 0xFFFF) + (checksum >> 16);As an example, if checksum = 0x1FFFF the former code give an incorrect result (0), but the later code will give the correct result (1). I have updated my hacked version to fix this in at least some places:http://www.itstud.chalmers.se/~larssten/wifi_lib.tar.bz2 Link to comment Share on other sites More sharing options...
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!Register a new account
Already have an account? Sign in here.Sign In Now