Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 2390 → Rev 2389

/kernel/branches/net/network/udp.inc
121,12 → 121,11
; First validate, checksum
 
neg [esi + UDP_header.Checksum] ; substract checksum from 0
jz .no_checksum ; if checksum is zero, it is considered valid
 
jz .no_checksum ; if checksum is zero, it is considered valid and we continue processing
; otherwise, we will re-calculate the checksum and add it to this value, thus creating 0 when it is correct
 
UDP_checksum (edi), (edi+4)
jnz .checksum_mismatch
;;; jnz .checksum_mismatch
 
.no_checksum:
DEBUGF 1,"UDP Checksum is correct\n"
288,7 → 287,7
.fail:
DEBUGF 1,"UDP_output: failed\n"
add esp, 4+4+8
or eax, -1
xor eax, eax
ret
 
 
/kernel/branches/net/network/tcp_input.inc
36,8 → 36,14
 
DEBUGF 1,"TCP_input size=%u\n", ecx
 
; First, re-calculate the checksum
and [esi + TCP_header.DataOffset], 0xf0 ; Calculate TCP segment header size (throwing away unused reserved bits in TCP header)
shr [esi + TCP_header.DataOffset], 2
cmp [esi + TCP_header.DataOffset], sizeof.TCP_header ; Now see if it's at least the size of a standard TCP header
jb .drop_not_locked ; If not, drop the packet
 
;-------------------------------
; Now, re-calculate the checksum
 
push ecx esi
pushw [esi + TCP_header.Checksum]
mov [esi + TCP_header.Checksum], 0
45,15 → 51,10
pop cx ; previous checksum
cmp cx, dx
pop edx ecx
jne .drop_not_locked
jnz .drop_not_locked
 
DEBUGF 1,"Checksum ok\n"
 
and [edx + TCP_header.DataOffset], 0xf0 ; Calculate TCP segment header size (throwing away unused reserved bits in TCP header)
shr [edx + TCP_header.DataOffset], 2
cmp [edx + TCP_header.DataOffset], sizeof.TCP_header ; Now see if it's at least the size of a standard TCP header
jb .drop_not_locked ; If not, drop the packet
 
movzx eax, [edx + TCP_header.DataOffset]
sub ecx, eax ; substract TCP header size from total segment size
jb .drop_not_locked ; If total segment size is less then the advertised header size, drop packet
/kernel/branches/net/network/tcp_subr.inc
40,8 → 40,6
adc dl, cl
adc dh, ch
 
adc edx, 0
 
;---------------------
; Real header and data