netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ander Juaristi <a@juaristi.eus>
To: netfilter-devel@vger.kernel.org
Subject: [PATCH libnftnl v2 1/2] expr: meta: Make NFT_META_TIME_{NS,DAY,HOUR} known
Date: Sat, 17 Aug 2019 13:32:47 +0200	[thread overview]
Message-ID: <20190817113248.9832-1-a@juaristi.eus> (raw)

Signed-off-by: Ander Juaristi <a@juaristi.eus>
---
 include/linux/netfilter/nf_tables.h | 6 ++++++
 src/expr/meta.c                     | 5 ++++-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/include/linux/netfilter/nf_tables.h b/include/linux/netfilter/nf_tables.h
index 03fd1b7..0222d08 100644
--- a/include/linux/netfilter/nf_tables.h
+++ b/include/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)
+ * @NFT_META_TIME_HOUR: hour of day (in seconds)
  */
 enum nft_meta_keys {
 	NFT_META_LEN,
@@ -831,6 +834,9 @@ enum nft_meta_keys {
 	NFT_META_OIFKIND,
 	NFT_META_BRI_IIFPVID,
 	NFT_META_BRI_IIFVPROTO,
+	NFT_META_TIME_NS,
+	NFT_META_TIME_DAY,
+	NFT_META_TIME_HOUR,
 };
 
 /**
diff --git a/src/expr/meta.c b/src/expr/meta.c
index 73f6efa..9790198 100644
--- a/src/expr/meta.c
+++ b/src/expr/meta.c
@@ -22,7 +22,7 @@
 #include <libnftnl/rule.h>
 
 #ifndef NFT_META_MAX
-#define NFT_META_MAX (NFT_META_BRI_IIFVPROTO + 1)
+#define NFT_META_MAX (NFT_META_TIME_HOUR + 1)
 #endif
 
 struct nftnl_expr_meta {
@@ -163,6 +163,9 @@ static const char *meta_key2str_array[NFT_META_MAX] = {
 	[NFT_META_OIFKIND]	= "oifkind",
 	[NFT_META_BRI_IIFPVID]	 = "bri_iifpvid",
 	[NFT_META_BRI_IIFVPROTO] = "bri_iifvproto",
+	[NFT_META_TIME_NS]	= "time",
+	[NFT_META_TIME_DAY]	= "day",
+	[NFT_META_TIME_HOUR]	= "hour",
 };
 
 static const char *meta_key2str(uint8_t key)
-- 
2.17.1


             reply	other threads:[~2019-08-17 11:32 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-17 11:32 Ander Juaristi [this message]
2019-08-17 11:32 ` [PATCH libnftnl v2 2/2] expr: meta: Make NFT_DYNSET_OP_DELETE known Ander Juaristi
2019-08-27 16:09   ` Pablo Neira Ayuso
2019-08-27 12:11 ` [PATCH libnftnl v2 1/2] expr: meta: Make NFT_META_TIME_{NS,DAY,HOUR} known 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=20190817113248.9832-1-a@juaristi.eus \
    --to=a@juaristi.eus \
    --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).