]> git.ipfire.org Git - thirdparty/nftables.git/commit
meta: fix hour decoding when timezone offset is negative
authorFlorian Westphal <fw@strlen.de>
Thu, 2 Nov 2023 14:34:13 +0000 (15:34 +0100)
committerFlorian Westphal <fw@strlen.de>
Thu, 2 Nov 2023 22:33:01 +0000 (23:33 +0100)
commitd392ddf243dcbf8a34726c777d2c669b1e8bfa85
treed28ab7c8119c2524b8adcc8275140b0c55983f9e
parente4c9f9f7e0d1f83be18f6c4a418da503e9021b24
meta: fix hour decoding when timezone offset is negative

Brian Davidson says:

 meta hour rules don't display properly after being created when the
 hour is on or after 00:00 UTC. The netlink debug looks correct for
 seconds past midnight UTC, but displaying the rules looks like an
 overflow or a byte order problem. I am in UTC-0400, so today, 20:00
 and later exhibits the problem, while 19:00 and earlier hours are
 fine.

meta.c only ever worked when the delta to UTC is positive.
We need to add in case the second counter turns negative after
offset adjustment.

Also add a test case for this.

Fixes: f8f32deda31d ("meta: Introduce new conditions 'time', 'day' and 'hour'")
Reported-by: Brian Davidson <davidson.brian@gmail.com>
Signed-off-by: Florian Westphal <fw@strlen.de>
src/meta.c
tests/shell/testcases/listing/dumps/meta_time.nodump [new file with mode: 0644]
tests/shell/testcases/listing/meta_time [new file with mode: 0755]