summaryrefslogtreecommitdiffstats
path: root/dhcp_wizard/scripts/Dhcpconf.pm
diff options
context:
space:
mode:
Diffstat (limited to 'dhcp_wizard/scripts/Dhcpconf.pm')
-rw-r--r--dhcp_wizard/scripts/Dhcpconf.pm18
1 files changed, 10 insertions, 8 deletions
diff --git a/dhcp_wizard/scripts/Dhcpconf.pm b/dhcp_wizard/scripts/Dhcpconf.pm
index d3504d5a..d94db67d 100644
--- a/dhcp_wizard/scripts/Dhcpconf.pm
+++ b/dhcp_wizard/scripts/Dhcpconf.pm
@@ -56,12 +56,12 @@ sub check {
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) {
+ if ($r1_trunc ne $s_trunc || $r2_trunc ne $s_trunc) {
standalone::explanations("DHCP wizard : range not in network");
- return 1;
+ return 2;
}
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}
+ if ($ds >= $d1 && $ds <= $d2) { standalone::explanations("DHCP wizard : server in range"); return 3}
10;
}
@@ -74,6 +74,8 @@ sub do_it {
my $wiz_domain_name = $o->network_get("DOMAINNAME");
my $wiz_host_name = $o->network_get("HOSTNAME");
my $wiz_ip_net = "$1.$2.$3.0" if $wiz_ip_server =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/;
+ my $err = check();
+ return $err if $err != 10;
my $wiz_ip_range1 = $ENV{wiz_ip_range1};
my $wiz_ip_range2 = $ENV{wiz_ip_range2};
my $wiz_ip_netmask = $o->itf_get("NETMASK");
@@ -92,7 +94,7 @@ sub do_it {
if (!`grep INTERFACES $file`){
MDK::Common::append_to_file($file, "\nINTERFACES=$wiz_device");
MDK::Common::cp_af($file, $file . ".orig");
- my $tmp = `mktemp /tmp/Dhcpconf.XXXXXX` or die "can't make a temp file: $!";
+ my $tmp = `/bin/mktemp /tmp/Dhcpconf.XXXXXX` or die "can't make a temp file: $!";
open(NEW, "> $tmp") or die "can't open $tmp: $!";
open(OLD, "< $file") or die "can't open default: $!";
while (<OLD>) {
@@ -132,11 +134,11 @@ mask = $wiz_ip_netmask, rng1 = $wiz_ip_range1, rng2 = $wiz_ip_range2, dname = $w
$mdk{interfaces} = $wiz_device;
standalone::explanations("$file: lease_file = $mdk{lease_file}, interfaces = $mdk{interfaces}");
Vareqval->commit($file, \%mdk);
+ !$ENV{wiz_authoritative} and output($file, map {
+ s|^\s*not\s*authoritative.*|\#$&|i;
+ $_
+ } cat_ ("/etc/dhcpd.conf"));
}
- !$ENV{wiz_authoritative} and output($file, map {
- s|^\s*not\s*authoritative.*|\#$&|i;
- $_;
- } cat_ ("/etc/dhcpd.conf"));
system("/etc/rc.d/init.d/dhcpd restart");
10;