From c49a93f18e03c0935cb209dca14ce438b2d5f9be Mon Sep 17 00:00:00 2001 From: "Pablo M. Bermudo Garay" Date: Tue, 6 Jun 2017 00:08:28 +0200 Subject: xtables-translate: fix double space before comment When a comment translation immediately follows a counter statement, two spaces are printed between "counter" and "comment" keywords. The counter statement is almost always followed by a target, so we need to move the space following "counter" to the beginning of the target translation. Signed-off-by: Pablo M. Bermudo Garay Signed-off-by: Pablo Neira Ayuso --- iptables/xtables-translate.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'iptables/xtables-translate.c') diff --git a/iptables/xtables-translate.c b/iptables/xtables-translate.c index e049f24e..3e6c7051 100644 --- a/iptables/xtables-translate.c +++ b/iptables/xtables-translate.c @@ -60,12 +60,13 @@ int xlate_action(const struct iptables_command_state *cs, bool goto_set, if (cs->target != NULL) { /* Standard target? */ if (strcmp(cs->jumpto, XTC_LABEL_ACCEPT) == 0) - xt_xlate_add(xl, "accept"); + xt_xlate_add(xl, " accept"); else if (strcmp(cs->jumpto, XTC_LABEL_DROP) == 0) - xt_xlate_add(xl, "drop"); + xt_xlate_add(xl, " drop"); else if (strcmp(cs->jumpto, XTC_LABEL_RETURN) == 0) - xt_xlate_add(xl, "return"); + xt_xlate_add(xl, " return"); else if (cs->target->xlate) { + xt_xlate_add(xl, " "); struct xt_xlate_tg_params params = { .ip = (const void *)&cs->fw, .target = cs->target->t, @@ -79,9 +80,9 @@ int xlate_action(const struct iptables_command_state *cs, bool goto_set, } else if (strlen(cs->jumpto) > 0) { /* Not standard, then it's a go / jump to chain */ if (goto_set) - xt_xlate_add(xl, "goto %s", cs->jumpto); + xt_xlate_add(xl, " goto %s", cs->jumpto); else - xt_xlate_add(xl, "jump %s", cs->jumpto); + xt_xlate_add(xl, " jump %s", cs->jumpto); } return ret; -- cgit v1.2.3