diff options
Diffstat (limited to 'dhcp_wizard/Dhcp.pm')
-rwxr-xr-x | dhcp_wizard/Dhcp.pm | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/dhcp_wizard/Dhcp.pm b/dhcp_wizard/Dhcp.pm index ca5775c5..17158cab 100755 --- a/dhcp_wizard/Dhcp.pm +++ b/dhcp_wizard/Dhcp.pm @@ -31,6 +31,7 @@ use MDK::Wizard::Wizcommon; my $wiz = new MDK::Wizard::Wizcommon; my $wiz_ip_server = $wiz->{net}->itf_get("IPADDR"); +my $wiz_tftpserverip = $wiz_ip_server; my $d = $4 if $wiz_ip_server =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/; my $s = "$1.$2.$3" if $wiz_ip_server =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/; @@ -76,7 +77,7 @@ $o->{pages} = { ], next => 'summary' }, - dhcp_warning => { + dhcp_warning => { name => N("Warning") . "\n\n" . N("You are in dhcp, server may not work with your configuration."), ignore => 1, next => 'ip_range' @@ -99,9 +100,9 @@ $o->{pages} = { summary => { name => N("Configuring the DHCP Server") . "\n\n" . N("The wizard collected the following parameters needed to configure your DHCP service:"), data => [ - { label => N("Lowest IP Address:"), fixed_val => \$o->{var}{ip1} }, - { label => N("Highest IP Address:"), fixed_val => \$o->{var}{ip2} }, - { label => N("Interface:"), fixed_val => \$o->{var}{interface} }, + { label => N("Lowest IP Address:"), fixed_val => \$o->{var}{ip1} }, + { label => N("Highest IP Address:"), fixed_val => \$o->{var}{ip2} }, + { label => N("Interface:"), fixed_val => \$o->{var}{interface} }, ], post => \&do_it, next => 'end' @@ -136,12 +137,12 @@ sub check { 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' } 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 $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})/; 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 'ip_range_error' } if (!$r2_trunc) { standalone::explanations("DHCP wizard : incorrect adress range 2"); return 'ip_range_error' } - if ($r1_trunc ne $s_trunc || $r2_trunc ne $s_trunc) { + if ($r1_trunc ne $s_trunc || $r2_trunc ne $s_trunc) { standalone::explanations("DHCP wizard : range not in network"); return 'ip_range_warning'; } @@ -197,7 +198,7 @@ sub do_it { } $file = "/etc/dhcpd.conf"; -f $file and MDK::Common::cp_af($file, $file.".orig"); - output($file, map { + output($file, map { s|__hname__|$wiz_host_name|g; s|__dns__|$wiz_dns|g; s|__net__|$wiz_ip_net|g; @@ -207,6 +208,7 @@ sub do_it { s|__rng2__|$wiz_ip_range2|g; s|__dname__|$wiz_domain_name|g; s|__gateway__|$wiz_gateway|g; + s|__tftpserverip__|$wiz_tftpserverip|g; $_; } cat_("__WIZ_HOME__/dhcp_wizard/scripts/dhcpd.conf.default")); standalone::explanations("$file: hname = $wiz_host_name, net = $wiz_ip_net, ip = $wiz_ip_server, |