From e93a49b442561fed0a928c86f4cc079e767b085c Mon Sep 17 00:00:00 2001 From: hidnplayr Date: Tue, 28 May 2013 19:19:23 +0000 Subject: [PATCH] Disabled network debug output by default. git-svn-id: svn://kolibrios.org@3556 a494cfbc-eb01-0410-851d-a64ba20cac60 --- kernel/trunk/kernel.asm | 2 +- kernel/trunk/network/ARP.inc | 48 +++++----- kernel/trunk/network/IPv4.inc | 64 ++++++------- kernel/trunk/network/IPv6.inc | 20 ++-- kernel/trunk/network/PPPoE.inc | 22 ++--- kernel/trunk/network/ethernet.inc | 14 +-- kernel/trunk/network/icmp.inc | 30 +++--- kernel/trunk/network/loopback.inc | 12 +-- kernel/trunk/network/socket.inc | 144 ++++++++++++++-------------- kernel/trunk/network/stack.inc | 21 ++-- kernel/trunk/network/tcp_input.inc | 102 ++++++++++---------- kernel/trunk/network/tcp_output.inc | 28 +++--- kernel/trunk/network/tcp_subr.inc | 20 ++-- kernel/trunk/network/tcp_timer.inc | 8 +- kernel/trunk/network/tcp_usreq.inc | 4 +- kernel/trunk/network/udp.inc | 22 ++--- 16 files changed, 282 insertions(+), 279 deletions(-) diff --git a/kernel/trunk/kernel.asm b/kernel/trunk/kernel.asm index f037b6bc90..50fce8e205 100644 --- a/kernel/trunk/kernel.asm +++ b/kernel/trunk/kernel.asm @@ -77,7 +77,7 @@ $Revision$ USE_COM_IRQ equ 1 ; make irq 3 and irq 4 available for PCI devices ; Enabling the next line will enable serial output console -debug_com_base equ 0x3f8 ; 0x3f8 is com1, 0x2f8 is com2, 0x3e8 is com3, 0x2e8 is com4, no irq's are used +;debug_com_base equ 0x3f8 ; 0x3f8 is com1, 0x2f8 is com2, 0x3e8 is com3, 0x2e8 is com4, no irq's are used ; The following constant, if nonzero, duplicates debug output to the screen. debug_direct_print equ 0 diff --git a/kernel/trunk/network/ARP.inc b/kernel/trunk/network/ARP.inc index 070c3f1ada..bd5679b260 100644 --- a/kernel/trunk/network/ARP.inc +++ b/kernel/trunk/network/ARP.inc @@ -177,7 +177,7 @@ ARP_input: inc [ARP_PACKETS_RX + 4*edi] ; update stats - DEBUGF 1,"ARP_input: got packet from %u.%u.%u.%u through device %u\n",\ + DEBUGF DEBUG_NETWORK_VERBOSE, "ARP_input: got packet from %u.%u.%u.%u through device %u\n",\ [edx + ARP_header.SenderIP]:1, [edx + ARP_header.SenderIP + 1]:1,\ [edx + ARP_header.SenderIP + 2]:1, [edx + ARP_header.SenderIP + 3]:1, edi @@ -194,7 +194,7 @@ ARP_input: cmp [edx + ARP_header.Opcode], ARP_REP_OPCODE jne .maybe_request - DEBUGF 1,"ARP_input: It's a reply\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "ARP_input: It's a reply\n" mov ecx, [NumARP] test ecx, ecx @@ -208,16 +208,16 @@ ARP_input: dec ecx jnz .loop - DEBUGF 1,"ARP_input: no matching entry found\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "ARP_input: no matching entry found\n" jmp .exit .gotit: - DEBUGF 1,"ARP_input: found matching entry\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "ARP_input: found matching entry\n" cmp [esi + ARP_entry.TTL], ARP_STATIC_ENTRY ; if it is a static entry, dont touch it je .exit - DEBUGF 1,"ARP_input: updating entry\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "ARP_input: updating entry\n" mov [esi + ARP_entry.Status], ARP_VALID_MAPPING mov [esi + ARP_entry.TTL], ARP_ENTRY_TTL @@ -236,7 +236,7 @@ ARP_input: cmp [edx + ARP_header.Opcode], ARP_REQ_OPCODE jne .exit - DEBUGF 1,"ARP_input: its a request\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "ARP_input: its a request\n" mov eax, [IP_LIST + 4*edi] cmp eax, [edx + ARP_header.TargetIP] ; Is it looking for my IP address? @@ -277,20 +277,20 @@ ARP_input: ; mov ax , ETHER_ARP ; It's already there, I'm sure of it! ; stosw - DEBUGF 1,"ARP_input: Sending reply\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "ARP_input: Sending reply\n" call [ebx + NET_DEVICE.transmit] ret .collision: inc [ARP_CONFLICTS + 4*edi] - DEBUGF 1,"ARP_input: IP address conflict detected!\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "ARP_input: IP address conflict detected!\n" .exit: call kernel_free add esp, 4 ; pop (balance stack) - DEBUGF 1,"ARP_input: exiting\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "ARP_input: exiting\n" ret @@ -310,7 +310,7 @@ ARP_output_request: pushd [IP_LIST + edi] ; SenderIP inc [ARP_PACKETS_TX + edi] ; assume we will succeed - DEBUGF 1,"ARP_output_request: ip=%u.%u.%u.%u\n",\ + DEBUGF DEBUG_NETWORK_VERBOSE, "ARP_output_request: ip=%u.%u.%u.%u\n",\ [esp + 4]:1, [esp + 5]:1, [esp + 6]:1, [esp + 7]:1 mov ebx, [NET_DRV_LIST + edi] ; device ptr @@ -344,7 +344,7 @@ ARP_output_request: pop eax ; DestIP stosd ; - DEBUGF 1,"ARP_output_request: device=%x\n", ebx + DEBUGF DEBUG_NETWORK_VERBOSE, "ARP_output_request: device=%x\n", ebx push edx ecx call [ebx + NET_DEVICE.transmit] @@ -352,7 +352,7 @@ ARP_output_request: .exit: add esp, 4 + 4 - DEBUGF 1,"ARP_output_request: failed\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "ARP_output_request: failed\n" sub eax, eax ret @@ -369,7 +369,7 @@ ARP_output_request: align 4 ARP_add_entry: - DEBUGF 1,"ARP_add_entry: " + DEBUGF DEBUG_NETWORK_VERBOSE, "ARP_add_entry: " mov ecx, [NumARP] cmp ecx, ARP_TABLE_SIZE ; list full ? @@ -400,12 +400,12 @@ ARP_add_entry: rep movsw inc [NumARP] sub edi, sizeof.ARP_entry - DEBUGF 1,"entry=%u\n", eax + DEBUGF DEBUG_NETWORK_VERBOSE, "entry=%u\n", eax ret .error: - DEBUGF 1,"failed\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "failed\n" mov eax, -1 ret @@ -421,8 +421,8 @@ ARP_add_entry: align 4 ARP_del_entry: - DEBUGF 1,"ARP_del_entry: entry=%x entrys=%u\n", esi, [NumARP] - DEBUGF 1,"ARP_del_entry: IP=%u.%u.%u.%u\n", \ + DEBUGF DEBUG_NETWORK_VERBOSE, "ARP_del_entry: entry=%x entrys=%u\n", esi, [NumARP] + DEBUGF DEBUG_NETWORK_VERBOSE, "ARP_del_entry: IP=%u.%u.%u.%u\n", \ [esi + ARP_entry.IP]:1, [esi + ARP_entry.IP + 1]:1, [esi + ARP_entry.IP + 2]:1, [esi + ARP_entry.IP + 3]:1 mov ecx, ARP_table + (ARP_TABLE_SIZE - 1) * sizeof.ARP_entry @@ -438,7 +438,7 @@ ARP_del_entry: rep stosw dec [NumARP] - DEBUGF 1,"ARP_del_entry: success\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "ARP_del_entry: success\n" ret @@ -463,9 +463,9 @@ ARP_del_entry: align 4 ARP_IP_to_MAC: - DEBUGF 1,"ARP_IP_to_MAC: %u.%u", al, ah + DEBUGF DEBUG_NETWORK_VERBOSE, "ARP_IP_to_MAC: %u.%u", al, ah rol eax, 16 - DEBUGF 1,".%u.%u\n", al, ah + DEBUGF DEBUG_NETWORK_VERBOSE, ".%u.%u\n", al, ah rol eax, 16 cmp eax, 0xffffffff @@ -485,7 +485,7 @@ ARP_IP_to_MAC: loop .scan_loop .not_in_list: - DEBUGF 1,"ARP_IP_to_MAC: preparing for ARP request\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "ARP_IP_to_MAC: preparing for ARP request\n" ;-------------------- ; Send an ARP request @@ -535,16 +535,16 @@ else end if .valid: - DEBUGF 1,"ARP_IP_to_MAC: found MAC\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "ARP_IP_to_MAC: found MAC\n" movzx eax, word[esi + ARP_entry.MAC] mov ebx, dword[esi + ARP_entry.MAC + 2] ret .full: - DEBUGF 1,"ARP_IP_to_MAC: table is full!\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "ARP_IP_to_MAC: table is full!\n" add esp, 8 .give_up: - DEBUGF 1,"ARP_IP_to_MAC: entry has no valid mapping!\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "ARP_IP_to_MAC: entry has no valid mapping!\n" mov eax, -1 ret diff --git a/kernel/trunk/network/IPv4.inc b/kernel/trunk/network/IPv4.inc index 2cc0449d52..352fc10bfe 100644 --- a/kernel/trunk/network/IPv4.inc +++ b/kernel/trunk/network/IPv4.inc @@ -112,7 +112,7 @@ local .loop, .next jmp .done .died: - DEBUGF 2,"IPv4 Fragment slot timed-out!\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "IPv4 Fragment slot timed-out!\n" ;;; TODO: clear all entry's of timed-out slot jmp .next @@ -205,10 +205,10 @@ macro IPv4_checksum ptr { align 4 IPv4_input: ; TODO: add IPv4 raw sockets support - DEBUGF 2,"IPv4_input, packet from: %u.%u.%u.%u ",\ + DEBUGF DEBUG_NETWORK_VERBOSE, "IPv4_input, packet from: %u.%u.%u.%u ",\ [edx + IPv4_header.SourceAddress + 0]:1,[edx + IPv4_header.SourceAddress + 1]:1,\ [edx + IPv4_header.SourceAddress + 2]:1,[edx + IPv4_header.SourceAddress + 3]:1 - DEBUGF 2,"to: %u.%u.%u.%u\n",\ + DEBUGF DEBUG_NETWORK_VERBOSE, "to: %u.%u.%u.%u\n",\ [edx + IPv4_header.DestinationAddress + 0]:1,[edx + IPv4_header.DestinationAddress + 1]:1,\ [edx + IPv4_header.DestinationAddress + 2]:1,[edx + IPv4_header.DestinationAddress + 3]:1 @@ -218,7 +218,7 @@ IPv4_input: ; TODO: add IPv4 IPv4_checksum edx jnz .dump ; if checksum isn't valid then dump packet - DEBUGF 1,"IPv4_input: Checksum ok\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "IPv4_input: Checksum ok\n" ;----------------------------------- ; Check if destination IP is correct @@ -256,7 +256,7 @@ IPv4_input: ; TODO: add IPv4 ; or it's just not meant for us.. :( - DEBUGF 2,"IPv4_input: Destination address does not match!\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "IPv4_input: Destination address does not match!\n" jmp .dump ;------------------------ @@ -300,10 +300,10 @@ IPv4_input: ; TODO: add IPv4 cmp al, IP_PROTO_ICMP je ICMP_input - DEBUGF 2,"IPv4_input: unknown protocol %u\n", al + DEBUGF DEBUG_NETWORK_VERBOSE, "IPv4_input: unknown protocol %u\n", al .dump: - DEBUGF 1,"IPv4_input: dumping\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "IPv4_input: dumping\n" inc [IP_packets_dumped] ; FIXME: use correct interface call kernel_free add esp, 4 ; pop (balance stack) @@ -319,7 +319,7 @@ IPv4_input: ; TODO: add IPv4 xchg al, ah shl ax, 3 - DEBUGF 1,"IPv4_input: fragmented packet offset=%u id=%x\n", ax, [edx + IPv4_header.Identification]:4 + DEBUGF DEBUG_NETWORK_VERBOSE, "IPv4_input: fragmented packet offset=%u id=%x\n", ax, [edx + IPv4_header.Identification]:4 test ax, ax ; Is this the first packet of the fragment? jz .is_first_fragment @@ -328,7 +328,7 @@ IPv4_input: ; TODO: add IPv4 ;------------------------------------------------------- ; We have a fragmented IP packet, but it's not the first - DEBUGF 1,"IPv4_input: Middle fragment packet received!\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "IPv4_input: Middle fragment packet received!\n" call IPv4_find_fragment_slot cmp esi, -1 @@ -361,7 +361,7 @@ IPv4_input: ; TODO: add IPv4 ; We have received the first fragment .is_first_fragment: - DEBUGF 1,"IPv4_input: First fragment packet received!\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "IPv4_input: First fragment packet received!\n" ; try to locate a free slot.. mov ecx, MAX_FRAGMENTS mov esi, FRAGMENT_LIST @@ -395,7 +395,7 @@ IPv4_input: ; TODO: add IPv4 ; We have received the last fragment .is_last_fragment: - DEBUGF 1,"IPv4_input: Last fragment packet received!\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "IPv4_input: Last fragment packet received!\n" call IPv4_find_fragment_slot cmp esi, -1 @@ -411,12 +411,12 @@ IPv4_input: ; TODO: add IPv4 jne .destroy_slot_pop ; Damn, something screwed up, remove the whole slot (and free buffers too if possible!) mov cx, [esi + sizeof.FRAGMENT_entry + IPv4_header.TotalLength] ; Add total length xchg cl, ch - DEBUGF 1,"IPv4_input: Packet size=%u\n", cx + DEBUGF DEBUG_NETWORK_VERBOSE, "IPv4_input: Packet size=%u\n", cx add ax, cx movzx cx, [esi + sizeof.FRAGMENT_entry + IPv4_header.VersionAndIHL] ; Sub Header length and cx, 0x000F shl cx, 2 - DEBUGF 1,"IPv4_input: Header size=%u\n", cx + DEBUGF DEBUG_NETWORK_VERBOSE, "IPv4_input: Header size=%u\n", cx sub ax, cx mov edi, esi mov esi, [esi + FRAGMENT_entry.NextPtr] @@ -431,9 +431,9 @@ IPv4_input: ; TODO: add IPv4 mov cx, [edx + IPv4_header.TotalLength] ; Note: This time we dont substract Header length xchg cl, ch - DEBUGF 1,"IPv4_input: Packet size=%u\n", cx + DEBUGF DEBUG_NETWORK_VERBOSE, "IPv4_input: Packet size=%u\n", cx add ax, cx - DEBUGF 1,"IPv4_input: Total Received data size=%u\n", eax + DEBUGF DEBUG_NETWORK_VERBOSE, "IPv4_input: Total Received data size=%u\n", eax push eax mov ax, [edx + IPv4_header.FlagsAndFragmentOffset] @@ -441,7 +441,7 @@ IPv4_input: ; TODO: add IPv4 shl ax, 3 add cx, ax pop eax - DEBUGF 1,"IPv4_input: Total Fragment size=%u\n", ecx + DEBUGF DEBUG_NETWORK_VERBOSE, "IPv4_input: Total Fragment size=%u\n", ecx cmp ax, cx jne .destroy_slot_pop @@ -457,7 +457,7 @@ IPv4_input: ; TODO: add IPv4 movzx ecx, [edx + sizeof.FRAGMENT_entry + IPv4_header.FlagsAndFragmentOffset] ; Calculate the fragment offset xchg cl, ch ; intel byte order shl cx, 3 ; multiply by 8 and clear first 3 bits - DEBUGF 1,"IPv4_input: Fragment offset=%u\n", cx + DEBUGF DEBUG_NETWORK_VERBOSE, "IPv4_input: Fragment offset=%u\n", cx lea edi, [eax + ecx] ; Notice that edi will be equal to eax for first fragment movzx ebx, [edx + sizeof.FRAGMENT_entry + IPv4_header.VersionAndIHL] ; Find header size (in ebx) of fragment @@ -504,7 +504,7 @@ IPv4_input: ; TODO: add IPv4 .destroy_slot_pop: add esp, 4 .destroy_slot: - DEBUGF 1,"IPv4_input: Destroy fragment slot!\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "IPv4_input: Destroy fragment slot!\n" ; TODO! jmp .dump @@ -568,7 +568,7 @@ IPv4_find_fragment_slot: align 4 IPv4_output: - DEBUGF 1,"IPv4_output: size=%u\n", ecx + DEBUGF DEBUG_NETWORK_VERBOSE, "IPv4_output: size=%u\n", ecx cmp ecx, 65500 ; Max IPv4 packet size ja .too_large @@ -614,23 +614,23 @@ IPv4_output: IPv4_checksum edi add edi, sizeof.IPv4_header - DEBUGF 2,"IPv4_output: success!\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "IPv4_output: success!\n" ret .eth_error: - DEBUGF 2,"IPv4_output: ethernet error\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "IPv4_output: ethernet error\n" add esp, 3*4+2+6 xor edi, edi ret .arp_error: - DEBUGF 2,"IPv4_output: ARP error=%x\n", eax + DEBUGF DEBUG_NETWORK_VERBOSE, "IPv4_output: ARP error=%x\n", eax add esp, 3*4+2 xor edi, edi ret .too_large: - DEBUGF 2,"IPv4_output: Packet too large!\n" + DEBUGF DEBUG_NETWORK_ERROR, "IPv4_output: Packet too large!\n" xor edi, edi ret @@ -713,7 +713,7 @@ IPv4_output_raw: IPv4_checksum edi ;;;; todo: checksum for IP packet with options! add edi, sizeof.IPv4_header - DEBUGF 2,"IPv4_output_raw: device=%x\n", ebx + DEBUGF DEBUG_NETWORK_VERBOSE, "IPv4_output_raw: device=%x\n", ebx call [ebx + NET_DEVICE.transmit] ret @@ -722,7 +722,7 @@ IPv4_output_raw: .arp_error: add esp, 8+4+4 .too_large: - DEBUGF 2,"IPv4_output_raw: Failed\n" + DEBUGF DEBUG_NETWORK_ERROR, "IPv4_output_raw: Failed\n" sub edi, edi ret @@ -742,7 +742,7 @@ IPv4_output_raw: align 4 IPv4_fragment: - DEBUGF 1,"IPv4_fragment\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "IPv4_fragment\n" and ecx, not 111b ; align 4 @@ -770,7 +770,7 @@ IPv4_fragment: push dword 0 ; offset .new_fragment: - DEBUGF 1,"Ipv4_fragment: new fragment" + DEBUGF DEBUG_NETWORK_VERBOSE, "Ipv4_fragment: new fragment" mov eax, [esp + 3*4] @@ -792,7 +792,7 @@ IPv4_fragment: add esi, [esp] ; offset mov ecx, [esp + 1*4] - DEBUGF 1,"IPv4_fragment: copying %u bytes\n", ecx + DEBUGF DEBUG_NETWORK_VERBOSE, "IPv4_fragment: copying %u bytes\n", ecx rep movsb ; now, correct header @@ -829,7 +829,7 @@ IPv4_fragment: sub ecx, [esp+2*4] ; ptr to ip header add ecx, [esp] ; offset - DEBUGF 1,"Ipv4_fragment: %u bytes remaining\n", ecx + DEBUGF DEBUG_NETWORK_VERBOSE, "Ipv4_fragment: %u bytes remaining\n", ecx cmp ecx, [esp+1*4] jae .new_fragment @@ -838,11 +838,11 @@ IPv4_fragment: jmp .new_fragment .err: - DEBUGF 1,"Ipv4_fragment: failed\n" + DEBUGF DEBUG_NETWORK_ERROR, "Ipv4_fragment: failed\n" .done: add esp, 12 + 4 + 6 .err2: - DEBUGF 1,"Ipv4_fragment: dumping\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "Ipv4_fragment: dumping\n" call kernel_free add esp, 4 @@ -886,7 +886,7 @@ IPv4_route: mov eax, [GATEWAY_LIST] .found_it: - DEBUGF 1,"IPv4_dest_to_dev: %u\n", edi + DEBUGF DEBUG_NETWORK_VERBOSE, "IPv4_route: %u\n", edi ret .broadcast: diff --git a/kernel/trunk/network/IPv6.inc b/kernel/trunk/network/IPv6.inc index 1f28e5781b..ce152f7a9e 100644 --- a/kernel/trunk/network/IPv6.inc +++ b/kernel/trunk/network/IPv6.inc @@ -83,7 +83,7 @@ macro IPv6_init { align 4 IPv6_input: - DEBUGF 2,"IPv6_input from: %x%x:%x%x:%x%x:%x%x:%x%x:%x%x:%x%x:%x%x\n",\ + DEBUGF DEBUG_NETWORK_VERBOSE, "IPv6_input from: %x%x:%x%x:%x%x:%x%x:%x%x:%x%x:%x%x:%x%x\n",\ [edx + IPv6_header.SourceAddress + 0]:2,[edx + IPv6_header.SourceAddress + 1]:2,\ [edx + IPv6_header.SourceAddress + 2]:2,[edx + IPv6_header.SourceAddress + 3]:2,\ [edx + IPv6_header.SourceAddress + 4]:2,[edx + IPv6_header.SourceAddress + 5]:2,\ @@ -93,7 +93,7 @@ IPv6_input: [edx + IPv6_header.SourceAddress + 12]:2,[edx + IPv6_header.SourceAddress + 13]:2,\ [edx + IPv6_header.SourceAddress + 14]:2,[edx + IPv6_header.SourceAddress + 15]:2 - DEBUGF 1,"IPv6_input to: %x%x:%x%x:%x%x:%x%x:%x%x:%x%x:%x%x:%x%x\n",\ + DEBUGF DEBUG_NETWORK_VERBOSE, "IPv6_input to: %x%x:%x%x:%x%x:%x%x:%x%x:%x%x:%x%x:%x%x\n",\ [edx + IPv6_header.DestinationAddress + 0]:2,[edx + IPv6_header.DestinationAddress + 1]:2,\ [edx + IPv6_header.DestinationAddress + 2]:2,[edx + IPv6_header.DestinationAddress + 3]:2,\ [edx + IPv6_header.DestinationAddress + 4]:2,[edx + IPv6_header.DestinationAddress + 5]:2,\ @@ -143,10 +143,10 @@ IPv6_input: ; cmp al, 58 ; je ICMP6_input - DEBUGF 2,"IPv6_input - unknown protocol: %u\n", al + DEBUGF DEBUG_NETWORK_VERBOSE, "IPv6_input - unknown protocol: %u\n", al .dump: - DEBUGF 1,"IPv6_input - dumping\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "IPv6_input - dumping\n" call kernel_free add esp, 4 @@ -166,7 +166,7 @@ IPv6_input: ; Hop-by-Hop .hop_by_hop: - DEBUGF 1,"IPv6_input - hop by hop\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "IPv6_input - hop by hop\n" pushw [esi] ; 8 bit identifier for option type movzx eax, byte[esi + 1] ; Hdr Ext Len inc eax ; first 8 octets not counted @@ -195,7 +195,7 @@ IPv6_input: .pad_n: movzx eax, byte[esi + 1] - DEBUGF 1,"IPv6_input - pad %u\n", eax + DEBUGF DEBUG_NETWORK_VERBOSE, "IPv6_input - pad %u\n", eax inc esi inc esi add esi, eax @@ -203,7 +203,7 @@ IPv6_input: jmp .hop_by_hop .pad_1: - DEBUGF 1,"IPv6_input - pad 1\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "IPv6_input - pad 1\n" inc esi dec ecx jmp .hop_by_hop @@ -211,11 +211,11 @@ IPv6_input: .dest_opts: - DEBUGF 1,"IPv6_input - dest opts\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "IPv6_input - dest opts\n" jmp .nextheader .routing: - DEBUGF 1,"IPv6_input - routing\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "IPv6_input - routing\n" pushw [esi] ; 8 bit identifier for option type movzx eax, byte[esi + 1] ; Hdr Ext Len inc eax ; first 8 octets not counted @@ -238,7 +238,7 @@ IPv6_input: jmp .nextheader .fragment: - DEBUGF 1,"IPv6_input - fragment\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "IPv6_input - fragment\n" jmp .nextheader diff --git a/kernel/trunk/network/PPPoE.inc b/kernel/trunk/network/PPPoE.inc index f2ff64717e..ad9995bd8e 100644 --- a/kernel/trunk/network/PPPoE.inc +++ b/kernel/trunk/network/PPPoE.inc @@ -59,7 +59,7 @@ macro PPPoE_init { align 4 PPPoE_discovery_input: - DEBUGF 2,"PPPoE_discovery_input\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "PPPoE_discovery_input\n" ; First, find open PPPoE socket @@ -84,7 +84,7 @@ PPPoE_discovery_input: jmp SOCKET_input .dump: - DEBUGF 1,'PPPoE_discovery_input: dumping\n' + DEBUGF DEBUG_NETWORK_VERBOSE, 'PPPoE_discovery_input: dumping\n' call kernel_free add esp, 4 ret @@ -103,7 +103,7 @@ PPPoE_discovery_input: align 4 PPPoE_discovery_output: - DEBUGF 2,"PPPoE_discovery_output: socket=%x buffer=%x size=%d\n", eax, esi, ecx + DEBUGF DEBUG_NETWORK_VERBOSE, "PPPoE_discovery_output: socket=%x buffer=%x size=%d\n", eax, esi, ecx ; RFC2516: An entire PADI packet (including the PPPoE header) MUST NOT ; exceed 1484 octets. @@ -123,7 +123,7 @@ PPPoE_discovery_output: cmp [ebx + NET_DEVICE.type], NET_TYPE_ETH jne .bad - DEBUGF 2,"PPPoE_discovery_output: device=%x\n", ebx + DEBUGF DEBUG_NETWORK_VERBOSE, "PPPoE_discovery_output: device=%x\n", ebx ; Create packet. push ecx esi @@ -193,7 +193,7 @@ PPPoE_session_input: xchg cl, ch mov ax, [edx + PPPoE_frame.SessionID] - DEBUGF 2,"PPPoE_input: session ID=%x, length=%u\n", ax, cx + DEBUGF DEBUG_NETWORK_VERBOSE, "PPPoE_input: session ID=%x, length=%u\n", ax, cx cmp ax, [PPPoE_SID] jne .dump @@ -207,10 +207,10 @@ PPPoE_session_input: ; je IPv6_input jmp PPPoE_discovery_input ; Send LCP,CHAP,CBCP,... packets to the PPP dialer - DEBUGF 2,"PPPoE_input: Unknown protocol=%x\n", ax + DEBUGF DEBUG_NETWORK_VERBOSE, "PPPoE_input: Unknown protocol=%x\n", ax .dump: - DEBUGF 2,"PPPoE_input: dumping\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "PPPoE_input: dumping\n" call kernel_free add esp, 4 ret @@ -238,7 +238,7 @@ PPPoE_session_input: align 4 PPPoE_output: - DEBUGF 1,"PPPoE_output: size=%u device=%x\n", ecx, ebx + DEBUGF DEBUG_NETWORK_VERBOSE, "PPPoE_output: size=%u device=%x\n", ecx, ebx pushw di pushw [PPPoE_SID] @@ -263,7 +263,7 @@ PPPoE_output: sub ecx, 2 add edi, PPPoE_frame.Payload + 2 - DEBUGF 1,"PPPoE_output: success!\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "PPPoE_output: success!\n" ret @@ -276,7 +276,7 @@ PPPoE_output: PPPoE_start_connection: - DEBUGF 2,"PPPoE_start_connection: %x\n", cx + DEBUGF DEBUG_NETWORK_VERBOSE, "PPPoE_start_connection: %x\n", cx cmp [PPPoE_SID], 0 jne .fail @@ -296,7 +296,7 @@ PPPoE_start_connection: align 4 PPPoE_stop_connection: - DEBUGF 2,"PPPoE_stop_connection\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "PPPoE_stop_connection\n" xor eax, eax mov [PPPoE_SID], ax diff --git a/kernel/trunk/network/ethernet.inc b/kernel/trunk/network/ethernet.inc index f34a29ab41..955bd708ee 100644 --- a/kernel/trunk/network/ethernet.inc +++ b/kernel/trunk/network/ethernet.inc @@ -56,7 +56,7 @@ ETH_input: mov eax, [esp] mov ecx, [esp+4] - DEBUGF 1,"ETH_input: size=%u\n", ecx + DEBUGF DEBUG_NETWORK_VERBOSE,"ETH_input: size=%u\n", ecx cmp ecx, ETH_FRAME_MINIMUM jb .dump sub ecx, sizeof.ETH_header @@ -79,10 +79,10 @@ ETH_input: cmp ax, ETHER_PPP_SESSION je PPPoE_session_input - DEBUGF 2,"ETH_input: Unknown packet type=%x\n", ax + DEBUGF DEBUG_NETWORK_ERROR, "ETH_input: Unknown packet type=%x\n", ax .dump: - DEBUGF 2,"ETH_input: dumping\n" + DEBUGF DEBUG_NETWORK_VERBOSE,"ETH_input: dumping\n" call kernel_free add esp, 4 ret @@ -107,7 +107,7 @@ ETH_input: align 4 ETH_output: - DEBUGF 1,"ETH_output: size=%u device=%x\n", ecx, ebx + DEBUGF DEBUG_NETWORK_VERBOSE, "ETH_output: size=%u device=%x\n", ecx, ebx cmp ecx, [ebx + NET_DEVICE.mtu] ja .exit @@ -137,7 +137,7 @@ ETH_output: cmp edx, ETH_FRAME_MINIMUM jbe .adjust_size .done: - DEBUGF 1,"ETH_output: ptr=%x size=%u\n", eax, edx + DEBUGF DEBUG_NETWORK_VERBOSE, "ETH_output: ptr=%x size=%u\n", eax, edx ret .adjust_size: @@ -146,13 +146,13 @@ ETH_output: jmp .done .out_of_ram: - DEBUGF 2,"ETH_output: Out of ram!\n" + DEBUGF DEBUG_NETWORK_ERROR, "ETH_output: Out of ram!\n" add esp, 4+4+2+4 sub edi, edi ret .exit: - DEBUGF 2,"ETH_output: Packet too large!\n" + DEBUGF DEBUG_NETWORK_ERROR, "ETH_output: Packet too large!\n" sub edi, edi ret diff --git a/kernel/trunk/network/icmp.inc b/kernel/trunk/network/icmp.inc index 9ef776eae8..218cf96d72 100644 --- a/kernel/trunk/network/icmp.inc +++ b/kernel/trunk/network/icmp.inc @@ -38,8 +38,8 @@ ICMP_UNREACH_HOST_PROHIB = 10 ; ditto ICMP_UNREACH_TOSNET = 11 ; bad tos for net ICMP_UNREACH_TOSHOST = 12 ; bad tos for host ICMP_UNREACH_FILTER_PROHIB = 13 ; admin prohib -ICMP_UNREACH_HOST_PRECEDENCE = 14 ; host prec vio. -ICMP_UNREACH_PRECEDENCE_CUTOFF = 15 ; prec cutoff +ICMP_UNREACH_HOST_PRECEDENCE = 14 ; host prec vio. +ICMP_UNREACH_PRECEDENCE_CUTOFF = 15 ; prec cutoff ICMP_SOURCEQUENCH = 4 ; Packet lost, slow down @@ -142,7 +142,7 @@ macro ICMP_init { align 4 ICMP_input: - DEBUGF 1,"ICMP_input:\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "ICMP_input:\n" ; First, check the checksum (altough some implementations ignore it) @@ -163,7 +163,7 @@ ICMP_input: ; We well re-use the packet so we can create the response as fast as possible ; Notice: this only works on pure ethernet - DEBUGF 1,"got echo request\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "got echo request\n" mov [edx + ICMP_header.Type], ICMP_ECHOREPLY ; Change Packet type to reply mov esi, [esp] ; Start of buffer @@ -258,7 +258,7 @@ ICMP_input: ; je .dump ; inc [ICMP_PACKETS_RX+edi] - DEBUGF 1,"socket=%x\n", eax + DEBUGF DEBUG_NETWORK_VERBOSE, "socket=%x\n", eax pusha lea ecx, [eax + SOCKET.mutex] @@ -270,10 +270,10 @@ ICMP_input: .checksum_mismatch: - DEBUGF 1,"checksum mismatch\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "checksum mismatch\n" .dump: - DEBUGF 1,"ICMP_input: dumping\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "ICMP_input: dumping\n" call kernel_free add esp, 4 ; pop (balance stack) @@ -297,7 +297,7 @@ ICMP_input: align 4 ICMP_output: - DEBUGF 1,"Creating ICMP Packet\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "Creating ICMP Packet\n" push esi edi dx @@ -308,7 +308,7 @@ ICMP_output: call IPv4_output jz .exit - DEBUGF 1,"full icmp packet size: %u\n", edx + DEBUGF DEBUG_NETWORK_VERBOSE, "full icmp packet size: %u\n", edx pop word [edi + ICMP_header.Type] ; Write both type and code bytes at once pop dword [edi + ICMP_header.Identifier] ; identifier and sequence number @@ -333,11 +333,11 @@ ICMP_output: sub edi, edx ;;; TODO: find a better way to remember start of packet push edx edi - DEBUGF 1,"Sending ICMP Packet\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "Sending ICMP Packet\n" call [ebx + NET_DEVICE.transmit] ret .exit: - DEBUGF 1,"Creating ICMP Packet failed\n" + DEBUGF DEBUG_NETWORK_ERROR, "Creating ICMP Packet failed\n" add esp, 2*4 + 2 ret @@ -356,7 +356,7 @@ ICMP_output: align 4 ICMP_output_raw: - DEBUGF 1,"Creating ICMP Packet for socket %x, data ptr=%x\n", eax, edx + DEBUGF DEBUG_NETWORK_VERBOSE, "Creating ICMP Packet for socket %x, data ptr=%x\n", eax, edx push edx @@ -371,7 +371,7 @@ ICMP_output_raw: push eax push edi ecx - DEBUGF 1,"copying %u bytes from %x to %x\n", ecx, esi, edi + DEBUGF DEBUG_NETWORK_VERBOSE, "copying %u bytes from %x to %x\n", ecx, esi, edi rep movsb pop ecx edi @@ -383,11 +383,11 @@ ICMP_output_raw: call checksum_2 mov [edi + ICMP_header.Checksum], dx - DEBUGF 1,"Sending ICMP Packet\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "Sending ICMP Packet\n" call [ebx + NET_DEVICE.transmit] ret .exit: - DEBUGF 1,"Creating ICMP Packet failed\n" + DEBUGF DEBUG_NETWORK_ERROR, "Creating ICMP Packet failed\n" add esp, 4 ret diff --git a/kernel/trunk/network/loopback.inc b/kernel/trunk/network/loopback.inc index e8f9eb42cf..eb3b619e48 100644 --- a/kernel/trunk/network/loopback.inc +++ b/kernel/trunk/network/loopback.inc @@ -59,7 +59,7 @@ LOOP_input: push ecx push eax - DEBUGF 1,"LOOP_input: size=%u\n", ecx + DEBUGF DEBUG_NETWORK_VERBOSE, "LOOP_input: size=%u\n", ecx lea edx, [eax + 2] mov ax, word[eax] mov ebx, LOOPBACK_DEVICE @@ -67,10 +67,10 @@ LOOP_input: cmp ax, ETHER_IPv4 je IPv4_input - DEBUGF 2,"LOOP_input: Unknown packet type=%x\n", ax + DEBUGF DEBUG_NETWORK_VERBOSE, "LOOP_input: Unknown packet type=%x\n", ax .dump: - DEBUGF 2,"LOOP_input: dumping\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "LOOP_input: dumping\n" call kernel_free add esp, 4 ret @@ -93,7 +93,7 @@ LOOP_input: align 4 LOOP_output: - DEBUGF 1,"LOOP_output\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "LOOP_output\n" push ecx push di @@ -114,11 +114,11 @@ LOOP_output: mov ebx, LOOPBACK_DEVICE .done: - DEBUGF 2,"LOOP_output: ptr=%x size=%u\n", eax, edx + DEBUGF DEBUG_NETWORK_VERBOSE, "LOOP_output: ptr=%x size=%u\n", eax, edx ret .out_of_ram: - DEBUGF 2,"LOOP_output: failed\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "LOOP_output: failed\n" add esp, 2+4 sub edi, edi ret diff --git a/kernel/trunk/network/socket.inc b/kernel/trunk/network/socket.inc index 454999da3c..0c755b303e 100644 --- a/kernel/trunk/network/socket.inc +++ b/kernel/trunk/network/socket.inc @@ -263,7 +263,7 @@ sys_socket: .number = ($ - .table) / 4 - 1 s_error: - DEBUGF 2,"SOCKET: error\n" + DEBUGF DEBUG_NETWORK_ERROR, "SOCKET: error\n" mov dword [esp+32], -1 ret @@ -281,7 +281,7 @@ s_error: align 4 SOCKET_open: - DEBUGF 2,"SOCKET_open: domain=%u type=%u protocol=%x ", ecx, edx, esi + DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_open: domain=%u type=%u protocol=%x ", ecx, edx, esi push ecx edx esi call SOCKET_alloc @@ -289,7 +289,7 @@ SOCKET_open: jz s_error mov [esp+32], edi ; return socketnumber - DEBUGF 2,"socknum=%u\n", edi + DEBUGF DEBUG_NETWORK_VERBOSE, "socknum=%u\n", edi ; push edx ; and edx, SO_NONBLOCK @@ -321,7 +321,7 @@ SOCKET_open: je .pppoe .no_ppp: - DEBUGF 2,"Unknown socket family/protocol\n" + DEBUGF DEBUG_NETWORK_ERROR, "SOCKET_open: Unknown socket family/protocol\n" ret align 4 @@ -394,7 +394,7 @@ align 4 align 4 SOCKET_bind: - DEBUGF 2,"SOCKET_bind: socknum=%u sockaddr=%x length=%u\n", ecx, edx, esi + DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_bind: socknum=%u sockaddr=%x length=%u\n", ecx, edx, esi call SOCKET_num_to_ptr jz s_error @@ -444,7 +444,7 @@ SOCKET_bind: call SOCKET_check_port jz s_error ; ZF is set by socket_check_port, on error - DEBUGF 1,"SOCKET_bind: local ip=%u.%u.%u.%u\n",\ + DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_bind: local ip=%u.%u.%u.%u\n",\ [eax + IP_SOCKET.LocalIP + 0]:1,[eax + IP_SOCKET.LocalIP + 1]:1,\ [eax + IP_SOCKET.LocalIP + 2]:1,[eax + IP_SOCKET.LocalIP + 3]:1 @@ -467,7 +467,7 @@ SOCKET_bind: align 4 SOCKET_connect: - DEBUGF 2,"SOCKET_connect: socknum=%u sockaddr=%x length=%u\n", ecx, edx, esi + DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_connect: socknum=%u sockaddr=%x length=%u\n", ecx, edx, esi call SOCKET_num_to_ptr jz s_error @@ -616,7 +616,7 @@ align 4 align 4 SOCKET_listen: - DEBUGF 2,"SOCKET_listen: socknum=%u backlog=%u\n", ecx, edx + DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_listen: socknum=%u backlog=%u\n", ecx, edx call SOCKET_num_to_ptr jz s_error @@ -668,7 +668,7 @@ SOCKET_listen: align 4 SOCKET_accept: - DEBUGF 2,"SOCKET_accept: socknum=%u sockaddr=%x length=%u\n", ecx, edx, esi + DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_accept: socknum=%u sockaddr=%x length=%u\n", ecx, edx, esi call SOCKET_num_to_ptr jz s_error @@ -718,7 +718,7 @@ SOCKET_accept: align 4 SOCKET_close: - DEBUGF 2,"SOCKET_close: socknum=%u\n", ecx + DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_close: socknum=%u\n", ecx call SOCKET_num_to_ptr jz s_error @@ -767,7 +767,7 @@ SOCKET_close: align 4 SOCKET_receive: - DEBUGF 2,"SOCKET_receive: socknum=%u bufaddr=%x buflength=%u flags=%x\n", ecx, edx, esi, edi + DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_receive: socknum=%u bufaddr=%x buflength=%u flags=%x\n", ecx, edx, esi, edi call SOCKET_num_to_ptr jz s_error @@ -778,7 +778,7 @@ SOCKET_receive: align 4 SOCKET_receive_dgram: - DEBUGF 1,"SOCKET_receive: DGRAM\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_receive: DGRAM\n" mov ebx, esi mov edi, edx ; addr to buffer @@ -787,14 +787,14 @@ SOCKET_receive_dgram: get_from_queue (eax + SOCKET_QUEUE_LOCATION), SOCKET_QUEUE_SIZE, sizeof.socket_queue_entry, .block ; destroys esi and ecx mov ecx, [esi + socket_queue_entry.data_size] - DEBUGF 1,"SOCKET_receive: %u bytes data\n", ecx + DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_receive: %u bytes data\n", ecx cmp ecx, ebx ja .too_small push [esi + socket_queue_entry.buf_ptr] ; save the buffer addr so we can clear it later mov esi, [esi + socket_queue_entry.data_ptr] - DEBUGF 1,"SOCKET_receive: Source buffer=%x real addr=%x\n", [esp], esi + DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_receive: Source buffer=%x real addr=%x\n", [esp], esi mov [esp+32+4], ecx ; return number of bytes copied ; copy the data @@ -816,7 +816,7 @@ SOCKET_receive_dgram: .too_small: - DEBUGF 2,"SOCKET_receive: Buffer too small\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_receive: Buffer too small\n" jmp s_error .block: @@ -846,7 +846,7 @@ SOCKET_receive_local: align 4 SOCKET_receive_stream: - DEBUGF 1,"SOCKET_receive: STREAM\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_receive: STREAM\n" mov ebx, edi mov ecx, esi @@ -902,7 +902,7 @@ SOCKET_receive_stream: align 4 SOCKET_send: - DEBUGF 2,"SOCKET_send: socknum=%u data ptr=%x length=%u flags=%x\n", ecx, edx, esi, edi + DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_send: socknum=%u data ptr=%x length=%u flags=%x\n", ecx, edx, esi, edi call SOCKET_num_to_ptr jz s_error @@ -916,7 +916,7 @@ SOCKET_send: align 4 SOCKET_send_udp: - DEBUGF 1,"SOCKET_send: UDP\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_send: UDP\n" mov [esp+32], ecx call UDP_output @@ -928,7 +928,7 @@ SOCKET_send_udp: align 4 SOCKET_send_tcp: - DEBUGF 1,"SOCKET_send: TCP\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_send: TCP\n" push eax add eax, STREAM_SOCKET.snd @@ -944,7 +944,7 @@ SOCKET_send_tcp: align 4 SOCKET_send_ip: - DEBUGF 1,"SOCKET_send: IPv4\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_send: IPv4\n" mov [esp+32], ecx call IPv4_output_raw @@ -956,7 +956,7 @@ SOCKET_send_ip: align 4 SOCKET_send_icmp: - DEBUGF 1,"SOCKET_send: ICMP\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_send: ICMP\n" mov [esp+32], ecx call ICMP_output_raw @@ -968,7 +968,7 @@ SOCKET_send_icmp: align 4 SOCKET_send_pppoe: - DEBUGF 1,"SOCKET_send: PPPoE\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_send: PPPoE\n" mov [esp+32], ecx mov ebx, [eax + SOCKET.device] @@ -998,7 +998,7 @@ SOCKET_send_local: align 4 SOCKET_send_local_: - DEBUGF 1,"SOCKET_send: LOCAL\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_send: LOCAL\n" ; get the other side's socket and check if it still exists mov eax, [eax + SOCKET.device] @@ -1037,7 +1037,7 @@ SOCKET_send_local_: align 4 SOCKET_get_opt: - DEBUGF 2,"SOCKET_get_opt\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_get_opt\n" call SOCKET_num_to_ptr jz s_error @@ -1087,7 +1087,7 @@ SOCKET_get_opt: align 4 SOCKET_set_opt: - DEBUGF 2,"SOCKET_set_opt\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_set_opt\n" call SOCKET_num_to_ptr jz s_error @@ -1116,7 +1116,7 @@ SOCKET_set_opt: jz s_error mov [eax + SOCKET.device], edx - DEBUGF 1,"SOCKET_set_opt: Bound socket %x to device %x\n",eax, edx + DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_set_opt: Bound socket %x to device %x\n",eax, edx mov dword [esp+32], 0 ; success! ret @@ -1158,7 +1158,7 @@ SOCKET_set_opt: align 4 SOCKET_pair: - DEBUGF 2,"SOCKET_pair\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_pair\n" call SOCKET_alloc jz s_error @@ -1217,7 +1217,7 @@ SOCKET_pair: align 4 SOCKET_debug: - DEBUGF 1,"SOCKET_debug\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_debug\n" mov edi, edx @@ -1266,7 +1266,7 @@ SOCKET_debug: align 4 SOCKET_find_port: - DEBUGF 2,"SOCKET_find_port\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_find_port\n" push ebx esi ecx @@ -1327,7 +1327,7 @@ SOCKET_find_port: align 4 SOCKET_check_port: - DEBUGF 2,"SOCKET_check_port: " + DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_check_port: " mov ecx, [eax + SOCKET.Protocol] mov edx, [eax + IP_SOCKET.LocalIP] @@ -1347,11 +1347,11 @@ SOCKET_check_port: cmp [esi + UDP_SOCKET.LocalPort], bx jne .next_socket - DEBUGF 2,"local port %x already in use\n", bx ; FIXME: find a way to print big endian values with debugf + DEBUGF DEBUG_NETWORK_VERBOSE, "local port %x already in use\n", bx ; FIXME: find a way to print big endian values with debugf ret .port_ok: - DEBUGF 2,"local port %x is free\n", bx ; FIXME: find a way to print big endian values with debugf + DEBUGF DEBUG_NETWORK_VERBOSE, "local port %x is free\n", bx ; FIXME: find a way to print big endian values with debugf mov [eax + UDP_SOCKET.LocalPort], bx or bx, bx ; clear the zero-flag ret @@ -1378,7 +1378,7 @@ SOCKET_check_port: align 4 SOCKET_input: - DEBUGF 2,"SOCKET_input: socket=%x, data=%x size=%u\n", eax, esi, ecx + DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_input: socket=%x, data=%x size=%u\n", eax, esi, ecx mov [esp+4], ecx push esi @@ -1386,7 +1386,7 @@ SOCKET_input: add_to_queue (eax + SOCKET_QUEUE_LOCATION), SOCKET_QUEUE_SIZE, sizeof.socket_queue_entry, SOCKET_input.full - DEBUGF 1,"SOCKET_input: success\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_input: success\n" add esp, sizeof.socket_queue_entry pusha @@ -1397,7 +1397,7 @@ SOCKET_input: jmp SOCKET_notify .full: - DEBUGF 2,"SOCKET_input: socket %x is full!\n", eax + DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_input: socket %x is full!\n", eax pusha lea ecx, [eax + SOCKET.mutex] @@ -1424,7 +1424,7 @@ SOCKET_ring_create: stdcall create_ring_buffer, SOCKET_MAXDATA, PG_SW pop edx - DEBUGF 1,"SOCKET_ring_created: %x\n", eax + DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_ring_created: %x\n", eax pusha lea ecx, [esi + RING_BUFFER.mutex] @@ -1458,7 +1458,7 @@ SOCKET_ring_create: align 4 SOCKET_ring_write: - DEBUGF 1,"SOCKET_ring_write: ringbuff=%x ptr=%x size=%u\n", eax, esi, ecx + DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_ring_write: ringbuff=%x ptr=%x size=%u\n", eax, esi, ecx ; lock mutex pusha @@ -1474,7 +1474,7 @@ SOCKET_ring_write: mov ecx, edi .copy: mov edi, [eax + RING_BUFFER.write_ptr] - DEBUGF 2,"SOCKET_ring_write: %u bytes from %x to %x\n", ecx, esi, edi + DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_ring_write: %u bytes from %x to %x\n", ecx, esi, edi ; update write ptr push edi @@ -1532,7 +1532,7 @@ SOCKET_ring_write: align 4 SOCKET_ring_read: - DEBUGF 1,"SOCKET_ring_read: ringbuff=%x ptr=%x size=%u offset=%x\n", eax, edi, ecx, edx + DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_ring_read: ringbuff=%x ptr=%x size=%u offset=%x\n", eax, edi, ecx, edx pusha lea ecx, [eax + RING_BUFFER.mutex] @@ -1555,7 +1555,7 @@ SOCKET_ring_read: ja .less_data .copy: - DEBUGF 2,"SOCKET_ring_read: %u bytes from %x to %x\n", ecx, esi, edi + DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_ring_read: %u bytes from %x to %x\n", ecx, esi, edi push ecx shr ecx, 1 jnc .nb @@ -1578,7 +1578,7 @@ SOCKET_ring_read: call mutex_unlock ; TODO: check what registers this function actually destroys popa - DEBUGF 1,"SOCKET_ring_read: no data at all!\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_ring_read: no data at all!\n" xor ecx, ecx ret @@ -1602,7 +1602,7 @@ SOCKET_ring_read: align 4 SOCKET_ring_free: - DEBUGF 1,"SOCKET_ring_free: %u bytes from ring %x\n", ecx, eax + DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_ring_free: %u bytes from ring %x\n", ecx, eax push eax ecx lea ecx, [eax + RING_BUFFER.mutex] @@ -1627,7 +1627,7 @@ SOCKET_ring_free: ret .error: ; we could free all available bytes, but that would be stupid, i guess.. - DEBUGF 1,"SOCKET_ring_free: buffer=%x error!\n", eax + DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_ring_free: buffer=%x error!\n", eax add [eax + RING_BUFFER.size], ecx push eax @@ -1652,7 +1652,7 @@ SOCKET_ring_free: align 4 SOCKET_block: - DEBUGF 1,"SOCKET_block: %x\n", eax + DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_block: %x\n", eax pushf cli @@ -1667,14 +1667,14 @@ SOCKET_block: ; Remember the thread ID so we can wake it up again mov edx, [edx + TASKDATA.pid] - DEBUGF 1,"SOCKET_block: suspending thread: %u\n", edx + DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_block: suspending thread: %u\n", edx mov [eax + SOCKET.TID], edx pop edx call change_task popf - DEBUGF 1,"SOCKET_block: continueing\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_block: continueing\n" ret @@ -1692,7 +1692,7 @@ SOCKET_block: align 4 SOCKET_notify: - DEBUGF 1,"SOCKET_notify: %x\n", eax + DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_notify: %x\n", eax call SOCKET_check jz .error @@ -1728,7 +1728,7 @@ SOCKET_notify: shl ecx, 8 or [ecx + SLOT_BASE + APPDATA.event_mask], EVENT_NETWORK - DEBUGF 1,"SOCKET_notify: Raised a network event!\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_notify: Raised a network event!\n" jmp .done @@ -1756,7 +1756,7 @@ SOCKET_notify: ; Run the thread mov [esi + TASKDATA.state], 0 ; Running - DEBUGF 1,"SOCKET_notify: Unblocked socket!\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_notify: Unblocked socket!\n" .done: pop esi ecx eax @@ -1785,7 +1785,7 @@ SOCKET_alloc: push ebx stdcall kernel_alloc, SOCKETBUFFSIZE - DEBUGF 1, "SOCKET_alloc: ptr=%x\n", eax + DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_alloc: ptr=%x\n", eax or eax, eax jz .exit @@ -1821,7 +1821,7 @@ SOCKET_alloc: .last_socket: mov [last_socket_num], edi mov [eax + SOCKET.Number], edi - DEBUGF 1, "SOCKET_alloc: number=%u\n", edi + DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_alloc: number=%u\n", edi ; Fill in PID mov ebx, [TASK_BASE] @@ -1878,7 +1878,7 @@ SOCKET_alloc: align 4 SOCKET_free: - DEBUGF 1, "SOCKET_free: %x\n", eax + DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_free: %x\n", eax call SOCKET_check jz .error @@ -1906,7 +1906,7 @@ SOCKET_free: mov ebx, [eax + SOCKET.NextPtr] mov eax, [eax + SOCKET.PrevPtr] - DEBUGF 1, "SOCKET_free: linking socket %x to socket %x\n", eax, ebx + DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_free: linking socket %x to socket %x\n", eax, ebx test eax, eax jz @f @@ -1921,7 +1921,7 @@ SOCKET_free: call kernel_free pop ebx - DEBUGF 1, "SOCKET_free: success!\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_free: success!\n" .error: ret @@ -1939,7 +1939,7 @@ SOCKET_free: align 4 SOCKET_fork: - DEBUGF 1,"SOCKET_fork: %x\n", ebx + DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_fork: %x\n", ebx ; Exit if backlog queue is full mov eax, [ebx + SOCKET_QUEUE_LOCATION + queue.size] @@ -1971,7 +1971,7 @@ SOCKET_fork: .fail2: add esp, 4+4+4 .fail: - DEBUGF 1,"SOCKET_fork: failed\n" + DEBUGF DEBUG_NETWORK_ERROR, "SOCKET_fork: failed\n" xor eax, eax ret @@ -1990,7 +1990,7 @@ SOCKET_fork: align 4 SOCKET_num_to_ptr: - DEBUGF 1,"SOCKET_num_to_ptr: num=%u ", ecx + DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_num_to_ptr: num=%u ", ecx mov eax, net_sockets @@ -2003,11 +2003,11 @@ SOCKET_num_to_ptr: test eax, eax - DEBUGF 1,"ptr=%x\n", eax + DEBUGF DEBUG_NETWORK_VERBOSE, "ptr=%x\n", eax ret .error: - DEBUGF 1,"not found\n", eax + DEBUGF DEBUG_NETWORK_ERROR, "SOCKET_nuto_ptr: not found\n", eax ret @@ -2025,18 +2025,18 @@ SOCKET_num_to_ptr: align 4 SOCKET_ptr_to_num: - DEBUGF 1,"SOCKET_ptr_to_num: ptr=%x ", eax + DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_ptr_to_num: ptr=%x ", eax call SOCKET_check jz .error mov eax, [eax + SOCKET.Number] - DEBUGF 1,"num=%u\n", eax + DEBUGF DEBUG_NETWORK_VERBOSE, "num=%u\n", eax ret .error: - DEBUGF 1,"not found\n", eax + DEBUGF DEBUG_NETWORK_ERROR, "SOCKET_ptr_to_num: not found\n", eax ret @@ -2054,7 +2054,7 @@ SOCKET_ptr_to_num: align 4 SOCKET_check: - DEBUGF 1,"SOCKET_check: %x\n", eax + DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_check: %x\n", eax push ebx mov ebx, net_sockets @@ -2088,7 +2088,7 @@ SOCKET_check: align 4 SOCKET_check_owner: - DEBUGF 1,"SOCKET_check_owner: %x\n", eax + DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_check_owner: %x\n", eax push ebx mov ebx, [TASK_BASE] @@ -2116,7 +2116,7 @@ SOCKET_check_owner: align 4 SOCKET_process_end: - DEBUGF 1, "SOCKET_process_end: %x\n", edx + DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_process_end: %x\n", edx push ebx mov ebx, net_sockets @@ -2130,7 +2130,7 @@ SOCKET_process_end: cmp [ebx + SOCKET.PID], edx jne .next_socket - DEBUGF 1, "SOCKET_process_end: killing socket %x\n", ebx + DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_process_end: killing socket %x\n", ebx mov [ebx + SOCKET.PID], 0 mov eax, ebx @@ -2160,7 +2160,7 @@ SOCKET_process_end: align 4 SOCKET_is_connecting: - DEBUGF 1,"SOCKET_is_connecting: %x\n", eax + DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_is_connecting: %x\n", eax and [eax + SOCKET.options], not (SS_ISCONNECTED + SS_ISDISCONNECTING + SS_ISCONFIRMING) or [eax + SOCKET.options], SS_ISCONNECTING @@ -2181,7 +2181,7 @@ SOCKET_is_connecting: align 4 SOCKET_is_connected: - DEBUGF 1,"SOCKET_is_connected: %x\n", eax + DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_is_connected: %x\n", eax and [eax + SOCKET.options], not (SS_ISCONNECTING + SS_ISDISCONNECTING + SS_ISCONFIRMING) or [eax + SOCKET.options], SS_ISCONNECTED @@ -2203,7 +2203,7 @@ SOCKET_is_connected: align 4 SOCKET_is_disconnecting: - DEBUGF 1,"SOCKET_is_disconnecting: %x\n", eax + DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_is_disconnecting: %x\n", eax and [eax + SOCKET.options], not (SS_ISCONNECTING) or [eax + SOCKET.options], SS_ISDISCONNECTING + SS_CANTRCVMORE + SS_CANTSENDMORE @@ -2224,7 +2224,7 @@ SOCKET_is_disconnecting: align 4 SOCKET_is_disconnected: - DEBUGF 1,"SOCKET_is_disconnected: %x\n", eax + DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_is_disconnected: %x\n", eax and [eax + SOCKET.options], not (SS_ISCONNECTING + SS_ISCONNECTED + SS_ISDISCONNECTING) or [eax + SOCKET.options], SS_CANTRCVMORE + SS_CANTSENDMORE @@ -2257,7 +2257,7 @@ SOCKET_is_disconnected: align 4 SOCKET_cant_recv_more: - DEBUGF 1,"SOCKET_cant_recv_more: %x\n", eax + DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_cant_recv_more: %x\n", eax or [eax + SOCKET.options], SS_CANTRCVMORE @@ -2277,7 +2277,7 @@ SOCKET_cant_recv_more: align 4 SOCKET_cant_send_more: - DEBUGF 1,"SOCKET_cant_send_more: %x\n", eax + DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_cant_send_more: %x\n", eax or [eax + SOCKET.options], SS_CANTSENDMORE diff --git a/kernel/trunk/network/stack.inc b/kernel/trunk/network/stack.inc index a97f273f8e..4c7f465e43 100644 --- a/kernel/trunk/network/stack.inc +++ b/kernel/trunk/network/stack.inc @@ -28,6 +28,9 @@ uglobal net_tmr_count dw ? endg +DEBUG_NETWORK_ERROR = 1 +DEBUG_NETWORK_VERBOSE = 0 + MAX_NET_DEVICES = 16 ARP_BLOCK = 1 ; true or false @@ -305,12 +308,12 @@ stack_handler: align 4 NET_link_changed: - DEBUGF 1,"NET_link_changed device=0x%x status=0x%x\n", ebx, [ebx + NET_DEVICE.state] + DEBUGF DEBUG_NETWORK_VERBOSE, "NET_link_changed device=0x%x status=0x%x\n", ebx, [ebx + NET_DEVICE.state] align 4 NET_send_event: - DEBUGF 1,"NET_send_event\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "NET_send_event\n" ; Send event to all applications push edi ecx @@ -340,7 +343,7 @@ NET_send_event: align 4 NET_add_device: - DEBUGF 1,"NET_Add_Device: %x\n", ebx ;;; TODO: use mutex to lock net device list + DEBUGF DEBUG_NETWORK_VERBOSE, "NET_Add_Device: %x\n", ebx ;;; TODO: use mutex to lock net device list cmp [NET_RUNNING], MAX_NET_DEVICES jae .error @@ -384,12 +387,12 @@ NET_add_device: call NET_send_event - DEBUGF 1,"Device number: %u\n", eax + DEBUGF DEBUG_NETWORK_VERBOSE, "Device number: %u\n", eax ret .error: or eax, -1 - DEBUGF 2,"Adding network device failed\n" + DEBUGF DEBUG_NETWORK_ERROR, "Adding network device failed\n" ret @@ -407,7 +410,7 @@ NET_add_device: align 4 NET_set_default: - DEBUGF 1,"NET_set_default: device=%x\n", eax + DEBUGF DEBUG_NETWORK_VERBOSE, "NET_set_default: device=%x\n", eax cmp eax, MAX_NET_DEVICES jae .error @@ -417,12 +420,12 @@ NET_set_default: mov [NET_DEFAULT], eax - DEBUGF 1,"NET_set_default: succes\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "NET_set_default: succes\n" ret .error: or eax, -1 - DEBUGF 1,"NET_set_default: failed\n" + DEBUGF DEBUG_NETWORK_ERROR, "NET_set_default: failed\n" ret @@ -634,7 +637,7 @@ checksum_2: .not_zero: xchg dl, dh - DEBUGF 1,"Checksum: %x\n", dx + DEBUGF DEBUG_NETWORK_VERBOSE, "Checksum: %x\n", dx ret diff --git a/kernel/trunk/network/tcp_input.inc b/kernel/trunk/network/tcp_input.inc index 07f2433f53..c1fb8ef9ee 100644 --- a/kernel/trunk/network/tcp_input.inc +++ b/kernel/trunk/network/tcp_input.inc @@ -60,7 +60,7 @@ TCP_input: .fail: popf - DEBUGF 2, "TCP incoming queue is full, discarding packet!\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "TCP incoming queue is full, discarding packet!\n" inc [TCP_segments_missed] ; FIXME: use correct interface @@ -97,7 +97,7 @@ TCP_process_input: mov edi, [esi + TCP_queue_entry.ip_ptr] ; ptr to ipv4 source address, followed by ipv4 destination address mov esi, [esi + TCP_queue_entry.segment_ptr] ; change esi last - DEBUGF 1,"TCP_input: size=%u time=%d\n", ecx, [timer_ticks] + DEBUGF DEBUG_NETWORK_VERBOSE, "TCP_input: size=%u time=%d\n", ecx, [timer_ticks] mov edx, esi @@ -127,7 +127,7 @@ TCP_process_input: movzx eax, [edx + TCP_header.DataOffset] sub ecx, eax ; substract TCP header size from total segment size jb .drop_no_socket ; If total segment size is less then the advertised header size, drop packet - DEBUGF 1,"TCP_input: %u bytes of data\n", ecx + DEBUGF DEBUG_NETWORK_VERBOSE, "TCP_input: %u bytes of data\n", ecx ;------------------------------------------- ; Convert Big-endian values to little endian @@ -176,7 +176,7 @@ TCP_process_input: test ax, ax jnz .socket_loop .found_socket: ; ebx now contains the socketpointer - DEBUGF 1,"TCP_input: socket ptr=%x state=%u flags=%x\n", ebx, [ebx + TCP_SOCKET.t_state], [edx + TCP_header.Flags]:2 + DEBUGF DEBUG_NETWORK_VERBOSE, "TCP_input: socket ptr=%x state=%u flags=%x\n", ebx, [ebx + TCP_SOCKET.t_state], [edx + TCP_header.Flags]:2 ;------------- ; update stats @@ -197,7 +197,7 @@ TCP_process_input: call mutex_lock popa - DEBUGF 1,"TCP_input: socket locked\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "TCP_input: socket locked\n" ;--------------------------- ; disable all temporary bits @@ -220,7 +220,7 @@ TCP_process_input: test [ebx + SOCKET.options], SO_ACCEPTCON jz .no_accept - DEBUGF 1,"TCP_input: Accepting new connection\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "TCP_input: Accepting new connection\n" pusha lea ecx, [ebx + SOCKET.mutex] @@ -263,7 +263,7 @@ TCP_process_input: cmp ecx, sizeof.TCP_header ; Does header contain any options? je .no_options - DEBUGF 1,"TCP_input: Segment has options\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "TCP_input: Segment has options\n" ;;; FIXME: for LISTEN, options should be called after we determined route, we need it for MSS ;;; cmp [ebx + TCP_SOCKET.t_state], TCPS_LISTEN ; no options when in listen state @@ -290,7 +290,7 @@ TCP_process_input: ; je .opt_sack cmp al, TCP_OPT_TIMESTAMP je .opt_timestamp - DEBUGF 1,"TCP_input: unknown option:%u\n", al + DEBUGF DEBUG_NETWORK_VERBOSE, "TCP_input: unknown option:%u\n", al jmp .no_options ; If we reach here, some unknown options were received, skip them all! .opt_maxseg: @@ -303,7 +303,7 @@ TCP_process_input: lodsw rol ax, 8 - DEBUGF 1,"TCP_input: Maxseg=%u\n", ax + DEBUGF DEBUG_NETWORK_VERBOSE, "TCP_input: Maxseg=%u\n", ax call TCP_mss @@: jmp .opt_loop @@ -317,7 +317,7 @@ TCP_process_input: test [edx + TCP_header.Flags], TH_SYN jz @f - DEBUGF 1,"TCP_input: Got window scale option\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "TCP_input: Got window scale option\n" or [ebx + TCP_SOCKET.t_flags], TF_RCVD_SCALE lodsb @@ -336,7 +336,7 @@ TCP_process_input: test [edx + TCP_header.Flags], TH_SYN jz @f - DEBUGF 1,"TCP_input: Selective Acknowledgement permitted\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "TCP_input: Selective Acknowledgement permitted\n" or [ebx + TCP_SOCKET.t_flags], TF_SACK_PERMIT @@: @@ -348,7 +348,7 @@ TCP_process_input: cmp al, 10 ; length must be 10 jne .no_options - DEBUGF 1,"TCP_input: Got timestamp option\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "TCP_input: Got timestamp option\n" test [edx + TCP_header.Flags], TH_SYN jz @f @@ -372,7 +372,7 @@ TCP_process_input: cmp eax, [ebx + TCP_SOCKET.ts_val] jge .no_paws - DEBUGF 1,"TCP_input: PAWS: detected an old segment\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "TCP_input: PAWS: detected an old segment\n" mov eax, [esp+4+4] ; tcp_now sub eax, [ebx + TCP_SOCKET.ts_recent_age] @@ -450,7 +450,7 @@ TCP_process_input: sub eax, [ebx + TCP_SOCKET.SND_UNA] jbe .not_uni_xfer - DEBUGF 1,"TCP_input: Header prediction: we are sender\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "TCP_input: Header prediction: we are sender\n" ;--------------------------------- ; Packet is a pure ACK, process it @@ -524,7 +524,7 @@ TCP_process_input: ; Complete processing of received data - DEBUGF 1,"TCP_input: Header prediction: we are receiving %u bytes\n", ecx + DEBUGF DEBUG_NETWORK_VERBOSE, "TCP_input: Header prediction: we are receiving %u bytes\n", ecx add [ebx + TCP_SOCKET.RCV_NXT], ecx ; Update sequence number with number of bytes we have copied @@ -545,7 +545,7 @@ TCP_process_input: .not_uni_xfer: - DEBUGF 1,"TCP_input: Header prediction failed\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "TCP_input: Header prediction failed\n" ; Calculate receive window size @@ -558,7 +558,7 @@ TCP_process_input: jg @f mov eax, edx @@: - DEBUGF 1,"Receive window size=%d\n", eax + DEBUGF DEBUG_NETWORK_VERBOSE, "Receive window size=%d\n", eax mov [ebx + TCP_SOCKET.RCV_WND], eax pop edx @@ -579,12 +579,12 @@ TCP_process_input: sub eax, [edx + TCP_header.SequenceNumber] jle .no_duplicate - DEBUGF 1,"TCP_input: %u bytes duplicate data!\n", eax + DEBUGF DEBUG_NETWORK_VERBOSE, "TCP_input: %u bytes duplicate data!\n", eax test [edx + TCP_header.Flags], TH_SYN jz .no_dup_syn - DEBUGF 1,"TCP_input: got duplicate syn\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "TCP_input: got duplicate syn\n" and [edx + TCP_header.Flags], not (TH_SYN) inc [edx + TCP_header.SequenceNumber] @@ -613,7 +613,7 @@ TCP_process_input: ; send an ACK and resynchronize and drop any data. ; But keep on processing for RST or ACK - DEBUGF 1, "616\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "616\n" or [ebx + TCP_SOCKET.t_flags], TF_ACKNOW mov eax, ecx ;TODO: update stats @@ -658,7 +658,7 @@ TCP_process_input: sub eax, [ebx + TCP_SOCKET.RCV_WND] ; eax now holds the number of bytes to drop jle .no_excess_data - DEBUGF 1,"%d bytes beyond right edge of window\n", eax + DEBUGF DEBUG_NETWORK_VERBOSE, "%d bytes beyond right edge of window\n", eax ;;; TODO: update stats cmp eax, ecx @@ -687,7 +687,7 @@ TCP_process_input: cmp eax, [ebx + TCP_SOCKET.RCV_NXT] jne .drop_after_ack - DEBUGF 1, "690\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "690\n" or [ebx + TCP_SOCKET.t_flags], TF_ACKNOW ;;; TODO: update stats jmp .no_excess_data @@ -715,7 +715,7 @@ TCP_process_input: sub eax, ecx jae .no_timestamp - DEBUGF 1,"Recording timestamp\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "Recording timestamp\n" mov eax, [esp + 4] ; tcp_now mov [ebx + TCP_SOCKET.ts_recent_age], eax @@ -729,7 +729,7 @@ TCP_process_input: test [edx + TCP_header.Flags], TH_RST jz .no_rst - DEBUGF 1,"TCP_input: Got an RST flag\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "TCP_input: Got an RST flag\n" mov eax, [ebx + TCP_SOCKET.t_state] shl eax, 2 @@ -749,18 +749,18 @@ TCP_process_input: dd .rst_close ; TCPS_TIMED_WAIT .econnrefused: - DEBUGF 1,"TCP_input: Connection refused\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "TCP_input: Connection refused\n" mov [ebx + SOCKET.errorcode], ECONNREFUSED jmp .close .econnreset: - DEBUGF 1,"TCP_input: Connection reset\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "TCP_input: Connection reset\n" mov [ebx + SOCKET.errorcode], ECONNRESET .close: - DEBUGF 1,"TCP_input: Closing connection\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "TCP_input: Closing connection\n" mov [ebx + TCP_SOCKET.t_state], TCPS_CLOSED ;;; TODO: update stats (tcp drops) @@ -769,7 +769,7 @@ TCP_process_input: jmp .drop_no_socket .rst_close: - DEBUGF 1,"TCP_input: Closing with reset\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "TCP_input: Closing with reset\n" mov eax, ebx call TCP_close @@ -799,7 +799,7 @@ TCP_process_input: jb .ack_processed ; states: closed, listen, syn_sent ja .no_syn_rcv ; established, fin_wait_1, fin_wait_2, close_wait, closing, last_ack, time_wait - DEBUGF 1,"TCP_input: state=syn_received\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "TCP_input: state=syn_received\n" mov eax, [edx + TCP_header.AckNumber] cmp [ebx + TCP_SOCKET.SND_UNA], eax @@ -846,7 +846,7 @@ TCP_process_input: cmp eax, [ebx + TCP_SOCKET.SND_WND] jne .reset_dupacks - DEBUGF 1,"TCP_input: Processing duplicate ACK\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "TCP_input: Processing duplicate ACK\n" ; If we have outstanding data, other than a window probe, this is a completely duplicate ACK ; (window info didnt change) The ACK is the biggest we've seen and we've seen exactly our rexmt threshold of them, @@ -927,7 +927,7 @@ TCP_process_input: .no_re_xmit: jbe .not_dup_ack - DEBUGF 1,"TCP_input: Increasing congestion window\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "TCP_input: Increasing congestion window\n" mov eax, [ebx + TCP_SOCKET.t_maxseg] add [ebx + TCP_SOCKET.SND_CWND], eax @@ -980,7 +980,7 @@ TCP_process_input: ;;; TODO: update stats - DEBUGF 1,"TCP_input: acceptable ACK for %u bytes\n", edi + DEBUGF DEBUG_NETWORK_VERBOSE, "TCP_input: acceptable ACK for %u bytes\n", edi ;------------------------------------------ ; RTT measurements and retransmission timer (912-926) @@ -1073,7 +1073,7 @@ TCP_process_input: call SOCKET_ring_free pop ebx edx ecx - DEBUGF 1,"TCP_input: our FIN is acked\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "TCP_input: our FIN is acked\n" stc jmp .wakeup @@ -1088,7 +1088,7 @@ TCP_process_input: sub [ebx + TCP_SOCKET.SND_WND], ecx pop edx ecx - DEBUGF 1,"TCP_input: our FIN is not acked\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "TCP_input: our FIN is not acked\n" clc ;---------------------------------------- @@ -1176,7 +1176,7 @@ TCP_process_input: align 4 .LISTEN: - DEBUGF 1,"TCP_input: state=listen\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "TCP_input: state=listen\n" test [edx + TCP_header.Flags], TH_RST jnz .drop @@ -1228,7 +1228,7 @@ align 4 align 4 .SYN_SENT: - DEBUGF 1,"TCP_input: state=syn_sent\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "TCP_input: state=syn_sent\n" test [edx + TCP_header.Flags], TH_ACK jz @f @@ -1288,7 +1288,7 @@ align 4 test [edx + TCP_header.Flags], TH_ACK jz .simultaneous_open - DEBUGF 1,"TCP_input: active open\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "TCP_input: active open\n" ;;; TODO: update stats @@ -1316,7 +1316,7 @@ align 4 .simultaneous_open: - DEBUGF 1,"TCP_input: simultaneous open\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "TCP_input: simultaneous open\n" ; We have received a syn but no ACK, so we are having a simultaneous open.. mov [ebx + TCP_SOCKET.t_state], TCPS_SYN_RECEIVED @@ -1339,7 +1339,7 @@ align 4 .ack_processed: - DEBUGF 1,"TCP_input: ACK processed\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "TCP_input: ACK processed\n" ;---------------------------------------------- ; check if we need to update window information @@ -1373,7 +1373,7 @@ align 4 @@: mov [ebx + TCP_SOCKET.SND_WND], eax - DEBUGF 1,"TCP_input: Updating window to %u\n", eax + DEBUGF DEBUG_NETWORK_VERBOSE, "TCP_input: Updating window to %u\n", eax push [edx + TCP_header.SequenceNumber] pop [ebx + TCP_SOCKET.SND_WL1] @@ -1467,7 +1467,7 @@ align 4 call TCP_reassemble - DEBUGF 1, "1470\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "1470\n" or [ebx + TCP_SOCKET.t_flags], TF_ACKNOW .data_done: @@ -1478,12 +1478,12 @@ align 4 test [edx + TCP_header.Flags], TH_FIN jz .final_processing - DEBUGF 1,"TCP_input: Processing FIN\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "TCP_input: Processing FIN\n" cmp [ebx + TCP_SOCKET.t_state], TCPS_TIMED_WAIT jae .not_first_fin - DEBUGF 1,"TCP_input: First FIN for this connection\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "TCP_input: First FIN for this connection\n" mov eax, ebx call SOCKET_cant_recv_more @@ -1534,7 +1534,7 @@ align 4 .drop_after_ack: - DEBUGF 1,"TCP_input: Drop after ACK\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "TCP_input: Drop after ACK\n" push edx ebx lea ecx, [ebx + SOCKET.mutex] @@ -1548,7 +1548,7 @@ align 4 jmp .need_output .drop_with_reset: - DEBUGF 1,"TCP_input: Drop with reset\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "TCP_input: Drop with reset\n" push ebx edx lea ecx, [ebx + SOCKET.mutex] @@ -1571,7 +1571,7 @@ align 4 ; Final processing .final_processing: - DEBUGF 1,"TCP_input: Final processing\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "TCP_input: Final processing\n" push ebx lea ecx, [ebx + SOCKET.mutex] @@ -1583,14 +1583,14 @@ align 4 test [eax + TCP_SOCKET.t_flags], TF_ACKNOW jz .dumpit - DEBUGF 1,"TCP_input: ACK now!\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "TCP_input: ACK now!\n" .need_output: - DEBUGF 1,"TCP_input: need output\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "TCP_input: need output\n" call TCP_output .dumpit: - DEBUGF 1,"TCP_input: dumping\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "TCP_input: dumping\n" call kernel_free add esp, 4 @@ -1641,7 +1641,7 @@ align 4 ; Drop .drop: - DEBUGF 1,"TCP_input: Dropping segment\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "TCP_input: Dropping segment\n" pusha lea ecx, [ebx + SOCKET.mutex] @@ -1656,7 +1656,7 @@ align 4 call SOCKET_free .drop_no_socket: - DEBUGF 1,"TCP_input: Drop (no socket)\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "TCP_input: Drop (no socket)\n" call kernel_free add esp, 4 diff --git a/kernel/trunk/network/tcp_output.inc b/kernel/trunk/network/tcp_output.inc index 9f3d588859..a7859e4ce5 100644 --- a/kernel/trunk/network/tcp_output.inc +++ b/kernel/trunk/network/tcp_output.inc @@ -28,7 +28,7 @@ $Revision: 3289 $ align 4 TCP_output: - DEBUGF 1,"TCP_output: socket=%x\n", eax + DEBUGF DEBUG_NETWORK_VERBOSE, "TCP_output: socket=%x\n", eax push eax lea ecx, [eax + SOCKET.mutex] @@ -78,7 +78,7 @@ TCP_output: cmp [eax + TCP_SOCKET.t_force], 0 je .no_force - DEBUGF 1,"TCP_output: forcing data out\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "TCP_output: forcing data out\n" test ecx, ecx jnz .no_zero_window @@ -202,7 +202,7 @@ TCP_output: ;---------------------------------------- ; Check if a window update should be sent (154) - DEBUGF 1,"TCP_output: window=%d\n", ecx + DEBUGF DEBUG_NETWORK_VERBOSE, "TCP_output: window=%d\n", ecx ; Compare available window to amount of window known to peer (as advertised window less next expected input) ; If the difference is at least two max size segments, or at least 50% of the maximum possible window, @@ -237,7 +237,7 @@ TCP_output: ;-------------------------- ; Should a segment be sent? (174) - DEBUGF 1,"TCP_output: 174\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "TCP_output: 174\n" test [eax + TCP_SOCKET.t_flags], TF_ACKNOW ; we need to ACK jnz TCP_send @@ -273,7 +273,7 @@ TCP_output: cmp [eax + TCP_SOCKET.timer_persist], 0 ; Persist timer already expired? jne @f - DEBUGF 1,"TCP_output: Entering persist state\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "TCP_output: Entering persist state\n" mov [eax + TCP_SOCKET.t_rxtshift], 0 call TCP_set_persist @@ -282,7 +282,7 @@ TCP_output: ;---------------------------- ; No reason to send a segment (219) - DEBUGF 1,"TCP_output: No reason to send a segment\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "TCP_output: No reason to send a segment\n" pusha lea ecx, [eax + SOCKET.mutex] @@ -313,7 +313,7 @@ TCP_output: align 4 TCP_send: - DEBUGF 1,"TCP_send: socket=%x length=%u flags=%x\n", eax, esi, dl + DEBUGF DEBUG_NETWORK_VERBOSE, "TCP_send: socket=%x length=%u flags=%x\n", eax, esi, dl push eax ; save socket ptr push esi ; and data length too @@ -337,7 +337,7 @@ TCP_send: push ecx add di, 4 - DEBUGF 1,"TCP_send: added maxseg option\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "TCP_send: added maxseg option\n" test [eax + TCP_SOCKET.t_flags], TF_REQ_SCALE jz .no_scale @@ -355,7 +355,7 @@ TCP_send: pushw TCP_OPT_WINDOW + 3 shl 8 add di, 4 - DEBUGF 1,"TCP_send: added scale option\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "TCP_send: added scale option\n" .no_scale: .no_syn: @@ -381,7 +381,7 @@ TCP_send: pushd TCP_OPT_NOP + TCP_OPT_NOP shl 8 + TCP_OPT_TIMESTAMP shl 16 + 10 shl 24 add di, 12 - DEBUGF 1,"TCP_send: added timestamp\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "TCP_send: added timestamp\n" .no_timestamp: @@ -538,7 +538,7 @@ TCP_send: ;---------------- ; Send the packet - DEBUGF 1,"TCP_send: Sending with device %x\n", ebx + DEBUGF DEBUG_NETWORK_VERBOSE, "TCP_send: Sending with device %x\n", ebx call [ebx + NET_DEVICE.transmit] jnz .send_error @@ -580,7 +580,7 @@ TCP_send: test [eax + TCP_SOCKET.temp_bits], TCP_BIT_SENDALOT jnz TCP_output.again - DEBUGF 1,"TCP_send: success!\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "TCP_send: success!\n" xor eax, eax ret @@ -597,7 +597,7 @@ TCP_send: lea ecx, [eax + SOCKET.mutex] call mutex_unlock - DEBUGF 1,"TCP_send: IP error\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "TCP_send: IP error\n" or eax, -1 ret @@ -609,7 +609,7 @@ TCP_send: lea ecx, [eax + SOCKET.mutex] call mutex_unlock - DEBUGF 1,"TCP_send: sending failed\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "TCP_send: sending failed\n" or eax, -2 ret diff --git a/kernel/trunk/network/tcp_subr.inc b/kernel/trunk/network/tcp_subr.inc index eb133fb8fe..40afd5746a 100644 --- a/kernel/trunk/network/tcp_subr.inc +++ b/kernel/trunk/network/tcp_subr.inc @@ -119,7 +119,7 @@ macro TCP_init_socket socket { align 4 TCP_pull_out_of_band: - DEBUGF 1,"TCP_pull_out_of_band\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "TCP_pull_out_of_band\n" ;;;; 1282-1305 @@ -145,7 +145,7 @@ TCP_pull_out_of_band: align 4 TCP_drop: - DEBUGF 1,"TCP_drop: %x\n", eax + DEBUGF DEBUG_NETWORK_VERBOSE, "TCP_drop: %x\n", eax cmp [eax + TCP_SOCKET.t_state], TCPS_SYN_RECEIVED jb .no_syn_received @@ -184,7 +184,7 @@ TCP_drop: align 4 TCP_close: - DEBUGF 1,"TCP_close: %x\n", eax + DEBUGF DEBUG_NETWORK_VERBOSE, "TCP_close: %x\n", eax ;;; TODO: update RTT and mean deviation ;;; TODO: update slow start threshold @@ -212,7 +212,7 @@ TCP_outflags: mov edx, [eax + TCP_SOCKET.t_state] movzx edx, byte [edx + .flaglist] - DEBUGF 1,"TCP_outflags: socket=%x flags=%x\n", eax, dl + DEBUGF DEBUG_NETWORK_VERBOSE, "TCP_outflags: socket=%x flags=%x\n", eax, dl ret @@ -248,7 +248,7 @@ TCP_outflags: align 4 TCP_respond: - DEBUGF 1,"TCP_respond_socket: socket=%x flags=%x\n", ebx, cl + DEBUGF DEBUG_NETWORK_VERBOSE, "TCP_respond_socket: socket=%x flags=%x\n", ebx, cl ;--------------------- ; Create the IP packet @@ -305,7 +305,7 @@ TCP_respond: ret .error: - DEBUGF 1,"TCP_respond_socket: failed\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "TCP_respond_socket: failed\n" add esp, 2 + 4 ret @@ -327,7 +327,7 @@ TCP_respond: align 4 TCP_respond_segment: - DEBUGF 1,"TCP_respond_segment: frame=%x flags=%x\n", edx, cl + DEBUGF DEBUG_NETWORK_VERBOSE,"TCP_respond_segment: frame=%x flags=%x\n", edx, cl ;--------------------- ; Create the IP packet @@ -381,7 +381,7 @@ TCP_respond_segment: ret .error: - DEBUGF 1,"TCP_respond_segment: failed\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "TCP_respond_segment: failed\n" add esp, 2+4 ret @@ -416,7 +416,7 @@ local .done align 4 TCP_set_persist: - DEBUGF 1,"TCP_set_persist\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "TCP_set_persist\n" ; First, check if retransmit timer is not set, retransmit and persist are mutually exclusive @@ -454,7 +454,7 @@ TCP_set_persist: align 4 TCP_xmit_timer: - DEBUGF 1,"TCP_xmit_timer: socket=%x rtt=%d0ms\n", ebx, eax + DEBUGF DEBUG_NETWORK_VERBOSE, "TCP_xmit_timer: socket=%x rtt=%d0ms\n", ebx, eax ;TODO: update stats diff --git a/kernel/trunk/network/tcp_timer.inc b/kernel/trunk/network/tcp_timer.inc index 2ab108a280..02e780394b 100644 --- a/kernel/trunk/network/tcp_timer.inc +++ b/kernel/trunk/network/tcp_timer.inc @@ -87,7 +87,7 @@ local .exit dec [eax + TCP_SOCKET.timer_retransmission] jnz .check_more2 - DEBUGF 1,"socket %x: Retransmission timer expired\n", eax + DEBUGF DEBUG_NETWORK_VERBOSE, "socket %x: Retransmission timer expired\n", eax push eax call TCP_output @@ -97,7 +97,7 @@ local .exit dec [eax + TCP_SOCKET.timer_keepalive] jnz .check_more3 - DEBUGF 1,"socket %x: Keepalive expired\n", eax + DEBUGF DEBUG_NETWORK_VERBOSE, "socket %x: Keepalive expired\n", eax cmp [eax + TCP_SOCKET.state], TCPS_ESTABLISHED ja .dont_kill @@ -126,13 +126,13 @@ local .exit dec [eax + TCP_SOCKET.timer_timed_wait] jnz .check_more5 - DEBUGF 1,"socket %x: 2MSL timer expired\n", eax + DEBUGF DEBUG_NETWORK_VERBOSE, "socket %x: 2MSL timer expired\n", eax .check_more5: dec [eax + TCP_SOCKET.timer_persist] jnz .loop - DEBUGF 1,"socket %x: persist timer expired\n", eax + DEBUGF DEBUG_NETWORK_VERBOSE, "socket %x: persist timer expired\n", eax call TCP_set_persist mov [eax + TCP_SOCKET.t_force], 1 diff --git a/kernel/trunk/network/tcp_usreq.inc b/kernel/trunk/network/tcp_usreq.inc index b932c267f5..9e219e93ef 100644 --- a/kernel/trunk/network/tcp_usreq.inc +++ b/kernel/trunk/network/tcp_usreq.inc @@ -27,7 +27,7 @@ align 4 TCP_usrclosed: - DEBUGF 1,"TCP_usrclosed: %x\n", eax + DEBUGF DEBUG_NETWORK_VERBOSE, "TCP_usrclosed: %x\n", eax push ebx mov ebx, [eax + TCP_SOCKET.t_state] @@ -87,7 +87,7 @@ TCP_usrclosed: align 4 TCP_disconnect: - DEBUGF 1,"TCP_disconnect: %x\n", eax + DEBUGF DEBUG_NETWORK_VERBOSE, "TCP_disconnect: %x\n", eax cmp [eax + TCP_SOCKET.t_state], TCPS_ESTABLISHED jb TCP_close diff --git a/kernel/trunk/network/udp.inc b/kernel/trunk/network/udp.inc index 8bd91127b1..96f17cd1f4 100644 --- a/kernel/trunk/network/udp.inc +++ b/kernel/trunk/network/udp.inc @@ -116,7 +116,7 @@ macro UDP_checksum IP1, IP2 { ; esi = ptr to udp packet, ecx = packet size align 4 UDP_input: - DEBUGF 1,"UDP_input: size=%u\n", ecx + DEBUGF DEBUG_NETWORK_VERBOSE, "UDP_input: size=%u\n", ecx ; First validate, checksum @@ -129,7 +129,7 @@ UDP_input: jnz .checksum_mismatch .no_checksum: - DEBUGF 1,"UDP_input: checksum ok\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "UDP_input: checksum ok\n" ; Convert length to little endian @@ -158,7 +158,7 @@ UDP_input: cmp [eax + UDP_SOCKET.LocalPort], dx jne .next_socket - DEBUGF 1,"UDP_input: socket=%x\n", eax + DEBUGF DEBUG_NETWORK_VERBOSE, "UDP_input: socket=%x\n", eax ;;; TODO: when packet is processed, check more sockets! @@ -196,7 +196,7 @@ UDP_input: call mutex_lock popa - DEBUGF 1,"UDP_input: new remote port=%x\n", cx ; FIXME: find a way to print big endian values with debugf + DEBUGF DEBUG_NETWORK_VERBOSE, "UDP_input: new remote port=%x\n", cx ; FIXME: find a way to print big endian values with debugf mov [eax + UDP_SOCKET.RemotePort], cx inc [eax + UDP_SOCKET.firstpacket] @@ -204,12 +204,12 @@ UDP_input: .checksum_mismatch: - DEBUGF 2,"UDP_input: checksum mismatch\n" + DEBUGF DEBUG_NETWORK_VERBOSE, "UDP_input: checksum mismatch\n" .dump: call kernel_free add esp, 4 ; pop (balance stack) - DEBUGF 2,"UDP_input: dumping\n" + DEBUGF DEBUG_NETWORK_VERBOSE,"UDP_input: dumping\n" ret @@ -229,13 +229,13 @@ UDP_input: align 4 UDP_output: - DEBUGF 1,"UDP_output: socket=%x bytes=%u data_ptr=%x\n", eax, ecx, esi + DEBUGF DEBUG_NETWORK_VERBOSE, "UDP_output: socket=%x bytes=%u data_ptr=%x\n", eax, ecx, esi mov dx, [eax + UDP_SOCKET.RemotePort] - DEBUGF 1,"UDP_output: remote port=%x, ", dx ; FIXME: find a way to print big endian values with debugf + DEBUGF DEBUG_NETWORK_VERBOSE, "UDP_output: remote port=%x, ", dx ; FIXME: find a way to print big endian values with debugf rol edx, 16 mov dx, [eax + UDP_SOCKET.LocalPort] - DEBUGF 1,"local port=%x\n", dx + DEBUGF DEBUG_NETWORK_VERBOSE, "local port=%x\n", dx sub esp, 8 ; Data ptr and data size will be placed here push edx esi @@ -270,7 +270,7 @@ UDP_output: mov [edi + UDP_header.Checksum], 0 UDP_checksum (edi-4), (edi-8) ; FIXME: IPv4 packet could have options.. - DEBUGF 1,"UDP_output: sending with device %x\n", ebx + DEBUGF DEBUG_NETWORK_VERBOSE, "UDP_output: sending with device %x\n", ebx call [ebx + NET_DEVICE.transmit] test eax, eax jnz @f @@ -280,7 +280,7 @@ UDP_output: ret .fail: - DEBUGF 1,"UDP_output: failed\n" + DEBUGF DEBUG_NETWORK_ERROR, "UDP_output: failed\n" add esp, 4+4+8 or eax, -1 ret