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 |