Subversion Repositories Kolibri OS

Rev

Rev 3640 | Rev 3644 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3640 Rev 3643
Line 174... Line 174...
174
; Check validity and print some debug info
174
; Check validity and print some debug info
Line 175... Line 175...
175
 
175
 
176
        cmp     ecx, sizeof.ARP_header
176
        cmp     ecx, sizeof.ARP_header
Line 177... Line 177...
177
        jb      .exit
177
        jb      .exit
178
 
178
 
179
        call    NET_ptr_to_num
179
        call    NET_ptr_to_num4
Line 180... Line 180...
180
        cmp     edi, -1
180
        cmp     edi, -1
Line 181... Line 181...
181
        jz      .exit
181
        jz      .exit
182
 
182
 
183
        inc     [ARP_PACKETS_RX + 4*edi]        ; update stats
183
        inc     [ARP_PACKETS_RX + edi]          ; update stats
Line 184... Line 184...
184
 
184
 
185
        DEBUGF  DEBUG_NETWORK_VERBOSE, "ARP_input: got packet from %u.%u.%u.%u through device %u\n",\
185
        DEBUGF  DEBUG_NETWORK_VERBOSE, "ARP_input: got packet from %u.%u.%u.%u (device*4=%u)\n",\
Line 186... Line 186...
186
        [edx + ARP_header.SenderIP]:1, [edx + ARP_header.SenderIP + 1]:1,\
186
        [edx + ARP_header.SenderIP]:1, [edx + ARP_header.SenderIP + 1]:1,\
187
        [edx + ARP_header.SenderIP + 2]:1, [edx + ARP_header.SenderIP + 3]:1, edi
187
        [edx + ARP_header.SenderIP + 2]:1, [edx + ARP_header.SenderIP + 3]:1, edi
188
 
188
 
Line 189... Line 189...
189
;------------------------------
189
;------------------------------
190
; First, check for IP collision
190
; First, check for IP collision
Line 191... Line 191...
191
 
191
 
192
        mov     eax, [edx + ARP_header.SenderIP]
192
        mov     eax, [edx + ARP_header.SenderIP]
Line 193... Line 193...
193
        cmp     eax, [IP_LIST + 4*edi]
193
        cmp     eax, [IP_LIST + edi]
Line 194... Line 194...
194
        je      .collision
194
        je      .collision
195
 
195
 
196
;---------------------
196
;---------------------
Line 197... Line 197...
197
; Handle reply packets
197
; Handle reply packets
198
 
198
 
199
        cmp     [edx + ARP_header.Opcode], ARP_REP_OPCODE
199
        cmp     [edx + ARP_header.Opcode], ARP_REP_OPCODE
200
        jne     .maybe_request
200
        jne     .maybe_request
201
 
201
 
202
        DEBUGF  DEBUG_NETWORK_VERBOSE, "ARP_input: It's a reply\n"
202
        DEBUGF  DEBUG_NETWORK_VERBOSE, "ARP_input: It's a reply\n"
203
 
203
 
Line 243... Line 243...
243
        cmp     [edx + ARP_header.Opcode], ARP_REQ_OPCODE
243
        cmp     [edx + ARP_header.Opcode], ARP_REQ_OPCODE
244
        jne     .exit
244
        jne     .exit
Line 245... Line 245...
245
 
245
 
Line 246... Line 246...
246
        DEBUGF  DEBUG_NETWORK_VERBOSE, "ARP_input: its a request\n"
246
        DEBUGF  DEBUG_NETWORK_VERBOSE, "ARP_input: its a request\n"
247
 
247
 
248
        mov     eax, [IP_LIST + 4*edi]
248
        mov     eax, [IP_LIST + edi]
Line 249... Line 249...
249
        cmp     eax, [edx + ARP_header.TargetIP]                ; Is it looking for my IP address?
249
        cmp     eax, [edx + ARP_header.TargetIP]                ; Is it looking for my IP address?
250
        jne     .exit
250
        jne     .exit
Line 260... Line 260...
260
        movsd                                                   ; Move Sender Mac to Dest MAC
260
        movsd                                                   ; Move Sender Mac to Dest MAC
261
        movsw                                                   ;
261
        movsw                                                   ;
262
        movsd                                                   ; Move sender IP to Dest IP
262
        movsd                                                   ; Move sender IP to Dest IP
Line 263... Line 263...
263
 
263
 
264
        pop     esi
264
        pop     esi
265
        mov     esi, [NET_DRV_LIST + 4*esi]
265
        mov     esi, [NET_DRV_LIST + esi]
266
        lea     esi, [esi + ETH_DEVICE.mac]
266
        lea     esi, [esi + ETH_DEVICE.mac]
267
        lea     edi, [edx + ARP_header.SenderMAC]
267
        lea     edi, [edx + ARP_header.SenderMAC]
268
        movsd                                                   ; Copy MAC address from in MAC_LIST
268
        movsd                                                   ; Copy MAC address from in MAC_LIST
269
        movsw                                                   ;
269
        movsw                                                   ;
Line 288... Line 288...
288
 
288
 
289
        call    [ebx + NET_DEVICE.transmit]
289
        call    [ebx + NET_DEVICE.transmit]
Line 290... Line 290...
290
        ret
290
        ret
291
 
291
 
292
  .collision:
292
  .collision:
Line 293... Line 293...
293
        inc     [ARP_CONFLICTS + 4*edi]
293
        inc     [ARP_CONFLICTS + edi]
294
        DEBUGF  DEBUG_NETWORK_VERBOSE, "ARP_input: IP address conflict detected!\n"
294
        DEBUGF  DEBUG_NETWORK_VERBOSE, "ARP_input: IP address conflict detected!\n"
295
 
295