Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 5583 → Rev 5584

/kernel/trunk/network/IPv4.inc
569,6 → 569,7
; IPv4_output
;
; IN: eax = Destination IP
; ebx = device ptr (or 0 to let IP layer decide)
; ecx = data length
; edx = Source IP
; di = TTL shl 8 + protocol
863,6 → 864,7
; IPv4_route
;
; IN: eax = Destination IP
; ebx = outgoing device / 0
; edx = Source IP
; OUT: eax = Destination IP (or gateway IP)
; edx = Source IP
874,6 → 876,9
align 4
IPv4_route: ; TODO: return error if no valid route found
 
test ebx, ebx
jnz .got_device
 
cmp eax, 0xffffffff
je .broadcast
 
903,8 → 908,29
 
ret
 
.got_device:
; Validate device ptr and convert to device number
call NET_ptr_to_num4
cmp edi, -1
je .fail
 
mov edx, [IP_LIST + edi] ; Source IP
 
; Check if we should route to gateway or not
mov ebx, [IP_LIST + edi]
and ebx, [SUBNET_LIST + edi]
mov ecx, eax
and ecx, [SUBNET_LIST + edi]
je @f
mov eax, [GATEWAY_LIST + edi]
@@:
ret
 
.fail:
ret
 
 
 
;---------------------------------------------------------------------------
;
; IPv4_get_frgmnt_num
/kernel/trunk/network/icmp.inc
388,6 → 388,7
 
mov di, IP_PROTO_ICMP SHL 8 + 128 ; TTL
mov edx, [eax + IP_SOCKET.LocalIP]
mov ebx, [eax + IP_SOCKET.device]
mov eax, [eax + IP_SOCKET.RemoteIP]
call IPv4_output
jz .exit
/kernel/trunk/network/socket.inc
1160,7 → 1160,7
cmp dword[edx+8], 0
je .unbind
 
movzx edx, byte[edx + 9]
movzx edx, byte[edx + 12]
cmp edx, NET_DEVICES_MAX
ja .invalid
 
/kernel/trunk/network/tcp_output.inc
504,6 → 504,7
 
mov ecx, esi
mov edx, [eax + IP_SOCKET.LocalIP] ; source ip
mov ebx, [eax + IP_SOCKET.device]
mov eax, [eax + IP_SOCKET.RemoteIP] ; dest ip
mov di, IP_PROTO_TCP shl 8 + 128
call IPv4_output
/kernel/trunk/network/tcp_subr.inc
287,6 → 287,7
push cx ebx
mov eax, [ebx + IP_SOCKET.RemoteIP]
mov edx, [ebx + IP_SOCKET.LocalIP]
mov ebx, [ebx + IP_SOCKET.device]
mov ecx, sizeof.TCP_header
mov di, IP_PROTO_TCP shl 8 + 128
call IPv4_output
372,6 → 373,7
mov eax, [edi]
mov ecx, sizeof.TCP_header
mov di, IP_PROTO_TCP shl 8 + 128
xor ebx, ebx ;;; fixme
call IPv4_output
jz .error
pop esi cx
/kernel/trunk/network/udp.inc
258,6 → 258,7
sub esp, 4 ; Data ptr will be placed here
push edx esi
mov edx, [eax + IP_SOCKET.LocalIP]
mov ebx, [eax + IP_SOCKET.device]
mov eax, [eax + IP_SOCKET.RemoteIP]
mov di, IP_PROTO_UDP shl 8 + 128
add ecx, sizeof.UDP_header