netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* RFC: removing meta keyword
@ 2014-01-15  6:46 Patrick McHardy
  0 siblings, 0 replies; only message in thread
From: Patrick McHardy @ 2014-01-15  6:46 UTC (permalink / raw)
  To: pablo; +Cc: netfilter-devel

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

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2014-01-15  6:46 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-15  6:46 RFC: removing meta keyword Patrick McHardy

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).