Title: reassemble()

reassemble() reassembles a packet from its fragments. reassemble() either adds a fragment to ip_ass_table[] if all of the fragments have not already been received or, if all of the fragments have been received, reassembles the original ip packet from the fragments. For example, the following ip packet of length 3744 bytes is broken up in transit into 4 fragments of lengths 1480 bytes, 1480 bytes, and 784 bytes. The corresponding fragment offsets of the fragments are 0, 185, and 370 respectively (the "fragment offset" is the actual byte offset divided by 8). reassemble() will reassemble this original ip packet from the fragments it receives.

reassemble() is called by ip_port_arrive() and in turn calls find_ass_ent() and merge_frags().

A return value of NULL indicates that the packet to which the fragment belongs was not reassembled in its entirety or that the reassembly time exceeded the maximum time allowed (255 seconds in Minix).