From: Sylvain Rochet <gradator@gradator.net>
To: linux-kernel@vger.kernel.org
Subject: PATCH: 2.4.37.9 MTU change for TUN/TAP interfaces
Date: Wed, 7 Apr 2010 21:57:24 +0200 [thread overview]
Message-ID: <20100407195724.GA4830@gradator.net> (raw)
[-- Attachment #1.1: Type: text/plain, Size: 133 bytes --]
Hi,
This patch add the ability to change the MTU of TUN/TAP interfaces for
the 2.4.x kernels series.
Best regards,
Sylvain
[-- Attachment #1.2: tuntap-change-mtu-2.4.37.9.patch --]
[-- Type: text/x-diff, Size: 721 bytes --]
diff -Nru linux-2.4.36.6.a/drivers/net/tun.c linux-2.4.36.6.b/drivers/net/tun.c
--- linux-2.4.36.6.a/drivers/net/tun.c 2008-06-06 18:25:34.000000000 +0200
+++ linux-2.4.36.6.b/drivers/net/tun.c 2010-04-07 17:51:33.000000000 +0200
@@ -118,6 +118,17 @@
return &tun->stats;
}
+#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;
+}
+
+
/* Initialize net device. */
int tun_net_init(struct net_device *dev)
{
@@ -156,6 +167,7 @@
break;
};
+ dev->change_mtu = tun_net_change_mtu;
return 0;
}
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
next reply other threads:[~2010-04-07 20:26 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-07 19:57 Sylvain Rochet [this message]
2010-04-20 5:03 ` PATCH: 2.4.37.9 MTU change for TUN/TAP interfaces Willy Tarreau
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=20100407195724.GA4830@gradator.net \
--to=gradator@gradator.net \
--cc=linux-kernel@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