netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: pablo@netfilter.org
Cc: netfilter-devel@vger.kernel.org
Subject: RFC: removing meta keyword
Date: Wed, 15 Jan 2014 06:46:02 +0000	[thread overview]
Message-ID: <20140115064602.GA12074@macbook.localnet> (raw)

One thing I wanted to discuss before the next nftables release is removal
of the meta keyword for some cases. It is only required by the grammar for
the length key to avoid a conflict with the UDP length keyword.

It seems more natural to express

filter output meta iifname eth0

as

filter output iifname eth0

To avoid potential new conflicts in the future with header fields, I'd
propose to not require it only for a subset of keys, specifically
mark, iif, oif, iifname, oifname, skuid, skgid, nftrace, secmark and
rtclassid.

nfproto and l4proto could be added but are mainly intended for internal
use, protocol and priority have to much risk of conflicts.

The same thing could also be done with a couple of ct expression keys.

The attached patch demonstrates the change to the grammar, the printing
functions would of course also need adjustment.

Any opinions?


diff --git a/src/parser.y b/src/parser.y
index 7c18875..ff4968b 100644
--- a/src/parser.y
+++ b/src/parser.y
@@ -464,7 +464,7 @@ static void location_update(struct location *loc, struct location *rhs, int n)
 
 %type <expr>			meta_expr
 %destructor { expr_free($$); }	meta_expr
-%type <val>			meta_key
+%type <val>			meta_key	meta_key1	meta_key2
 
 %type <expr>			ct_expr
 %destructor { expr_free($$); }	ct_expr
@@ -1375,14 +1375,24 @@ meta_expr		:	META	meta_key
 			{
 				$$ = meta_expr_alloc(&@$, $2);
 			}
+			|	meta_key2
+			{
+				$$ = meta_expr_alloc(&@$, $1);
+			}
+			;
+
+meta_key		:	meta_key1
+			|	meta_key2
 			;
 
-meta_key		:	LENGTH		{ $$ = NFT_META_LEN; }
+meta_key1		:	LENGTH		{ $$ = NFT_META_LEN; }
 			|	NFPROTO		{ $$ = NFT_META_NFPROTO; }
 			|	L4PROTO		{ $$ = NFT_META_L4PROTO; }
 			|	PROTOCOL	{ $$ = NFT_META_PROTOCOL; }
 			|	PRIORITY	{ $$ = NFT_META_PRIORITY; }
-			|	MARK		{ $$ = NFT_META_MARK; }
+			;
+
+meta_key2		:	MARK		{ $$ = NFT_META_MARK; }
 			|	IIF		{ $$ = NFT_META_IIF; }
 			|	IIFNAME		{ $$ = NFT_META_IIFNAME; }
 			|	IIFTYPE		{ $$ = NFT_META_IIFTYPE; }
@@ -1400,6 +1410,10 @@ meta_stmt		:	META	meta_key	SET	expr
 			{
 				$$ = meta_stmt_alloc(&@$, $2, $4);
 			}
+			|	meta_key2	SET	expr
+			{
+				$$ = meta_stmt_alloc(&@$, $1, $3);
+			}
 			;
 
 ct_expr			:	CT	ct_key

                 reply	other threads:[~2014-01-15  6:46 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20140115064602.GA12074@macbook.localnet \
    --to=kaber@trash.net \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.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).