summaryrefslogtreecommitdiffstats
path: root/dhcp_wizard
diff options
context:
space:
mode:
authorFlorent Villard <warly@mandriva.com>2003-02-28 18:48:08 +0000
committerFlorent Villard <warly@mandriva.com>2003-02-28 18:48:08 +0000
commit95147b49a34217f6bfd43661e09f10a26cae8802 (patch)
tree86a8e72f147e6c2538eef04e839324bafa345b13 /dhcp_wizard
parentb2c33ddc8e1674ea9c58c11827b997e4b9816ddc (diff)
downloaddrakwizard-95147b49a34217f6bfd43661e09f10a26cae8802.tar
drakwizard-95147b49a34217f6bfd43661e09f10a26cae8802.tar.gz
drakwizard-95147b49a34217f6bfd43661e09f10a26cae8802.tar.bz2
drakwizard-95147b49a34217f6bfd43661e09f10a26cae8802.tar.xz
drakwizard-95147b49a34217f6bfd43661e09f10a26cae8802.zip
remove unknow fields from dhcpd.conf and add ip of the gateway and dnsserver
Diffstat (limited to 'dhcp_wizard')
-rw-r--r--dhcp_wizard/scripts/Dhcpconf.pm8
-rw-r--r--dhcp_wizard/scripts/dhcpd.conf.default8
2 files changed, 10 insertions, 6 deletions
diff --git a/dhcp_wizard/scripts/Dhcpconf.pm b/dhcp_wizard/scripts/Dhcpconf.pm
index d94db67d..881ef56f 100644
--- a/dhcp_wizard/scripts/Dhcpconf.pm
+++ b/dhcp_wizard/scripts/Dhcpconf.pm
@@ -73,6 +73,12 @@ sub check_dhcp {
sub do_it {
my $wiz_domain_name = $o->network_get("DOMAINNAME");
my $wiz_host_name = $o->network_get("HOSTNAME");
+ my $wiz_gateway = $o->network_get("GATEWAY");
+ my $wiz_dns = $o->network_get("dnsServer");
+ if (!$wiz_gateway) {
+ my $t = `LC_ALL=C /sbin/ip route list scope global`;
+ ($wiz_gateway) = $t =~ /default via (\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}) dev/;
+ }
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;
@@ -115,12 +121,14 @@ sub do_it {
-f $file and MDK::Common::cp_af($file, $file.".orig");
output($file, map {
s|__hname__|$wiz_host_name|g;
+ s|__dns__|$wiz_dns|g;
s|__net__|$wiz_ip_net|g;
s|__ip__|$wiz_ip_server|g;
s|__mask__|$wiz_ip_netmask|g;
s|__rng1__|$wiz_ip_range1|g;
s|__rng2__|$wiz_ip_range2|g;
s|__dname__|$wiz_domain_name|g;
+ s|__gateway__|$wiz_gateway|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,
diff --git a/dhcp_wizard/scripts/dhcpd.conf.default b/dhcp_wizard/scripts/dhcpd.conf.default
index 58e5ab35..ec2e20c2 100644
--- a/dhcp_wizard/scripts/dhcpd.conf.default
+++ b/dhcp_wizard/scripts/dhcpd.conf.default
@@ -11,13 +11,9 @@ not authoritative;
subnet __net__ netmask __mask__{
range __rng1__ __rng2__;
option domain-name "__dname__";
- option domain-name-servers __ip__;
- option nis-servers __ip__;
- option lpr-servers __ip__;
- option netbios-name-servers __ip__;
- option routers __ip__;
+ option domain-name-servers __dns__;
+ option routers __gateway__;
option subnet-mask __mask__;
- option time-servers __ip__;
ddns-updates on;
ddns-domainname "__dname__";
ddns-rev-domainname "in-addr.arpa";