This is a static, read-only archive of Wireshark Q&A. Older questions and answers from October 2017 and earlier can be found at osqa-ask.wireshark.org.
0

UDP datagram wrongly reassembled

asked Jan 09 '26

updated Jan 09 '26

I am analyzing a 10G SR connection between an IoT device and a Linux computer without a switch in between. Captured data is here

The filter ip.fragment.error shows some errors, eg for packet: 1125980. But this packet is correct. However the following datagram is not correctly reassembled.

wrongly reassembled packet image

Packet 1125995 is regarded as last fragment, but it has the "more fragments flag" set. It is followed by two additional packets, where 1125997 has a cleared "more fragments flag" and is not used for reassembling.

What's wrong with this packets?

I'm using version 4.6.2

Thanks

Tom

Comments

Your link to the packet image seems to be broken.

User 98587 ( Jan 09 '26 )

This is the link to the image: https://nextcloud.abaxor.de/index.php...

User 56935 ( Jan 09 '26 )

NextCloud seems to mangle the URL, you could post the image on a public share and then post a link to it back here.

User 98587 ( Jan 09 '26 )

Captured data is here

Browser download says cam_145_8_frames.pcapng is 1.7GB.
Please make a smaller capture file with frames of interest that show the issue.

User 2763 ( Jan 09 '26 )

Not an answer - parking subset of the screenshot showing the question frames.
Please make a smaller capture file from 1125980 to 1125998.

image description

User 2763 ( Jan 09 '26 )

1 Answer

1

answered Jan 09 '26

This looks like an example of analysis issues caused by ip.id reuse.

Excluding the TCP and ICMP packets (!tcp && !icmp), the sample capture shows reconstituted UDP packets from ip address 192.168.1.145 to ip address 192.168.1.3, with each UDP packet made from 17 IP packets of which which the first 16 IP packets have ip.flags.mf == True. IP level fragmentation makes use of the ip.id field to help identify the relevant fragments. Reuse of ip.id values can trigger analysis ambiguities when an aip.id is used more than once and an earlier fragmented UDP packet is not fully resolved.

In In the case of frame.number == 1125980 we have ip.id == 0xb002 and in the case of frame.number == 1125995 we have ip.id == 0xb003.

With ip.id == 0xb002 we see that we have only 12 of the expected 17 ip packets at approximately 23.293 seconds into the capture (frame.number in {19306..19317}). Several seconds later at approximately 33.266 seconds into the capture (frame.number in {1125964..1125980}) we have a second group of packets with ip.id == 0xb002. If we expand the [IPv4 Fragments] tree in the packet details of frame.number == 1125980 we see this UDP packet appears to be composed of 29 IP packets.

With ip.id == 0xb003 at approximately 23.293 seconds into the capture (frame.number in {19318..19319}) we see the last two IP packets of an expected 17 ip packets for an expected UDP packet. At approximately 33.266 seconds into the capture (frame.number in {11259581..1125997}) for we see a complete set of 17 ip packets for a UDP packet. On frame.number == 1125995 the [IPv4 Fragments] field only shows 17 IP packets with the last two parts of the UDP packet reconstituted with frame.number in {19318..19319} and notframe.number in {1125996..1125997}. One could argue that we should see a list of 19 IP packets for this particular UDP packet.

Comments

Nice analysis @jim-young! And if you use editcap to isolate only the packets 1125900-1125999 into a new capture file, you don't see any problems with the reassembly because there's no ip.id reuse in that case.

For example: editcap -r -F pcap cam_145_8_frames.pcapng cam_145_8_frames-1125900-1125999.pcap 1125900-1125999

(In this subset, frame 1125980 becomes frame 81 and 1125997 becomes frame 98.)

User 1680 ( Jan 09 '26 )

To avoid this problem, I wonder if it would be possible for the IP dissector to include a preference that limits the maximum amount of time allowed for fragments to be included in reassembly. On Linux the default from /proc/sys/net/ipv4/ipfrag_time appears to be 30 seconds, and on Windows it appears to default to 60 seconds from netsh interface ipv4 show ipstats | find "Reassembly Timeout". 30 seconds might be a good default value for Wireshark, which obviously wouldn't help in this case, but if it was configured for 10 seconds or perhaps a bit less, then the reassembly would work fine here.

User 1680 ( Jan 09 '26 )

I suppose another possibility to avoid this problem might be to keep track of the frame with offset 0 and then just be sure not to include any frames earlier than that one as part of the reassembly for a given ip.id.

User 1680 ( Jan 10 '26 )

By the way, this is Issue 20696.

User 1680 ( Jan 12 '26 )

There are systems that send out the ip fragments in reversed order, so tracking the frame with offset zero might not always give the best results. I think a (configurable) timeout, either in time or an amount of frames might be the best option to handle this.

User 36540 ( Jan 12 '26 )

I agree and acknowledged in Issue 20696 that if implemented, this solution wouldn't be ideal, although I do think it would be better than the current situation. Still, if a better solution can be devised using time or maximum frames, then that solution would be preferred.

User 1680 ( Jan 12 '26 )

Thank you Jim. Your answer was very helpful. Now I know, we are loosing fragments.

User 56935 ( Jan 15 '26 )

When you open Statistics -> Capture file properties you will see that there are discards reported. These discards are incremented when the capture library has received packets that it could not save to disk (IO problems). And in your file, there were quite a few. So when you say you are loosing fragments, the fragments are missed in the capturing, not so much lost on the wire (although there could of course also be packets missing on the wire).

User 36540 ( Jan 15 '26 )
cc-by-sa Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.