summaryrefslogtreecommitdiff
path: root/net/tftp.c
diff options
context:
space:
mode:
authorWolfgang Denk <wd@denx.de>2007-08-30 14:42:15 +0200
committerWolfgang Denk <wd@denx.de>2007-08-30 14:42:15 +0200
commitff13ac8c7bbebb238e339592de765c546dba1073 (patch)
treefc700730f63a90bcbebbb9bf8017345a1b570e89 /net/tftp.c
parent1900fbf255acba8b94fb442a16408ea85a1d46a6 (diff)
downloadu-boot-imx-ff13ac8c7bbebb238e339592de765c546dba1073.zip
u-boot-imx-ff13ac8c7bbebb238e339592de765c546dba1073.tar.gz
u-boot-imx-ff13ac8c7bbebb238e339592de765c546dba1073.tar.bz2
Backout commit 8f1bc284 as it causes TFTP to fail.
Signed-off-by: Wolfgang Denk <wd@denx.de>
Diffstat (limited to 'net/tftp.c')
-rw-r--r--net/tftp.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/net/tftp.c b/net/tftp.c
index 27f5e88..fb2f505 100644
--- a/net/tftp.c
+++ b/net/tftp.c
@@ -238,9 +238,9 @@ TftpSend (void)
static void
TftpHandler (uchar * pkt, unsigned dest, unsigned src, unsigned len)
{
- char * blksize;
ushort proto;
ushort *s;
+ int i;
if (dest != TftpOurPort) {
#ifdef CONFIG_MCAST_TFTP
@@ -272,22 +272,22 @@ TftpHandler (uchar * pkt, unsigned dest, unsigned src, unsigned len)
case TFTP_OACK:
#ifdef ET_DEBUG
- printf("Got OACK:\n");
- print_buffer (0, pkt, 1, len, 16);
+ printf("Got OACK: %s %s\n", pkt, pkt+strlen(pkt)+1);
#endif
TftpState = STATE_OACK;
TftpServerPort = src;
-
/* Check for 'blksize' option */
- pkt[len] = 0; /* NULL terminate so string ops work */
- blksize = strstr((char*)pkt, "blksize");
- if ((blksize) && (blksize + 8 < (char*)pkt + len)) {
- TftpBlkSize = simple_strtoul(blksize + 8, NULL, 10);
+ for (i=0;i<len-8;i++) {
+ if (strcmp ((char*)pkt+i,"blksize") == 0) {
+ TftpBlkSize = (unsigned short)
+ simple_strtoul((char*)pkt+i+8,NULL,10);
#ifdef ET_DEBUG
- printf("Blocksize ack: %d\n", TftpBlkSize);
+ printf ("Blocksize ack: %s, %d\n",
+ (char*)pkt+i+8,TftpBlkSize);
#endif
+ break;
+ }
}
-
#ifdef CONFIG_MCAST_TFTP
parse_multicast_oack((char *)pkt,len-1);
if ((Multicast) && (!MasterClient))