kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
From: fan.du@windriver.com (Fan Du)
To: kernelnewbies@lists.kernelnewbies.org
Subject: IPv4 Fragmentation in a IPIP6 tunnel
Date: Thu, 31 Oct 2013 17:39:35 +0800	[thread overview]
Message-ID: <52722557.9060201@windriver.com> (raw)
In-Reply-To: <8D0A3982952F4F5-118C-17739@webmail-d239.sysops.aol.com>

Hi Pietro

On 2013?10?30? 23:02, Pietro Paolini wrote:
> Hello everyone,
> I am working for an embedded Linux firmware running on a CPE and I am
> using an IP4 over IPv6 tunnel configured as following:
>
> ip -f inet6 tunnel add tun1 mode ipip6 remote XX:XX:XX local XX:XX:XX
> dev eth0
>
> And it works fine until I don't try to test the fragment case: I send a
> too big UDP packet and my expectation - and requirement (sob) - would
> be a IPv6 packet fragmentation but what  I get is a double
> fragmentation (IPv4 and IPv6), then, summarizing:
>
> IPv4 -->  [IPv4-1-segment][IPv6] [IPv4-2-segment][IPv6]

I didn't manage to test this, but a first glance make me think your expectation has one requirement:

UDP packet + IPv4 header doesn't not exceed mtu of IPv4 src->dst, *AND* UDP packet + IPv4 header exceed the IPv6 tunnel mtu.
UDP packet first has to fit into IPv4 layer size(phase 1), and then tunneled in IPv6 style(phase 2). So two kinds of mtu involved here.


> Looking at the kernel code - which in I am not an expert - I observed
> that the function ip_finish_output :
>
> #if defined(CONFIG_NETFILTER)&&  defined(CONFIG_XFRM)
>          /* Policy lookup after SNAT yielded a new policy */
>          if (skb_dst(skb)->xfrm != NULL) {
>                  IPCB(skb)->flags |= IPSKB_REROUTED;
>                  return dst_output(skb);
>          }
> #endif
> #if defined(CONFIG_INET_IPSEC_OFFLOAD)
>          if ((skb->ipsec_offload == 0)&&
>                  skb->len>  ip_skb_dst_mtu(skb)&&  !skb_is_gso(skb))
> #else
>          if (skb->len>  ip_skb_dst_mtu(skb)&&  !skb_is_gso(skb))
> #endif
>                  return ip_fragment(skb, ip_finish_output2);
>          else
>                  return ip_finish_output2(skb);
>
> Does not care about it, it just fragments if the MTU does not match.
>
> Is there any options to disable the fragmentation on IPV4  ? I am
> misconfiguring something ? Why does the ipip6 has this wrong behavior ?
>
> Thanks in advance,
> Pietro.
>
> Pietro Paolini
> pulsarpietro at aol.com
>
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>

-- 
?????????

--fan

  reply	other threads:[~2013-10-31  9:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-30 15:02 IPv4 Fragmentation in a IPIP6 tunnel Pietro Paolini
2013-10-31  9:39 ` Fan Du [this message]
2013-11-04 11:17   ` Pietro Paolini

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=52722557.9060201@windriver.com \
    --to=fan.du@windriver.com \
    --cc=kernelnewbies@lists.kernelnewbies.org \
    /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).