netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC] Make the ip6_tunnel reflect the true mtu.
@ 2010-10-19 14:38 Anders.Franzen
  2010-10-26 17:44 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Anders.Franzen @ 2010-10-19 14:38 UTC (permalink / raw)
  To: eric.dumazet, netdev; +Cc: Anders Franzen

From: Anders Franzen <anders.franzen@ericsson.com>

The ip6_tunnel always assumes it consumes 40 bytes (ip6 hdr) of the mtu of the
underlaying device. So for a normal ethernet bearer, the mtu of the ip6_tunnel is
1460.
However, when creating a tunnel the encap limit option is enabled by default, and it
consumes 8 bytes more, so the true mtu shall be 1452.

I dont really know if this breaks some statement in some RFC, so this is a request for
comments.
---
 net/ipv6/ip6_tunnel.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
index c2c0f89..1f4c3cc 100644
--- a/net/ipv6/ip6_tunnel.c
+++ b/net/ipv6/ip6_tunnel.c
@@ -1175,6 +1175,8 @@ static void ip6_tnl_link_config(struct ip6_tnl *t)
 				sizeof (struct ipv6hdr);
 
 			dev->mtu = rt->rt6i_dev->mtu - sizeof (struct ipv6hdr);
+			if (!(t->parms.flags & IP6_TNL_F_IGN_ENCAP_LIMIT))
+				dev->mtu-=8;
 
 			if (dev->mtu < IPV6_MIN_MTU)
 				dev->mtu = IPV6_MIN_MTU;
@@ -1362,12 +1364,17 @@ static const struct net_device_ops ip6_tnl_netdev_ops = {
 
 static void ip6_tnl_dev_setup(struct net_device *dev)
 {
+	struct ip6_tnl *t = NULL;
+
 	dev->netdev_ops = &ip6_tnl_netdev_ops;
 	dev->destructor = ip6_dev_free;
 
 	dev->type = ARPHRD_TUNNEL6;
 	dev->hard_header_len = LL_MAX_HEADER + sizeof (struct ipv6hdr);
 	dev->mtu = ETH_DATA_LEN - sizeof (struct ipv6hdr);
+	t = netdev_priv(dev);
+	if (!(t->parms.flags & IP6_TNL_F_IGN_ENCAP_LIMIT))
+		dev->mtu-=8;
 	dev->flags |= IFF_NOARP;
 	dev->addr_len = sizeof(struct in6_addr);
 	dev->features |= NETIF_F_NETNS_LOCAL;
-- 
1.7.2.3


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [RFC] Make the ip6_tunnel reflect the true mtu.
  2010-10-19 14:38 [RFC] Make the ip6_tunnel reflect the true mtu Anders.Franzen
@ 2010-10-26 17:44 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2010-10-26 17:44 UTC (permalink / raw)
  To: Anders.Franzen; +Cc: eric.dumazet, netdev

From: Anders.Franzen@ericsson.com
Date: Tue, 19 Oct 2010 16:38:43 +0200

> From: Anders Franzen <anders.franzen@ericsson.com>
> 
> The ip6_tunnel always assumes it consumes 40 bytes (ip6 hdr) of the mtu of the
> underlaying device. So for a normal ethernet bearer, the mtu of the ip6_tunnel is
> 1460.
> However, when creating a tunnel the encap limit option is enabled by default, and it
> consumes 8 bytes more, so the true mtu shall be 1452.
> 
> I dont really know if this breaks some statement in some RFC, so this is a request for
> comments.

This patch looks fine to me, but please fully resubmit this with a
proper "Signed-off-by: " tag as per Documentation/SubmittingPatches

Thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-10-26 17:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-19 14:38 [RFC] Make the ip6_tunnel reflect the true mtu Anders.Franzen
2010-10-26 17:44 ` David Miller

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).