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

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