/kernel/branches/net/network/IPv4.inc |
---|
512,6 → 512,16 |
cmp ecx, 1480 |
jg .exit_ |
cmp ebx, ebx ; if dest ip = 0 |
jnz .ip_ok ; and local ip is valid |
; use local ip instead |
cmp [IP_LIST],0xffffffff ; |
je .ip_ok ; TODO: find solution to send broadcast |
; on device other then device 0 |
mov ebx, [IP_LIST] ; |
; |
.ip_ok: ; |
push ecx eax ebx dx di |
cmp eax, -1 |
/kernel/branches/net/network/socket.inc |
---|
722,9 → 722,11 |
cmp [eax + SOCKET.LocalPort],0 |
jne .port_ok |
push esi |
mov ecx, [eax + SOCKET.Type] |
call socket_find_port |
test bx, bx |
pop esi |
je s_error |
mov [eax + SOCKET.LocalPort], bx |
733,7 → 735,7 |
mov ecx, esi |
mov esi, edx |
mov edx, dword [eax + SOCKET.LocalPort] ; load local port and remote port at once |
DEBUGF 1,"local port: %x, remote port: %x\n",[eax + SOCKET.LocalPort]:2, [eax + SOCKET.RemotePort]:2 |
DEBUGF 1,"local port: %x, remote port: %x\n",[eax + SOCKET.LocalPort]:4, [eax + SOCKET.RemotePort]:4 |
mov ebx, [eax + SOCKET.LocalIP] |
mov eax, [eax + SOCKET.RemoteIP] |
787,7 → 789,7 |
align 4 |
socket_find_port: |
DEBUGF 1,"Socket_find_free_port, type: %u ",eax |
DEBUGF 1,"Socket_find_free_port\n" |
cmp ecx, IP_PROTO_UDP |
je .udp |
/kernel/branches/net/network/udp.inc |
---|
95,6 → 95,8 |
cmp [eax + SOCKET.LocalPort], bx |
jne .next_socket |
DEBUGF 1,"found socket with matching domain, type and localport\n" |
; For dhcp, we must allow any remote server to respond. |
; I will accept the first incoming response to be the one |
; I bind to, if the socket is opened with a destination IP address of |
103,10 → 105,12 |
je .ok1 |
mov ebx, [esp] |
mov ebx, [ebx + ETH_FRAME.Data + IPv4_Packet.SourceAddress] ; get the Source address from the IP Packet |
cmp [eax + SOCKET.RemoteIP], eax |
mov ebx, [ebx + ETH_FRAME.Data + IPv4_Packet.SourceAddress] ; get the Source address from the IP Packet FIXME |
cmp [eax + SOCKET.RemoteIP], ebx |
jne .try_more ; Quit if the source IP is not valid, check for more sockets with this IP/PORT combination |
DEBUGF 1,"Remote Ip matches\n" |
.ok1: |
mov bx, [edx + UDP_Packet.SourcePort] ; Remote port must be 0, or equal to sourceport of packet |