diff options
author | Arnaud Desmons <adesmons@mandriva.com> | 2002-09-06 14:58:50 +0000 |
---|---|---|
committer | Arnaud Desmons <adesmons@mandriva.com> | 2002-09-06 14:58:50 +0000 |
commit | f27ecb0842657324622b04c3bca4f718c8956027 (patch) | |
tree | de3b1dc1dbeab4618a265bb34f32d51b2ba19af3 | |
parent | 9c9d6b1127cf4e960f79c7d427a7e0387c6d7e6a (diff) | |
download | drakwizard-f27ecb0842657324622b04c3bca4f718c8956027.tar drakwizard-f27ecb0842657324622b04c3bca4f718c8956027.tar.gz drakwizard-f27ecb0842657324622b04c3bca4f718c8956027.tar.bz2 drakwizard-f27ecb0842657324622b04c3bca4f718c8956027.tar.xz drakwizard-f27ecb0842657324622b04c3bca4f718c8956027.zip |
added check
-rw-r--r-- | dhcp_wizard/scripts/Dhcpconf.pm | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/dhcp_wizard/scripts/Dhcpconf.pm b/dhcp_wizard/scripts/Dhcpconf.pm index f16118de..40c1bc5e 100644 --- a/dhcp_wizard/scripts/Dhcpconf.pm +++ b/dhcp_wizard/scripts/Dhcpconf.pm @@ -48,6 +48,21 @@ sub compute_range2 { sub check { # FIXME : see check_range.sh + my $wiz_ip_server = $o->get_from_known_dev("IP"); + my $r1_trunc = "$1.$2.$3" if $ENV{wiz_ip_range1} =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/; + my $r2_trunc = "$1.$2.$3" if $ENV{wiz_ip_range2} =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/; + my $d1 = "$4" if $ENV{wiz_ip_range1} =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/; + my $d2 = "$4" if $ENV{wiz_ip_range2} =~ /(\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})/; + my $ds = "$4" if $wiz_ip_server =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/; + if (!$r1_trunc) { standalone::explanations("DHCP wizard : incorrect adress range 1"); return 1} + if (!$r2_trunc) { standalone::explanations("DHCP wizard : incorrect adress range 2"); return 1} + if ($r1_trunc != $s_trunc || $r2_trunc != $s_trunc) { + standalone::explanations("DHCP wizard : range not in network"); + return 1; + } + if (!$d1 || !$d2 || $d1 > $d2) { standalone::explanations("DHCP wizard : bad range"); return 1} + if ($ds >= $d1 && $ds <= $d2) { standalone::explanations("DHCP wizard : server in range"); return 1} 10; } |