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

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