Patchwork libxt_tcp: print space before, not after "flags:"

login
register
mail settings
Submitter Andreas Schwab
Date Aug. 20, 2012, 4:52 p.m.
Message ID <m2k3wt4iaz.fsf@igel.home>
Download mbox | patch
Permalink /patch/178893/
State Accepted
Headers show

Comments

Andreas Schwab - Aug. 20, 2012, 4:52 p.m.
Signed-off-by: Andreas Schwab <schwab@linux-m68k.org>
---
 extensions/libxt_tcp.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
Pablo Neira - Aug. 21, 2012, 10:37 a.m.
On Mon, Aug 20, 2012 at 06:52:36PM +0200, Andreas Schwab wrote:
> Signed-off-by: Andreas Schwab <schwab@linux-m68k.org>
> ---
>  extensions/libxt_tcp.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/extensions/libxt_tcp.c b/extensions/libxt_tcp.c
> index e849fa2..bbdec45 100644
> --- a/extensions/libxt_tcp.c
> +++ b/extensions/libxt_tcp.c
> @@ -278,11 +278,10 @@ static void
>  print_flags(uint8_t mask, uint8_t cmp, int invert, int numeric)
>  {
>  	if (mask || invert) {
> -		printf("flags:%s", invert ? "!" : "");
> +		printf(" flags:%s", invert ? "!" : "");
>  		if (numeric)
> -			printf(" 0x%02X/0x%02X", mask, cmp);
> +			printf("0x%02X/0x%02X", mask, cmp);
>  		else {
> -			printf(" ");
>  			print_tcpf(mask);
>  			printf("/");
>  			print_tcpf(cmp);

Right, iptables -L -n is broken indeed:

tcp dpt:10flags: 0x17/0x02

Applied, thanks.
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/extensions/libxt_tcp.c b/extensions/libxt_tcp.c
index e849fa2..bbdec45 100644
--- a/extensions/libxt_tcp.c
+++ b/extensions/libxt_tcp.c
@@ -278,11 +278,10 @@  static void
 print_flags(uint8_t mask, uint8_t cmp, int invert, int numeric)
 {
 	if (mask || invert) {
-		printf("flags:%s", invert ? "!" : "");
+		printf(" flags:%s", invert ? "!" : "");
 		if (numeric)
-			printf(" 0x%02X/0x%02X", mask, cmp);
+			printf("0x%02X/0x%02X", mask, cmp);
 		else {
-			printf(" ");
 			print_tcpf(mask);
 			printf("/");
 			print_tcpf(cmp);