Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 5841 → Rev 5842

/kernel/trunk/network/icmp.inc
133,8 → 133,9
; IN: Pointer to buffer in [esp]
; ebx = pointer to device struct
; ecx = ICMP Packet size
; edx = ptr to IPv4 header
; esi = ptr to ICMP Packet data
; edi = ptr to ipv4 source and dest address
; edi = interface number*4
;
; OUT: /
;
144,8 → 145,13
 
DEBUGF DEBUG_NETWORK_VERBOSE, "ICMP_input\n"
 
; Dump all multicasts and broadcasts
mov eax, [IP_LIST + edi]
cmp eax, [edx + IPv4_header.DestinationAddress]
jne .dump
 
; Check the checksum
push esi ecx
push esi ecx edx
push [esi + ICMP_header.Checksum]
mov [esi + ICMP_header.Checksum], 0
xor edx, edx
153,17 → 159,11
call checksum_2
pop si
cmp dx, si
pop ecx esi
pop edx ecx esi
jne .checksum_mismatch
 
DEBUGF DEBUG_NETWORK_VERBOSE, "ICMP_input: Checksum OK\n"
 
; Ualidate device ptr
mov eax, edi
call NET_ptr_to_num4
cmp edi, -1
je .dump
 
; Update stats
inc [ICMP_PACKETS_RX + edi]
 
177,10 → 177,10
call mutex_lock
popa
 
mov edx, [eax] ; ipv4 source address
add ecx, esi
sub ecx, edx
mov esi, edx
mov eax, net_sockets
.try_more:
; mov , [esi + ICMP_header.Identifier]
.next_socket:
mov eax, [eax + SOCKET.NextPtr]
or eax, eax
192,12 → 192,6
cmp [eax + SOCKET.Protocol], IP_PROTO_ICMP
jne .next_socket
 
cmp [eax + IP_SOCKET.RemoteIP], edx
jne .next_socket
 
; cmp [eax + ICMP_SOCKET.Identifier],
; jne .next_socket
 
pusha
mov ecx, socket_mutex
call mutex_unlock
376,7 → 370,7
;
; IN: eax = socket ptr
; ecx = data length
; esi = data offset
; edx = data pointer
;
;-----------------------------------------------------------------
align 4
385,13 → 379,13
DEBUGF DEBUG_NETWORK_VERBOSE, "Creating ICMP Packet for socket %x, data ptr=%x\n", eax, edx
 
push edx
 
mov di, IP_PROTO_ICMP SHL 8 + 128 ; TTL
mov ebx, [eax + IP_SOCKET.device]
mov edx, [eax + IP_SOCKET.LocalIP]
mov ebx, [eax + IP_SOCKET.device]
mov eax, [eax + IP_SOCKET.RemoteIP]
mov edi, [eax + IP_SOCKET.RemoteIP]
mov al, [eax + IP_SOCKET.ttl]
mov ah, IP_PROTO_ICMP
call IPv4_output
jz .exit
jz .fail
 
pop esi
push eax
417,8 → 411,12
inc [ICMP_PACKETS_TX + edi]
@@:
ret
.exit:
 
.fail:
pop edx
DEBUGF DEBUG_NETWORK_ERROR, "Creating ICMP Packet failed\n"
or eax, -1
mov ebx, EMSGSIZE ;;; FIXME
ret