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.desnoy...@efficios.com>
---
 src/bin/lttng-relayd/stream.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

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

_______________________________________________
lttng-dev mailing list
lttng-dev@lists.lttng.org
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

Reply via email to