The question is as follows: what is the algorithm to resegment an incoming TCP/UDP packet?
So, for example, I have a TCP packet, which size is more than some number, and I want to split this packet into two, three, etc., so that each segment's size would be less or equal to that predefined number. The basics are simple: divide the data in the packet, recalculate hashes and update sequence numbers, but I am sure there is more to it, and was wondering if there is an algorithm, for instance, in pseudocode, which would describe the process - I could not find it.
Also, I should note that the question is only about L4 segmentation, L3 is not covered. Thanks in advance!