Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F140043386
D4590.id11344.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D4590.id11344.diff
View Options
Index: lib/libstand/tftp.c
===================================================================
--- lib/libstand/tftp.c
+++ lib/libstand/tftp.c
@@ -399,6 +399,8 @@
struct tftp_handle *tftpfile;
struct iodesc *io;
int res;
+ size_t pathsize;
+ const char *extraslash;
if (strcmp(f->f_dev->dv_name, "net") != 0) {
#ifdef __i386__
@@ -424,10 +426,22 @@
io->destip = servip;
tftpfile->off = 0;
- tftpfile->path = strdup(path);
+ pathsize = (strlen(rootpath) + 1 + strlen(path) + 1) * sizeof(char);
+ tftpfile->path = malloc(pathsize);
if (tftpfile->path == NULL) {
- free(tftpfile);
- return(ENOMEM);
+ free(tftpfile);
+ return(ENOMEM);
+ }
+ if (rootpath[strlen(rootpath) - 1] == '/' || path[0] == '/')
+ extraslash = "";
+ else
+ extraslash = "/";
+ res = snprintf(tftpfile->path, pathsize, "%s%s%s",
+ rootpath, extraslash, path);
+ if (res < 0 || res > pathsize) {
+ free(tftpfile->path);
+ free(tftpfile);
+ return(ENOMEM);
}
res = tftp_makereq(tftpfile);
Index: sys/boot/i386/libi386/libi386.h
===================================================================
--- sys/boot/i386/libi386/libi386.h
+++ sys/boot/i386/libi386/libi386.h
@@ -123,5 +123,4 @@
int bi_load64(char *args, vm_offset_t addr, vm_offset_t *modulep,
vm_offset_t *kernend, int add_smap);
-char *pxe_default_rc(void);
void pxe_enable(void *pxeinfo);
Index: sys/boot/i386/libi386/pxe.c
===================================================================
--- sys/boot/i386/libi386/pxe.c
+++ sys/boot/i386/libi386/pxe.c
@@ -288,8 +288,10 @@
bootp(pxe_sock, BOOTP_PXE);
if (rootip.s_addr == 0)
rootip.s_addr = bootplayer.sip;
+#ifdef LOADER_NFS_SUPPORT
if (!rootpath[0])
strcpy(rootpath, PXENFSROOTPATH);
+#endif
for (i = 0; rootpath[i] != '\0' && i < FNAME_SIZE; i++)
if (rootpath[i] == ':')
@@ -317,6 +319,7 @@
setenv("boot.nfsroot.path", rootpath, 1);
#else
setenv("boot.netif.server", inet_ntoa(rootip), 1);
+ setenv("boot.tftproot.path", rootpath, 1);
#endif
setenv("dhcp.host-name", hostname, 1);
@@ -705,26 +708,3 @@
uh->uh_sport = udpread_p->s_port;
return udpread_p->buffer_size;
}
-
-char *
-pxe_default_rc(void)
-{
- char *rc;
- size_t count, rcsz;
-
- /* XXX It may not be a good idea to modify the PXE boot file. */
- rc = (char *)bootplayer.bootfile;
- rcsz = sizeof(bootplayer.bootfile);
-
- /* Ignore how we define rc and rcsz above -- it can change. */
- if (rcsz < 6)
- return (NULL);
- if (*rc == '\0') {
- strncpy(rc, "pxeboot", rcsz);
- rc[rcsz - 1] = '\0';
- }
- count = strlen(rc);
- strncat(rc, ".4th", rcsz - count - 1);
- printf("PXE: loading Forth from %s\n", rc);
- return (rc);
-}
Index: sys/boot/i386/loader/main.c
===================================================================
--- sys/boot/i386/loader/main.c
+++ sys/boot/i386/loader/main.c
@@ -196,11 +196,6 @@
bios_getsmap();
-#ifdef LOADER_TFTP_SUPPORT
- if (kargs->bootflags & KARGS_FLAGS_PXE)
- interact(pxe_default_rc());
- else
-#endif
interact(NULL);
/* if we ever get here, it is an error */
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Dec 20, 11:08 AM (10 h, 5 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
27096091
Default Alt Text
D4590.id11344.diff (3 KB)
Attached To
Mode
D4590: Make pxeboot use rootpath option in tftp mode
Attached
Detach File
Event Timeline
Log In to Comment