Merge "libnetutils: Expect 1's complement if computed UDP checksum is zero"

This commit is contained in:
Vineeta Srivastava 2013-12-12 22:19:05 +00:00 committed by Android (Google) Code Review
commit 32212f2688
1 changed files with 2 additions and 0 deletions

View File

@ -230,6 +230,8 @@ int receive_packet(int s, struct dhcp_msg *msg)
packet.udp.check = 0;
sum = finish_sum(checksum(&packet, nread, 0));
packet.udp.check = temp;
if (!sum)
sum = finish_sum(sum);
if (temp != sum) {
ALOGW("UDP header checksum failure (0x%x should be 0x%x)", sum, temp);
return -1;