Rev 1544 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1544 | Rev 2302 | ||
---|---|---|---|
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: 1544 $ |
20 | $Revision: 2302 $ |
Line 190... | Line 190... | ||
190 | push [esi + IPv4_Packet.DestinationAddress] |
190 | push [esi + IPv4_Packet.DestinationAddress] |
191 | pop [esi + IPv4_Packet.SourceAddress] |
191 | pop [esi + IPv4_Packet.SourceAddress] |
192 | pop [esi + IPv4_Packet.DestinationAddress] |
192 | pop [esi + IPv4_Packet.DestinationAddress] |
Line 193... | Line 193... | ||
193 | 193 | ||
194 | ; Recalculate ip header checksum |
194 | ; Recalculate ip header checksum |
195 | movzx ecx, byte [esi + IPv4_Packet.VersionAndIHL] ; Calculate IP Header length by using IHL field |
195 | movzx ecx, [esi + IPv4_Packet.VersionAndIHL] ; Calculate IP Header length by using IHL field |
196 | and ecx, 0x0f |
196 | and ecx, 0x0f |
197 | shl cx, 2 |
197 | shl cx, 2 |
198 | mov edi, ecx ; IP header length |
198 | mov edi, ecx ; IP header length |
Line 199... | Line 199... | ||
199 | mov eax, edx ; ICMP packet start addr |
199 | mov eax, edx ; ICMP packet start addr |
200 | 200 | ||
201 | push esi ; Calculate the IP checksum |
201 | push esi ; Calculate the IP checksum |
202 | xor edx, edx ; |
202 | xor edx, edx ; |
203 | call checksum_1 ; |
203 | call checksum_1 ; |
204 | call checksum_2 ; |
204 | call checksum_2 ; |
Line 205... | Line 205... | ||
205 | pop esi ; |
205 | pop esi ; |
206 | mov word [esi + IPv4_Packet.HeaderChecksum], dx ; |
206 | mov [esi + IPv4_Packet.HeaderChecksum], dx ; |
207 | 207 | ||
208 | ; Recalculate ICMP CheckSum |
208 | ; Recalculate ICMP CheckSum |
Line 209... | Line 209... | ||
209 | movzx ecx, word[esi + IPv4_Packet.TotalLength] ; Find length of IP Packet |
209 | movzx ecx, [esi + IPv4_Packet.TotalLength] ; Find length of IP Packet |
210 | xchg ch, cl ; |
210 | xchg ch, cl ; |
211 | sub ecx, edi ; IP packet length - IP header length = ICMP packet length |
211 | sub ecx, edi ; IP packet length - IP header length = ICMP packet length |
212 | 212 | ||
213 | mov esi, eax ; Calculate ICMP checksum |
213 | mov esi, eax ; Calculate ICMP checksum |
Line 214... | Line 214... | ||
214 | xor edx, edx ; |
214 | xor edx, edx ; |
215 | call checksum_1 ; |
215 | call checksum_1 ; |
216 | call checksum_2 ; |
216 | call checksum_2 ; |