Rev 7536 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 7536 | Rev 7678 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
2 | ;; ;; |
2 | ;; ;; |
3 | ;; Copyright (C) KolibriOS team 2004-2015. All rights reserved. ;; |
3 | ;; Copyright (C) KolibriOS team 2004-2019. All rights reserved. ;; |
4 | ;; Distributed under terms of the GNU General Public License ;; |
4 | ;; Distributed under terms of the GNU General Public License ;; |
5 | ;; ;; |
5 | ;; ;; |
6 | ;; ICMP.INC ;; |
6 | ;; ICMP.INC ;; |
7 | ;; ;; |
7 | ;; ;; |
8 | ;; Part of the tcp/ip network stack for KolibriOS ;; |
8 | ;; Part of the tcp/ip network stack for KolibriOS ;; |
Line 14... | Line 14... | ||
14 | ;; GNU GENERAL PUBLIC LICENSE ;; |
14 | ;; GNU GENERAL PUBLIC LICENSE ;; |
15 | ;; Version 2, June 1991 ;; |
15 | ;; Version 2, June 1991 ;; |
16 | ;; ;; |
16 | ;; ;; |
17 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
17 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
Line 18... | Line 18... | ||
18 | 18 | ||
Line 19... | Line 19... | ||
19 | $Revision: 7536 $ |
19 | $Revision: 7678 $ |
Line 20... | Line 20... | ||
20 | 20 | ||
Line 97... | Line 97... | ||
97 | 97 | ||
98 | 98 | ||
Line 99... | Line 99... | ||
99 | uglobal |
99 | uglobal |
100 | align 4 |
100 | align 4 |
Line 101... | Line 101... | ||
101 | 101 | ||
Line 113... | Line 113... | ||
113 | ;-----------------------------------------------------------------; |
113 | ;-----------------------------------------------------------------; |
Line 114... | Line 114... | ||
114 | 114 | ||
Line 115... | Line 115... | ||
115 | macro icmp_init { |
115 | macro icmp_init { |
116 | 116 | ||
117 | xor eax, eax |
117 | xor eax, eax |
118 | mov edi, ICMP_PACKETS_TX |
118 | mov edi, ICMP_packets_tx |
Line 119... | Line 119... | ||
119 | mov ecx, 2*NET_DEVICES_MAX |
119 | mov ecx, 2*NET_DEVICES_MAX |
Line 141... | Line 141... | ||
141 | icmp_input: |
141 | icmp_input: |
Line 142... | Line 142... | ||
142 | 142 | ||
Line 143... | Line 143... | ||
143 | DEBUGF DEBUG_NETWORK_VERBOSE, "ICMP_input\n" |
143 | DEBUGF DEBUG_NETWORK_VERBOSE, "ICMP_input\n" |
144 | 144 | ||
145 | ; Dump all multicasts and broadcasts |
145 | ; Dump all multicasts and broadcasts |
146 | mov eax, [IP_LIST + edi] |
146 | mov eax, [IPv4_address + edi] |
Line 147... | Line 147... | ||
147 | cmp eax, [edx + IPv4_header.DestinationAddress] |
147 | cmp eax, [edx + IPv4_header.DestinationAddress] |
148 | jne .dump |
148 | jne .dump |
Line 160... | Line 160... | ||
160 | jne .checksum_mismatch |
160 | jne .checksum_mismatch |
Line 161... | Line 161... | ||
161 | 161 | ||
Line 162... | Line 162... | ||
162 | DEBUGF DEBUG_NETWORK_VERBOSE, "ICMP_input: Checksum OK\n" |
162 | DEBUGF DEBUG_NETWORK_VERBOSE, "ICMP_input: Checksum OK\n" |
163 | 163 | ||
Line 164... | Line 164... | ||
164 | ; Update stats |
164 | ; Update stats |
165 | inc [ICMP_PACKETS_RX + edi] |
165 | inc [ICMP_packets_rx + edi] |
166 | 166 | ||
Line 271... | Line 271... | ||
271 | call [ebx + NET_DEVICE.transmit] |
271 | call [ebx + NET_DEVICE.transmit] |
272 | test eax, eax |
272 | test eax, eax |
273 | jnz @f |
273 | jnz @f |
274 | DEBUGF DEBUG_NETWORK_VERBOSE, "ICMP transmit failed\n" |
274 | DEBUGF DEBUG_NETWORK_VERBOSE, "ICMP transmit failed\n" |
275 | call net_ptr_to_num4 |
275 | call net_ptr_to_num4 |
276 | inc [ICMP_PACKETS_TX + edi] |
276 | inc [ICMP_packets_tx + edi] |
- | 277 | inc [IPv4_packets_tx + edi] |
|
277 | @@: |
278 | @@: |
278 | ret |
279 | ret |
Line 279... | Line 280... | ||
279 | 280 | ||
280 | .dump_: |
281 | .dump_: |
Line 404... | Line 405... | ||
404 | DEBUGF DEBUG_NETWORK_VERBOSE, "Sending ICMP Packet\n" |
405 | DEBUGF DEBUG_NETWORK_VERBOSE, "Sending ICMP Packet\n" |
405 | call [ebx + NET_DEVICE.transmit] |
406 | call [ebx + NET_DEVICE.transmit] |
406 | test eax, eax |
407 | test eax, eax |
407 | jnz @f |
408 | jnz @f |
408 | call net_ptr_to_num4 |
409 | call net_ptr_to_num4 |
409 | inc [ICMP_PACKETS_TX + edi] |
410 | inc [ICMP_packets_tx + edi] |
410 | @@: |
411 | @@: |
411 | ret |
412 | ret |
Line 412... | Line 413... | ||
412 | 413 | ||
413 | .fail: |
414 | .fail: |
Line 445... | Line 446... | ||
445 | .error: |
446 | .error: |
446 | mov eax, -1 |
447 | mov eax, -1 |
447 | ret |
448 | ret |
Line 448... | Line 449... | ||
448 | 449 | ||
449 | .packets_tx: |
450 | .packets_tx: |
450 | mov eax, [ICMP_PACKETS_TX + eax] |
451 | mov eax, [ICMP_packets_tx + eax] |
Line 451... | Line 452... | ||
451 | ret |
452 | ret |
452 | 453 | ||
453 | .packets_rx: |
454 | .packets_rx: |