summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLiu Aleaxander <Aleaxander@gmail.com>2009-08-09 14:54:08 +0800
committerLiu Aleaxander <Aleaxander@gmail.com>2009-08-09 14:54:08 +0800
commitcb76438e0029540a870213fd001c01e77ae7e892 (patch)
tree84300a1d10a7e5cf0d3439d22bd185e8649d071d
parenta0a603145eaf41c0650dd9c80002375c8b2cb04f (diff)
downloadsyslinux-cb76438e0029540a870213fd001c01e77ae7e892.tar.gz
pxe: fix OACK packet handling
The current code only works iff the tsize option is set. This patch fixes the handling of the OACK packet and makes the code work with all combinations of the tsize and blksize options. Signed-off-by: Sebastian Herbszt <herbszt@gmx.de>
-rw-r--r--core/pxe.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/core/pxe.c b/core/pxe.c
index 12c3113e..7cf5cc1a 100644
--- a/core/pxe.c
+++ b/core/pxe.c
@@ -933,8 +933,10 @@ static void pxe_searchdir(char *filename, struct file *file)
* Now we need to parse the OACK packet to get the transfer
* and packet sizes.
*/
- if (!buffersize)
+ if (!buffersize) {
+ filesize = -1;
goto done; /* No options acked */
+ }
/*
* If we find an option which starts with a NUL byte,
@@ -964,8 +966,10 @@ static void pxe_searchdir(char *filename, struct file *file)
p = options;
tftp_opt = tftp_options;
for (i = 0; i < tftp_opts; i++) {
- if (!strncmp(p, tftp_opt->str_ptr,tftp_opt->str_len))
+ if (!strncmp(p, tftp_opt->str_ptr,tftp_opt->str_len)) {
+ options += tftp_opt->str_len;
break;
+ }
tftp_opt++;
}
if (i == tftp_opts)
@@ -974,11 +978,12 @@ static void pxe_searchdir(char *filename, struct file *file)
p += tftp_opt->str_len;
/* get the address of the filed that we want to write on */
- data_ptr = (uint32_t *)((char *)file + tftp_opt->offset);
+ data_ptr = (uint32_t *)((char *)open_file + tftp_opt->offset);
*data_ptr = 0;
/* do convert a number-string to decimal number, just like atoi */
while (buffersize--) {
+ options++;
if (*p == 0)
break; /* found a final null */
if (*p > '9')