From owner-freebsd-bugs@FreeBSD.ORG Sun Jan 29 15:40:12 2012 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2ABD0106566B for ; Sun, 29 Jan 2012 15:40:12 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 075588FC0C for ; Sun, 29 Jan 2012 15:40:12 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id q0TFe9BL090804 for ; Sun, 29 Jan 2012 15:40:09 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.5/8.14.5/Submit) id q0TFe9Qi090803; Sun, 29 Jan 2012 15:40:09 GMT (envelope-from gnats) Resent-Date: Sun, 29 Jan 2012 15:40:09 GMT Resent-Message-Id: <201201291540.q0TFe9Qi090803@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Floris Bos Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EE33D106566B for ; Sun, 29 Jan 2012 15:40:03 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22]) by mx1.freebsd.org (Postfix) with ESMTP id D73AD8FC13 for ; Sun, 29 Jan 2012 15:40:03 +0000 (UTC) Received: from red.freebsd.org (localhost [127.0.0.1]) by red.freebsd.org (8.14.4/8.14.4) with ESMTP id q0TFe2sT061781 for ; Sun, 29 Jan 2012 15:40:02 GMT (envelope-from nobody@red.freebsd.org) Received: (from nobody@localhost) by red.freebsd.org (8.14.4/8.14.4/Submit) id q0TFe26k061780; Sun, 29 Jan 2012 15:40:02 GMT (envelope-from nobody) Message-Id: <201201291540.q0TFe26k061780@red.freebsd.org> Date: Sun, 29 Jan 2012 15:40:02 GMT From: Floris Bos To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: misc/164604: TFTP pxeboot: should use root-path provided by DHCP X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Jan 2012 15:40:12 -0000 >Number: 164604 >Category: misc >Synopsis: TFTP pxeboot: should use root-path provided by DHCP >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Sun Jan 29 15:40:09 UTC 2012 >Closed-Date: >Last-Modified: >Originator: Floris Bos >Release: 9.0 >Organization: >Environment: 9.0-RELEASE >Description: When pxeboot is compiled with LOADER_TFTP_SUPPORT it always expects to find the boot files in the /boot folder on the TFTP server. This hardcoded value is inflexible and does not allow the network booting of more than one version of FreeBSD. Instead it should fetch the files from the path specified by the root-path value supplied by DHCP, like other operating systems do. >How-To-Repeat: - >Fix: Attached a patch that uses the root-path parameter if present. If the parameter is not present it reverts to the old behavior, so does not break existing setups. Patch attached with submission follows: --- /usr/src/lib/libstand/tftp.c.orig 2012-01-28 21:07:55.000000000 +0100 +++ /usr/src/lib/libstand/tftp.c 2012-01-28 21:41:24.000000000 +0100 @@ -413,12 +413,22 @@ io->destip = servip; tftpfile->off = 0; - tftpfile->path = strdup(path); - if (tftpfile->path == NULL) { + + if (path == NULL) { free(tftpfile); return(ENOMEM); } + if (rootpath != NULL) { + tftpfile->path = malloc(strlen(rootpath)+strlen(path)+1); + strcpy(tftpfile->path, rootpath); + strcat(tftpfile->path, path); + } + else + { + tftpfile->path = strdup(path); + } + res = tftp_makereq(tftpfile); if (res) { >Release-Note: >Audit-Trail: >Unformatted: