packet fragmentation

Started by
5 comments, last by ArKano22 13 years, 8 months ago
Hi,

I´m trying to get a good grasp at how networks work before starting to actually implement network functionality in my engine. I´m stuck with ip packet fragmentation, though.

If a packet must go trough a subnet which has a minimal transfer unit smaller than the packet size, the packet gets divided into smaller packets called "fragments". That´s ok.

However, if we have two hosts, A and B, each one connected to a subnet and a router between the two subnets: A sends a packet to B, the packet gets fragmented to go through A´s subnet and reach the router, then the MTU of B´s subnet is smaller than one of the framents. What happens? Does the fragment get fragmented again? Is the MTU calculated beforehand as min(MTUA,MTUB)? Does the router glue the fragments together upon arrival and splits the resulting (original) packet again to go through B´s subnet? I´m pretty confused with this. Can anyone help me out?
Advertisement
Fragments are reassembled at destination.

There is no guarantee or requirement that two IP packets will travel over same route, so nothing can be done in transit.

Quote:Is the MTU calculated beforehand as min(MTUA,MTUB)?
Not possible in general case.

Also, routers do not care about payload, they only shuffle IP packets and only care about FROM and TO address so they can route it. Fragmentation as such isn't relevant to users - it's all the same IP packets, they can't tell how that packet came to be or why.

The endpoint will however examine the extra data and note that payload has been fragmented, since all packets should eventually arrive there.
Quote:Original post by Antheus
Fragments are reassembled at destination.

There is no guarantee or requirement that two IP packets will travel over same route, so nothing can be done in transit.


Ok. So the router does not glue together anything, that´s B´s responsibility. I must assume that a fragment can get fragmented again to pass trough a net with smaller MTU? (you´d have a fragment tree instead of a fragment list...)
Quote:Original post by ArKano22
Ok. So the router does not glue together anything, that´s B´s responsibility.
It can't - packets travel at arbitrary routes, so same router isn't guaranteed to receive all fragments.

Quote:I must assume that a fragment can get fragmented again to pass trough a net with smaller MTU? (you´d have a fragment tree instead of a fragment list...)


IP packets get fragmented. These fragments are IP packets again. There is no hierarchy.

Fragments are marked as indices into array. If all elements of array arrived at destination, original packet can be reassembled.
Quote:Original post by Antheus
Quote:Original post by ArKano22
Ok. So the router does not glue together anything, that´s B´s responsibility.
It can't - packets travel at arbitrary routes, so same router isn't guaranteed to receive all fragments.

Quote:I must assume that a fragment can get fragmented again to pass trough a net with smaller MTU? (you´d have a fragment tree instead of a fragment list...)


IP packets get fragmented. These fragments are IP packets again. There is no hierarchy.

Fragments are marked as indices into array. If all elements of array arrived at destination, original packet can be reassembled.


Ok. So, if a fragment is considered a new packet, and there is no hierarchy, each fragment has offset data relative to the original packet, not to the last time they fragmented, right?

if P is the original packet:
P--Asubnet--> P1,P2
P1--Bsubnet--> P11, P12
P2--Bsubnet--> P2 (no fragmentation)

gluing together again: P = P11+P12+P2

Is this right?
Quote:Original post by ArKano22
Ok. So, if a fragment is considered a new packet, and there is no hierarchy, each fragment has offset data relative to the original packet, not to the last time they fragmented, right?


That's correct!
enum Bool { True, False, FileNotFound };
Quote:Original post by hplus0603
Quote:Original post by ArKano22
Ok. So, if a fragment is considered a new packet, and there is no hierarchy, each fragment has offset data relative to the original packet, not to the last time they fragmented, right?


That's correct!


Thank both of you very much, now it´s crystal clear :)

This topic is closed to new replies.

Advertisement