When having one Diameter message spanned in two different TCP packets (TCP is used as Diameter transport protocol), wireshark sometimes is not able to reassemble properly the Diameter messages. We have seen the following situations: 1) The payload in the TCP message is not starting as a Diamter message (probably wireshark does not understand the Diameter version and the Diameter message length are coming). In this situation, wireshark shows the Diameter message as a CONTINUATION of the previous ones. 2) The payload in the TCP message seems to be starting as a Diameter message (probably wireshark understands a Diameter version and a valid message length is coming), but the truth is it is the continuation of a Diameter message which was sent in the previous TCP packet. In this situation, wireshark shows the Diameter message is containing a unknwon command code containing a malformed Diameter message. This is usually seen when a packet is lost or at the beginning of the trace. Once the TCP payload is starting with a valid Diameter message (with its Diameter version, length, and valid command code) wireshark is decoding the messages properly, until a new packet is lost. In the end, it seems a system is sending invalid Diameter messages when it is not. Have you already seen this problem? Do you know if that might be related to how wireshark reassembles Diameter messages? By the way, both TCP (Allow subdisectors to reassemble TCP streams) and Diameter (Reassemble Diameter messages spanning multiple TCP segments) options to reassemble Diameter/TCP messages are set. asked 27 Mar '14, 11:29 Juan_ma |
One Answer:
From what I understand of your question (hint: a publicly posted capture somewhere helps tremendously) you are expecting the Diameter dissector to be able to correctly reassemble and dissect messages where some fragment of the message is missing? I'm not at all familiar with Diameter but in general this isn't going to happen for any protocol as each message fragment will contain vital information for the reassembly and if any is missing then reassembly will be at best broken, and at worst the dissector will complain about a malformed (incomplete) message. This situation will especially apply for protocols running over stream based (i.e. no message boundaries) transport protocols such as tcp as the application protocol doesn't have any idea of what transport fragmentation may be taking place so can't ensure a viable application pdu is in each transport layer fragment. answered 28 Mar '14, 03:25 grahamb ♦
Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.
|
If you have a sample capture showing the 2nd case (Wireshark thinks it's Diameter but it's not really) it's possible someone could improve the Diameter dissector's heuristics to remove these false positives (i.e., make it claim that it's just continuation data).
It sounds like Wireshark is reporting this correctly Juan. From it's perspective, at the beginning or end of your trace file if only one of the two segments that make up the Diameter message exist in the trace file, it's not going to call it a correctly-formed Diameter message.
Diameter over TCP, so I'm assuming this is a credit control interface? If you can share it you can upload it here and post a link: https://appliance.cloudshark.org/upload/
Finally I managed to get a file without sensitive information. I also manipulated all ip addresses, mac addresses and Diameter addresses, so take into account checksums will not be valid.
Here there is a link to the pcap file: https://www.cloudshark.org/captures/6cf577bd1721
From frame 1 to 14, packets are decoded as DIAMETER CONTINUATION messages since it is the beginning of the trace and the payload is not beginning with the starting of a Diameter message.
From frame 15 to 683, packets are correctly decoded, main reason is starting of payload in packet 15 coincides with the beginning of a Diameter message.
687 frame was received out of order (684 is really the continuation of 687). At this moment wireshark stops reassembling Diameter messages (don't know if somehow it could realize 684 is the continuation of 687)
From frame 691 to 693, packets are decoded as DIAMETER CONTINUATION messages since the payload is not beginning with the starting of a Diameter message.
Payload in 694 is starting with 01, which is how Diameter messages are starting (Diameter version) and next three bytes are considered the length of the Diameter message, those three bytes are including value 07 40 00 in hex which basically is understood by wireshark as a length of 475136 bytes!!! The truth is payload of frame 694 is the continuation of frame 693, but its starting is similar to a Diameter message (I wonder if Diameter dissector's is just chaecking Diameter version is coming...).
All frames from 694 to 1398 are reassembled as a Diameter message of 475136 bytes, this huge Diameter message is not understood by wireshark and considers it a malformed Diameter message.
Frame 1400 is not starting as a Diameter message (no 01 at the beginning) and hence wireshark considers it a Diameter continuation
However frame 1401 is starting with 01 and the next three bytes read are 2c 01 00, which is understood by Diameter dissector as a Diameter message of 2883840 bytes!!! That would mean messages from 1401 to 5602 are understood as one Diameter message.
Same behaviour is repeated until frame number 11375 where the starting of the TCP payload coincides again with the beginning of a real Diameter message (Diameter version/ Diameter length/Diameter Flags/Diameter Command Code...)
I guess it is a problem on the Diameter dissector's heuristics as Jeff pointed out.
You were exactly right that the Diameter dissector was only looking at the version and not the length. I submitted a change which strengthens those heuristics so the length is checked (only works for messages under 8192 bytes--if you know messages might be bigger than that in the real world, let me know and I'll increase the number) and that none of the reserved Flags bits are set.
(Really should have moved this over to a bug report but oh well...)
Sorry, I'm quite new on this fora and didn't know I could create a bug report. I guess you'll take the point of requesting to solve this issue, right?
In relation to the Diameter message size, I know cases where 64 Kbytes are sent in the real world, and the truth is Diameter RFC is theoretically allowing 16777215 bytes.
I think it would be better to check command flags fields coming after the length (see text copied from RFC 6733):
Command Flags The Command Flags field is eight bits. The following bits are assigned:
and taking into account "r" bits must be zero