Date: Wed, 8 Jan 2003 12:08:06 -0500 (EST) From: Andrew Gallatin <gallatin@cs.duke.edu> To: "M. Warner Losh" <imp@bsdimp.com> Cc: freebsd-stable@FreeBSD.ORG Subject: Re: wi0 and mtu setting [bad idea] Message-ID: <15900.23286.323707.772202@grasshopper.cs.duke.edu> In-Reply-To: <20030108.095214.36936663.imp@bsdimp.com> References: <Pine.A41.4.10.10301061918340.116252-100000@bessel.tekniikka.turkuamk.fi> <20030106.102538.57922346.imp@bsdimp.com> <15897.56408.793022.131019@grasshopper.cs.duke.edu> <20030108.095214.36936663.imp@bsdimp.com>
next in thread | previous in thread | raw e-mail | index | archive | help
M. Warner Losh writes: > In message: <15897.56408.793022.131019@grasshopper.cs.duke.edu> > Andrew Gallatin <gallatin@cs.duke.edu> writes: > : > : M. Warner Losh writes: > : > : > > : > Well, this converstation needs to take place on the net@ list. In > : > -current, at least, if_ethersubr.c prevents 'ethernet' drivers from > : > setting the mtu higher. There's some experimental patches that make > : > : It doesn't prevent anything. It just sets the mtu to a default of > : ETHER_MTU, which is what 98% of ethernet drivers want. If you want > : something higher (or lower) as your default, you just need to reset > : the mtu after calling ether_ifattach(). > : > : For example, the following code at the bottom of my attach function > : has worked fine for years..: (GM_IP_MTU is 9K on some firmware, 4K on > : older firmware) > : > : #if (__FreeBSD_version >= 500000) > : ether_ifattach (ifp, sc->is_addr); > : #elif (__FreeBSD_version >= 410000) > : ether_ifattach (ifp, ETHER_BPF_SUPPORTED); > : #else > : if_attach (ifp); > : ether_ifattach (ifp); > : #endif > : /*ether_ifattach resets mtu */ > : ifp->if_mtu = GM_IP_MTU; > : return 0; > > Interesting. I see the following code: > > case SIOCSIFMTU: > /* > * Set the interface MTU. > */ > if (ifr->ifr_mtu > ETHERMTU) { > error = EINVAL; > } else { > ifp->if_mtu = ifr->ifr_mtu; > } > break; > > But as others have pointed out, this can easily be defeated... Yes, you just override SIOCSIFMTU in your driver's ioctl. See sys/dev/bge/if_bge.c for an in-tree example. Drew To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-stable" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?15900.23286.323707.772202>