From: Jérémie Galarneau Date: Fri, 23 Oct 2015 21:12:51 +0000 (-0400) Subject: Fix: Java agent protocol network endianness consistency X-Git-Tag: v2.8.0-rc1~55 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=abac44cda88a3b83c2bf98c6bab16ed6a1cc1af1;p=lttng-ust.git Fix: Java agent protocol network endianness consistency Considering the Agent Protocol is bumped to v2.0 as of 2.8.x, this patch revisits the unfortunate decision of communicating in host-endianness from the session daemon to the agents, and in big endian from the agents to the session daemon. This change does not affect the Python agent which was erroneously (although quite reasonably) assuming communications were occurring in network endianness. This issue does not affect versions 2.7 and below because the loglevel was not used. Signed-off-by: Jérémie Galarneau Signed-off-by: Mathieu Desnoyers --- diff --git a/liblttng-ust-java-agent/java/lttng-ust-agent-common/org/lttng/ust/agent/client/SessiondDisableEventCommand.java b/liblttng-ust-java-agent/java/lttng-ust-agent-common/org/lttng/ust/agent/client/SessiondDisableEventCommand.java index 03cd9de6..2956c7e2 100644 --- a/liblttng-ust-java-agent/java/lttng-ust-agent-common/org/lttng/ust/agent/client/SessiondDisableEventCommand.java +++ b/liblttng-ust-java-agent/java/lttng-ust-agent-common/org/lttng/ust/agent/client/SessiondDisableEventCommand.java @@ -38,7 +38,7 @@ class SessiondDisableEventCommand implements ISessiondCommand { throw new IllegalArgumentException(); } ByteBuffer buf = ByteBuffer.wrap(data); - buf.order(ByteOrder.LITTLE_ENDIAN); + buf.order(ByteOrder.BIG_ENDIAN); eventName = new String(data).trim(); } diff --git a/liblttng-ust-java-agent/java/lttng-ust-agent-common/org/lttng/ust/agent/client/SessiondEnableEventCommand.java b/liblttng-ust-java-agent/java/lttng-ust-agent-common/org/lttng/ust/agent/client/SessiondEnableEventCommand.java index c9183d19..5665a691 100644 --- a/liblttng-ust-java-agent/java/lttng-ust-agent-common/org/lttng/ust/agent/client/SessiondEnableEventCommand.java +++ b/liblttng-ust-java-agent/java/lttng-ust-agent-common/org/lttng/ust/agent/client/SessiondEnableEventCommand.java @@ -48,7 +48,7 @@ class SessiondEnableEventCommand implements ISessiondCommand { throw new IllegalArgumentException(); } ByteBuffer buf = ByteBuffer.wrap(data); - buf.order(ByteOrder.LITTLE_ENDIAN); + buf.order(ByteOrder.BIG_ENDIAN); int logLevel = buf.getInt(); int logLevelType = buf.getInt(); logLevelFilter = new LogLevelSelector(logLevel, logLevelType);