* [PATCH][IPTABLES]: libxt_iprange: Fix IP validation logic
@ 2008-04-01 21:17 James King
2008-04-02 10:17 ` Patrick McHardy
0 siblings, 1 reply; 2+ messages in thread
From: James King @ 2008-04-01 21:17 UTC (permalink / raw)
To: kaber; +Cc: netfilter-devel
On iptables 1.4.1 pulled from SVN, the iprange match rejects valid IP addresses:
#iptables -t filter -A INPUT -m iprange --src-range \
192.168.1.1-192.168.1.2 -j ACCEPT
iptables v1.4.1: iprange match: Bad IP address `192.168.1.1'
The validation logic following numeric_to_ipaddr() was inverted.
Compile and rule insert tested.
===
[IPTABLES]: libxt_iprange: Fix IP validation logic
IP address validation logic was inverted, causing valid addresses to
be rejected.
Signed-off-by: James King <t.james.king@gmail.com>
---
diff -uprN a/extensions/libxt_iprange.c b/extensions/libxt_iprange.c
--- a/extensions/libxt_iprange.c 2008-04-01 10:26:51.000000000 -0700
+++ b/extensions/libxt_iprange.c 2008-04-01 10:40:15.000000000 -0700
@@ -41,14 +41,14 @@ parse_iprange(char *arg, struct ipt_ipra
*dash = '\0';
ip = numeric_to_ipaddr(arg);
- if (ip != NULL)
+ if (!ip)
exit_error(PARAMETER_PROBLEM, "iprange match: Bad IP address `%s'\n",
arg);
range->min_ip = ip->s_addr;
if (dash != NULL) {
ip = numeric_to_ipaddr(dash+1);
- if (ip != NULL)
+ if (!ip)
exit_error(PARAMETER_PROBLEM, "iprange match: Bad IP address `%s'\n",
dash+1);
range->max_ip = ip->s_addr;
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH][IPTABLES]: libxt_iprange: Fix IP validation logic
2008-04-01 21:17 [PATCH][IPTABLES]: libxt_iprange: Fix IP validation logic James King
@ 2008-04-02 10:17 ` Patrick McHardy
0 siblings, 0 replies; 2+ messages in thread
From: Patrick McHardy @ 2008-04-02 10:17 UTC (permalink / raw)
To: James King; +Cc: netfilter-devel
James King wrote:
> [IPTABLES]: libxt_iprange: Fix IP validation logic
>
> IP address validation logic was inverted, causing valid addresses to
> be rejected.
>
> Signed-off-by: James King <t.james.king@gmail.com>
Applied, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-04-02 10:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-01 21:17 [PATCH][IPTABLES]: libxt_iprange: Fix IP validation logic James King
2008-04-02 10:17 ` Patrick McHardy
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.