Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 2389 → Rev 2390

/kernel/branches/net/network/tcp_input.inc
36,14 → 36,8
 
DEBUGF 1,"TCP_input size=%u\n", ecx
 
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
; First, re-calculate the checksum
 
;-------------------------------
; Now, re-calculate the checksum
 
push ecx esi
pushw [esi + TCP_header.Checksum]
mov [esi + TCP_header.Checksum], 0
51,10 → 45,15
pop cx ; previous checksum
cmp cx, dx
pop edx ecx
jnz .drop_not_locked
jne .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,6 → 40,8
adc dl, cl
adc dh, ch
 
adc edx, 0
 
;---------------------
; Real header and data
 
/kernel/branches/net/network/udp.inc
121,11 → 121,12
; First validate, checksum
 
neg [esi + UDP_header.Checksum] ; substract checksum from 0
jz .no_checksum ; if checksum is zero, it is considered valid and we continue processing
jz .no_checksum ; if checksum is zero, it is considered valid
 
; 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"
287,7 → 288,7
.fail:
DEBUGF 1,"UDP_output: failed\n"
add esp, 4+4+8
xor eax, eax
or eax, -1
ret