diff options
author | H. Peter Anvin <hpa@zytor.com> | 2011-04-24 14:42:56 -0700 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2011-04-24 14:42:56 -0700 |
commit | 9c136a34a30708efa50545cb8859e937964bed2f (patch) | |
tree | 2f72c953798ade5c65a4b5d7d9266c4f39e6dbb4 /core/fs/pxe/pxe.c | |
parent | 782a60a49cf263e9ce99897cef530deb02af00dd (diff) | |
download | syslinux-9c136a34a30708efa50545cb8859e937964bed2f.tar.gz |
pxe: continue to bounce URLs with unknown schemes to gPXE
If we're running on top of a gPXE/iPXE stack, and get a URL we don't
know, continue to bounce it to gPXE. It isn't entirely clear how well
this will actually work with an UNDI-based network stack, however...
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'core/fs/pxe/pxe.c')
-rw-r--r-- | core/fs/pxe/pxe.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/core/fs/pxe/pxe.c b/core/fs/pxe/pxe.c index 5789bb63..939ce719 100644 --- a/core/fs/pxe/pxe.c +++ b/core/fs/pxe/pxe.c @@ -68,6 +68,7 @@ void free_socket(struct inode *inode) { struct pxe_pvt_inode *socket = PVT(inode); + free(socket->tftp_pktbuf); /* If we allocated a buffer, free it now */ free_port(socket->tftp_localport); free_inode(inode); } @@ -380,9 +381,13 @@ static void __pxe_searchdir(const char *filename, struct file *file) struct fs_info *fs = file->fs; struct inode *inode; char fullpath[2*FILENAME_MAX]; +#ifdef GPXE + char urlsave[2*FILENAME_MAX]; +#endif struct url_info url; - const struct url_scheme *us; + const struct url_scheme *us = NULL; int redirect_count = 0; + bool found_scheme = false; inode = file->inode = NULL; @@ -391,9 +396,15 @@ static void __pxe_searchdir(const char *filename, struct file *file) break; strlcpy(fullpath, filename, sizeof fullpath); +#ifdef GPXE + strcpy(urlsave, fullpath); +#endif parse_url(&url, fullpath); if (url.type == URL_SUFFIX) { snprintf(fullpath, sizeof fullpath, "%s%s", fs->cwd_name, filename); +#ifdef GPXE + strcpy(urlsave, fullpath); +#endif parse_url(&url, fullpath); } @@ -404,9 +415,11 @@ static void __pxe_searchdir(const char *filename, struct file *file) url_set_ip(&url); filename = NULL; + found_scheme = false; for (us = url_schemes; us->name; us++) { if (!strcmp(us->name, url.scheme)) { us->open(&url, inode, &filename); + found_scheme = true; break; } } @@ -414,6 +427,13 @@ static void __pxe_searchdir(const char *filename, struct file *file) /* filename here is set on a redirect */ } +#ifdef GPXE + if (!found_scheme) { + /* No URL scheme found, hand it to GPXE */ + gpxe_open(inode, urlsave); + } +#endif + if (inode->size) file->inode = inode; else |