summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authored <ed@FreeBSD.org>2011-12-22 09:36:37 +0000
committered <ed@FreeBSD.org>2011-12-22 09:36:37 +0000
commit0441bd2fad88678678a39538fcb9d5b32b959995 (patch)
treeef6a45c4344ec13471761c816712d9ea2a2a0438 /lib
parent2942879b6ed0f413f59c085747271ea20b06e8f1 (diff)
downloadFreeBSD-src-0441bd2fad88678678a39538fcb9d5b32b959995.zip
FreeBSD-src-0441bd2fad88678678a39538fcb9d5b32b959995.tar.gz
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
Diffstat (limited to 'lib')
-rw-r--r--lib/libstand/tftp.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/libstand/tftp.c b/lib/libstand/tftp.c
index bf92c04..aa331b3 100644
--- a/lib/libstand/tftp.c
+++ b/lib/libstand/tftp.c
@@ -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);
OpenPOWER on IntegriCloud