Alexander Wuerstlein
2010-Jul-20 01:52 UTC
[syslinux] fix byte ordering problem in TFTP/PXE fs access
Hello, When trying out (g)pxelinux using TFTP URLs and the '<host>::<path>' syntax, pxelinux seemed to "hang". Some printf debugging and tcpdump revealed that it looped in the timeout after sending the TFTP RRQ. Further investigation revealed, that if a plain IP address (e.g. "tftp://12.34.56.78/something") is used, the byte order is not converted from host to network byte order. When a hostname is used (e.g. "tftp://server/something"), the resolving function seems to return the address in the correct byte order. For a fix, please see the attached patch.
Alexander Wuerstlein
2010-Jul-20 01:52 UTC
[syslinux] [PATCH] Fix byte order of plain IP addresses in TFTP URLs and old TFTP syntax
Signed-off-by: Alexander Wuerstlein <arw at arw.name> --- core/fs/pxe/pxe.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/core/fs/pxe/pxe.c b/core/fs/pxe/pxe.c index 25bd094..7562b95 100644 --- a/core/fs/pxe/pxe.c +++ b/core/fs/pxe/pxe.c @@ -703,6 +703,8 @@ static void pxe_searchdir(const char *filename, struct file *file) buf = stpcpy(buf, np+2); if (parse_dotquad(filename, &ip) != np) ip = dns_resolv(filename); + else + ip = htonl(ip); break; case PXE_URL_TFTP: @@ -712,6 +714,8 @@ static void pxe_searchdir(const char *filename, struct file *file) if (np > filename + 7) { if (parse_dotquad(filename + 7, &ip) != np) ip = dns_resolv(filename + 7); + else + ip = htonl(ip); } if (*np == ':') { np++; -- 1.6.3.3
H. Peter Anvin
2010-Jul-20 06:46 UTC
[syslinux] [PATCH] Fix byte order of plain IP addresses in TFTP URLs and old TFTP syntax
Hi there, Thanks for the report. I addressed this in a different way and make a 4.02-pre5 prerelease. Please test it if you can. -hpa
Alexander Wuerstlein
2010-Jul-23 04:04 UTC
[syslinux] [PATCH] Fix byte order of plain IP addresses in TFTP URLs and old TFTP syntax
On 10-07-20 08:46, H. Peter Anvin <hpa at zytor.com> wrote:> Hi there, > > Thanks for the report. I addressed this in a different way and make a > 4.02-pre5 prerelease.Tested it with various configurations, seems to work. Ciao, Alexander Wuerstlein.