Rev 1251 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1251 | Rev 1254 | ||
---|---|---|---|
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: 1251 $ |
19 | $Revision: 1254 $ |
Line 20... | Line 20... | ||
20 | 20 | ||
Line 121... | Line 121... | ||
121 | 121 | ||
Line 122... | Line 122... | ||
122 | push edx ebx |
122 | push edx ebx |
123 | 123 | ||
124 | ; save checksum, and clear it in original packet |
- | |
125 | mov di , [edx + IPv4_Packet.HeaderChecksum] |
124 | ; save checksum, and clear it in original packet |
Line 126... | Line 125... | ||
126 | DEBUGF 1,"checksum: %x\n",di |
125 | mov di , [edx + IPv4_Packet.HeaderChecksum] |
127 | mov word [edx + IPv4_Packet.HeaderChecksum], 0 |
126 | mov word [edx + IPv4_Packet.HeaderChecksum], 0 |
128 | 127 | ||
Line 138... | Line 137... | ||
138 | ; now compare the two.. |
137 | ; now compare the two.. |
139 | cmp dx, di |
138 | cmp dx, di |
140 | pop ebx edx |
139 | pop ebx edx |
141 | jne .dump ; if checksum isn't valid then dump packet |
140 | jne .dump ; if checksum isn't valid then dump packet |
Line -... | Line 141... | ||
- | 141 | ||
- | 142 | DEBUGF 1,"IPv4 Checksum is correct\n",di |
|
142 | 143 | ||
143 | mov eax, [edx + IPv4_Packet.DestinationAddress] |
144 | mov eax, [edx + IPv4_Packet.DestinationAddress] |
144 | mov edi, BROADCAST |
145 | mov edi, BROADCAST |
145 | mov ecx, MAX_IP+1 |
146 | mov ecx, MAX_IP+1 |
146 | repnz scasd |
147 | repnz scasd |
Line 155... | Line 156... | ||
155 | jmp .dump |
156 | jmp .dump |
Line 156... | Line 157... | ||
156 | 157 | ||
157 | .ip_ok: |
158 | .ip_ok: |
158 | call ETH_struc2dev ; TODO: make this work on other protocols too! |
159 | call ETH_struc2dev ; TODO: make this work on other protocols too! |
159 | inc [IP_PACKETS_RX+4*edi] |
160 | inc [IP_PACKETS_RX+4*edi] |
160 | DEBUGF 1,"IP_Handler - packet from %u.%u.%u.%u\n",\ |
161 | DEBUGF 1,"packet comes from %u.%u.%u.%u\n",\ |
Line 161... | Line 162... | ||
161 | [edx + IPv4_Packet.SourceAddress]:1,[edx + IPv4_Packet.SourceAddress + 1]:1,[edx + IPv4_Packet.SourceAddress + 2]:1,[edx + IPv4_Packet.SourceAddress + 3]:1 |
162 | [edx + IPv4_Packet.SourceAddress]:1,[edx + IPv4_Packet.SourceAddress + 1]:1,[edx + IPv4_Packet.SourceAddress + 2]:1,[edx + IPv4_Packet.SourceAddress + 3]:1 |
162 | 163 | ||
163 | mov al , [edx + IPv4_Packet.VersionAndIHL] |
164 | mov al , [edx + IPv4_Packet.VersionAndIHL] |
Line 187... | Line 188... | ||
187 | sub ecx, eax ; |
188 | sub ecx, eax ; |
Line 188... | Line 189... | ||
188 | 189 | ||
189 | add eax, edx |
190 | add eax, edx |
190 | push eax |
191 | push eax |
191 | mov al , [edx + IPv4_Packet.Protocol] |
- | |
192 | ;----------------------- experimental |
192 | mov al , [edx + IPv4_Packet.Protocol] |
193 | mov esi, [edx + IPv4_Packet.SourceAddress] |
193 | mov esi, [edx + IPv4_Packet.SourceAddress] |
194 | mov edi, [edx + IPv4_Packet.DestinationAddress] |
- | |
195 | ;----------------------- |
194 | mov edi, [edx + IPv4_Packet.DestinationAddress] |
Line 196... | Line 195... | ||
196 | pop edx ; Offset to data (tcp/udp/icmp/.. Packet) |
195 | pop edx ; Offset to data (tcp/udp/icmp/.. Packet) |
197 | 196 | ||
Line 202... | Line 201... | ||
202 | je UDP_handler |
201 | je UDP_handler |
Line 203... | Line 202... | ||
203 | 202 | ||
204 | cmp al , IP_PROTO_ICMP |
203 | cmp al , IP_PROTO_ICMP |
Line 205... | Line 204... | ||
205 | je ICMP_handler |
204 | je ICMP_handler |
Line 206... | Line 205... | ||
206 | 205 | ||
207 | DEBUGF 1,"IP_Handler - unknown protocol:%u\n",al |
206 | DEBUGF 1,"unknown protocol: %u\n",al |
208 | 207 | ||
209 | .dump: |
208 | .dump: |
Line 400... | Line 399... | ||
400 | 399 | ||
401 | 400 | ||
402 | add eax, edx |
401 | add eax, edx |
403 | push eax |
- | |
404 | mov al , [edx + IPv4_Packet.Protocol] |
402 | push eax |
405 | ;----------------------- experimental |
403 | mov al , [edx + IPv4_Packet.Protocol] |
406 | mov esi, [edx + IPv4_Packet.SourceAddress] |
- | |
407 | mov edi, [edx + IPv4_Packet.DestinationAddress] |
404 | mov esi, [edx + IPv4_Packet.SourceAddress] |
Line 408... | Line 405... | ||
408 | ;----------------------- |
405 | mov edi, [edx + IPv4_Packet.DestinationAddress] |
409 | pop edx ; Offset to data (tcp/udp/icmp/.. Packet) |
406 | pop edx ; Offset to data (tcp/udp/icmp/.. Packet) |