mbox series

[firmware-utils,v1,00/10] Refactor image ingestion to support new formats

Message ID cover.1675461748.git.sander@svanheule.net
Headers show
Series Refactor image ingestion to support new formats | expand

Message

Sander Vanheule Feb. 3, 2023, 10:03 p.m. UTC
TP-Link is playing fast and loose with the safeloader format, having
resulted in different types of images with their specific quirks.

A new incompatible format is currently used in the wild, which places
the payload partition table at a different offset, causing the image
parsers to fail. [1]

This series starts by fixing a bug or two and cleaning up the code a
tiny bit, and then refactors the different image ingestion options to
use one common parser.

Finally, support for the QNEW and Cloud images types is added through the
new parser. The latter doesn't really need explicit support at the
moment, so the patch serves mostly as documentation.

[1] https://forum.openwrt.org/t/148982

Best,
Sander

Sander Vanheule (10):
  tplink-safeloader: stricter free_image_partition()
  tplink-safeloader: use enum for table types
  tplink-safeloader: replace hardcoded offsets
  tplink-safeloader: stop at nameless partition
  tplink-safeloader: don't end-pad sysupgrade file
  tplink-safeloader: ignore NULLs in version info
  tplink-safeloader: refactor image ingestion
  tplink-safeloader: add vendor info support
  tplink-safeloader: add QNEW image detection
  tplink-safeloader: add Cloud image detection

 src/tplink-safeloader.c | 341 ++++++++++++++++++++++++++--------------
 1 file changed, 222 insertions(+), 119 deletions(-)

Comments

Sander Vanheule March 12, 2023, 8:20 p.m. UTC | #1
On Fri, 2023-02-03 at 23:03 +0100, Sander Vanheule wrote:
> TP-Link is playing fast and loose with the safeloader format, having
> resulted in different types of images with their specific quirks.
> 
> A new incompatible format is currently used in the wild, which places
> the payload partition table at a different offset, causing the image
> parsers to fail. [1]
> 
> This series starts by fixing a bug or two and cleaning up the code a
> tiny bit, and then refactors the different image ingestion options to
> use one common parser.
> 
> Finally, support for the QNEW and Cloud images types is added through the
> new parser. The latter doesn't really need explicit support at the
> moment, so the patch serves mostly as documentation.
> 
> [1] https://forum.openwrt.org/t/148982
> 
> Best,
> Sander
> 
> Sander Vanheule (10):
>   tplink-safeloader: stricter free_image_partition()
>   tplink-safeloader: use enum for table types
>   tplink-safeloader: replace hardcoded offsets
>   tplink-safeloader: stop at nameless partition
>   tplink-safeloader: don't end-pad sysupgrade file
>   tplink-safeloader: ignore NULLs in version info
>   tplink-safeloader: refactor image ingestion
>   tplink-safeloader: add vendor info support
>   tplink-safeloader: add QNEW image detection
>   tplink-safeloader: add Cloud image detection

If there are no objections, I'll merge these patches in the coming days.

Best,
Sander