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 12385) +++ /ar5315_microredboot/microredboot/ecos/packages/redboot/current/src/net/tftp_server.c (revision 12388) @@ -240,7 +240,9 @@ sizeof(struct firmware_formats); i++) { int v = - fw_formats[i]. - fw_check_image((char *)BASE_ADDR, - ptr - BASE_ADDR, 0) == 0; + fw_formats[i].fw_check_image((char *) + BASE_ADDR, + ptr - + BASE_ADDR, + 0) == 0; if (v) { detect = i; 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 12385) +++ /ar5315_microredboot/microredboot/ecos/packages/redboot/current/src/net/tftp_client.c (revision 12388) @@ -223,5 +223,7 @@ 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 */ Index: /ar5315_microredboot/microredboot/ecos/packages/redboot/current/src/net/fwupgrade_ubnt.c =================================================================== --- /ar5315_microredboot/microredboot/ecos/packages/redboot/current/src/net/fwupgrade_ubnt.c (revision 12385) +++ /ar5315_microredboot/microredboot/ecos/packages/redboot/current/src/net/fwupgrade_ubnt.c (revision 12388) @@ -59,4 +59,22 @@ signature_t *sig; fw.size = maxlen; + if (!strncmp(header->magic, "OPEN", 4) + && !strncmp(header->magic, "UBNT", 4)) { + return -1; //not ubnt firmware + } +#if defined(CYGPKG_HAL_MIPS_AR2316) + if (strncmp((unsigned char *)&header->version[4], "ar2316", 6)) { + diag_printf + ("UBNT_FW: cannot upgrade, wrong target platform. only ar2316 is valid"); + return -1; + } +#endif +#if defined(CYGPKG_HAL_MIPS_AR5312) + if (strncmp((unsigned char *)&header->version[4], "ar2313", 6)) { + diag_printf + ("UBNT_FW: cannot upgrade, wrong target platform. only ar2313 is valid"); + return -1; + } +#endif if (htonl(crc) != header->crc) { diag_printf("UBNT_FW: header crc failed\n");