0
votes

Environment

As per my understanding Network layer is responsible for reassembly of fragmented datagrams and then it supplies the reassembled data to upper Transport layer.

I have collected packet traces using libpcap and i want to reassemble fragmented packets at layer 3 on my own.

This link says that i need fragment flag, fragment offset, identification number and buffer value for reassembly of segments.

Question

At the arrival of first segment how to know what should be size of buffer to be initialized for complete reassembly of datagram.

Thanks.

1

1 Answers

0
votes

The IP header only gives you the size of the fragment. So you need to reserve a buffer the size of the largest possible IP packet, i.e. 65535 bytes. Only once you get the last fragment can you determine the length of the complete packet.