Re: [PATCH] tplink-safeloader: fix C7v5 factory flashing from vendor fw > v1.1.x

2021-05-06 Thread Henrique de Moraes Holschuh

On 06/05/2021 05:00, Petr Štetiar wrote:

Henrique de Moraes Holschuh  [2021-05-05 17:49:19]:

Any updates on this?


it has been merged about month ago into master and 21.02 branches, so it's
available in 21.02.0-rc1 images and I've just pushed it into 19.07 branch as
well.


Thank you!

--
Henrique de Moraes Holschuh
Analista de Projetos
Centro de Estudos e Pesquisas em Tecnologias de Redes e Operações 
(Ceptro.br)

www.nic.br

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [PATCH] tplink-safeloader: fix C7v5 factory flashing from vendor fw > v1.1.x

2021-05-06 Thread Petr Štetiar
Henrique de Moraes Holschuh  [2021-05-05 17:49:19]:

Hi,

> Any updates on this?

it has been merged about month ago into master and 21.02 branches, so it's
available in 21.02.0-rc1 images and I've just pushed it into 19.07 branch as
well.

-- ynezz

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [PATCH] tplink-safeloader: fix C7v5 factory flashing from vendor fw > v1.1.x

2021-05-05 Thread Henrique de Moraes Holschuh

Any updates on this?

An user reported to us this same issue with the latest 2021 version of 
the C7v5-US tp-link firmware [as available in Brazil].


Install was possible only through tftp: the tp-link stock firmware web 
page would refuse the factory image.


On 13/04/2021 05:26, Petr Štetiar wrote:

Adrian Schmutzler  [2021-04-10 18:55:10]:

Hi,


Currently it's not possible to flash factory images on devices shipped with
vendor firmware versions 1.1.0 Build 20201120 rel. 50406 (published
2020-12-22):


Will this prevent flashing back vendor firmware via TFTP or is a different 
comparison used there?


nope, it seems like U-Boot has different kind of checks. For example my
testing unit has following U-Boot:

  U-Boot 1.1.4-gbec22107-dirty (Nov 18 2020 - 18:19:12)

and flashing from OpenWrt back to stock with latest factory vendor image
c7v5_us-up-ver1-1-2-P1[20210125-rel37999]_2021-01-25_10.33.55.bin
works as expected:

  Firmware downloaded... filesize = 0xeeae77 fileaddr = 0x8006.
  Firmware Recovery file length : 15642231
  Firmware process id 2.
  handle_fw_cloud 146
  Image verify OK!
  Firmware file Verify ok!
  product-info:product_name:Archer C7
  product_ver:5.0.0
  special_id:5553
  [Error]sysmgr_cfg_checkSupportList(): 1023 @ specialId 4555 NOT Match.
  Firmware supports, check OK.
  Firmware Recovery check ok!

-- ynezz

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel




--
Henrique de Moraes Holschuh
Analista de Projetos
Centro de Estudos e Pesquisas em Tecnologias de Redes e Operações 
(Ceptro.br)

+55 11 5509-3537 R.:4023
INOC 22548*625
www.nic.br

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [PATCH] tplink-safeloader: fix C7v5 factory flashing from vendor fw > v1.1.x

2021-04-13 Thread Petr Štetiar
Adrian Schmutzler  [2021-04-10 18:55:10]:

Hi,

> > Currently it's not possible to flash factory images on devices shipped with
> > vendor firmware versions 1.1.0 Build 20201120 rel. 50406 (published
> > 2020-12-22):
> 
> Will this prevent flashing back vendor firmware via TFTP or is a different 
> comparison used there?

nope, it seems like U-Boot has different kind of checks. For example my
testing unit has following U-Boot:

 U-Boot 1.1.4-gbec22107-dirty (Nov 18 2020 - 18:19:12)

