Make if_loop MTU settable via SIOCSFMTU/ifconfig. Useful for testing,

and for regression-testing performance at various MTUs.

NB: route MTU may not track MTU changes, which may cause problems for
AF_ISO if loopback MTU is decreased. I've never seen problems with IP,
in various tests going back to around NetBSD 1.3.
This commit is contained in:
jonathan 2003-08-15 19:22:08 +00:00
parent e7df232658
commit f4c2260f8a
1 changed files with 17 additions and 3 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_loop.c,v 1.47 2003/08/07 16:32:53 agc Exp $ */
/* $NetBSD: if_loop.c,v 1.48 2003/08/15 19:22:08 jonathan Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@ -65,7 +65,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_loop.c,v 1.47 2003/08/07 16:32:53 agc Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_loop.c,v 1.48 2003/08/15 19:22:08 jonathan Exp $");
#include "opt_inet.h"
#include "opt_atalk.h"
@ -134,8 +134,10 @@ __KERNEL_RCSID(0, "$NetBSD: if_loop.c,v 1.47 2003/08/07 16:32:53 agc Exp $");
#if defined(LARGE_LOMTU)
#define LOMTU (131072 + MHLEN + MLEN)
#define LOMTU_MAX LOMTU
#else
#define LOMTU (32768 + MHLEN + MLEN)
#define LOMTU_MAX (65536 + MHLEN + MLEN)
#endif
struct ifnet loif[NLOOP];
@ -402,8 +404,10 @@ lortrequest(cmd, rt, info)
struct rt_addrinfo *info;
{
struct ifnet *ifp = &loif[0];
if (rt)
rt->rt_rmx.rmx_mtu = LOMTU;
rt->rt_rmx.rmx_mtu = ifp->if_mtu;
}
/*
@ -432,6 +436,16 @@ loioctl(ifp, cmd, data)
*/
break;
case SIOCSIFMTU:
ifr = (struct ifreq *)data;
if ((unsigned)ifr->ifr_mtu > LOMTU_MAX)
error = EINVAL;
else {
/* XXX update rt mtu for AF_ISO? */
ifp->if_mtu = ifr->ifr_mtu;
}
break;
case SIOCADDMULTI:
case SIOCDELMULTI:
ifr = (struct ifreq *)data;