summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xdhcp_wizard/Dhcp.pm7
1 files changed, 4 insertions, 3 deletions
diff --git a/dhcp_wizard/Dhcp.pm b/dhcp_wizard/Dhcp.pm
index 389f0750..dc983512 100755
--- a/dhcp_wizard/Dhcp.pm
+++ b/dhcp_wizard/Dhcp.pm
@@ -151,12 +151,13 @@ sub compute_range2 {
"$s.$n";
}
+sub check_ip { return $_[0] < 0 || $_[0] > 255 ? 0 : 1 }
+
sub check {
- my $check_ip = sub { return $_[0] < 0 || $_[0] > 255 ? 0 : 1 };
my $r1_trunc = "$1.$2.$3" if $o->{var}{ip1} =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/;
- foreach ($1, $2, $3, $4) { $check_ip->($_) or return 'ip_range_error' }
+ foreach ($1, $2, $3, $4) { check_ip($_) or return 'ip_range_error' }
my $r2_trunc = "$1.$2.$3" if $o->{var}{ip2} =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/;
- foreach ($1, $2, $3, $4) { $check_ip->($_) or return 'ip_range_error' }
+ foreach ($1, $2, $3, $4) { check_ip($_) or return 'ip_range_error' }
my $d1 = $4 if $o->{var}{ip1} =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/;
my $d2 = $4 if $o->{var}{ip2} =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/;
my $s_trunc = "$1.$2.$3" if $wiz_ip_server =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/;