]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
iptables: extensions: iptables-translate prints extra "nft" after printing any error
authorGuruswamy Basavaiah <guru2018@gmail.com>
Thu, 25 Feb 2016 19:04:50 +0000 (11:04 -0800)
committerPablo Neira Ayuso <pablo@netfilter.org>
Tue, 1 Mar 2016 17:49:14 +0000 (18:49 +0100)
 Output of command "./iptables-translate junk" is Bad argument
 `junk' Try `iptables-translate -h' or 'iptables-translate --help' for more
 information. nft

Output of command "./iptables-translate -B" is
iptables-translate v1.6.0: unknown option "-B"
Try `iptables-translate -h' or 'iptables-translate --help' for more
information.
nft

nft should have not been printed in both the cases. Moving the printf
call after the do_parse function call

Signed-off-by: Guruswamy Basavaiah <guru2018@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
iptables/xtables-translate.c

index 9e2c6aeb9f404cd22a29eb1c089921212d3c86ab..3c5b5775be1bbcaf5e8139f7753546be369492b9 100644 (file)
@@ -191,6 +191,7 @@ static int do_command_xlate(struct nft_handle *h, int argc, char *argv[],
 
        do_parse(h, argc, argv, &p, &cs, &args);
 
+       printf("nft ");
        switch (p.command) {
        case CMD_APPEND:
                ret = 1;
@@ -359,7 +360,6 @@ static int xtables_xlate_main(int family, const char *progname, int argc,
                exit(EXIT_FAILURE);
        }
 
-       printf("nft ");
        ret = do_command_xlate(&h, argc, argv, &table, false);
        if (!ret)
                fprintf(stderr, "Translation not implemented\n");