remove unneeded ip6tables-save source/destination address output
PATCH 1/1 remove unneeded ip6tables-save source/destination address output
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
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)
return;
printf("%s %s%s",-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFFcM3DZz9quLVV3/MRAuYSAJ9wUCXr8yEiClPeuVfANBISlzBGTACffYHh dFqNciiAzKuvSTw7pXV2cAA=
=Ssso
-----END PGP SIGNATURE-----
Quoted 16 lines · Daniel De Graaf
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 ACCEPTThis patch will not output the address if the mask length is zero.
- Daniel De Graaf
Index:
ip6tables-save.c
===================================================================
ip6tables-save.c (working copy) line 128
Quoted 5 lines
ip6tables-save.c (working copy) renamed from ip6tables-save.c (revision 6699) +1
-1@@ -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.
iptables-save.c +1 -1
@@ -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",
ip6tables-save.c +1 -1
@@ -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",