MQTT decoding PUBLISH with QoS 0
Submitted by Alexander Kaiser
Assigned to Bence Janos Szabo
Link to original bug (#519882)
Description
Created attachment 269432 Logfile with the described scenario
This Bug belongs to the MQTT ProtocolModule and is available in both Modules (negative & regular).
Setup: I have Titan (TS) for simulating an MQTT-Client and a Reference Implementation of an MQTT-Broker as the SUT. The TS connects to the broker and subscribes to a specific Topic with QoS 0. In the next step, the TS publishes messages to the Topic and waits for a publish from the Broker (Ping-Pong)
Observed Behavior: The received publish from the broker contains a payload which is 2 Bytes shorter than the original payload. Instead, the decoded Publish Control Packet has a packet_identifier with exactly the two missing Bytes. According to [MQTT-2.3.1-5] a Publish Packet MUST NOT contain a packet_identifier if its QoS value is set to 0. In the Codec (Mqtt_v3.1.1_EncDec.cc) I found in Line 196 the point which should omit the packet_identifier in the case of QoS == 0, but seem not to work.
Find attached a log for the described scenario.
Attachment 269432, "Logfile with the described scenario":
mqtt_2.3.1-5.log