283,11 → 283,11 |
if( ! echo_data ){ |
res = ENOENT; |
}else{ |
res = icmp_echo( echo_data->id, echo_data->sequence, size, timeout, ttl, tos, dont_fragment, addr, addrlen ); |
if( echo_data->sequence < MAX_UINT16 ){ |
++ echo_data->sequence; |
res = icmp_echo( echo_data->identifier, echo_data->sequence_number, size, timeout, ttl, tos, dont_fragment, addr, addrlen ); |
if( echo_data->sequence_number < MAX_UINT16 ){ |
++ echo_data->sequence_number; |
}else{ |
echo_data->sequence = 0; |
echo_data->sequence_number = 0; |
} |
} |
fibril_rwlock_write_unlock( & icmp_globals.lock ); |
366,8 → 366,8 |
return icmp_release_and_return( packet, ENOMEM ); |
} |
bzero( header, sizeof( * header )); |
header->un.echo.id = id; |
header->un.echo.sequence = sequence; |
header->un.echo.identifier = id; |
header->un.echo.sequence_number = sequence; |
|
// prepare the reply and the reply timeout structures |
reply_timeout = malloc( sizeof( * reply_timeout )); |
379,7 → 379,7 |
free( reply_timeout ); |
return icmp_release_and_return( packet, ENOMEM ); |
} |
reply_timeout->reply_key = ICMP_GET_REPLY_KEY( header->un.echo.id, header->un.echo.sequence ); |
reply_timeout->reply_key = ICMP_GET_REPLY_KEY( header->un.echo.identifier, header->un.echo.sequence_number ); |
// timeout in microseconds |
reply_timeout->timeout = timeout * 1000; |
fibril_mutex_initialize( & reply->mutex ); |
511,7 → 511,7 |
fibril_rwlock_write_unlock( & icmp_globals.lock ); |
return index; |
}else{ |
id = echo_data->id; |
id = echo_data->identifier; |
fibril_rwlock_write_unlock( & icmp_globals.lock ); |
// return the echo data identifier as the ICMP phone |
return id; |
668,7 → 668,7 |
icmp_reply_ref reply; |
|
// compute the reply key |
reply_key = ICMP_GET_REPLY_KEY( header->un.echo.id, header->un.echo.sequence ); |
reply_key = ICMP_GET_REPLY_KEY( header->un.echo.identifier, header->un.echo.sequence_number ); |
pq_release( icmp_globals.net_phone, packet_get_id( packet )); |
// lock the globals |
fibril_rwlock_write_lock( & icmp_globals.lock ); |
710,7 → 710,7 |
ERROR_DECLARE; |
|
bool keep_on_going = true; |
fibril_rwlock_t lock; |
// fibril_rwlock_t lock; |
ipc_call_t answer; |
int answer_count; |
size_t length; |
724,7 → 724,7 |
*/ |
ipc_answer_0( callid, EOK ); |
|
fibril_rwlock_initialize( & lock ); |
// fibril_rwlock_initialize( & lock ); |
|
echo_data = ( icmp_echo_ref ) malloc( sizeof( * echo_data )); |
if( ! echo_data ) return ENOMEM; |
748,7 → 748,7 |
ERROR_CODE = EOK; |
break; |
case NET_ICMP_ECHO: |
fibril_rwlock_write_lock( & lock ); |
// fibril_rwlock_write_lock( & lock ); |
if( ! ipc_data_write_receive( & data_callid, & length )){ |
ERROR_CODE = EINVAL; |
}else{ |
758,18 → 758,18 |
}else{ |
if( ! ERROR_OCCURRED( ipc_data_write_finalize( data_callid, addr, length ))){ |
fibril_rwlock_write_lock( & icmp_globals.lock ); |
ERROR_CODE = icmp_echo( echo_data->id, echo_data->sequence, ICMP_GET_SIZE( call ), ICMP_GET_TIMEOUT( call ), ICMP_GET_TTL( call ), ICMP_GET_TOS( call ), ICMP_GET_DONT_FRAGMENT( call ), addr, ( socklen_t ) length ); |
ERROR_CODE = icmp_echo( echo_data->identifier, echo_data->sequence_number, ICMP_GET_SIZE( call ), ICMP_GET_TIMEOUT( call ), ICMP_GET_TTL( call ), ICMP_GET_TOS( call ), ICMP_GET_DONT_FRAGMENT( call ), addr, ( socklen_t ) length ); |
fibril_rwlock_write_unlock( & icmp_globals.lock ); |
free( addr ); |
if( echo_data->sequence < MAX_UINT16 ){ |
++ echo_data->sequence; |
if( echo_data->sequence_number < MAX_UINT16 ){ |
++ echo_data->sequence_number; |
}else{ |
echo_data->sequence = 0; |
echo_data->sequence_number = 0; |
} |
} |
} |
} |
fibril_rwlock_write_unlock( & lock ); |
// fibril_rwlock_write_unlock( & lock ); |
break; |
default: |
ERROR_CODE = icmp_process_message( & call ); |
780,7 → 780,7 |
|
// release the identifier |
fibril_rwlock_write_lock( & icmp_globals.lock ); |
icmp_echo_data_exclude( & icmp_globals.echo_data, echo_data->id ); |
icmp_echo_data_exclude( & icmp_globals.echo_data, echo_data->identifier ); |
fibril_rwlock_write_unlock( & icmp_globals.lock ); |
return EOK; |
} |
845,8 → 845,8 |
break; |
} |
}while( icmp_echo_data_find( & icmp_globals.echo_data, index ) != NULL ); |
echo_data->id = index; |
echo_data->sequence = 0; |
echo_data->identifier = index; |
echo_data->sequence_number = 0; |
return icmp_echo_data_add( & icmp_globals.echo_data, index, echo_data ); |
} |
|