Skip to content

Malformed packet error at connection time when QOS level is 1 (At least once) and MQTT version 3.1 #2522

Description

@garinocyr

Environment

  • System running Mosquitto: Linux CentOS 7
    • Using docker image: eclipse-mosquitto:latest (2.0.14)
  • System trying to connect and publish MQTT topics: OpenVMS 8.4
  • Library used to connect and publish MQTT topics: librabbitmq with plugin MQTT (version 3.1)

Describe the bug

  • When connecting to Mosquitto, a connection failure occurs with the following trace in Mosquitto log file
...
2022-04-26T16:42:52: New connection from xxx.xxx.xxx.xxx:61289 on port 1883.
2022-04-26T16:42:52: Client <unknown> disconnected due to malformed packet.
...
  • Default QOS level set at connection time by librabbitmq is 1 (At least once)

Expected behaviour

  • Connection success with no malformed packet error raised

Remarks

  • This bug does not occur with Mosquitto version 1.3.5 (build date 2014-10-08 22:00:48+0000)

Analysis

  • Wireshark trace for connection request from librabbitmq (OpenVMS 8.4)
    MQTT_connect_message
  • Wireshark trace for connection request from mosquitto_pub using option "-V mqttv31" (Linux CentOS 7)
    MQTT_connect_message_mosquitto_pub
  • There is a difference with the QOS level value in the fixed header
    • librabbitmq sets it to 1 (At least once)
    • mosquitto_pub sets it to 0 (At most once)
  • Modifying the MQTT message generated by librabbitmq (using Wireshark trace and TCPReplay tool) with QOS level set to 1 makes Mosquitto 2.0.14 accept connection
  • The MQTT version 3.1 specification does not mention the obligation to set the QOS level value to 0 for CONNECT message type

Metadata

Metadata

Assignees

No one assigned

    Labels

    Component: mosquitto-brokerStatus: CompletedNothing further to be done with this issue, it can be closed by the requestor or committer.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions