diff options
| author | Jo-Philipp Wich | 2022-03-30 14:49:22 +0000 |
|---|---|---|
| committer | Jo-Philipp Wich | 2022-03-30 14:52:23 +0000 |
| commit | 9972f7dca635392832810d2d43b663f08466b088 (patch) | |
| tree | 4a75faf676e47d648a4c84cf1fa5e8400e42d0fa | |
| parent | fde80708d63d54be18037c598d1e6aef0c65ca08 (diff) | |
| download | firewall4-9972f7dca635392832810d2d43b663f08466b088.tar.gz | |
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 <jo@mein.io>
| -rw-r--r-- | root/usr/share/ucode/fw4.uc | 16 |
1 files changed, 8 insertions, 8 deletions
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) |