tplink-safeloader: show compat_level with FW info
authorSander Vanheule <sander@svanheule.net>
Tue, 16 Jan 2024 19:44:19 +0000 (20:44 +0100)
committerSander Vanheule <sander@svanheule.net>
Tue, 16 Jan 2024 19:45:53 +0000 (20:45 +0100)
To help diagnosing issues with stock firmware refusing OpenWrt factory
images, it can be useful to compare firmware compatibility levels. Print
it out with the rest of the version info, if it is contained in the
soft-version partition.

Signed-off-by: Sander Vanheule <sander@svanheule.net>
src/tplink-safeloader.c

index 3dc470d93ec72473ef33da0a9dab1f6bd8c94cd9..f489b7964d02bf41f7a19289488a2ea227055ab4 100644 (file)
@@ -4272,6 +4272,10 @@ static int firmware_info(const char *input)
                        printf("Version: %d.%d.%d\n", s->version_major, s->version_minor, s->version_patch);
                        printf("Date: %02x%02x-%02x-%02x\n", s->year_hi, s->year_lo, s->month, s->day);
                        printf("Revision: %d\n", ntohl(s->rev));
+
+                       if (data_len >= offsetof(struct soft_version, compat_level)) {
+                               printf("Compatibility level: %d\n", ntohl(s->compat_level));
+                       }
                } else {
                        printf("Failed to parse data\n");
                }