summaryrefslogtreecommitdiffstats
path: root/lib/ipset.c
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2021-06-25 22:30:41 +0200
committerJozsef Kadlecsik <kadlec@netfilter.org>2021-06-26 23:07:08 +0200
commitff7f000ef2dbe81444a4e204dbab9a2177c35e21 (patch)
tree4fcba44208210e16e25e946787edd065f083ce2e /lib/ipset.c
parent4dd0a5e5755ec058b78e3bd6da39fe2bb7bbb4f3 (diff)
lib: Detach restore routine from parser
Do not call restore() from ipset_parser(). Instead, ipset_parser() returns the IPSET_CMD_RESTORE command and the caller invokes restore(). This patch comes in preparation for the ipset to nftables translation infrastructure. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> Signed-off-by: Jozsef Kadlecsik <kadlec@netfilter.org>
Diffstat (limited to 'lib/ipset.c')
-rw-r--r--lib/ipset.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/ipset.c b/lib/ipset.c
index 3077f97..5232d8b 100644
--- a/lib/ipset.c
+++ b/lib/ipset.c
@@ -1231,7 +1231,7 @@ ipset_parser(struct ipset *ipset, int oargc, char *oargv[])
return ipset->custom_error(ipset,
p, IPSET_PARAMETER_PROBLEM,
"Unknown argument %s", argv[1]);
- return restore(ipset);
+ return IPSET_CMD_RESTORE;
case IPSET_CMD_ADD:
case IPSET_CMD_DEL:
case IPSET_CMD_TEST:
@@ -1296,6 +1296,9 @@ ipset_parse_argv(struct ipset *ipset, int oargc, char *oargv[])
if (cmd < 0)
return cmd;
+ if (cmd == IPSET_CMD_RESTORE)
+ return restore(ipset);
+
ret = ipset_cmd(session, cmd, ipset->restore_line);
D("ret %d", ret);
/* In the case of warning, the return code is success */