From owner-freebsd-questions@FreeBSD.ORG Wed Dec 10 16:30:42 2003 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4956C16A4CE for ; Wed, 10 Dec 2003 16:30:42 -0800 (PST) Received: from cpc2-cove3-6-0-cust88.brhm.cable.ntl.com (cpc2-cove3-6-0-cust88.brhm.cable.ntl.com [81.107.10.88]) by mx1.FreeBSD.org (Postfix) with ESMTP id A55F043D2A for ; Wed, 10 Dec 2003 16:30:39 -0800 (PST) (envelope-from ianjhart@ntlworld.com) Received: from gamma.private.lan (gamma.private.lan [192.168.0.12]) ESMTP id hBB0UYgW001906 for ; Thu, 11 Dec 2003 00:30:38 GMT (envelope-from ianjhart@ntlworld.com) From: ian j hart To: freebsd-questions@freebsd.org Date: Thu, 11 Dec 2003 00:30:34 +0000 User-Agent: KMail/1.5.4 References: <200311291436.37674.ianjhart@ntlworld.com> In-Reply-To: <200311291436.37674.ianjhart@ntlworld.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200312110030.34410.ianjhart@ntlworld.com> Subject: Re: diskless swap filename X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Dec 2003 00:30:42 -0000 Re: http://docs.freebsd.org/cgi/mid.cgi?200311291436.37674.ianjhart On Saturday 29 November 2003 2:36 pm, ian j hart wrote: > Does anyone have a patch to use the mac address instead of the ip > address for the swapfile name? > > Feeling lazy this week :) > > Cheers No takers then :( For the archive, here's a patch. It's probably bogus and it certainly breaks style, but it seems to work okay. --- sys/nfs/bootp_subr.c.orig Thu Dec 11 00:06:28 2003 +++ sys/nfs/bootp_subr.c Thu Dec 11 00:14:10 2003 @@ -57,6 +57,7 @@ #include #include +#include #include #include @@ -1845,9 +1846,31 @@ gctx->lookup_path, nd->swap_fh, &nd->swap_fhsize, &nd->swap_args, procp); - if (error != 0) - panic("nfs_boot: lookup swap, error=%d", - error); + if (error != 0) { + if (gctx->interfaces->sdl->sdl_type == IFT_ETHER && + gctx->interfaces->sdl->sdl_alen == ETHER_ADDR_LEN) { + snprintf(gctx->lookup_path, + sizeof(gctx->lookup_path), + "swap.%02x:%02x:%02x:%02x:%02x:%02x", + ((struct ether_addr *)LLADDR(gctx->interfaces->sdl))->octet[0], + ((struct ether_addr *)LLADDR(gctx->interfaces->sdl))->octet[1], + ((struct ether_addr *)LLADDR(gctx->interfaces->sdl))->octet[2], + ((struct ether_addr *)LLADDR(gctx->interfaces->sdl))->octet[3], + ((struct ether_addr *)LLADDR(gctx->interfaces->sdl))->octet[4], + ((struct ether_addr *)LLADDR(gctx->interfaces->sdl))->octet[5] + ); + error = md_lookup_swap(&nd->swap_saddr, + gctx->lookup_path, + nd->swap_fh, &nd->swap_fhsize, + &nd->swap_args, procp); + if (error != 0) + panic("nfs_boot: lookup swap name=%s, error=%d", + gctx->lookup_path, error); + } + else + panic("nfs_boot: lookup swap, error=%d", + error); + } } nfs_diskless_valid = 3; } -- ian j hart http://ars.userfriendly.org/cartoons/?id=20031016