wrong udp checksums

Bug #153253 reported by Martin Lindhe
4
Affects Status Importance Assigned to Milestone
php5 (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

Hi. Im running ubuntu-dev (soon to be 7.10) on x64 architecture.

I'm trying to send a UDP packet using PHP (5.2.3-1ubuntu6).

The following script sends one UDP packet. It works correctly (generates correct checksum) on PHP 5.2.3 under Windows XP (32 bit).
However on my Ubuntu machine, the UDP checksum is calculated wrong so the packet is discarded.

<?
 $data = 'test123';

 $fwd_sock = stream_socket_client('udp://localhost:44200', $errno, $errstr);
 if (!$fwd_sock) echo "$errstr ($errno)\n";
 stream_socket_sendto($fwd_sock, $data);
 fclose($fwd_sock);
?>

Generated UDP packet:

0000 00 00 03 04 00 00 00 11 95 42 42 49 00 00 08 00 .........BBI....
0010 45 00 00 23 7d 6a 40 00 40 11 bf 5d 7f 00 00 01 E..#}j@.@..]....
0020 7f 00 00 01 80 13 ac a8 00 0f fe 22 74 65 73 74 ..........."test
0030 31 32 33 123

Checksum is 0xfe22. Correct checksum should be 0x8905 according to Wireshark.

Tags: checksum udp
Revision history for this message
Albert Damen (albrt) wrote :

Thank you for taking the time to report this bug and helping to make Ubuntu better.
The problem you see seems to be the standard Linux implementation for packets send to the local system, see http://www.ussg.iu.edu/hypermail/linux/kernel/0308.1/2205.html.
Can you please test to send the packet to a remote system?
Preferably you should check the checksum on the receiving host, as sometimes the checksum is only calculated on the network interface, and not seen correctly by wireshark, see: http://www.wireshark.org/faq.html#q11.1

Changed in php5:
status: New → Incomplete
Revision history for this message
Martin Lindhe (martinlindhe) wrote :

Albert: thanks for responding and explaining.
Yes, remote UDP packets have correctly calculated checksums.
I guess i was derailed from what I was originally debugging by all these "UDP checksum incorrect" warnings in wireshark

This bug could be closed, it's not a real bug

Changed in php5:
status: Incomplete → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.