aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux
diff options
context:
space:
mode:
authorJohn Crispin <blogic@openwrt.org>2016-04-01 07:11:53 +0000
committerJohn Crispin <blogic@openwrt.org>2016-04-01 07:11:53 +0000
commitf0d41e20e45db5a6334dbf7a23165b0baac0ea9d (patch)
treeaa052383dc6e5b24fed7bac52901236ca46f62be /target/linux
parent04c82ebd6162aa44c20bfc95fe651021c451870a (diff)
downloadmaster-187ad058-f0d41e20e45db5a6334dbf7a23165b0baac0ea9d.tar.gz
master-187ad058-f0d41e20e45db5a6334dbf7a23165b0baac0ea9d.tar.bz2
master-187ad058-f0d41e20e45db5a6334dbf7a23165b0baac0ea9d.zip
ar71xx: check both HWID and HWREV on upgrades of TP-LINK devices
There's no reason for us to be more lenient than the stock firmware, so better check the HWREV as well to avoid bricked devices. Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@49105 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux')
-rwxr-xr-xtarget/linux/ar71xx/base-files/lib/upgrade/platform.sh16
1 files changed, 12 insertions, 4 deletions
diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
index 1d3695f372..923e02b9fc 100755
--- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
@@ -66,6 +66,10 @@ tplink_get_image_hwid() {
get_image "$@" | dd bs=4 count=1 skip=16 2>/dev/null | hexdump -v -n 4 -e '1/1 "%02x"'
}
+tplink_get_image_mid() {
+ get_image "$@" | dd bs=4 count=1 skip=17 2>/dev/null | hexdump -v -n 4 -e '1/1 "%02x"'
+}
+
tplink_get_image_boot_size() {
get_image "$@" | dd bs=4 count=1 skip=37 2>/dev/null | hexdump -v -n 4 -e '1/1 "%02x"'
}
@@ -396,13 +400,17 @@ platform_check_image() {
}
local hwid
- local imageid
+ local mid
+ local imagehwid
+ local imagemid
hwid=$(tplink_get_hwid)
- imageid=$(tplink_get_image_hwid "$1")
+ mid=$(tplink_get_mid)
+ imagehwid=$(tplink_get_image_hwid "$1")
+ imagemid=$(tplink_get_image_mid "$1")
- [ "$hwid" != "$imageid" ] && {
- echo "Invalid image, hardware ID mismatch, hw:$hwid image:$imageid."
+ [ "$hwid" != "$imagehwid" -o "$mid" != "$imagemid" ] && {
+ echo "Invalid image, hardware ID mismatch, hw:$hwid $mid image:$imagehwid $imagemid."
return 1
}