DPDK patches and discussions
 help / color / mirror / Atom feed
From: Thomas Monjalon <thomas.monjalon@6wind.com>
To: "Александр Киселев" <kiselev99@gmail.com>
Cc: dev@dpdk.org
Subject: Re: [dpdk-dev] ipv4 fragmentation bug?
Date: Mon, 22 Aug 2016 13:31:12 +0200	[thread overview]
Message-ID: <13658731.5PNXAK9RiV@xps13> (raw)
In-Reply-To: <CAMKNYby4g_Oi68E7x1=G1+3nLMfpVkZ_UMkZdWf5GiRQHApaAA@mail.gmail.com>

Hi,

> 2016-08-15 20:30 GMT+03:00 Александр Киселев <kiselev99@gmail.com>:
> > While playing with function rte_ipv4_fragment_packet I found that it
> > incorrectly fragments packets.
> > For example if the function takes 1200 bytes packet and mtu size 1000 it
> > will produces two fragments. And when those fragments are reassembled back
> > the resulting packet will be 4 bytes shorter than it should be.
> >
> > I played with linux ping program and it reports that a reply is truncated.
> >     1204 bytes from 192.168.125.1: icmp_seq=1 ttl=64 (truncated)
> >
> > Looking at the source of rte_ipv4_fragment_packet I discovered the cause
> > of the above behavior.
> >
> > Function makes the following assumption and the whole calculations are
> > bases on that assumption.
> >
> > /* Fragment size should be a multiply of 8. */
> > IP_FRAG_ASSERT((frag_size & IPV4_HDR_FO_MASK) == 0);
> >
> > The problem is that this assert doesn’t make any sense. It's true that
> > fragment size should be a multiply of 8, but what this line real checks is
> > that
> > the size of mtu minus 20 bytes should be multiply of 8. In other words
> > it constrains the size of the mtu. So, if I take valid mtu value, say
> > 1504,
> > it will produce incorrect fragments when asserts are off.

Thanks for reporting.

2016-08-15 20:48, Александр Киселев:
> I'am sorry. Looks like having an mtu value multiply of 8 is a good practice.
> 
> But mtu value 1504 is also widely used in qinq linux interfaces.

Please, would like to write a patch for master branch?
Or do you prefer to delegate it to someone reading this thread?

  reply	other threads:[~2016-08-22 11:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-15 17:30 Александр Киселев
2016-08-15 17:48 ` Александр Киселев
2016-08-22 11:31   ` Thomas Monjalon [this message]
2016-09-15 20:09     ` Александр Киселев

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=13658731.5PNXAK9RiV@xps13 \
    --to=thomas.monjalon@6wind.com \
    --cc=dev@dpdk.org \
    --cc=kiselev99@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).