diff options
author | Thierry Vignaud <tv@mageia.org> | 2012-10-18 20:50:51 +0000 |
---|---|---|
committer | Thierry Vignaud <tv@mageia.org> | 2012-10-18 20:50:51 +0000 |
commit | 5ac685ad8c457a062302db020583478bd1b2f907 (patch) | |
tree | 960c29e799ee1906a4c93297c775b75afa7edca6 /dhcp_wizard | |
parent | ca117033f0bb9b7fb9317ec4af7850a8ad95e478 (diff) | |
download | drakwizard-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-x | dhcp_wizard/Dhcp.pm | 7 |
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})/; |