Rev 4394 | Rev 4501 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4394 | Rev 4396 | ||
---|---|---|---|
Line 370... | Line 370... | ||
370 | if( length > device->content ) return NULL; |
370 | if( length > device->content ) return NULL; |
371 | packet = packet_get_4( arp_globals.net_phone, device->addr_len, device->prefix, length, device->suffix ); |
371 | packet = packet_get_4( arp_globals.net_phone, device->addr_len, device->prefix, length, device->suffix ); |
372 | if( ! packet ) return NULL; |
372 | if( ! packet ) return NULL; |
373 | header = ( arp_header_ref ) packet_suffix( packet, length ); |
373 | header = ( arp_header_ref ) packet_suffix( packet, length ); |
374 | if( ! header ){ |
374 | if( ! header ){ |
375 | pq_release( packet ); |
375 | pq_release( arp_globals.net_phone, packet_get_id( packet )); |
376 | return NULL; |
376 | return NULL; |
377 | } |
377 | } |
378 | header->hardware = htons( device->hardware ); |
378 | header->hardware = htons( device->hardware ); |
379 | header->hardware_length = device->addr->length; |
379 | header->hardware_length = device->addr->length; |
380 | header->protocol = htons( protocol_map( device->service, protocol )); |
380 | header->protocol = htons( protocol_map( device->service, protocol )); |
Line 387... | Line 387... | ||
387 | length += proto->addr->length; |
387 | length += proto->addr->length; |
388 | bzero((( uint8_t * ) header ) + length, device->addr->length ); |
388 | bzero((( uint8_t * ) header ) + length, device->addr->length ); |
389 | length += device->addr->length; |
389 | length += device->addr->length; |
390 | memcpy((( uint8_t * ) header ) + length, target->value, target->length ); |
390 | memcpy((( uint8_t * ) header ) + length, target->value, target->length ); |
391 | if( packet_set_addr( packet, ( uint8_t * ) device->addr->value, ( uint8_t * ) device->broadcast_addr->value, CONVERT_SIZE( char, uint8_t, device->addr->length )) != EOK ){ |
391 | if( packet_set_addr( packet, ( uint8_t * ) device->addr->value, ( uint8_t * ) device->broadcast_addr->value, CONVERT_SIZE( char, uint8_t, device->addr->length )) != EOK ){ |
392 | pq_release( packet ); |
392 | pq_release( arp_globals.net_phone, packet_get_id( packet )); |
393 | return NULL; |
393 | return NULL; |
394 | } |
394 | } |
395 | nil_send_msg( device->phone, device_id, packet, SERVICE_ARP ); |
395 | nil_send_msg( device->phone, device_id, packet, SERVICE_ARP ); |
396 | return NULL; |
396 | return NULL; |
397 | } |
397 | } |
Line 520... | Line 520... | ||
520 | case NET_IL_RECEIVED: |
520 | case NET_IL_RECEIVED: |
521 | if( ! ERROR_OCCURRED( packet_translate( arp_globals.net_phone, & packet, IPC_GET_PACKET( call )))){ |
521 | if( ! ERROR_OCCURRED( packet_translate( arp_globals.net_phone, & packet, IPC_GET_PACKET( call )))){ |
522 | rwlock_read_lock( & arp_globals.lock ); |
522 | rwlock_read_lock( & arp_globals.lock ); |
523 | do{ |
523 | do{ |
524 | next = pq_next( packet ); |
524 | next = pq_next( packet ); |
525 | packet_detach( packet ); |
525 | pq_detach( packet ); |
526 | ERROR_CODE = arp_receive_message( IPC_GET_DEVICE( call ), packet ); |
526 | ERROR_CODE = arp_receive_message( IPC_GET_DEVICE( call ), packet ); |
527 | if( ERROR_CODE != 1 ) pq_release( arp_globals.net_phone, packet_get_id( packet )); |
527 | if( ERROR_CODE != 1 ) pq_release( arp_globals.net_phone, packet_get_id( packet )); |
528 | packet = next; |
528 | packet = next; |
529 | }while( packet ); |
529 | }while( packet ); |
530 | rwlock_read_unlock( & arp_globals.lock ); |
530 | rwlock_read_unlock( & arp_globals.lock ); |