From f27ecb0842657324622b04c3bca4f718c8956027 Mon Sep 17 00:00:00 2001 From: Arnaud Desmons Date: Fri, 6 Sep 2002 14:58:50 +0000 Subject: added check --- dhcp_wizard/scripts/Dhcpconf.pm | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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; } -- cgit v1.2.1