summaryrefslogtreecommitdiffstats
path: root/dhcp_wizard
diff options
context:
space:
mode:
Diffstat (limited to 'dhcp_wizard')
-rw-r--r--dhcp_wizard/dhcp.wiz4
-rw-r--r--dhcp_wizard/scripts/Dhcpconf.pm20
2 files changed, 21 insertions, 3 deletions
diff --git a/dhcp_wizard/dhcp.wiz b/dhcp_wizard/dhcp.wiz
index 7eee4efe..8a2d9ac3 100644
--- a/dhcp_wizard/dhcp.wiz
+++ b/dhcp_wizard/dhcp.wiz
@@ -90,7 +90,7 @@
<Freetext
name="dhcpIpLow"
variableName="dhcp_range_low"
- fillScript="__WIZ_HOME__/dhcp_wizard/scripts/compute_range1.sh"
+ fillfunc="compute_range"
helpText="Lowest IP Address:"
editable="true"
>
@@ -99,7 +99,7 @@
<Freetext
name="dhcpIpHigh"
variableName="dhcp_range_high"
- fillScript="__WIZ_HOME__/dhcp_wizard/scripts/compute_range2.sh"
+ fillfunc="compute_range2"
helpText="Highest IP Address:"
editable="true"
>
diff --git a/dhcp_wizard/scripts/Dhcpconf.pm b/dhcp_wizard/scripts/Dhcpconf.pm
index ad34c59a..8fd15aef 100644
--- a/dhcp_wizard/scripts/Dhcpconf.pm
+++ b/dhcp_wizard/scripts/Dhcpconf.pm
@@ -26,9 +26,27 @@ use strict;
use standalone;
my $o = DrakconnectConf->new();
+my $wiz_ip_server = $o->get_from_known_dev("IP");
+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})/;
+
+sub compute_range {
+ my $n;
+ if ($d <= 64) { $n = "65" }
+ elsif ($d <= 128) { $n = "129" }
+ else { $n = "1"}
+ "$s.$n";
+}
+
+sub compute_range2 {
+ my $n;
+ if ($d <= 128) { $n = "254" }
+ elsif ($d > 192) { $n = "192" }
+ else { $n = "128"}
+ "$s.$n";
+}
sub do_it {
- my $wiz_ip_server = $o->get_from_known_dev("IP");
my $wiz_domain_name = $o->get("DomainName");
my $wiz_host_name = $o->get("SystemName");
my $wiz_ip_net = "$1.$2.$3.0" if $wiz_ip_server =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/;