Rev 4702 | Rev 4723 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 4702 | Rev 4708 | ||
|---|---|---|---|
| Line 435... | Line 435... | ||
| 435 | if( length <= sizeof( arp_header_t )) return EINVAL; |
435 | if( length <= sizeof( arp_header_t )) return EINVAL; |
| 436 | device = arp_cache_find( & arp_globals.cache, device_id ); |
436 | device = arp_cache_find( & arp_globals.cache, device_id ); |
| 437 | if( ! device ) return ENOENT; |
437 | if( ! device ) return ENOENT; |
| 438 | header = ( arp_header_ref ) packet_get_data( packet ); |
438 | header = ( arp_header_ref ) packet_get_data( packet ); |
| 439 | if(( ntohs( header->hardware ) != device->hardware ) |
439 | if(( ntohs( header->hardware ) != device->hardware ) |
| 440 | // TODO how remove conversion from int '2' to uint? |
- | |
| 441 | || ( length < sizeof( arp_header_t ) + ( header->hardware_length + header->protocol_length ) * 2u )){ |
440 | || ( length < sizeof( arp_header_t ) + header->hardware_length * 2u + header->protocol_length * 2u )){ |
| 442 | return EINVAL; |
441 | return EINVAL; |
| 443 | } |
442 | } |
| 444 | proto = arp_protos_find( & device->protos, protocol_unmap( device->service, ntohs( header->protocol ))); |
443 | proto = arp_protos_find( & device->protos, protocol_unmap( device->service, ntohs( header->protocol ))); |
| 445 | if( ! proto ) return ENOENT; |
444 | if( ! proto ) return ENOENT; |
| 446 | src_hw = (( uint8_t * ) header ) + sizeof( arp_header_t ); |
445 | src_hw = (( uint8_t * ) header ) + sizeof( arp_header_t ); |
| Line 494... | Line 493... | ||
| 494 | } |
493 | } |
| 495 | arp_protos_clear( & device->protos ); |
494 | arp_protos_clear( & device->protos ); |
| 496 | } |
495 | } |
| 497 | 496 | ||
| 498 | int arp_connect_module( services_t service ){ |
497 | int arp_connect_module( services_t service ){ |
| - | 498 | if( service != SERVICE_ARP ) return EINVAL; |
|
| 499 | return EOK; |
499 | return EOK; |
| 500 | } |
500 | } |
| 501 | 501 | ||
| 502 | int arp_mtu_changed_message( device_id_t device_id, size_t mtu ){ |
502 | int arp_mtu_changed_message( device_id_t device_id, size_t mtu ){ |
| 503 | arp_device_ref device; |
503 | arp_device_ref device; |