summaryrefslogtreecommitdiffstats
path: root/dhcp_wizard
diff options
context:
space:
mode:
authorFlorent Villard <warly@mandriva.com>2003-02-28 15:26:37 +0000
committerFlorent Villard <warly@mandriva.com>2003-02-28 15:26:37 +0000
commitb53593dd74b1c255d6e3cba0eef5ade14b6d6c2b (patch)
treea446593e92227ae5df575cfb68d59babb2dc7ff3 /dhcp_wizard
parente50ac7719ada4befb44f5e5ae57f5c3cd4ff2e68 (diff)
downloaddrakwizard-b53593dd74b1c255d6e3cba0eef5ade14b6d6c2b.tar
drakwizard-b53593dd74b1c255d6e3cba0eef5ade14b6d6c2b.tar.gz
drakwizard-b53593dd74b1c255d6e3cba0eef5ade14b6d6c2b.tar.bz2
drakwizard-b53593dd74b1c255d6e3cba0eef5ade14b6d6c2b.tar.xz
drakwizard-b53593dd74b1c255d6e3cba0eef5ade14b6d6c2b.zip
fix dhcp wizard
Diffstat (limited to 'dhcp_wizard')
-rw-r--r--dhcp_wizard/dhcp.wiz52
-rw-r--r--dhcp_wizard/scripts/Dhcpconf.pm18
2 files changed, 59 insertions, 11 deletions
diff --git a/dhcp_wizard/dhcp.wiz b/dhcp_wizard/dhcp.wiz
index f95284f1..93164559 100644
--- a/dhcp_wizard/dhcp.wiz
+++ b/dhcp_wizard/dhcp.wiz
@@ -9,6 +9,7 @@
defaultImage="__WIZ_HOME__/dhcp_wizard/images/DHCP.png"
perlModule="__WIZ_HOME__/dhcp_wizard/scripts/Dhcpconf.pm"
rpm="dhcp-server"
+ summaryFunc="do_it"
>
<Variable
@@ -87,6 +88,19 @@
jumpIndex="1"
>
</Target>
+
+ <Target
+ targetName="range_not_in_network"
+ jumpIndex="2"
+ >
+ </Target>
+
+ <Target
+ targetName="server_in_range"
+ jumpIndex="3"
+ >
+ </Target>
+
<Target
targetName="doit"
@@ -104,8 +118,7 @@
helpText="Select the range of addresses assigned to the workstations by the DHCP service; unless you have special needs, you can safely accept the proposed values."
>
</Info>
-
-
+
<Freetext
name="dhcpIpLow"
variableName="dhcp_range_low"
@@ -140,7 +153,6 @@
name="error_dhcp"
jumpPage="ask_dhcp_ip_range"
executionLevel="NORMAL"
- nextFinish="true"
canBack="true"
canCancel="true"
>
@@ -170,6 +182,40 @@
<Page
helpURL="file:/usr/share/doc/mandrake/${LANG}/ref.html/wiz-dhcp.html"
+ name="range_not_in_network"
+ jumpPage="ask_dhcp_ip_range"
+ nextButtonText="Fix it"
+ executionLevel="NORMAL"
+ nextFinish="false"
+ canBack="true"
+ canCancel="true"
+ >
+
+ <Info
+ helpText="The IP range specified is not in server network address range"
+ >
+ </Info>
+ </Page>
+
+ <Page
+ helpURL="file:/usr/share/doc/mandrake/${LANG}/ref.html/wiz-dhcp.html"
+ name="server_in_range"
+ jumpPage="ask_dhcp_ip_range"
+ nextButtonText="Fix it"
+ executionLevel="NORMAL"
+ nextFinish="false"
+ canBack="true"
+ canCancel="true"
+ >
+
+ <Info
+ helpText="The IP of the server must not be in range"
+ >
+ </Info>
+ </Page>
+
+ <Page
+ helpURL="file:/usr/share/doc/mandrake/${LANG}/ref.html/wiz-dhcp.html"
name="doit"
func="do_it"
nextButtonText="Configure"
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;