Rev 1165 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1165 | Rev 1171 | ||
---|---|---|---|
Line 123... | Line 123... | ||
123 | rep stosd |
123 | rep stosd |
Line 124... | Line 124... | ||
124 | 124 | ||
Line -... | Line 125... | ||
- | 125 | ret |
|
- | 126 | ||
- | 127 | ||
- | 128 | ||
- | 129 | ||
- | 130 | ||
- | 131 | ||
- | 132 | ||
125 | ret |
133 | |
126 | 134 | ||
127 | 135 | ||
128 | ;-------------------------------- |
136 | ;-------------------------------- |
129 | ; |
137 | ; |
Line 149... | Line 157... | ||
149 | jne .check_sockets |
157 | jne .check_sockets |
Line 150... | Line 158... | ||
150 | 158 | ||
151 | mov byte [edx + ICMP_Packet.Type], ICMP_ECHOREPLY ; Change Packet type to reply |
159 | mov byte [edx + ICMP_Packet.Type], ICMP_ECHOREPLY ; Change Packet type to reply |
Line -... | Line 160... | ||
- | 160 | mov word [edx + ICMP_Packet.Checksum], 0 ; Set checksum to 0, needed to calculate new checksum |
|
- | 161 | ||
- | 162 | call ETH_struc2dev |
|
- | 163 | cmp edi,-1 |
|
- | 164 | je .dump |
|
152 | mov word [edx + ICMP_Packet.Checksum], 0 ; Set checksum to 0, needed to calculate new checksum |
165 | inc [ICMP_PACKETS_RX+4*edi] |
153 | 166 | ||
154 | ; exchange dest and source address in IP header |
167 | ; exchange dest and source address in IP header |
Line 155... | Line 168... | ||
155 | ; exchange dest and source MAC in ETH header |
168 | ; exchange dest and source MAC in ETH header |
Line 195... | Line 208... | ||
195 | stdcall checksum_jb,edx,eax ; Calculate the checksum of icmp data |
208 | stdcall checksum_jb,edx,eax ; Calculate the checksum of icmp data |
196 | pop edx ebx |
209 | pop edx ebx |
197 | xchg al, ah ; Convert to intel byte order |
210 | xchg al, ah ; Convert to intel byte order |
198 | mov word [edx + ICMP_Packet.Checksum], ax |
211 | mov word [edx + ICMP_Packet.Checksum], ax |
Line 199... | Line 212... | ||
199 | 212 | ||
- | 213 | jmp ETH_Sender ; Send the reply |
|
- | 214 | ||
- | 215 | ||
- | 216 | ||
Line 200... | Line 217... | ||
200 | jmp ETH_Sender |
217 | |
201 | 218 | ||
Line 202... | Line 219... | ||
202 | .check_sockets: |
219 | .check_sockets: |
Line 220... | Line 237... | ||
220 | jnz .dump ; only one packet at a time may be in the buffer! |
237 | jnz .dump ; only one packet at a time may be in the buffer! |
Line 221... | Line 238... | ||
221 | 238 | ||
222 | cmp ecx, SOCKETBUFFSIZE - SOCKETHEADERSIZE; TODO: fix this problem ! |
239 | cmp ecx, SOCKETBUFFSIZE - SOCKETHEADERSIZE; TODO: fix this problem ! |
Line -... | Line 240... | ||
- | 240 | jg .dump |
|
- | 241 | ||
- | 242 | call IPv4_dest_to_dev |
|
- | 243 | cmp edi,-1 |
|
- | 244 | je .dump |
|
223 | jg .dump |
245 | inc [ICMP_PACKETS_RX+4*edi] |
Line 224... | Line 246... | ||
224 | 246 | ||
225 | DEBUGF 1,"Found valid ICMP packet for socket %x\n", esi |
247 | DEBUGF 1,"Found valid ICMP packet for socket %x\n", esi |