From 73866357e4a7a0fdc1b293bf8863fee2bd56da9e Mon Sep 17 00:00:00 2001 From: Jan Engelhardt Date: Sat, 18 Dec 2010 02:04:59 +0100 Subject: iptables: do not print trailing whitespaces Due to the use of printf("foobar "), iptables emits spaces at the end-of-line, which looks odd to some users because it causes the terminal to wrap even if there is seemingly nothing to print. It may also have other points of annoyance, such as mailers interpreting a trailing space as an indicator that the paragraph continues when format=flowed is also on. And git highlights trailing spaces in red, so let's avoid :) Preexisting inconsistencies in outputting spaces in the right spot are also addressed right away. References: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=429579 Signed-off-by: Jan Engelhardt --- extensions/libxt_TPROXY.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'extensions/libxt_TPROXY.c') diff --git a/extensions/libxt_TPROXY.c b/extensions/libxt_TPROXY.c index 26419f5d..890dd866 100644 --- a/extensions/libxt_TPROXY.c +++ b/extensions/libxt_TPROXY.c @@ -169,7 +169,7 @@ static void tproxy_tg_print(const void *ip, const struct xt_entry_target *target int numeric) { const struct xt_tproxy_target_info *info = (const void *)target->data; - printf("TPROXY redirect %s:%u mark 0x%x/0x%x", + printf(" TPROXY redirect %s:%u mark 0x%x/0x%x", xtables_ipaddr_to_numeric((const struct in_addr *)&info->laddr), ntohs(info->lport), (unsigned int)info->mark_value, (unsigned int)info->mark_mask); @@ -182,7 +182,7 @@ tproxy_tg_print4(const void *ip, const struct xt_entry_target *target, const struct xt_tproxy_target_info_v1 *info = (const void *)target->data; - printf("TPROXY redirect %s:%u mark 0x%x/0x%x", + printf(" TPROXY redirect %s:%u mark 0x%x/0x%x", xtables_ipaddr_to_numeric(&info->laddr.in), ntohs(info->lport), (unsigned int)info->mark_value, (unsigned int)info->mark_mask); @@ -195,7 +195,7 @@ tproxy_tg_print6(const void *ip, const struct xt_entry_target *target, const struct xt_tproxy_target_info_v1 *info = (const void *)target->data; - printf("TPROXY redirect %s:%u mark 0x%x/0x%x", + printf(" TPROXY redirect %s:%u mark 0x%x/0x%x", xtables_ip6addr_to_numeric(&info->laddr.in6), ntohs(info->lport), (unsigned int)info->mark_value, (unsigned int)info->mark_mask); @@ -205,10 +205,10 @@ static void tproxy_tg_save(const void *ip, const struct xt_entry_target *target) { const struct xt_tproxy_target_info *info = (const void *)target->data; - printf("--on-port %u ", ntohs(info->lport)); - printf("--on-ip %s ", + printf(" --on-port %u", ntohs(info->lport)); + printf(" --on-ip %s", xtables_ipaddr_to_numeric((const struct in_addr *)&info->laddr)); - printf("--tproxy-mark 0x%x/0x%x ", + printf(" --tproxy-mark 0x%x/0x%x", (unsigned int)info->mark_value, (unsigned int)info->mark_mask); } @@ -218,9 +218,9 @@ tproxy_tg_save4(const void *ip, const struct xt_entry_target *target) const struct xt_tproxy_target_info_v1 *info; info = (const void *)target->data; - printf("--on-port %u ", ntohs(info->lport)); - printf("--on-ip %s ", xtables_ipaddr_to_numeric(&info->laddr.in)); - printf("--tproxy-mark 0x%x/0x%x ", + printf(" --on-port %u", ntohs(info->lport)); + printf(" --on-ip %s", xtables_ipaddr_to_numeric(&info->laddr.in)); + printf(" --tproxy-mark 0x%x/0x%x", (unsigned int)info->mark_value, (unsigned int)info->mark_mask); } @@ -230,9 +230,9 @@ tproxy_tg_save6(const void *ip, const struct xt_entry_target *target) const struct xt_tproxy_target_info_v1 *info; info = (const void *)target->data; - printf("--on-port %u ", ntohs(info->lport)); - printf("--on-ip %s ", xtables_ip6addr_to_numeric(&info->laddr.in6)); - printf("--tproxy-mark 0x%x/0x%x ", + printf(" --on-port %u", ntohs(info->lport)); + printf(" --on-ip %s", xtables_ip6addr_to_numeric(&info->laddr.in6)); + printf(" --tproxy-mark 0x%x/0x%x", (unsigned int)info->mark_value, (unsigned int)info->mark_mask); } -- cgit v1.2.3