From: "Ed Swierk" <eswierk@arastra.com>
To: "Herbert Xu" <herbert@gondor.apana.org.au>,
netdev@vger.kernel.org, maxk@qualcomm.com,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Configurable tap interface MTU
Date: Wed, 12 Sep 2007 09:54:35 -0700 [thread overview]
Message-ID: <e6c711510709120954i29a8f86bg9ea7bb337a039b5a@mail.gmail.com> (raw)
In-Reply-To: <E1IVIv8-0003Uc-00@gondolin.me.apana.org.au>
[-- Attachment #1: Type: text/plain, Size: 404 bytes --]
On 9/11/07, Herbert Xu <herbert@gondor.apana.org.au> wrote:
> Please make it 65535 without an Ethernet header and 65521
> with an Ethernet header.
Here is a revised patch that allows MTUs up to 65535 for tap
interfaces and up to 65521 for tun interfaces.
(If I set the MTU to 65521 on a tun interface, ping complains "message
too long" when I send a 65521-byte packet; 65520 works okay, though.)
--Ed
[-- Attachment #2: tap-change-mtu.patch --]
[-- Type: application/octet-stream, Size: 1185 bytes --]
Index: linux-2.6.22.6/drivers/net/tun.c
===================================================================
--- linux-2.6.22.6.orig/drivers/net/tun.c
+++ linux-2.6.22.6/drivers/net/tun.c
@@ -171,6 +171,18 @@ tun_net_mclist(struct net_device *dev)
}
}
+#define MIN_MTU 68
+#define MAX_MTU 65535
+
+static int
+tun_net_change_mtu(struct net_device *dev, int new_mtu)
+{
+ if (new_mtu < MIN_MTU || new_mtu + dev->hard_header_len > MAX_MTU)
+ return -EINVAL;
+ dev->mtu = new_mtu;
+ return 0;
+}
+
static struct net_device_stats *tun_net_stats(struct net_device *dev)
{
struct tun_struct *tun = netdev_priv(dev);
@@ -188,6 +200,7 @@ static void tun_net_init(struct net_devi
dev->hard_header_len = 0;
dev->addr_len = 0;
dev->mtu = 1500;
+ dev->change_mtu = tun_net_change_mtu;
/* Zero header length */
dev->type = ARPHRD_NONE;
@@ -200,6 +213,7 @@ static void tun_net_init(struct net_devi
dev->set_multicast_list = tun_net_mclist;
ether_setup(dev);
+ dev->change_mtu = tun_net_change_mtu;
/* random address already created for us by tun_set_iff, use it */
memcpy(dev->dev_addr, tun->dev_addr, min(sizeof(tun->dev_addr), sizeof(dev->dev_addr)) );
next prev parent reply other threads:[~2007-09-12 16:54 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-11 14:42 Ed Swierk
2007-09-11 17:20 ` Rick Jones
2007-09-12 3:29 ` Herbert Xu
2007-09-12 16:54 ` Ed Swierk [this message]
2007-09-16 19:22 ` David Miller
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=e6c711510709120954i29a8f86bg9ea7bb337a039b5a@mail.gmail.com \
--to=eswierk@arastra.com \
--cc=herbert@gondor.apana.org.au \
--cc=linux-kernel@vger.kernel.org \
--cc=maxk@qualcomm.com \
--cc=netdev@vger.kernel.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
all inboxes | Powered by JetHome®