summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfenner <fenner@FreeBSD.org>1996-12-16 19:23:34 +0000
committerfenner <fenner@FreeBSD.org>1996-12-16 19:23:34 +0000
commitb7f56c720419d57c6fd04f8556283eb6cf9ef4e7 (patch)
tree4463d79a8b187a5b0c35a794ad5eda0644469541
parentec712ef4762ea99c9ccd86fb79d59fb1e68d8213 (diff)
downloadFreeBSD-src-b7f56c720419d57c6fd04f8556283eb6cf9ef4e7.zip
FreeBSD-src-b7f56c720419d57c6fd04f8556283eb6cf9ef4e7.tar.gz
Change default tun MTU back to 1500.
Use the interface MTU instead of the constant when deciding what packets to accept. Allow using the SIOCSIFMTU ioctl (e.g. "ifconfig tun0 mtu XXX") to set the MTU.
-rw-r--r--sys/net/if_tun.c7
-rw-r--r--sys/net/if_tun.h4
2 files changed, 8 insertions, 3 deletions
diff --git a/sys/net/if_tun.c b/sys/net/if_tun.c
index 0b740e5..df84d53 100644
--- a/sys/net/if_tun.c
+++ b/sys/net/if_tun.c
@@ -268,6 +268,11 @@ tunifioctl(ifp, cmd, data)
TUNDEBUG("%s%d: destination address set\n",
ifp->if_name, ifp->if_unit);
break;
+ case SIOCSIFMTU:
+ ifp->if_mtu = ifr->ifr_mtu;
+ TUNDEBUG("%s%d: mtu set\n",
+ ifp->if_name, ifp->if_unit);
+ break;
case SIOCADDMULTI:
case SIOCDELMULTI:
if (ifr == 0) {
@@ -519,7 +524,7 @@ tunwrite(dev_t dev, struct uio *uio, int flag)
TUNDEBUG("%s%d: tunwrite\n", ifp->if_name, ifp->if_unit);
- if (uio->uio_resid < 0 || uio->uio_resid > TUNMTU) {
+ if (uio->uio_resid < 0 || uio->uio_resid > ifp->if_mtu) {
TUNDEBUG("%s%d: len=%d!\n", ifp->if_name, ifp->if_unit,
uio->uio_resid);
return EIO;
diff --git a/sys/net/if_tun.h b/sys/net/if_tun.h
index c31b548..404a877 100644
--- a/sys/net/if_tun.h
+++ b/sys/net/if_tun.h
@@ -38,8 +38,8 @@ struct tun_softc {
struct selinfo tun_wsel; /* write select (not used) */
};
-/* Maximum packet size */
-#define TUNMTU 1600
+/* Default maximum packet size */
+#define TUNMTU 1500
struct tuninfo {
int baudrate; /* linespeed */
OpenPOWER on IntegriCloud