156,9 → 156,17 |
pop ecx edx |
jne .checksum_mismatch |
|
; Check packet type |
|
cmp [edx + ICMP_header.Type], ICMP_ECHO ; Is this an echo request? |
jne .check_sockets |
|
; Update stats (and validate device ptr) |
call NET_ptr_to_num4 |
cmp edi, -1 |
je .dump |
inc [ICMP_PACKETS_RX + edi] |
|
; We well re-use the packet so we can create the response as fast as possible |
; Notice: this only works on pure ethernet |
|
166,14 → 174,6 |
mov [edx + ICMP_header.Type], ICMP_ECHOREPLY ; Change Packet type to reply |
|
mov esi, [esp] ; Start of buffer |
|
; Update stats (and validate device ptr) |
call NET_ptr_to_num |
cmp edi, -1 |
je .dump |
inc [ICMP_PACKETS_RX + 4*edi] |
inc [ICMP_PACKETS_TX + 4*edi] |
|
cmp ebx, LOOPBACK_DEVICE |
je .loopback |
|
225,6 → 225,11 |
|
; Transmit the packet (notice that packet ptr and packet size have been on stack since start of the procedure!) |
call [ebx + NET_DEVICE.transmit] |
test eax, eax |
jnz @f |
call NET_ptr_to_num4 |
inc [UDP_PACKETS_TX + edi] |
@@: |
ret |
|
|
254,10 → 259,11 |
; cmp [eax + ICMP_SOCKET.Identifier], |
; jne .next_socket |
|
; call IPv4_dest_to_dev |
; cmp edi,-1 |
; je .dump |
; inc [ICMP_PACKETS_RX+edi] |
; Update stats (and validate device ptr) |
call NET_ptr_to_num4 |
cmp edi, -1 |
je .dump |
inc [ICMP_PACKETS_RX + edi] |
|
DEBUGF DEBUG_NETWORK_VERBOSE, "socket=%x\n", eax |
|
336,6 → 342,11 |
push edx edi |
DEBUGF DEBUG_NETWORK_VERBOSE, "Sending ICMP Packet\n" |
call [ebx + NET_DEVICE.transmit] |
test eax, eax |
jnz @f |
call NET_ptr_to_num4 |
inc [ICMP_PACKETS_TX + edi] |
@@: |
ret |
.exit: |
DEBUGF DEBUG_NETWORK_ERROR, "Creating ICMP Packet failed\n" |
386,6 → 397,11 |
|
DEBUGF DEBUG_NETWORK_VERBOSE, "Sending ICMP Packet\n" |
call [ebx + NET_DEVICE.transmit] |
test eax, eax |
jnz @f |
call NET_ptr_to_num4 |
inc [ICMP_PACKETS_TX + edi] |
@@: |
ret |
.exit: |
DEBUGF DEBUG_NETWORK_ERROR, "Creating ICMP Packet failed\n" |