and flashing from OpenWrt back to stock with latest factory vendor image
c7v5_us-up-ver1-1-2-P1[20210125-rel37999]_2021-01-25_10.33.55.bin
works as expected:

 Firmware downloaded... filesize = 0xeeae77 fileaddr = 0x8006.
 Firmware Recovery file length : 15642231
 Firmware process id 2.
 handle_fw_cloud 146
 Image verify OK!
 Firmware file Verify ok!
 product-info:product_name:Archer C7
 product_ver:5.0.0
 special_id:5553
 [Error]sysmgr_cfg_checkSupportList(): 1023 @ specialId 4555 NOT Match.
 Firmware supports, check OK.
 Firmware Recovery check ok!

-- ynezz

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


RE: [PATCH] tplink-safeloader: fix C7v5 factory flashing from vendor fw > v1.1.x

2021-04-10 Thread Adrian Schmutzler
Hi,

> -Original Message-
> From: openwrt-devel [mailto:openwrt-devel-boun...@lists.openwrt.org]
> On Behalf Of Petr Štetiar
> Sent: Freitag, 9. April 2021 15:35
> To: openwrt-devel@lists.openwrt.org
> Cc: Petr Štetiar 
> Subject: [PATCH] tplink-safeloader: fix C7v5 factory flashing from vendor fw
> > v1.1.x
> 
> Currently it's not possible to flash factory images on devices shipped with
> vendor firmware versions 1.1.0 Build 20201120 rel. 50406 (published
> 2020-12-22):

Will this prevent flashing back vendor firmware via TFTP or is a different 
comparison used there?

Best

Adrian


