]> git.ipfire.org Git - thirdparty/ipset.git/commitdiff
The "Fix hex literals in json output" broke save mode, restore it
authorJozsef Kadlecsik <kadlec@netfilter.org>
Sat, 3 Feb 2024 20:49:48 +0000 (21:49 +0100)
committerJozsef Kadlecsik <kadlec@netfilter.org>
Sat, 3 Feb 2024 20:49:48 +0000 (21:49 +0100)
Signed-off-by: Jozsef Kadlecsik <kadlec@netfilter.org>
lib/session.c

index a856614d036cc90778e8c9304d7a943abeb91b59..f8222883e75eb4639d3c49bcb9a0498ad51d3a9c 100644 (file)
@@ -2284,7 +2284,8 @@ ipset_cmd(struct ipset_session *session, enum ipset_cmd cmd, uint32_t lineno)
        if (cmd == IPSET_CMD_LIST || cmd == IPSET_CMD_SAVE) {
                /* Set default output mode */
                if (session->mode == IPSET_LIST_NONE)
-                       session->mode = IPSET_LIST_PLAIN;
+                       session->mode = cmd == IPSET_CMD_LIST ?
+                               IPSET_LIST_PLAIN : IPSET_LIST_SAVE;
                /* Reset just in case there are multiple modes in a session */
                ipset_envopt_unset(session, IPSET_ENV_QUOTED);
                switch (session->mode) {