How do I dissect multiple packets?
asked Dec 05 '17
For example, if there is information I can obtain only by using data from 2 packets (i.e packet 12 and 17), how would I dissect them?
asked Dec 05 '17
For example, if there is information I can obtain only by using data from 2 packets (i.e packet 12 and 17), how would I dissect them?
answered Dec 05 '17
This is known as reassembly. Look at README.dissector sect. 2.7.
2.7 seems to be only for TCP, is there instructions for reassembly for UDP?
Yep, 2.8, udp_dissect_pdus but that function only handles multiple PDU's in a single packet. If spread across multiple packets then you'll need to use the fragmentation API as detailed in the Developers Guide Sect 9.4.
Can you be more specific? Because I'm not sure whether I'll be answering what you actually ask.
If the PDU of the application protocol is split into several packets of a transport protocol, the dissector of the application protocol shall return 0 when invoked with incomplete data, so the dissector of the transport protocol knows it has to provide more data.
This works for TCP and probably SCTP which take care of payload completeness by means of acknowledgements and retransmissions. They collect the payload as it arrives and with each new arrival they offer it to the application layer dissector until it finally accepts it (by returning a non-zero number of processed bytes). So the dissection of the application layer is then shown in the last transport packet carrying a given PDU.
For other transport protocols like UDP where the retransmissions etc. have to be handled by the application protocol, the application layer dissector must collect them itself. However, splitting an application layer PDU into several UDP packets is quite rare - usually, a large UDP packet is generated and fragmented at IP layer, which Wireshark can handle in a similar way as given above, the UDP dissector is first invoked on the last fragment and only if all fragments are present in the capture.