Skip to contentSkip to conversation

REDIRECT does not accept IP

PATCH Applied Phil Oester 2 participants 2 messages Jun 20, 2006 netfilter

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 REDIRECT does not accept IP

As pointed out by Nicolas Mailhot in bugzilla #483, REDIRECT does not accept an IP address and when supplied with one, provides unexpected results. Patch below fixes this.

Phil

extensions/libipt_REDIRECT.c +3 -0
diff -ruN ipt-orig/extensions/libipt_REDIRECT.c ipt-new/extensions/libipt_REDIRECT.c
@@ -44,6 +44,9 @@
 
 	mr->range[0].flags |= IP_NAT_RANGE_PROTO_SPECIFIED;
 
+	if (strchr(arg, '.'))
+		exit_error(PARAMETER_PROBLEM, "IP address not permitted\n");
+
 	port = atoi(arg);
 	if (port == 0 || port > 65535)
 		exit_error(PARAMETER_PROBLEM, "Port `%s' not valid\n", arg);
#1 lore raw
Quoted 3 lines · Phil Oester

As pointed out by Nicolas Mailhot in bugzilla #483, REDIRECT does not accept an IP address and when supplied with one, provides unexpected results. Patch below fixes this.

Applied, thanks Phil.