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.
This commit is contained in:
Bill Fenner 1996-12-16 19:23:34 +00:00
parent 482bfccc70
commit c812f23a41
2 changed files with 8 additions and 3 deletions

@ -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;

@ -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 */