From: Jo-Philipp Wich Date: Wed, 30 Mar 2022 14:49:22 +0000 (+0200) Subject: fw4: ensure to capitalize weekday names X-Git-Url: http://git.openwrt.org/?a=commitdiff_plain;h=9972f7dca635392832810d2d43b663f08466b088;p=project%2Ffirewall4.git fw4: ensure to capitalize weekday names Despite what's being documented in the nftables wiki, nftables does not actually accept lowercased or abbreviated weekday names, currently failing with a "Error: Could not parse Day of week of packet reception" error for expressions such as `meta day { "sunday", "wed" }`. Work around the problem by explicitly emitting capitalized weekday names while a more thorough nftables-side solution is being sent upstream. Ref: https://forum.openwrt.org/t/firewall-time-restrictions-parental-controls-problems/123964 Ref: https://wiki.nftables.org/wiki-nftables/index.php/Matching_packet_metainformation#Matching_by_time Signed-off-by: Jo-Philipp Wich --- diff --git a/root/usr/share/ucode/fw4.uc b/root/usr/share/ucode/fw4.uc index 37d117c..8a4277b 100644 --- a/root/usr/share/ucode/fw4.uc +++ b/root/usr/share/ucode/fw4.uc @@ -888,7 +888,7 @@ return { val = lc(val); for (let i = 0; i < length(choices); i++) - if (substr(choices[i], 0, length(val)) == val) + if (lc(substr(choices[i], 0, length(val))) == val) return choices[i]; } @@ -1280,13 +1280,13 @@ return { for (let day in to_array(rv.val)) { day = this.parse_enum(day, [ - "monday", - "tuesday", - "wednesday", - "thursday", - "friday", - "saturday", - "sunday" + "Monday", + "Tuesday", + "Wednesday", + "Thursday", + "Friday", + "Saturday", + "Sunday" ]); if (!day)