[netperf-dev] [PATCH] Avoid a double htonl in udp_stream results
Rick Jones
rick.jones2 at hp.com
Thu Jul 21 13:37:35 PDT 2011
On 07/21/2011 12:10 PM, David MacMahon wrote:
> In recv_udp_stream(), htonl was called on the bytes_received field
> before calling send_response() which also calls htonl on bytes_received
> (and all other fields). This double htonl had no effect when netserver
> is running on big endian systems, but on little endian systems it caused
> bytes_received to be passed on the wire in little endian form rather
> than big endian form (i.e. network byte order).
> ---
> src/nettest_bsd.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/src/nettest_bsd.c b/src/nettest_bsd.c
> index 69f6d11..79d4ba4 100644
> --- a/src/nettest_bsd.c
> +++ b/src/nettest_bsd.c
> @@ -7296,7 +7296,7 @@ recv_udp_stream()
> }
>
> netperf_response.content.response_type = UDP_STREAM_RESULTS;
> - udp_stream_results->bytes_received = htonl(bytes_received);
> + udp_stream_results->bytes_received = bytes_received;
> udp_stream_results->messages_recvd = messages_recvd;
> udp_stream_results->elapsed_time = elapsed_time;
> udp_stream_results->cpu_method = cpu_method;
Do you have some before/after output showing the number wrong and then
correct? (Yes, I'm being a paranoid pedant :)
The omni migration sort of makes the patch moot, but I'll apply the
patch regardless. FWIW, it appears there is a similar hton call in
recv_tcp_stream:
tcp_stream_results->bytes_received = htond(bytes_received);
tcp_stream_results->elapsed_time = elapsed_time;
tcp_stream_results->recv_calls = receive_calls;
not sure what the send side does upon reciept.
rick jones
More information about the netperf-dev
mailing list