Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 29 Jan 2012 15:40:02 GMT
From:      Floris Bos <bos@je-eigen-domein.nl>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   misc/164604: TFTP pxeboot: should use root-path provided by DHCP
Message-ID:  <201201291540.q0TFe26k061780@red.freebsd.org>
Resent-Message-ID: <201201291540.q0TFe9Qi090803@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>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:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201201291540.q0TFe26k061780>