diff mbox series

[RFC,lttng-tools] Fix: relayd: Swap endianness of packet index

Message ID 20191108163247.6821-1-mathieu.desnoyers@efficios.com
State New
Headers show
Series [RFC,lttng-tools] Fix: relayd: Swap endianness of packet index | expand

Commit Message

Mathieu Desnoyers Nov. 8, 2019, 4:32 p.m. UTC
The packet index in stream_update_index() is meant to be stored
to disk, and therefore is kept in big endian.

Swap its endianness to host endian before using it internally.

Fixes "Fix: relayd: use packet sequence number for rotation position".

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers at efficios.com>
---
 src/bin/lttng-relayd/stream.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/src/bin/lttng-relayd/stream.c b/src/bin/lttng-relayd/stream.c
index c5bf3759..f9ff5e9a 100644
--- a/src/bin/lttng-relayd/stream.c
+++ b/src/bin/lttng-relayd/stream.c
@@ -1142,7 +1142,8 @@  int stream_update_index(struct relay_stream *stream, uint64_t net_seq_num,
 		tracefile_array_file_rotate(stream->tfa, TRACEFILE_ROTATE_READ);
 		tracefile_array_commit_seq(stream->tfa);
 		stream->index_received_seqcount++;
-		stream->received_packet_seq_num = index->index_data.packet_seq_num;
+		stream->received_packet_seq_num =
+				be64toh(index->index_data.packet_seq_num);
 		*flushed = true;
 	} else if (ret > 0) {
 		index->total_size = total_size;