Blame SOURCES/0003-lib-Detach-restore-routine-from-parser.patch

e0f94f
From 5f8dc543a936f7f962165977cfb8e9e108659eb5 Mon Sep 17 00:00:00 2001
e0f94f
From: Pablo Neira Ayuso <pablo@netfilter.org>
e0f94f
Date: Fri, 25 Jun 2021 22:30:41 +0200
e0f94f
Subject: [PATCH] lib: Detach restore routine from parser
e0f94f
e0f94f
Do not call restore() from ipset_parser(). Instead, ipset_parser()
e0f94f
returns the IPSET_CMD_RESTORE command and the caller invokes restore().
e0f94f
e0f94f
This patch comes in preparation for the ipset to nftables translation
e0f94f
infrastructure.
e0f94f
e0f94f
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
e0f94f
Signed-off-by: Jozsef Kadlecsik <kadlec@netfilter.org>
e0f94f
(cherry picked from commit ff7f000ef2dbe81444a4e204dbab9a2177c35e21)
e0f94f
---
e0f94f
 lib/ipset.c | 5 ++++-
e0f94f
 1 file changed, 4 insertions(+), 1 deletion(-)
e0f94f
e0f94f
diff --git a/lib/ipset.c b/lib/ipset.c
e0f94f
index 3077f9793f841..5232d8b76c46f 100644
e0f94f
--- a/lib/ipset.c
e0f94f
+++ b/lib/ipset.c
e0f94f
@@ -1231,7 +1231,7 @@ ipset_parser(struct ipset *ipset, int oargc, char *oargv[])
e0f94f
 			return ipset->custom_error(ipset,
e0f94f
 				p, IPSET_PARAMETER_PROBLEM,
e0f94f
 				"Unknown argument %s", argv[1]);
e0f94f
-		return restore(ipset);
e0f94f
+		return IPSET_CMD_RESTORE;
e0f94f
 	case IPSET_CMD_ADD:
e0f94f
 	case IPSET_CMD_DEL:
e0f94f
 	case IPSET_CMD_TEST:
e0f94f
@@ -1296,6 +1296,9 @@ ipset_parse_argv(struct ipset *ipset, int oargc, char *oargv[])
e0f94f
 	if (cmd < 0)
e0f94f
 		return cmd;
e0f94f
 
e0f94f
+	if (cmd == IPSET_CMD_RESTORE)
e0f94f
+		return restore(ipset);
e0f94f
+
e0f94f
 	ret = ipset_cmd(session, cmd, ipset->restore_line);
e0f94f
 	D("ret %d", ret);
e0f94f
 	/* In the case of warning, the return code is success */
e0f94f
-- 
e0f94f
2.38.0
e0f94f