From owner-svn-src-head@FreeBSD.ORG Thu Dec 22 09:36:38 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 048051065688; Thu, 22 Dec 2011 09:36:38 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E7CC98FC0C; Thu, 22 Dec 2011 09:36:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBM9abYu009473; Thu, 22 Dec 2011 09:36:37 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBM9abps009471; Thu, 22 Dec 2011 09:36:37 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201112220936.pBM9abps009471@svn.freebsd.org> From: Ed Schouten Date: Thu, 22 Dec 2011 09:36:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228798 - head/lib/libstand X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Dec 2011 09:36:38 -0000 Author: ed Date: Thu Dec 22 09:36:37 2011 New Revision: 228798 URL: http://svn.freebsd.org/changeset/base/228798 Log: Add placeholder code for prepending pathnames to tftp. At work we have a single tftp server that provides installation data for a variety of operating systems. I'd rather place our FreeBSD-related files in a subdirectory, instead of the root. It would be nice if this setting could be run-time configurable, but at least in our specific case, this is not possible, as pxeboot is chainloaded through pxelinux. Sponsored by: Kumina bv Modified: head/lib/libstand/tftp.c Modified: head/lib/libstand/tftp.c ============================================================================== --- head/lib/libstand/tftp.c Thu Dec 22 08:42:07 2011 (r228797) +++ head/lib/libstand/tftp.c Thu Dec 22 09:36:37 2011 (r228798) @@ -292,8 +292,15 @@ tftp_makereq(struct tftp_handle *h) wbuf.t.th_opcode = htons((u_short) RRQ); wtail = wbuf.t.th_stuff; l = strlen(h->path); +#ifdef TFTP_PREPEND_PATH + if (l > FNAME_SIZE - (sizeof(TFTP_PREPEND_PATH) - 1)) + return (ENAMETOOLONG); + bcopy(TFTP_PREPEND_PATH, wtail, sizeof(TFTP_PREPEND_PATH) - 1); + wtail += sizeof(TFTP_PREPEND_PATH) - 1; +#else if (l > FNAME_SIZE) return (ENAMETOOLONG); +#endif bcopy(h->path, wtail, l + 1); wtail += l + 1; bcopy("octet", wtail, 6);