Bugfixes in net branch:

-Disabled UDP remote IP checking because it blocks valid packets in certain situations (DNS resolving)
-Removed device '0' (application level) as default device because it was not correctly implemented and would require a lot of changes. Yet need to find a better solution for this.

git-svn-id: svn://kolibrios.org@2366 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
hidnplayr 2012-02-21 14:09:00 +00:00
parent 599bb8d0bd
commit dc66507e60
2 changed files with 334 additions and 331 deletions

View File

@ -172,7 +172,8 @@ align 4
uglobal uglobal
NET_RUNNING dd ? NET_RUNNING dd ?
NET_DRV_LIST rd (MAX_NET_DEVICES + 1) ; device 0 is a link to the default device NET_DEFAULT dd ?
NET_DRV_LIST rd MAX_NET_DEVICES
endg endg
@ -276,7 +277,7 @@ NET_add_device:
; Check if device is already listed ; Check if device is already listed
mov eax, ebx mov eax, ebx
mov ecx, MAX_NET_DEVICES ; We need to check whole list because a device may be removed without re-organizing list mov ecx, MAX_NET_DEVICES ; We need to check whole list because a device may be removed without re-organizing list
mov edi, NET_DRV_LIST+4 mov edi, NET_DRV_LIST
repne scasd ; See if device is already in the list repne scasd ; See if device is already in the list
jz .error jz .error
@ -285,7 +286,7 @@ NET_add_device:
; Find empty slot in the list ; Find empty slot in the list
xor eax, eax xor eax, eax
mov ecx, MAX_NET_DEVICES mov ecx, MAX_NET_DEVICES
mov edi, NET_DRV_LIST+4 mov edi, NET_DRV_LIST
repne scasd repne scasd
jnz .error jnz .error
@ -340,8 +341,7 @@ NET_set_default:
cmp [NET_DRV_LIST+eax*4], 0 cmp [NET_DRV_LIST+eax*4], 0
je .error je .error
push [NET_DRV_LIST+eax*4] mov [NET_DEFAULT], eax
pop [NET_DRV_LIST]
DEBUGF 1,"Device number %u is now default!\n", eax DEBUGF 1,"Device number %u is now default!\n", eax
ret ret
@ -377,11 +377,12 @@ NET_remove_device:
; there are still active devices, find one and make it default ; there are still active devices, find one and make it default
xor eax, eax xor eax, eax
mov ecx, MAX_NET_DEVICES mov ecx, MAX_NET_DEVICES
mov edi, NET_DRV_LIST+4 mov edi, NET_DRV_LIST
repe scasd repe scasd
je @f je @f
push dword [edi-4] shr edi, 2
pop [NET_DRV_LIST] dec edi
mov [NET_DEFAULT], edi
@@: @@:
;---------------------------- ;----------------------------
@ -422,7 +423,7 @@ NET_ptr_to_num:
push ecx push ecx
mov ecx, MAX_NET_DEVICES mov ecx, MAX_NET_DEVICES
mov edi, NET_DRV_LIST+4 mov edi, NET_DRV_LIST
.loop: .loop:
cmp ebx, [edi] cmp ebx, [edi]
@ -569,7 +570,7 @@ checksum_2:
; ;
;---------------------------------------------------------------- ;----------------------------------------------------------------
align 4 align 4
sys_network: sys_network: ; FIXME: make default device easily accessible
cmp ebx, -1 cmp ebx, -1
jne @f jne @f

View File

@ -165,11 +165,13 @@ UDP_input:
;;; TODO: when packet is processed, check more sockets! ;;; TODO: when packet is processed, check more sockets!
cmp [eax + IP_SOCKET.RemoteIP], 0xffffffff ; cmp [eax + IP_SOCKET.RemoteIP], 0xffffffff
je @f ; je @f
cmp [eax + IP_SOCKET.RemoteIP], edi ; cmp [eax + IP_SOCKET.RemoteIP], edi
jne .next_socket ; jne .next_socket
@@: ; @@:
;
; FIXME: UDP should check remote IP, but not under all circumstances!
cmp [eax + UDP_SOCKET.firstpacket], 0 cmp [eax + UDP_SOCKET.firstpacket], 0
je .updateport je .updateport