mirror of
https://github.com/reactos/reactos.git
synced 2025-04-28 01:11:35 +00:00
- Fix a typo in checksum calculation for datagrams with an odd number of octets
- Allow packets with no checksum - Remove debug prints that got left behind svn path=/trunk/; revision=43638
This commit is contained in:
parent
31ba6d7556
commit
13c453792d
2 changed files with 3 additions and 5 deletions
|
@ -69,16 +69,14 @@ UDPv4ChecksumCalculate(
|
|||
|
||||
/* Pad the data if needed */
|
||||
Pad = (DataLength & 1);
|
||||
if (Pad) {
|
||||
DbgPrint("Odd\n");
|
||||
if (Pad)
|
||||
DataLength++;
|
||||
} else DbgPrint("Even\n");
|
||||
|
||||
/* Add from the UDP header and data */
|
||||
for (i = 0; i < DataLength; i += 2)
|
||||
{
|
||||
TmpSum = ((PacketBuffer[i] << 8) & 0xFF00) +
|
||||
((Pad && i == DataLength - 1) ? 0 : (PacketBuffer[i+1] & 0x00FF));
|
||||
((Pad && i == DataLength - 2) ? 0 : (PacketBuffer[i+1] & 0x00FF));
|
||||
Sum += TmpSum;
|
||||
}
|
||||
|
||||
|
|
|
@ -267,7 +267,7 @@ VOID UDPReceive(PIP_INTERFACE Interface, PIP_PACKET IPPacket)
|
|||
i = UDPv4ChecksumCalculate(IPv4Header,
|
||||
(PUCHAR)UDPHeader,
|
||||
WH2N(UDPHeader->Length));
|
||||
if (i != DH2N(0x0000FFFF))
|
||||
if (i != DH2N(0x0000FFFF) && UDPHeader->Checksum != 0)
|
||||
{
|
||||
TI_DbgPrint(MIN_TRACE, ("Bad checksum on packet received.\n"));
|
||||
return;
|
||||
|
|
Loading…
Reference in a new issue