summaryrefslogtreecommitdiff
path: root/lib/Vyatta/IpTables/IpSet.pm
diff options
context:
space:
mode:
authorStig Thormodsrud <stig@io.vyatta.com>2009-02-10 16:30:32 -0800
committerStig Thormodsrud <stig@io.vyatta.com>2009-02-10 16:30:32 -0800
commit586f847fd9c6fb94fd794029e90351b4ff6f7e05 (patch)
treece0f8140b052fd64d599327dc6c59576ab7e5061 /lib/Vyatta/IpTables/IpSet.pm
parent9887700a0bcc22d646090ad263bff6b0895fb77c (diff)
downloadvyatta-cfg-firewall-586f847fd9c6fb94fd794029e90351b4ff6f7e05.tar.gz
vyatta-cfg-firewall-586f847fd9c6fb94fd794029e90351b4ff6f7e05.zip
Add more validation of firewall network-group before calling ipset.
Diffstat (limited to 'lib/Vyatta/IpTables/IpSet.pm')
-rwxr-xr-xlib/Vyatta/IpTables/IpSet.pm7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/Vyatta/IpTables/IpSet.pm b/lib/Vyatta/IpTables/IpSet.pm
index 80e20bb..f6452d9 100755
--- a/lib/Vyatta/IpTables/IpSet.pm
+++ b/lib/Vyatta/IpTables/IpSet.pm
@@ -165,12 +165,11 @@ sub check_member {
return "Error: [$member] isn't valid IPv4 network\n";
}
if ($member =~ /([\d.]+)\/(\d+)/) {
- my $net = $1;
- my $cidr = $2;
+ my ($net, $mask) = ($1, $2);
return "Error: zero net invalid in network-group\n"
if $net eq '0.0.0.0';
- return "Error: zero cidr invalid in network-group\n"
- if $cidr eq '0';
+ return "Error: invalid mask [$mask] - must be between 1-31\n"
+ if $mask < 1 or $mask > 31;
} else {
return "Error: Invalid network group [$member]\n";
}