netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Florian Westphal <fw@strlen.de>
To: Jones Desougi <jones.desougi+netfilter@gmail.com>
Cc: Ander Juaristi <a@juaristi.eus>, netfilter-devel@vger.kernel.org
Subject: Re: [PATCH v5 2/2] netfilter: nft_meta: support for time matching
Date: Tue, 20 Aug 2019 21:27:35 +0200	[thread overview]
Message-ID: <20190820192735.GW2588@breakpoint.cc> (raw)
In-Reply-To: <CAGdUbJE_ZF3Sa6WMfo_j9JRME9mZteKsGgws31c0i+ASPza=8Q@mail.gmail.com>

Jones Desougi <jones.desougi+netfilter@gmail.com> wrote:
> On Sun, Aug 18, 2019 at 8:22 PM Ander Juaristi <a@juaristi.eus> wrote:
> >
> > On 17/8/19 15:43, Jones Desougi wrote:
> > >> diff --git a/include/uapi/linux/netfilter/nf_tables.h b/include/uapi/linux/netfilter/nf_tables.h
> > >> index 82abaa183fc3..b83b62eb4b01 100644
> > >> --- a/include/uapi/linux/netfilter/nf_tables.h
> > >> +++ b/include/uapi/linux/netfilter/nf_tables.h
> > >> @@ -799,6 +799,9 @@ enum nft_exthdr_attributes {
> > >>   * @NFT_META_OIFKIND: packet output interface kind name (dev->rtnl_link_ops->kind)
> > >>   * @NFT_META_BRI_IIFPVID: packet input bridge port pvid
> > >>   * @NFT_META_BRI_IIFVPROTO: packet input bridge vlan proto
> > >> + * @NFT_META_TIME_NS: time since epoch (in nanoseconds)
> > >> + * @NFT_META_TIME_DAY: day of week (from 0 = Sunday to 6 = Saturday)
> > >
> > > This would be clearer as NFT_META_TIME_WEEKDAY. Just day can mean a
> > > lot of things.
> > > Matches nicely with the added nft_meta_weekday function too.
> >
> > I agree with you here. Seems to me WEEKDAY is clearer.
> >
> > >
> > >> + * @NFT_META_TIME_HOUR: hour of day (in seconds)
> > >
> > > This isn't really an hour, so why call it that (confuses unit at least)?
> > > Something like NFT_META_TIME_TIMEOFDAY? Alternatively TIMEINDAY.
> > > Presumably the added nft_meta_hour function also derives its name from
> > > this, but otherwise has nothing to do with hours.
> > >
> >
> > But not so sure on this one. TIMEOFDAY sounds to me equivalent to HOUR,
> > though less explicit (more ambiguous).
> 
> HOUR is a unit, much like NS, but its use is quite different with no
> clear hint as to how. Unlike the latter it's also not the unit of the
> value. From that perspective the name comes up empty of meaning. If
> you already know what it means, the name can be put in context, but
> that's not explicit at all.

If the NFT_META_TIME_* names are off, then those for the
frontend are too.

I think
meta time <iso-date>
meta hour <relative to this day>
meta day <weekday>

are fine, and thus so are the uapi enums.

Examples:

meta time < "2019-06-06 17:20:20" drop
meta hour 11:00-17:00 accept
meta day "Sat" drop

What would you suggest as alternatives?

  reply	other threads:[~2019-08-20 19:27 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-17 11:17 [PATCH v5 1/2] netfilter: Introduce new 64-bit helper functions Ander Juaristi
2019-08-17 11:17 ` [PATCH v5 2/2] netfilter: nft_meta: support for time matching Ander Juaristi
2019-08-17 13:43   ` Jones Desougi
2019-08-18 18:22     ` Ander Juaristi
2019-08-19 14:08       ` Jones Desougi
2019-08-20 19:27         ` Florian Westphal [this message]
2019-08-28 11:15           ` Jones Desougi
2019-08-26  9:28   ` Pablo Neira Ayuso
2019-08-26  9:28 ` [PATCH v5 1/2] netfilter: Introduce new 64-bit helper functions Pablo Neira Ayuso

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190820192735.GW2588@breakpoint.cc \
    --to=fw@strlen.de \
    --cc=a@juaristi.eus \
    --cc=jones.desougi+netfilter@gmail.com \
    --cc=netfilter-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).