From 197711f42a7580918c99536ff891eef7dd040c6b Mon Sep 17 00:00:00 2001
From: Phil Sutter <psutter@redhat.com>
Date: Wed, 20 Jun 2018 09:37:57 +0200
Subject: [PATCH] Deprecate add/insert rule 'position' argument
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1571968
Upstream Status: nftables commit effb881c9cef2
Conflicts: Context change due to missing commit f9cb9580b924f
("doc: nft.8 aim for consistent synopses throughout")
commit effb881c9cef28aca47adeec5014e0457507539e
Author: Phil Sutter <phil@nwl.cc>
Date: Wed May 9 16:03:40 2018 +0200
Deprecate add/insert rule 'position' argument
Instead, use 'handle' keyword for the same effect since that is more
consistent with respect to replace/delete commands. The old keyword is
still supported for backwards compatibility and also listed in man page
along with a hint that it shouldn't be used anymore.
Signed-off-by: Phil Sutter <phil@nwl.cc>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
doc/nft.xml | 17 +++++++++++++----
src/parser_bison.y | 8 ++++++++
2 files changed, 21 insertions(+), 4 deletions(-)
diff --git a/doc/nft.xml b/doc/nft.xml
index 45a392f..e6cfb78 100644
--- a/doc/nft.xml
+++ b/doc/nft.xml
@@ -835,7 +835,13 @@ filter input iif $int_ifs accept
<arg choice="opt"><replaceable>family</replaceable></arg>
<arg choice="req"><replaceable>table</replaceable></arg>
<arg choice="req"><replaceable>chain</replaceable></arg>
- <arg choice="opt">position <replaceable>handle</replaceable></arg>
+ <arg choice="opt">
+ <group choice="req">
+ <arg>handle</arg>
+ <arg>position</arg>
+ </group>
+ <replaceable>handle</replaceable>
+ </arg>
<arg choice="req" rep="repeat"><replaceable>statement</replaceable></arg>
</cmdsynopsis>
<cmdsynopsis>
@@ -867,8 +873,10 @@ filter input iif $int_ifs accept
<listitem>
<para>
Add a new rule described by the list of statements. The rule is appended to the
- given chain unless a position is specified, in which case the rule is appended to
- the rule given by the handle.
+ given chain unless a <literal>handle</literal> is specified, in which case the
+ rule is appended to the rule given by the <replaceable>handle</replaceable>.
+ The alternative name <literal>position</literal> is deprecated and should not be
+ used anymore.
</para>
</listitem>
</varlistentry>
@@ -877,7 +885,8 @@ filter input iif $int_ifs accept
<listitem>
<para>
Similar to the <command>add</command> command, but the rule is prepended to the
- beginning of the chain or before the rule with the given handle.
+ beginning of the chain or before the rule with the given
+ <replaceable>handle</replaceable>.
</para>
</listitem>
</varlistentry>
diff --git a/src/parser_bison.y b/src/parser_bison.y
index 7016f5b..f9878ba 100644
--- a/src/parser_bison.y
+++ b/src/parser_bison.y
@@ -1708,6 +1708,14 @@ rule_position : chain_spec
handle_merge(&$1, &$2);
$$ = $1;
}
+ | chain_spec handle_spec
+ {
+ $2.position.location = $2.handle.location;
+ $2.position.id = $2.handle.id;
+ $2.handle.id = 0;
+ handle_merge(&$1, &$2);
+ $$ = $1;
+ }
;
ruleid_spec : chain_spec handle_spec
--
1.8.3.1