Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 4707 → Rev 4708

/branches/network/uspace/srv/net/il/arp/arp.c
437,8 → 437,7
if( ! device ) return ENOENT;
header = ( arp_header_ref ) packet_get_data( packet );
if(( ntohs( header->hardware ) != device->hardware )
// TODO how remove conversion from int '2' to uint?
|| ( length < sizeof( arp_header_t ) + ( header->hardware_length + header->protocol_length ) * 2u )){
|| ( length < sizeof( arp_header_t ) + header->hardware_length * 2u + header->protocol_length * 2u )){
return EINVAL;
}
proto = arp_protos_find( & device->protos, protocol_unmap( device->service, ntohs( header->protocol )));
496,6 → 495,7
}
 
int arp_connect_module( services_t service ){
if( service != SERVICE_ARP ) return EINVAL;
return EOK;
}
 
/branches/network/uspace/srv/net/il/arp/arp_remote.c
84,6 → 84,7
}
 
int arp_connect_module( services_t service ){
if( service != SERVICE_ARP ) return EINVAL;
return connect_to_service( SERVICE_ARP );
}
 
/branches/network/uspace/srv/net/il/icmp/icmp.c
214,14 → 214,15
}
 
int icmp_process_packet( packet_t packet ){
int length;
size_t length;
int result;
void * data;
icmp_header_ref header;
 
// get rid of the ip header
length = ip_client_process_packet( packet, NULL, NULL, NULL, NULL, NULL );
if( length < 0 ) return length;
packet_trim( packet, length, 0 );
result = ip_client_process_packet( packet, NULL, NULL, NULL, NULL, NULL );
if( result < 0 ) return result;
packet_trim( packet, ( size_t ) result, 0 );
 
length = packet_get_data_length( packet );
if( length <= 0 ) return EINVAL;
/branches/network/uspace/srv/net/il/ip/ip.c
233,7 → 233,7
checksum = compact_checksum(compute_checksum( 0, data, length ));
 
// flip, zero is returned as 0xFFFF (not flipped)
return ( ~ checksum ) ? ~ checksum : IP_HEADER_CHECKSUM_ZERO;
return ( ~ checksum ) ? ( uint16_t ) ( ~ checksum ) : IP_HEADER_CHECKSUM_ZERO;
}
 
int ip_initialize( async_client_conn_t client_connection ){
906,10 → 906,12
ip_header_ref last_header;
uint8_t * src;
uint8_t * dest;
int address_length;
size_t address_length;
int result;
 
address_length = packet_get_addr( packet, & src, & dest );
if( address_length <= 0 ) return EINVAL;
result = packet_get_addr( packet, & src, & dest );
if( result <= 0 ) return EINVAL;
address_length = ( size_t ) result;
if( packet_get_data_length( packet ) <= sizeof( ip_header_t )) return ENOMEM;
// get header
header = ( ip_header_ref ) packet_get_data( packet );
994,7 → 996,7
next = sizeof( ip_header_t );
// process all ip options
while( next < first->ihl ){
option = ( ip_option_ref ) ((( void * ) first ) + next );
option = ( ip_option_ref ) ((( uint8_t * ) first ) + next );
// skip end or noop
if(( option->type == IPOPT_END ) || ( option->type == IPOPT_NOOP )){
++ next;
1001,7 → 1003,7
}else{
// copy if said so or skip
if( IPOPT_COPIED( option->type )){
memcpy((( void * ) last ) + length, (( void * ) first ) + next, option->length );
memcpy((( uint8_t * ) last ) + length, (( uint8_t * ) first ) + next, option->length );
length += option->length;
}
// next option
1010,7 → 1012,7
}
// align 4 byte boundary
if( length % 4 ){
bzero((( void * ) last ) + length, 4 - ( length % 4 ));
bzero((( uint8_t * ) last ) + length, 4 - ( length % 4 ));
last->ihl = length / 4 + 1;
}else{
last->ihl = length / 4;