From owner-freebsd-stable@FreeBSD.ORG Fri Feb 28 15:15:04 2014 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2A9F9AEE for ; Fri, 28 Feb 2014 15:15:04 +0000 (UTC) Received: from mail2.albyny.inoc.net (mail2.albyny.inoc.net [64.22.32.72]) by mx1.freebsd.org (Postfix) with ESMTP id DB6021638 for ; Fri, 28 Feb 2014 15:15:03 +0000 (UTC) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=inoc.net; h=Received:From:Subject:Date:To; b=rlVmqDl49MXAoquKwRNJiEAgSdapst6wfSEre5ULYXZzOcw2DwfgkyXhqck47Rh3WNQrylgS5X0dhL5B2dIvDedFITouRwFjThBbFtQLUFgMiSvIHP5x42kGKSzpZBIo2Y8mga8DA8lcRRhaIXqLLTPYXunFR4+V8pVlWPRrVV0=; X-Default-Received-SPF: pass (skip=loggedin (res=PASS)); Received: from [172.16.1.22] (unverified [173.84.191.60]) by mail2.albyny.inoc.net (build v14.0.10) with ESMTP id 4141908-1941382 for ; Fri, 28 Feb 2014 14:38:38 +0000 From: Robert Blayzor Content-Type: multipart/mixed; boundary="Apple-Mail=_665FA1C9-BEA3-4176-A01B-836975C24DE4" Subject: [patch] bootp_subr.c support for jumbo frames on BOOTP intf Message-Id: <36E8D129-6D5B-4C69-834E-85D3F243B756@inoc.net> Date: Fri, 28 Feb 2014 09:38:38 -0500 To: freebsd-stable@freebsd.org Mime-Version: 1.0 (Mac OS X Mail 7.2 \(1874\)) X-Mailer: Apple Mail (2.1874) X-Authenticated-User: rblayzor@inoc.net X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Feb 2014 15:15:04 -0000 --Apple-Mail=_665FA1C9-BEA3-4176-A01B-836975C24DE4 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii I am attaching a patch for those that wish to test or provide feedback. = Currently there is no support for adjusting the MTU on an interface a = diskless client boots from. Additionally if you attempt to adjust the = MTU on the interface with ifconfig after the system comes up, the result = is only cosmetic and the booting interface still cannot pass frames = larger than 1500 bytes. There is a RFC standard DHCP TAG to provide a hit to a client what = interface MTU should be set to. The attached patch will use this DHCP = option in bootp and set the interface MTU accordingly. This allows = diskless clients to be booted on a jumbo frame enabled network. =20 Before using this, make sure your network and NIC is jumbo frame = enabled/capable. Additionally the attached patch removes the client from setting itself = as the gateway (proxy-arp) if there is no router provided from DHCP. = The reasoning behind this is that it is more common for hosts to be = multi-homed and that the booting interface may not necissarily be the = interface a gateway is to be installed on. My erroneously setting = gateway to hosts self, a default route cannot be easily changed at boot = time. If the host needs to set itself as the gateway, return that in an = option in DHCP. For tracking: PR: http://www.freebsd.org/cgi/query-pr.cgi?pr=3Dmisc/187094 (should probably be moved from misc to kern) Patch is against: 10.0-RELEASE r261846 -- Robert Blayzor Network Architect & Engineer CCIE 42148 (SP) rblayzor@inoc.net INOC, LLC 80 State Street, 7th Flr Albany, NY 12207 USA --Apple-Mail=_665FA1C9-BEA3-4176-A01B-836975C24DE4 Content-Disposition: attachment; filename=bootp_subr.diff Content-Type: application/octet-stream; x-unix-mode=0644; name="bootp_subr.diff" Content-Transfer-Encoding: 7bit Index: sys/nfs/bootp_subr.c =================================================================== --- sys/nfs/bootp_subr.c (revision 261846) +++ sys/nfs/bootp_subr.c (working copy) @@ -196,6 +196,8 @@ #define TAG_HOSTNAME 12 /* Client host name */ #define TAG_ROOT 17 /* Root path */ +#define TAG_INTF_MTU 26 /* Interface MTU Size (RFC2132) */ + /* DHCP specific tags */ #define TAG_OVERLOAD 52 /* Option Overload */ #define TAG_MAXMSGSIZE 57 /* Maximum DHCP Message Size */ @@ -229,6 +231,8 @@ #endif static char bootp_cookie[128]; +static unsigned int bootp_ifmtu = 0; + static struct socket *bootp_so; SYSCTL_STRING(_kern, OID_AUTO, bootp_cookie, CTLFLAG_RD, bootp_cookie, 0, "Cookie (T134) supplied by bootp server"); @@ -1030,7 +1034,22 @@ return (0); } - printf("Adjusted interface %s\n", ifctx->ireq.ifr_name); + printf("Adjusted interface %s", ifctx->ireq.ifr_name); + + /* Do BOOTP interface options */ + if (bootp_ifmtu != 0) { + printf(" (MTU=%d", bootp_ifmtu); + if (bootp_ifmtu > 1514) + printf("/JUMBO"); + printf(")"); + + ifr->ifr_mtu = bootp_ifmtu; + error = ifioctl(bootp_so, SIOCSIFMTU, (caddr_t) ifr, td); + if (error != 0) + panic("%s: SIOCSIFMTU, error=%d", __func__, error); + } + printf("\n"); + /* * Do enough of ifconfig(8) so that the chosen interface * can talk to the servers. (just set the address) @@ -1053,7 +1072,12 @@ /* Add new default route */ - if (ifctx->gotgw != 0 || gctx->gotgw == 0) { + /* Only set default route if we received one in the request. + Proxy ARP considered obsolete. More valid to NOT set + a router in request as the host may be multi-homed and + gateway may not be on this interface. + */ + if (ifctx->gotgw != 0 || gctx->gotgw != 0) { clear_sinaddr(&defdst); clear_sinaddr(&defmask); /* XXX MRT just table 0 */ @@ -1518,6 +1542,11 @@ p[i] = '\0'; } + p = bootpc_tag(&gctx->tag, &ifctx->reply, ifctx->replylen, + TAG_INTF_MTU); + if (p != NULL) { + bootp_ifmtu = (((unsigned char)p[0] << 8) + (unsigned char)p[1]); + } printf("\n"); --Apple-Mail=_665FA1C9-BEA3-4176-A01B-836975C24DE4--