Skip to contentSkip to conversation

iprange: fix xt_iprange v0 parsing

PATCH Applied Vincent Bernat 2 participants 2 messages Apr 21, 2010 netfilter

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iprange: fix xt_iprange v0 parsing

iprange_parse() was incomplete and did not include parsed ranges into ipt_iprange_info structure resulting in always adding range 0.0.0.0-0.0.0.0 in the kernel.

Moreover, when using --dst-range, error messages may display --src-range instead. Fix this too.

---
 extensions/libxt_iprange.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)
extensions/libxt_iprange.c +5 -3
index b28a635..55a2f84 100644
@@ -108,7 +108,8 @@ static int iprange_parse(int c, char **argv, int invert, unsigned int *flags,
 		if (invert)
 			info->flags |= IPRANGE_SRC_INV;
 		iprange_parse_range(optarg, range, NFPROTO_IPV4, "--src-range");
-
+		info->src.min_ip = range[0].ip;
+		info->src.max_ip = range[1].ip;
 		break;
 
 	case '2':
@@ -122,8 +123,9 @@ static int iprange_parse(int c, char **argv, int invert, unsigned int *flags,
 		if (invert)
 			info->flags |= IPRANGE_DST_INV;
 
-		iprange_parse_range(optarg, range, NFPROTO_IPV4, "--src-range");
-
+		iprange_parse_range(optarg, range, NFPROTO_IPV4, "--dst-range");
+		info->dst.min_ip = range[0].ip;
+		info->dst.max_ip = range[1].ip;
 		break;
 
 	default:
Signature · 1 line
1.7.0.4
#1 lore raw
Quoted 6 lines · Vincent Bernat

iprange_parse() was incomplete and did not include parsed ranges into ipt_iprange_info structure resulting in always adding range 0.0.0.0-0.0.0.0 in the kernel.

Moreover, when using --dst-range, error messages may display --src-range instead. Fix this too.

Applied, thanks Vincent.