You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was trying to get an esp8266 connecting to "Losant" via MQTT using the Losant native device identifiers as well as authentication. Unfortunately they have a 24 byte client ID, 36 byte user ID and 64 byte password. I found that "tshark" was interpreting these CONNECT requests as malformed :-
Transmission Control Protocol, Src Port: 1537 (1537), Dst Port: 1883 (1883), Seq: 1, Ack: 1, Len: 147
MQ Telemetry Transport Protocol
Connect Command
0001 0000 = Header Flags: 0x10 (Connect Command)
0001 .... = Message Type: Connect Command (1)
.... 0... = DUP Flag: Not set
.... .00. = QOS Level: Fire and Forget (0)
.... ...0 = Retain: Not set
Msg Len: 17
[Malformed Packet: MQTT]
MQ Telemetry Transport Protocol
Publish Message
0011 0100 = Header Flags: 0x34 (Publish Message)
0011 .... = Message Type: Publish Message (3)
.... 0... = DUP Flag: Not set
.... .10. = QOS Level: Assured Delivery (2)
.... ...0 = Retain: Not set
Msg Len: 101
[Malformed Packet: MQTT]
If I shortened the password to a maximal 51 bytes, it would get decoded correctly. I also curiously noticed the Msg Len was 127.
Transmission Control Protocol, Src Port: 24094 (24094), Dst Port: 1883 (1883), Seq: 1, Ack: 1, Len: 129
MQ Telemetry Transport Protocol
Connect Command
0001 0000 = Header Flags: 0x10 (Connect Command)
0001 .... = Message Type: Connect Command (1)
.... 0... = DUP Flag: Not set
.... .00. = QOS Level: Fire and Forget (0)
.... ...0 = Retain: Not set
Msg Len: 127
Protocol Name: MQTT
Version: 4
1100 0010 = Connect Flags: 0xc2
1... .... = User Name Flag: Set
.1.. .... = Password Flag: Set
..0. .... = Will Retain: Not set
...0 0... = QOS Level: Fire and Forget (0)
.... .0.. = Will Flag: Not set
.... ..1. = Clean Session Flag: Set
.... ...0 = (Reserved): Not set
Keep Alive: 0
Client ID: 58ffe54ebea7820001dc1111
User Name: 7e6f0030-5806-4d52-a1b0-8f1c48fe1111
Password: passw0rd0123456789012345678901234567890123456789012
Going through the MQTT 3.1.1 specs I could see there was meant to be special handling for a message length >127 where we write the length into the header. I can see in the umqtt code for the publish function we seem to be doing this with the "while sz > 0x7f:" code. We need to do the same for the connect function.
The text was updated successfully, but these errors were encountered:
I was trying to get an esp8266 connecting to "Losant" via MQTT using the Losant native device identifiers as well as authentication. Unfortunately they have a 24 byte client ID, 36 byte user ID and 64 byte password. I found that "tshark" was interpreting these CONNECT requests as malformed :-
If I shortened the password to a maximal 51 bytes, it would get decoded correctly. I also curiously noticed the Msg Len was 127.
Going through the MQTT 3.1.1 specs I could see there was meant to be special handling for a message length >127 where we write the length into the header. I can see in the umqtt code for the publish function we seem to be doing this with the "while sz > 0x7f:" code. We need to do the same for the connect function.
The text was updated successfully, but these errors were encountered: