Jump to content
  • Advertisement
Sign in to follow this  
ArKano22

packet fragmentation

This topic is 2948 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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...)

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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!

Share this post


Link to post
Share on other sites
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 :)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!