From: Mieczyslaw Nalewaj Date: Wed, 20 Nov 2024 17:16:08 +0000 (+0100) Subject: firewall4: fix reading kernel version X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=1e8065380cefc4cdd2c5c264890b3e4a41330268;p=openwrt%2Fstaging%2Fwigyori.git firewall4: fix reading kernel version Fix reading kernel version for kernels with revision 0 e.g. 6.12 Repair incorrect shift of the revision number causing incorrect value for > 256. Signed-off-by: Mieczyslaw Nalewaj --- diff --git a/package/network/config/firewall4/patches/000-kernel-version.patch b/package/network/config/firewall4/patches/000-kernel-version.patch new file mode 100644 index 0000000000..e997f693f0 --- /dev/null +++ b/package/network/config/firewall4/patches/000-kernel-version.patch @@ -0,0 +1,14 @@ +--- a/root/usr/share/ucode/fw4.uc ++++ b/root/usr/share/ucode/fw4.uc +@@ -496,9 +496,9 @@ return { + v = 0; + + if (fd) { +- let m = match(fd.read("line"), /^Linux version ([0-9]+)\.([0-9]+)\.([0-9]+)/); ++ let m = match(fd.read("line"), /^Linux version ([0-9]+)\.([0-9]+)(\.([0-9]+))?/); + +- v = m ? (+m[1] << 24) | (+m[2] << 16) | (+m[3] << 8) : 0; ++ v = m ? (+m[1] << 24) | (+m[2] << 16) | (+m[4]) : 0; + fd.close(); + } +