From mboxrd@z Thu Jan 1 00:00:00 1970 From: Phil Oester Subject: [RFC][PATCH] nftables: add slash to chain syntax Date: Sat, 30 Nov 2013 15:20:23 -0800 Message-ID: <20131130232022.GA23206@home> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii To: netfilter-devel@vger.kernel.org Return-path: Received: from mail-pd0-f180.google.com ([209.85.192.180]:53937 "EHLO mail-pd0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751196Ab3K3XUX (ORCPT ); Sat, 30 Nov 2013 18:20:23 -0500 Received: by mail-pd0-f180.google.com with SMTP id q10so15659584pdj.39 for ; Sat, 30 Nov 2013 15:20:23 -0800 (PST) Received: from home (cpe-98-154-84-14.socal.res.rr.com. [98.154.84.14]) by mx.google.com with ESMTPSA id tu6sm111604259pbc.41.2013.11.30.15.20.21 for (version=TLSv1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 30 Nov 2013 15:20:22 -0800 (PST) Content-Disposition: inline Sender: netfilter-devel-owner@vger.kernel.org List-ID: 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 / 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 From mboxrd@z Thu Jan 1 00:00:00 1970 From: Phil Oester Subject: Re: [RFC][PATCH] nftables: add slash to chain syntax Date: Sat, 30 Nov 2013 15:22:48 -0800 Message-ID: <20131130232248.GA23209@home> References: <20131130232022.GA23206@home> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="IS0zKkzwUGydFO0o" To: netfilter-devel@vger.kernel.org Return-path: Received: from mail-pb0-f43.google.com ([209.85.160.43]:47903 "EHLO mail-pb0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751196Ab3K3XWv (ORCPT ); Sat, 30 Nov 2013 18:22:51 -0500 Received: by mail-pb0-f43.google.com with SMTP id rq2so16449543pbb.16 for ; Sat, 30 Nov 2013 15:22:51 -0800 (PST) Received: from home (cpe-98-154-84-14.socal.res.rr.com. [98.154.84.14]) by mx.google.com with ESMTPSA id xn12sm76990913pac.12.2013.11.30.15.22.49 for (version=TLSv1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 30 Nov 2013 15:22:50 -0800 (PST) Content-Disposition: inline In-Reply-To: <20131130232022.GA23206@home> Sender: netfilter-devel-owner@vger.kernel.org List-ID: --IS0zKkzwUGydFO0o Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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
/ 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 --IS0zKkzwUGydFO0o Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=patch-nft-slash_chain 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 \/ --IS0zKkzwUGydFO0o-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: Pablo Neira Ayuso Subject: Re: [RFC][PATCH] nftables: add slash to chain syntax Date: Wed, 4 Dec 2013 15:05:47 +0100 Message-ID: <20131204140547.GA9643@localhost> References: <20131130232022.GA23206@home> <20131130232248.GA23209@home> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: netfilter-devel@vger.kernel.org To: Phil Oester Return-path: Received: from mail.us.es ([193.147.175.20]:35394 "EHLO mail.us.es" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755768Ab3LDOFv (ORCPT ); Wed, 4 Dec 2013 09:05:51 -0500 Content-Disposition: inline In-Reply-To: <20131130232248.GA23209@home> Sender: netfilter-devel-owner@vger.kernel.org List-ID: On Sat, Nov 30, 2013 at 03:22:48PM -0800, Phil Oester wrote: > > > 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
/ Frankly, I prefer to leave the syntax as is in that regard. But there are a couple of syntax aspect that would be worth discussing before this is set in stone, eg. the `=>' in verdict maps. The > symbol in the bash shell, if not escaped, results in a redirection. We could replace it by ':', so the maps will look like: add rule ip filter OUTPUT tcp dport vmap { \ 22 : jump chain1, \ 23 : jump chain2, \ } Just in case we consider it worth to make it easier to run nft commands from the bash shell. From mboxrd@z Thu Jan 1 00:00:00 1970 From: Arturo Borrero Gonzalez Subject: Re: [RFC][PATCH] nftables: add slash to chain syntax Date: Wed, 4 Dec 2013 16:16:21 +0100 Message-ID: References: <20131130232022.GA23206@home> <20131130232248.GA23209@home> <20131204140547.GA9643@localhost> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: Phil Oester , Netfilter Development Mailing list To: Pablo Neira Ayuso Return-path: Received: from mail-lb0-f169.google.com ([209.85.217.169]:61461 "EHLO mail-lb0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932254Ab3LDPQn convert rfc822-to-8bit (ORCPT ); Wed, 4 Dec 2013 10:16:43 -0500 Received: by mail-lb0-f169.google.com with SMTP id y6so9445793lbh.14 for ; Wed, 04 Dec 2013 07:16:41 -0800 (PST) In-Reply-To: <20131204140547.GA9643@localhost> Sender: netfilter-devel-owner@vger.kernel.org List-ID: On 4 December 2013 15:05, Pablo Neira Ayuso wrote= : > The > symbol in the bash shell, if not escaped, results in a > redirection. We could replace it by ':', so the maps will look like: > > add rule ip filter OUTPUT tcp dport vmap { \ > 22 : jump chain1, \ > 23 : jump chain2, \ > } > > Just in case we consider it worth to make it easier to run nft > commands from the bash shell. I totally like this approach. Why not to ease the life of bash users? I guess they are many :-) --=20 Arturo Borrero Gonz=E1lez -- To unsubscribe from this list: send the line "unsubscribe netfilter-dev= el" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html