[netperf-dev] [PATCH] Avoid a double htonl in udp_stream results

David MacMahon davidm at astro.berkeley.edu
Thu Jul 21 12:10:28 PDT 2011


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;
-- 
1.7.4



More information about the netperf-dev mailing list