From owner-freebsd-stable Wed Jan 8 8:53:42 2003 Delivered-To: freebsd-stable@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 39DAB37B401 for ; Wed, 8 Jan 2003 08:53:40 -0800 (PST) Received: from harmony.village.org (rover.bsdimp.com [204.144.255.66]) by mx1.FreeBSD.org (Postfix) with ESMTP id 474F843ED1 for ; Wed, 8 Jan 2003 08:53:39 -0800 (PST) (envelope-from imp@bsdimp.com) Received: from localhost (warner@rover2.village.org [10.0.0.1]) by harmony.village.org (8.12.6/8.12.3) with ESMTP id h08GrT1e075888; Wed, 8 Jan 2003 09:53:29 -0700 (MST) (envelope-from imp@bsdimp.com) Date: Wed, 08 Jan 2003 09:52:14 -0700 (MST) Message-Id: <20030108.095214.36936663.imp@bsdimp.com> To: gallatin@cs.duke.edu Cc: freebsd-stable@FreeBSD.ORG Subject: Re: wi0 and mtu setting [bad idea] From: "M. Warner Losh" In-Reply-To: <15897.56408.793022.131019@grasshopper.cs.duke.edu> References: <20030106.102538.57922346.imp@bsdimp.com> <15897.56408.793022.131019@grasshopper.cs.duke.edu> X-Mailer: Mew version 2.1 on Emacs 21.2 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-stable@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG In message: <15897.56408.793022.131019@grasshopper.cs.duke.edu> Andrew Gallatin 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... Warner To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-stable" in the body of the message