Skip to contentSkip to conversation

trace-cmd listen: Do not compress for v1 of the msg protocol

PATCH New Steven Rostedt 1 participant 1 message May 21, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 trace-cmd listen: Do not compress for v1 of the msg protocol

From: "Steven Rostedt (Google)" <[email protected]>

The v1 of the msg protocol cannot handle compression being sent across the network. Do not compress if the listener can only handle the v1 message protocol.

Fixes 3f8447b1e2f97 ("trace-cmd library: Add support for compression algorithms")
---
 tracecmd/trace-record.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)
tracecmd/trace-record.c +6 -7
index f8d2bad70566..c770f698019f 100644
@@ -3780,19 +3780,18 @@ setup_connection(struct buffer_instance *instance, struct common_record_context
 		if (ret)
 			goto error;
 	} else {
+		/*
+		 * V3 can handle compression, but V1 can not.
+		 * Set the file version back to 6.
+		 */
+		ctx->file_version = FILE_VERSION_MIN;
+		ctx->compression = false;
 		network_handle = tracecmd_output_create_fd(msg_handle->fd);
 		if (!network_handle)
 			goto error;
 		if (tracecmd_output_set_version(network_handle, ctx->file_version))
 			goto error;
 
-		if (ctx->compression) {
-			if (tracecmd_output_set_compression(network_handle, ctx->compression))
-				goto error;
-		} else if (ctx->file_version >= FILE_VERSION_COMPRESSION) {
-			tracecmd_output_set_compression(network_handle, "any");
-		}
-
 		if (tracecmd_output_write_headers(network_handle, listed_events))
 			goto error;
 		tracecmd_set_quiet(network_handle, quiet);
Signature · 1 line
2.35.1