summaryrefslogtreecommitdiffstats
path: root/dhcp_wizard
diff options
context:
space:
mode:
authorThierry Vignaud <tv@mageia.org>2012-10-18 20:50:51 +0000
committerThierry Vignaud <tv@mageia.org>2012-10-18 20:50:51 +0000
commit5ac685ad8c457a062302db020583478bd1b2f907 (patch)
tree960c29e799ee1906a4c93297c775b75afa7edca6 /dhcp_wizard
parentca117033f0bb9b7fb9317ec4af7850a8ad95e478 (diff)
downloaddrakwizard-5ac685ad8c457a062302db020583478bd1b2f907.tar
drakwizard-5ac685ad8c457a062302db020583478bd1b2f907.tar.gz
drakwizard-5ac685ad8c457a062302db020583478bd1b2f907.tar.bz2
drakwizard-5ac685ad8c457a062302db020583478bd1b2f907.tar.xz
drakwizard-5ac685ad8c457a062302db020583478bd1b2f907.zip
(check_ip) split it out of check()
Diffstat (limited to 'dhcp_wizard')
-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})/;