Page MenuHomeFreeBSD

D4590.id11334.diff
No OneTemporary

D4590.id11334.diff

Index: lib/libstand/tftp.c
===================================================================
--- lib/libstand/tftp.c
+++ lib/libstand/tftp.c
@@ -47,6 +47,7 @@
#include <sys/types.h>
#include <sys/stat.h>
+#include <sys/param.h>
#include <netinet/in.h>
#include <netinet/udp.h>
#include <netinet/in_systm.h>
@@ -111,7 +112,7 @@
int islastblock; /* flag */
int validsize;
int off;
- char *path; /* saved for re-requests */
+ char path[MAXPATHLEN]; /* saved for re-requests */
unsigned int tftp_blksize;
unsigned long tftp_tsize;
struct {
@@ -424,8 +425,9 @@
io->destip = servip;
tftpfile->off = 0;
- tftpfile->path = strdup(path);
- if (tftpfile->path == NULL) {
+ res = snprintf(tftpfile->path, sizeof(tftpfile->path), "%s/%s",
+ rootpath[0] ? rootpath : "", path);
+ if (res < 0 || res > sizeof(tftpfile->path)) {
free(tftpfile);
return(ENOMEM);
}
@@ -433,7 +435,6 @@
res = tftp_makereq(tftpfile);
if (res) {
- free(tftpfile->path);
free(tftpfile);
return (res);
}
@@ -522,7 +523,6 @@
/* let it time out ... */
if (tftpfile) {
- free(tftpfile->path);
free(tftpfile);
}
is_open = 0;
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

Mime Type
text/plain
Expires
Mon, Apr 20, 5:57 PM (17 h, 16 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31855255
Default Alt Text
D4590.id11334.diff (3 KB)

Event Timeline