Blame SOURCES/0015-Deprecate-add-insert-rule-position-argument.patch

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