Skip to contentSkip to conversation

PATCH - Fix for --random option in DNAT and REDIRECT

PATCH Tom Eastep 2 participants 2 messages Nov 14, 2007 – Nov 15, 2007 netfilter

lore
Share & tools
lore

Tom Eastep

author
#0 lore raw

The --random option produces "Unknown arg `--random'" errors with both the DNAT and REDIRECT targets. Corrected by the attached patch.

-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_DNAT.c renamed from iptables-1.3.8.standard/extensions/libipt_DNAT.c +1 -0
diff -au ../iptables-1.3.8.standard/extensions/libipt_DNAT.c extensions/libipt_DNAT.c
@@ -180,6 +180,7 @@
 			*flags |= IPT_DNAT_OPT_RANDOM;
 		} else
 			*flags |= IPT_DNAT_OPT_RANDOM;
+		return 1;
 	default:
 		return 0;
 	}

Only in extensions/: libipt_DNAT.c~

libipt_REDIRECT.c renamed from iptables-1.3.8.standard/extensions/libipt_REDIRECT.c +1 -1
diff -au ../iptables-1.3.8.standard/extensions/libipt_REDIRECT.c extensions/libipt_REDIRECT.c
@@ -24,7 +24,7 @@
 
 static struct option opts[] = {
 	{ "to-ports", 1, 0, '1' },
-	{ "random", 1, 0, '2' },
+	{ "random", 0, 0, '2' },
 	{ 0 }
 };
 

Only in extensions/: libipt_REDIRECT.c~

#1 lore raw
Quoted 2 lines · Tom Eastep

The --random option produces "Unknown arg `--random'" errors with both the DNAT and REDIRECT targets. Corrected by the attached patch.

The REDIRECT part didn't apply cleanly because of changes in the tree. Please always base your patches on the latest version.

Anyway, I've fixed it up and applied it, thanks Tom.