Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 5115 → Rev 5116

/kernel/branches/kolibri-process/network/IPv4.inc
1,6 → 1,6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; Copyright (C) KolibriOS team 2004-2013. All rights reserved. ;;
;; Copyright (C) KolibriOS team 2004-2014. All rights reserved. ;;
;; Distributed under terms of the GNU General Public License ;;
;; ;;
;; IPv4.INC ;;
16,7 → 16,7
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
$Revision: 3515 $
$Revision: 5015 $
 
IPv4_MAX_FRAGMENTS = 64
IPv4_MAX_ROUTES = 64
576,11 → 576,11
; edx = Source IP
; di = TTL shl 8 + protocol
;
; OUT: eax = pointer to buffer start
; ebx = pointer to device struct (needed for sending procedure)
; ecx = unchanged (packet size of embedded data)
; edx = size of complete buffer
; edi = pointer to start of data (0 on error)
; OUT: eax = pointer to buffer start / 0 on error
; ebx = device ptr (send packet through this device)
; ecx = data length
; edx = size of complete frame
; edi = start of IPv4 payload
;
;------------------------------------------------------------------
align 4
594,7 → 594,6
push ecx di eax
call IPv4_route ; outputs device number in edi, dest ip in eax, source IP in edx
push edx
 
test edi, edi
jz .loopback
 
606,12 → 605,11
 
inc [IPv4_packets_tx + edi] ; update stats
 
mov ax, ETHER_PROTO_IPv4
mov ebx, [NET_DRV_LIST + edi]
lea eax, [ebx + ETH_DEVICE.mac]
mov edx, esp
mov ecx, [esp + 6 + 8 + 2]
add ecx, sizeof.IPv4_header
mov di, ETHER_PROTO_IPv4
mov edx, esp
call ETH_output
jz .eth_error
add esp, 6 ; pop the mac out of the stack
641,18 → 639,18
.eth_error:
DEBUGF DEBUG_NETWORK_ERROR, "IPv4_output: ethernet error\n"
add esp, 3*4+2+6
xor edi, edi
xor eax, eax
ret
 
.arp_error:
DEBUGF DEBUG_NETWORK_ERROR, "IPv4_output: ARP error=%x\n", eax
add esp, 3*4+2
xor edi, edi
xor eax, eax
ret
 
.too_large:
DEBUGF DEBUG_NETWORK_ERROR, "IPv4_output: Packet too large!\n"
xor edi, edi
xor eax, eax
ret
 
.loopback:
674,7 → 672,7
; ecx = data length
; esi = data ptr
;
; OUT: /
; OUT: eax = -1 on error
;
;------------------------------------------------------------------
align 4
698,15 → 696,13
push ax
 
inc [IPv4_packets_tx + 4*edi]
mov ax, ETHER_PROTO_IPv4
mov ebx, [NET_DRV_LIST + 4*edi]
lea eax, [ebx + ETH_DEVICE.mac]
mov edx, esp
mov ecx, [esp + 6 + 4]
add ecx, sizeof.IPv4_header
mov di, ETHER_PROTO_IPv4
mov edx, esp
call ETH_output
jz .error
 
add esp, 6 ; pop the mac
 
mov dword[esp+4+4], edx
745,7 → 741,7
add esp, 8+4+4
.too_large:
DEBUGF DEBUG_NETWORK_ERROR, "IPv4_output_raw: Failed\n"
sub edi, edi
or eax, -1
ret
 
 
794,13 → 790,9
.new_fragment:
DEBUGF DEBUG_NETWORK_VERBOSE, "Ipv4_fragment: new fragment"
 
 
mov eax, [esp + 3*4]
mov ax, ETHER_PROTO_IPv4
lea ebx, [esp + 4*4]
mov di , ETHER_PROTO_IPv4
call ETH_output
 
cmp edi, -1
jz .err
 
; copy header