Rev 2614 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2614 | Rev 2877 | ||
---|---|---|---|
Line 15... | Line 15... | ||
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 | 19 | ||
Line 20... | Line 20... | ||
20 | $Revision: 2614 $ |
20 | $Revision: 2877 $ |
Line 282... | Line 282... | ||
282 | ; IN: eax = dest ip |
282 | ; IN: eax = dest ip |
283 | ; ebx = source ip |
283 | ; ebx = source ip |
284 | ; ecx = data length |
284 | ; ecx = data length |
285 | ; dh = type |
285 | ; dh = type |
286 | ; dl = code |
286 | ; dl = code |
287 | ; high 16 bits of edx = fragment id (for IP header) |
- | |
288 | ; esi = data offset |
287 | ; esi = data offset |
289 | ; edi = identifier shl 16 + sequence number |
288 | ; edi = identifier shl 16 + sequence number |
290 | ; |
289 | ; |
291 | ;----------------------------------------------------------------- |
290 | ;----------------------------------------------------------------- |
292 | align 4 |
291 | align 4 |
293 | ICMP_output: |
292 | ICMP_output: |
Line 294... | Line 293... | ||
294 | 293 | ||
Line 295... | Line 294... | ||
295 | DEBUGF 1,"Creating ICMP Packet\n" |
294 | DEBUGF 1,"Creating ICMP Packet\n" |
Line 296... | Line 295... | ||
296 | 295 | ||
297 | push esi edi edx |
296 | push esi edi dx |
298 | 297 | ||
299 | mov ebx, [eax + IP_SOCKET.LocalIP] |
298 | mov edx, [eax + IP_SOCKET.LocalIP] |
300 | mov eax, [eax + IP_SOCKET.RemoteIP] |
- | |
301 | add ecx, sizeof.ICMP_header |
- | |
302 | mov di , IP_PROTO_ICMP SHL 8 + 128 ; TTL |
299 | mov eax, [eax + IP_SOCKET.RemoteIP] |
303 | shr edx, 16 |
300 | add ecx, sizeof.ICMP_header |
Line 304... | Line 301... | ||
304 | 301 | mov di, IP_PROTO_ICMP SHL 8 + 128 ; TTL |
|
Line 305... | Line -... | ||
305 | call IPv4_output |
- | |
306 | jz .exit |
302 | call IPv4_output |
307 | - | ||
308 | DEBUGF 1,"full icmp packet size: %u\n", edx |
- | |
309 | - | ||
310 | pop eax |
303 | jz .exit |
311 | mov word [edi + ICMP_header.Type], ax ; Write both type and code bytes at once |
304 | |
Line 312... | Line 305... | ||
312 | pop eax |
305 | DEBUGF 1,"full icmp packet size: %u\n", edx |
313 | mov [edi + ICMP_header.SequenceNumber], ax |
306 | |
314 | shr eax, 16 |
307 | pop word [edi + ICMP_header.Type] ; Write both type and code bytes at once |
315 | mov [edi + ICMP_header.Identifier], ax |
308 | pop dword [edi + ICMP_header.Identifier] ; identifier and sequence number |
316 | mov [edi + ICMP_header.Checksum], 0 |
309 | mov [edi + ICMP_header.Checksum], 0 |
317 | 310 | ||
318 | push eax ebx ecx edx |
311 | push ebx ecx edx |
Line 319... | Line 312... | ||
319 | mov esi, edi |
312 | mov esi, edi |
320 | xor edx, edx |
313 | xor edx, edx |
321 | call checksum_1 |
314 | call checksum_1 |
322 | call checksum_2 |
315 | call checksum_2 |
Line 337... | Line 330... | ||
337 | DEBUGF 1,"Sending ICMP Packet\n" |
330 | DEBUGF 1,"Sending ICMP Packet\n" |
338 | call [ebx + NET_DEVICE.transmit] |
331 | call [ebx + NET_DEVICE.transmit] |
339 | ret |
332 | ret |
340 | .exit: |
333 | .exit: |
341 | DEBUGF 1,"Creating ICMP Packet failed\n" |
334 | DEBUGF 1,"Creating ICMP Packet failed\n" |
342 | add esp, 3*4 |
335 | add esp,2*4+2 |
343 | ret |
336 | ret |
Line 360... | Line 353... | ||
360 | DEBUGF 1,"Creating ICMP Packet for socket %x, data ptr=%x\n", eax, edx |
353 | DEBUGF 1,"Creating ICMP Packet for socket %x, data ptr=%x\n", eax, edx |
Line 361... | Line 354... | ||
361 | 354 | ||
Line 362... | Line 355... | ||
362 | push edx |
355 | push edx |
363 | - | ||
364 | mov di, IP_PROTO_ICMP SHL 8 + 128 ; TTL |
356 | |
365 | shr edx, 16 |
357 | mov di, IP_PROTO_ICMP SHL 8 + 128 ; TTL |
366 | mov ebx, [eax + IP_SOCKET.LocalIP] |
358 | mov edx, [eax + IP_SOCKET.LocalIP] |
367 | mov eax, [eax + IP_SOCKET.RemoteIP] |
359 | mov eax, [eax + IP_SOCKET.RemoteIP] |
Line 368... | Line 360... | ||
368 | call IPv4_output |
360 | call IPv4_output |