misc/164604: TFTP pxeboot: should use root-path provided by DHCP

Floris Bos bos at je-eigen-domein.nl
Sun Jan 29 15:40:12 UTC 2012


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


More information about the freebsd-bugs mailing list