Skip to contentSkip to conversation

Another save/restore buglet

PATCH Applied Tom Eastep 3 participants 3 messages May 18, 2005 – Jun 11, 2005 netfilter

lore
Share & tools
lore

Tom Eastep

author
#0 lore raw

PATCH 1/1 Another save/restore buglet

This time, it's the CONNMARK extention that is producing saved output that won't restore.

gateway:/etc/test# iptables-save > save
gateway:/etc/test# iptables-restore < save
iptables-restore v1.3.1: Bad MASK value `ff'
Error occurred at line: 24
Try `iptables-restore -h' or 'iptables-restore --help' for more information.
gateway:/etc/test#

Patch attached.

-Tom

Signature · 4 lines
Tom Eastep    \ Nothing is foolproof to a sufficiently talented fool
Shoreline,     \ http://shorewall.net
Washington USA  \ [email protected]
PGP Public Key   \ https://lists.shorewall.net/teastep.pgp.key
libipt_CONNMARK.c renamed from libipt_CONNMARK.c~ +1 -1
@@ -165,7 +165,7 @@
 print_mask(const char *text, unsigned long mask)
 {
 	if (mask != ~0UL)
-		printf("%s%lx", text, mask);
+		printf("%s0x%lx", text, mask);
 }
 #endif
 
#1 lore raw
Quoted 11 lines · Tom Eastep

This time, it's the CONNMARK extention that is producing saved output that won't restore.

gateway:/etc/test# iptables-save > save
gateway:/etc/test# iptables-restore < save
iptables-restore v1.3.1: Bad MASK value `ff'
Error occurred at line: 24
Try `iptables-restore -h' or 'iptables-restore --help' for more
information. gateway:/etc/test#

Patch attached.

You've missed the 64-bit variant ;-)

Signature · 3 lines
The only thing necessary for the triumph of evil
  is for good men to do nothing.
                                           - Edmund Burke
libipt_CONNMARK.c +2 -2
Index: libipt_CONNMARK.c
===================================================================
@@ -150,7 +150,7 @@
 print_mask(const char *text, unsigned long long mask)
 {
 	if (mask != ~0ULL)
-		printf("%s%llx", text, mask);
+		printf("%s0x%llx", text, mask);
 }
 
 #else
@@ -165,7 +165,7 @@
 print_mask(const char *text, unsigned long mask)
 {
 	if (mask != ~0UL)
-		printf("%s%lx", text, mask);
+		printf("%s0x%lx", text, mask);
 }
 #endif
 
#2 lore raw
Quoted 5 lines · Pawel Sikora
Quoted 2 lines · Tom Eastep

Patch attached.

You've missed the 64-bit variant ;-)

Applied, thanks everyone.