All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: Daniel De Graaf <danield@iastate.edu>
Cc: Netfilter-Devel <netfilter-devel@lists.netfilter.org>
Subject: Re: [PATCH] remove unneeded ip6tables-save source/destination address output
Date: Sat, 02 Dec 2006 17:37:48 +0100	[thread overview]
Message-ID: <4571ABDC.3000409@trash.net> (raw)
In-Reply-To: <4570CDC4.2090205@iastate.edu>

[-- Attachment #1: Type: text/plain, Size: 793 bytes --]

Daniel De Graaf wrote:
> ip6tables-save outputs the source and destination IPs when it is not
> needed. This
> is caused by an incorrectly copied check from iptables-save. Example
> output:
> -A INPUT -s ::/0 -d ::/0 -i lo -j ACCEPT instead of just -A INPUT -i
> lo -j ACCEPT
> 
> This patch will not output the address if the mask length is zero.
> 
> - Daniel De Graaf
> 
> Index: ip6tables-save.c
> ===================================================================
> --- ip6tables-save.c    (revision 6699)
> +++ ip6tables-save.c    (working copy)
> @@ -125,7 +125,7 @@
>         char buf[51];
>         int l = ipv6_prefix_length(mask);
>  
> -       if (!mask && !ip)
> +       if (l == 0)

They both seem wrong since they ignore inversion (-s !0/0). I've
committed this patch instead.

[-- Attachment #2: x --]
[-- Type: text/plain, Size: 726 bytes --]

Index: iptables-save.c
===================================================================
--- iptables-save.c	(Revision 6698)
+++ iptables-save.c	(Arbeitskopie)
@@ -141,7 +141,7 @@
 /* print a given ip including mask if neccessary */
 static void print_ip(char *prefix, u_int32_t ip, u_int32_t mask, int invert)
 {
-	if (!mask && !ip)
+	if (!mask && !ip && !invert)
 		return;
 
 	printf("%s %s%u.%u.%u.%u",
Index: ip6tables-save.c
===================================================================
--- ip6tables-save.c	(Revision 6698)
+++ ip6tables-save.c	(Arbeitskopie)
@@ -125,7 +125,7 @@
 	char buf[51];
 	int l = ipv6_prefix_length(mask);
 
-	if (!mask && !ip)
+	if (l == 0 && !invert)
 		return;
 
 	printf("%s %s%s",

      reply	other threads:[~2006-12-02 16:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-02  0:50 [PATCH] remove unneeded ip6tables-save source/destination address output Daniel De Graaf
2006-12-02 16:37 ` Patrick McHardy [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4571ABDC.3000409@trash.net \
    --to=kaber@trash.net \
    --cc=danield@iastate.edu \
    --cc=netfilter-devel@lists.netfilter.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.