The naming of the new meta keys seem a bit confusing. On Sat, Aug 17, 2019 at 1:19 PM Ander Juaristi <a@xxxxxxxxxxxx> wrote: > > This patch introduces meta matches in the kernel for time (a UNIX timestamp), > day (a day of week, represented as an integer between 0-6), and > hour (an hour in the current day, or: number of seconds since midnight). > > All values are taken as unsigned 64-bit integers. > > The 'time' keyword is internally converted to nanoseconds by nft in > userspace, and hence the timestamp is taken in nanoseconds as well. > > Signed-off-by: Ander Juaristi <a@xxxxxxxxxxxx> > --- > include/uapi/linux/netfilter/nf_tables.h | 6 ++++ > net/netfilter/nft_meta.c | 46 ++++++++++++++++++++++++ > 2 files changed, 52 insertions(+) > > 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. > + * @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. > */ > enum nft_meta_keys { > NFT_META_LEN, ...