From 03c344530e5c94eb81a2c86a83ff5152c4c6e9dd Mon Sep 17 00:00:00 2001 From: eabdullin Date: Tue, 2 Apr 2024 17:20:20 +0000 Subject: [PATCH] import UBI nftables-1.0.4-4.el8_9 --- ...-for-broken-compatibility-with-older.patch | 86 +++++++++++++++++++ SPECS/nftables.spec | 6 +- 2 files changed, 91 insertions(+), 1 deletion(-) create mode 100644 SOURCES/0034-parser_bison-Fix-for-broken-compatibility-with-older.patch diff --git a/SOURCES/0034-parser_bison-Fix-for-broken-compatibility-with-older.patch b/SOURCES/0034-parser_bison-Fix-for-broken-compatibility-with-older.patch new file mode 100644 index 0000000..1b991b3 --- /dev/null +++ b/SOURCES/0034-parser_bison-Fix-for-broken-compatibility-with-older.patch @@ -0,0 +1,86 @@ +From fa2b3f20274f5e66b67e2c3d2b7d957b9200473e Mon Sep 17 00:00:00 2001 +From: Phil Sutter +Date: Wed, 15 Nov 2023 17:06:19 +0100 +Subject: [PATCH] parser_bison: Fix for broken compatibility with older dumps + +JIRA: https://issues.redhat.com/browse/RHEL-2596 +Upstream Status: nftables commit 22fab8681a50014174cdd02ace90f74b9e9eefe9 + +commit 22fab8681a50014174cdd02ace90f74b9e9eefe9 +Author: Phil Sutter +Date: Thu Oct 19 18:40:04 2023 +0200 + + parser_bison: Fix for broken compatibility with older dumps + + Commit e6d1d0d611958 ("src: add set element multi-statement + support") changed the order of expressions and other state attached to set + elements are expected in input. This broke parsing of ruleset dumps + created by nft commands prior to that commit. + + Restore compatibility by also accepting the old ordering. + + Fixes: e6d1d0d611958 ("src: add set element multi-statement support") + Signed-off-by: Phil Sutter + +Signed-off-by: Phil Sutter +--- + src/parser_bison.y | 6 ++++ + tests/shell/testcases/sets/elem_opts_compat_0 | 29 +++++++++++++++++++ + 2 files changed, 35 insertions(+) + create mode 100755 tests/shell/testcases/sets/elem_opts_compat_0 + +diff --git a/src/parser_bison.y b/src/parser_bison.y +index b548d5b..b882f3b 100644 +--- a/src/parser_bison.y ++++ b/src/parser_bison.y +@@ -4283,6 +4283,12 @@ meter_key_expr_alloc : concat_expr + + set_elem_expr : set_elem_expr_alloc + | set_elem_expr_alloc set_elem_expr_options ++ | set_elem_expr_alloc set_elem_expr_options set_elem_stmt_list ++ { ++ $$ = $1; ++ list_splice_tail($3, &$$->stmt_list); ++ xfree($3); ++ } + ; + + set_elem_key_expr : set_lhs_expr { $$ = $1; } +diff --git a/tests/shell/testcases/sets/elem_opts_compat_0 b/tests/shell/testcases/sets/elem_opts_compat_0 +new file mode 100755 +index 0000000..e012953 +--- /dev/null ++++ b/tests/shell/testcases/sets/elem_opts_compat_0 +@@ -0,0 +1,29 @@ ++#!/bin/sh ++ ++# ordering of element options and expressions has changed, make sure parser ++# accepts both ways ++ ++set -e ++ ++$NFT -f - < [1.0.4-4.el8] +- parser_bison: Fix for broken compatibility with older dumps (Phil Sutter) [RHEL-2596] + * Thu Sep 21 2023 Phil Sutter [1.0.4-3.el8] - spec: Rename variables to avoid a clash (Phil Sutter) [INTERNAL] - rule: check address family in set collapse (Phil Sutter) [RHEL-5160]