Index: /ar5315_microredboot/microredboot/ecos/packages/redboot/current/src/net/tftp_server.c =================================================================== --- /ar5315_microredboot/microredboot/ecos/packages/redboot/current/src/net/tftp_server.c (revision 12388) +++ /ar5315_microredboot/microredboot/ecos/packages/redboot/current/src/net/tftp_server.c (revision 12407) @@ -233,5 +233,5 @@ diag_printf("Checking uploaded file...\n"); - int detect = 0; + int detect = -1; int i; for (i = 0; @@ -239,11 +239,7 @@ sizeof(fw_formats) / sizeof(struct firmware_formats); i++) { - int v = - fw_formats[i].fw_check_image((char *) - BASE_ADDR, - ptr - - BASE_ADDR, - 0) == 0; - if (v) { + int v = fw_formats[i].fw_check_image((char *)BASE_ADDR,ptr - BASE_ADDR,0); +// diag_printf("%s returns %d\n",fw_formats[i].name,v); + if (!v) { detect = i; break; @@ -251,5 +247,5 @@ } - if (detect) /* third parameter 0 - do not write to flash */ + if (detect!=-1) /* third parameter 0 - do not write to flash */ tftpd_send(ACK, block, src_route, src_port); // crc ok else { Index: /ar5315_microredboot/microredboot/ecos/packages/redboot/current/src/net/tftp_client.c =================================================================== --- /ar5315_microredboot/microredboot/ecos/packages/redboot/current/src/net/tftp_client.c (revision 12388) +++ /ar5315_microredboot/microredboot/ecos/packages/redboot/current/src/net/tftp_client.c (revision 12407) @@ -223,7 +223,5 @@ if (ntohs(hdr->th_opcode) == DATA) { if (ntohs(hdr->th_block) == - (cyg_uint16) ((tftp_stream. - last_good_block + - 1) & 0xFFFF)) { + (cyg_uint16) ((tftp_stream.last_good_block + 1) & 0xFFFF)) { // Consume this data data_len -= 4; /* Sizeof TFTP header */