Linux Netfilter discussions
 help / color / mirror / Atom feed
* meta time rules display after 00:00 UTC
@ 2023-10-31 18:53 Brian Davidson
  2023-11-02 10:26 ` Florian Westphal
  0 siblings, 1 reply; 2+ messages in thread
From: Brian Davidson @ 2023-10-31 18:53 UTC (permalink / raw)
  To: netfilter

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.

nft add table ip t
nft add chain ip t c
nft add rule ip t c meta hour "19:00"-"19:59" counter
nft add rule ip t c meta hour "20:00"-"20:59" counter
nft list table ip t
table ip t {
        chain c {
                meta hour "19:00"-"19:59" counter packets 0 bytes 0
                meta hour "1193042:28:16"-"1193043:27:16" counter
packets 0 bytes 0
        }
}

# nft -d netlink -c add rule ip t c meta hour "20:00"-"20:59" counter
ip t c
  [ meta load hour => reg 1 ]
  [ byteorder reg 1 = hton(reg 1, 4, 4) ]
  [ cmp gte reg 1 0x00000000 ]
  [ cmp lte reg 1 0xd40d0000 ]
  [ counter pkts 0 bytes 0 ]

# date
Tue Oct 31 02:47:31 PM EDT 2023
# nft -v
nftables v1.0.6 (Lester Gooch #5)
# uname -a
Linux router 6.1.0-13-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.55-1
(2023-09-29) x86_64 GNU/Linux

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: meta time rules display after 00:00 UTC
  2023-10-31 18:53 meta time rules display after 00:00 UTC Brian Davidson
@ 2023-11-02 10:26 ` Florian Westphal
  0 siblings, 0 replies; 2+ messages in thread
From: Florian Westphal @ 2023-11-02 10:26 UTC (permalink / raw)
  To: Brian Davidson; +Cc: netfilter

Brian Davidson <davidson.brian@gmail.com> wrote:
> 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.
> 
> nft add table ip t
> nft add chain ip t c
> nft add rule ip t c meta hour "19:00"-"19:59" counter
> nft add rule ip t c meta hour "20:00"-"20:59" counter
> nft list table ip t
> table ip t {
>         chain c {
>                 meta hour "19:00"-"19:59" counter packets 0 bytes 0
>                 meta hour "1193042:28:16"-"1193043:27:16" counter

Right, existing code is broken for negative offsets.

I'll post a fix later today.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-11-02 10:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-31 18:53 meta time rules display after 00:00 UTC Brian Davidson
2023-11-02 10:26 ` Florian Westphal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox