* [iptables PATCH] xtables-translate: don't fail if help was requested
@ 2020-06-16 9:33 Arturo Borrero Gonzalez
2020-06-16 11:05 ` Phil Sutter
0 siblings, 1 reply; 3+ messages in thread
From: Arturo Borrero Gonzalez @ 2020-06-16 9:33 UTC (permalink / raw)
To: netfilter-devel
If the user called `iptables-translate -h` then we have CMD_NONE and we should gracefully handle
this case in do_command_xlate().
Before this patch, you would see:
user@debian:~$ sudo iptables-translate -h
[..]
nft Unsupported command?
user@debian:~$ echo $?
1
After this patch:
user@debian:~$ sudo iptables-translate -h
[..]
user@debian:~$ echo $?
0
Fixes: d4409d449c10fa ("nft: Don't exit early after printing help texts")
Signed-off-by: Arturo Borrero Gonzalez <arturo@netfilter.org>
---
iptables/xtables-translate.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/iptables/xtables-translate.c b/iptables/xtables-translate.c
index 5aa42496..363c8be1 100644
--- a/iptables/xtables-translate.c
+++ b/iptables/xtables-translate.c
@@ -249,7 +249,7 @@ static int do_command_xlate(struct nft_handle *h, int argc, char *argv[],
cs.restore = restore;
- if (!restore)
+ if (!restore && p.command != CMD_NONE)
printf("nft ");
switch (p.command) {
@@ -310,6 +310,9 @@ static int do_command_xlate(struct nft_handle *h, int argc, char *argv[],
break;
case CMD_SET_POLICY:
break;
+ case CMD_NONE:
+ ret = 1;
+ break;
default:
/* We should never reach this... */
printf("Unsupported command?\n");
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [iptables PATCH] xtables-translate: don't fail if help was requested
2020-06-16 9:33 [iptables PATCH] xtables-translate: don't fail if help was requested Arturo Borrero Gonzalez
@ 2020-06-16 11:05 ` Phil Sutter
2020-06-16 12:52 ` Arturo Borrero Gonzalez
0 siblings, 1 reply; 3+ messages in thread
From: Phil Sutter @ 2020-06-16 11:05 UTC (permalink / raw)
To: Arturo Borrero Gonzalez; +Cc: netfilter-devel
Hi Arturo,
On Tue, Jun 16, 2020 at 11:33:39AM +0200, Arturo Borrero Gonzalez wrote:
> If the user called `iptables-translate -h` then we have CMD_NONE and we should gracefully handle
> this case in do_command_xlate().
>
> Before this patch, you would see:
>
> user@debian:~$ sudo iptables-translate -h
> [..]
> nft Unsupported command?
> user@debian:~$ echo $?
> 1
>
> After this patch:
>
> user@debian:~$ sudo iptables-translate -h
> [..]
> user@debian:~$ echo $?
> 0
Apparently I forgot to test xtables-restore after changing help
functions, thanks for fixing this up.
> Fixes: d4409d449c10fa ("nft: Don't exit early after printing help texts")
> Signed-off-by: Arturo Borrero Gonzalez <arturo@netfilter.org>
Acked-by: Phil Sutter <phil@nwl.cc>
Thanks, Phil
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [iptables PATCH] xtables-translate: don't fail if help was requested
2020-06-16 11:05 ` Phil Sutter
@ 2020-06-16 12:52 ` Arturo Borrero Gonzalez
0 siblings, 0 replies; 3+ messages in thread
From: Arturo Borrero Gonzalez @ 2020-06-16 12:52 UTC (permalink / raw)
To: Phil Sutter, netfilter-devel
On 2020-06-16 13:05, Phil Sutter wrote:
> Acked-by: Phil Sutter <phil@nwl.cc>
>
> Thanks, Phil
Thanks,
pushed to master.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-06-16 12:52 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-16 9:33 [iptables PATCH] xtables-translate: don't fail if help was requested Arturo Borrero Gonzalez
2020-06-16 11:05 ` Phil Sutter
2020-06-16 12:52 ` Arturo Borrero Gonzalez
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.