Can a datagram fragment offset be a non integer number?

1

1

I have a datagram of 3600 Bytes, an MTU of 800 Bytes, and so my number of fragments is 5.

I found that the first 4 fragments will be 800 bytes (including the 20B for the IP header) and the last will be 480 (including the IP header).

The offset for the first is of course 0, but when I calculate the offset for the second fragment I get this:

fragment 2 offset = 780 Bytes / 8 = 97.5

How do I handle getting a non integer number? Do I take the ceiling of it?

mighty_squash

Posted 2012-10-03T12:25:09.507

Reputation: 53

Question was closed 2012-10-04T09:41:43.337

A complex number is a number that can be put in the form a + bi, where a and b are real numbers and i is called the imaginary unit, where i2 = −1 – Nifle – 2012-10-04T06:58:44.127

Answers

1

Okay I figured it out, you're supposed to pick a payload size that is divisible by 8 and leave the remaining space for the header.

For my question I was getting 97.5 because 780 isn't divisible by 8, so I knocked my payload size down to 776 which when divided by 8 gives me 97.

I then use that value to calculate the fragment offset.

If you have an MTU that is 800 Bytes, your offset for a second fragment will be of course 97, and how that works into the actual packet is this:

  • IP Header = 20 Bytes
  • Payload = 776 Bytes
  • Unused space = 4 Bytes

mighty_squash

Posted 2012-10-03T12:25:09.507

Reputation: 53