> 
>  (curFw_ver, newFw_ver) == (1.1, 1.0) [NM_Error](nm_checkSoftVer) 00848:
> Firmwave not supports, check failed.
>  [NM_Error](nm_checkUpdateContent) 01084: software version dismatched
>  [NM_Error](nm_buildUpgradeStruct) 01188: checkUpdateContent failed.
> 
> They've even following note in release notes:
> 
>  Note: You will be unable to downgrade to the previous firmware version
> after updating this firmware.
> 
> This version check is in vendor firmware is implemented in
> /usr/bin/nvrammanager binary as following code[1]:
> 
>  sscanf(buf, "%d.%d.%*s",_fw_major, _fw_minor);  ...
>  if (((int)upd_fw_major < (int)cur_fw_major) ||
>  ((ret = 1, cur_fw_major == upd_fw_major && (upd_fw_minor <
> (int)cur_fw_minor {
>ret = 0;
>printf("[NM_Error](%s) %05d: Firmwave not supports, check
> failed.\r\n\r\n","nm_checkSoftVer" ,0x350);  }  ...
>  return ret;
> 
> So in order to fix this and make it future proof it should be enough to ship 
> our
> factory firmware images with major version 7 (lucky number).
> 
> Tested on latest firmware version 1.1.2 Build 20210125 rel.37999:
> 
>  Firmwave supports, check OK.
>   (curFw_ver, newFw_ver) == (1.1, 7.0) check firmware ok!
>  chekc firmware file success!
> 
> 1. https://gist.github.com/ynezz/2e0583647d863386a66c3d231541b6d1
> 
> Signed-off-by: Petr Štetiar 
> ---
>  tools/firmware-utils/src/tplink-safeloader.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/firmware-utils/src/tplink-safeloader.c b/tools/firmware-
> utils/src/tplink-safeloader.c
> index da73e1bf307e..ac71b3305ee6 100644
> --- a/tools/firmware-utils/src/tplink-safeloader.c
> +++ b/tools/firmware-utils/src/tplink-safeloader.c
> @@ -1262,7 +1262,7 @@ static struct device_info boards[] = {
>   "{product_name:Archer
> C7,product_ver:5.0.0,special_id:4B52}\n",
> 
>   .part_trail = 0x00,
> - .soft_ver = "soft_ver:1.0.0\n",
> + .soft_ver = "soft_ver:7.0.0\n",
> 
>   /* We're using a dynamic kernel/rootfs split here */
>   .partitions = {
> 
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel


openpgp-digital-signature.asc
Description: PGP signature
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [PATCH] tplink-safeloader: fix C7v5 factory flashing from vendor fw > v1.1.x

2021-04-09 Thread Luiz Angelo Daros de Luca
> Currently it's not possible to flash factory images on devices shipped
> with vendor firmware versions 1.1.0 Build 20201120 rel. 50406 (published
> 2020-12-22):
>
>  (curFw_ver, newFw_ver) == (1.1, 1.0) [NM_Error](nm_checkSoftVer) 00848: 
> Firmwave not supports, check failed.
>  [NM_Error](nm_checkUpdateContent) 01084: software version dismatched
>  [NM_Error](nm_buildUpgradeStruct) 01188: checkUpdateContent failed.
>
> They've even following note in release notes:
>
>  Note: You will be unable to downgrade to the previous firmware version after 
> updating this firmware.
>
> This version check is in vendor firmware is implemented in
> /usr/bin/nvrammanager binary as following code[1]:
>
>  sscanf(buf, "%d.%d.%*s",_fw_major, _fw_minor);
>  ...
>  if (((int)upd_fw_major < (int)cur_fw_major) ||
>  ((ret = 1, cur_fw_major == upd_fw_major && (upd_fw_minor < 
> (int)cur_fw_minor {
>ret = 0;
>printf("[NM_Error](%s) %05d: Firmwave not supports, check 
> failed.\r\n\r\n","nm_checkSoftVer" ,0x350);
>  }
>  ...
>  return ret;
>
> So in order to fix this and make it future proof it should be enough to
> ship our factory firmware images with major version 7 (lucky number).
>
> Tested on latest firmware version 1.1.2 Build 20210125 rel.37999:
>
>  Firmwave supports, check OK.
>   (curFw_ver, newFw_ver) == (1.1, 7.0) check firmware ok!
>  chekc firmware file success!
>
> 1. https://gist.github.com/ynezz/2e0583647d863386a66c3d231541b6d1
>
> Signed-off-by: Petr Štetiar 
> ---
>  tools/firmware-utils/src/tplink-safeloader.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/firmware-utils/src/tplink-safeloader.c 
> b/tools/firmware-utils/src/tplink-safeloader.c
> index da73e1bf307e..ac71b3305ee6 100644
> --- a/tools/firmware-utils/src/tplink-safeloader.c
> +++ b/tools/firmware-utils/src/tplink-safeloader.c
> @@ -1262,7 +1262,7 @@ static struct device_info boards[] = {
> "{product_name:Archer 
> C7,product_ver:5.0.0,special_id:4B52}\n",
>
> .part_trail = 0x00,
> -   .soft_ver = "soft_ver:1.0.0\n",
> +   .soft_ver = "soft_ver:7.0.0\n",


Why not something bigger? Maybe 126 instead of 7? It is still safe
even if the version is stored as an unsigned char.

>
> Currently it's not possible to flash factory images on devices shipped
> with vendor firmware versions 1.1.0 Build 20201120 rel. 50406 (published
> 2020-12-22):
>
>  (curFw_ver, newFw_ver) == (1.1, 1.0) [NM_Error](nm_checkSoftVer) 00848: 
> Firmwave not supports, check failed.
>  [NM_Error](nm_checkUpdateContent) 01084: software version dismatched
>  [NM_Error](nm_buildUpgradeStruct) 01188: checkUpdateContent failed.
>
> They've even following note in release notes:
>
>  Note: You will be unable to downgrade to the previous firmware version after 
> updating this firmware.
>
> This version check is in vendor firmware is implemented in
> /usr/bin/nvrammanager binary as following code[1]:
>
>  sscanf(buf, "%d.%d.%*s",_fw_major, _fw_minor);
>  ...
>  if (((int)upd_fw_major < (int)cur_fw_major) ||
>  ((ret = 1, cur_fw_major == upd_fw_major && (upd_fw_minor < 
> (int)cur_fw_minor {
>ret = 0;
>printf("[NM_Error](%s) %05d: Firmwave not supports, check 
> failed.\r\n\r\n","nm_checkSoftVer" ,0x350);
>  }
>  ...
>  return ret;
>
> So in order to fix this and make it future proof it should be enough to
> ship our factory firmware images with major version 7 (lucky number).
>
> Tested on latest firmware version 1.1.2 Build 20210125 rel.37999:
>
>  Firmwave supports, check OK.
>   (curFw_ver, newFw_ver) == (1.1, 7.0) check firmware ok!
>  chekc firmware file success!
>
> 1. https://gist.github.com/ynezz/2e0583647d863386a66c3d231541b6d1
>
> Signed-off-by: Petr Štetiar 
> ---
>  tools/firmware-utils/src/tplink-safeloader.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/firmware-utils/src/tplink-safeloader.c 
> b/tools/firmware-utils/src/tplink-safeloader.c
> index da73e1bf307e..ac71b3305ee6 100644
> --- a/tools/firmware-utils/src/tplink-safeloader.c
> +++ b/tools/firmware-utils/src/tplink-safeloader.c
> @@ -1262,7 +1262,7 @@ static struct device_info boards[] = {
> "{product_name:Archer 
> C7,product_ver:5.0.0,special_id:4B52}\n",
>
> .part_trail = 0x00,
> -   .soft_ver = "soft_ver:1.0.0\n",
> +   .soft_ver = "soft_ver:7.0.0\n",
>
> /* We're using a dynamic kernel/rootfs split here */
> .partitions = {
>
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel

---
 Luiz Angelo Daros de Luca
luizl...@gmail.com

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[PATCH] tplink-safeloader: fix C7v5 factory flashing from vendor fw > v1.1.x

2021-04-09 Thread Petr Štetiar
Currently it's not possible to flash factory images on devices shipped
with vendor firmware versions 1.1.0 Build 20201120 rel. 50406 (published
2020-12-22):

 (curFw_ver, newFw_ver) == (1.1, 1.0) [NM_Error](nm_checkSoftVer) 00848: 
Firmwave not supports, check failed.
 [NM_Error](nm_checkUpdateContent) 01084: software version dismatched
 [NM_Error](nm_buildUpgradeStruct) 01188: checkUpdateContent failed.

They've even following note in release notes:

 Note: You will be unable to downgrade to the previous firmware version after 
updating this firmware.

This version check is in vendor firmware is implemented in
/usr/bin/nvrammanager binary as following code[1]:

 sscanf(buf, "%d.%d.%*s",_fw_major, _fw_minor);
 ...
 if (((int)upd_fw_major < (int)cur_fw_major) ||
 ((ret = 1, cur_fw_major == upd_fw_major && (upd_fw_minor < 
(int)cur_fw_minor {
   ret = 0;
   printf("[NM_Error](%s) %05d: Firmwave not supports, check 
failed.\r\n\r\n","nm_checkSoftVer" ,0x350);
 }
 ...
 return ret;

So in order to fix this and make it future proof it should be enough to
ship our factory firmware images with major version 7 (lucky number).

Tested on latest firmware version 1.1.2 Build 20210125 rel.37999:

 Firmwave supports, check OK.
  (curFw_ver, newFw_ver) == (1.1, 7.0) check firmware ok!
 chekc firmware file success!

1. https://gist.github.com/ynezz/2e0583647d863386a66c3d231541b6d1

Signed-off-by: Petr Štetiar 
---
 tools/firmware-utils/src/tplink-safeloader.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/firmware-utils/src/tplink-safeloader.c 
b/tools/firmware-utils/src/tplink-safeloader.c
index da73e1bf307e..ac71b3305ee6 100644
--- a/tools/firmware-utils/src/tplink-safeloader.c
+++ b/tools/firmware-utils/src/tplink-safeloader.c
@@ -1262,7 +1262,7 @@ static struct device_info boards[] = {
"{product_name:Archer 
C7,product_ver:5.0.0,special_id:4B52}\n",
 
.part_trail = 0x00,
-   .soft_ver = "soft_ver:1.0.0\n",
+   .soft_ver = "soft_ver:7.0.0\n",
 
/* We're using a dynamic kernel/rootfs split here */
.partitions = {

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel