netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Phil Oester <kernel@linuxace.com>
To: netfilter-devel@vger.kernel.org
Subject: Re: [RFC][PATCH] nftables: add slash to chain syntax
Date: Sat, 30 Nov 2013 15:22:48 -0800	[thread overview]
Message-ID: <20131130232248.GA23209@home> (raw)
In-Reply-To: <20131130232022.GA23206@home>

[-- Attachment #1: Type: text/plain, Size: 709 bytes --]

<v2: attach the patch this time...>

The current syntax when handling chains seems counterintuitive to me.  I would
expect that "add chain" would have the name of the chain directly after the
keyword "chain".  But instead, the name of the table is there, with the chain
after.  I think a better syntax might be this:

        add chain <table>/<chain>

which seems clearer to me.  And it has the added benefit of following the
"everything is a file" paradigm.  Who knows - maybe someday we can add a sysfs
interface for nftables, and this will fit nicely within a tree:

        nftables
          tables
            chains
              rules

Thoughts?  Attached patch is a general proof of concept.

Phil


[-- Attachment #2: patch-nft-slash_chain --]
[-- Type: text/plain, Size: 706 bytes --]

diff --git a/src/parser.y b/src/parser.y
index a49e5c2..5f6fed0 100644
--- a/src/parser.y
+++ b/src/parser.y
@@ -833,10 +833,10 @@ tables_spec		:	family_spec
 			}
 			;
 
-chain_spec		:	table_spec	identifier
+chain_spec		:	table_spec	SLASH	identifier
 			{
 				$$		= $1;
-				$$.chain	= $2;
+				$$.chain	= $3;
 			}
 			;
 
diff --git a/src/scanner.l b/src/scanner.l
index cee6aa6..ba1dcdf 100644
--- a/src/scanner.l
+++ b/src/scanner.l
@@ -111,7 +111,7 @@ decstring	{digit}+
 hexstring	0[xX]{hexdigit}+
 range		({decstring}?:{decstring}?)
 letter		[a-zA-Z]
-string		({letter})({letter}|{digit}|[/\-_\.])*
+string		({letter})({letter}|{digit}|[\-_\.])*
 quotedstring	\"[^"]*\"
 comment		#.*$
 slash		\/

  reply	other threads:[~2013-11-30 23:22 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-30 23:20 [RFC][PATCH] nftables: add slash to chain syntax Phil Oester
2013-11-30 23:22 ` Phil Oester [this message]
2013-12-04 14:05   ` Pablo Neira Ayuso
2013-12-04 15:16     ` Arturo Borrero Gonzalez

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=20131130232248.GA23209@home \
    --to=kernel@linuxace.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).