diff --git a/html/cgi-bin/dns.cgi b/html/cgi-bin/dns.cgi
index c7153b785..23e4a71de 100755
--- a/html/cgi-bin/dns.cgi
+++ b/html/cgi-bin/dns.cgi
@@ -51,7 +51,7 @@ unless (-f $settings_file) { system("touch $settings_file") };
unless (-f $servers_file) { system("touch $servers_file") };
# File which stores the ISP assigned DNS servers.
-my @ISP_nameserver_files = ( "${General::swroot}/dns/dns1", "${General::swroot}/dns/dns2" );
+my @ISP_nameserver_files = ( "/var/run/dns1", "/var/run/dns2" );
# File which contains the ca-certificates.
my $ca_certs_file = "/etc/ssl/certs/ca-bundle.crt";
diff --git a/src/initscripts/networking/dhcpcd.exe b/src/initscripts/networking/dhcpcd.exe
index 28d62a14e..7a9889b5b 100644
--- a/src/initscripts/networking/dhcpcd.exe
+++ b/src/initscripts/networking/dhcpcd.exe
@@ -14,9 +14,7 @@
. /etc/sysconfig/rc
. $rc_functions
-
eval $(/usr/local/bin/readhash /var/ipfire/ethernet/settings)
-eval $(/usr/local/bin/readhash /var/ipfire/dns/settings)
dhcpcd_up()
{
@@ -30,8 +28,7 @@ dhcpcd_up()
# Only if RED_TYPE=DHCP update /var/ipfire/red
if [ "$RED_TYPE" == "DHCP" ]; then
-
- #Check if we have to restart the services at update
+ # Check if we have to restart the services at update
[ ! -e "/var/ipfire/red/active" ] && update=1;
if [ "$old_domain_name_service" != "$new_domain_name_service" ]; then
update=1;
@@ -43,15 +40,9 @@ dhcpcd_up()
update=1;
fi
- #Get DNS from dhcp
- if [ -n "$DNS0" ] && [ -n "$DNS1" ]; then
- logger -p local0.info -t dhcpcd.exe[$$] "Overwritting DNS-Server addresses with ${DNS0},${DNS1}"
- echo -n ${DNS0} > /var/ipfire/red/dns1
- echo -n ${DNS1} > /var/ipfire/red/dns2
- else
- echo -n `/etc/rc.d/helper/getdnsfromdhcpc.pl 1` > /var/ipfire/red/dns1
- echo -n `/etc/rc.d/helper/getdnsfromdhcpc.pl 2` > /var/ipfire/red/dns2
- fi
+ # Get DNS from dhcp
+ /etc/rc.d/helper/getdnsfromdhcpc.pl 1 > /var/run/dns1
+ /etc/rc.d/helper/getdnsfromdhcpc.pl 2 > /var/run/dns2
#Get IP Address
echo -n "$new_ip_address" > /var/ipfire/red/local-ipaddress
@@ -76,6 +67,9 @@ dhcpcd_down()
set | grep "^new_" | sed "s|^new_||g" | \
sort > /var/ipfire/dhcpc/dhcpcd-$interface.info
+ # Remove DNS servers
+ rm -f /var/run/dns1 /var/run/dns2
+
# Only if RED_TYPE=DHCP update /var/ipfire/red
if [ "$RED_TYPE" == "DHCP" ]; then
rm -f /var/ipfire/red/active
diff --git a/src/initscripts/networking/red b/src/initscripts/networking/red
index b8d463241..7ce0a6f47 100644
--- a/src/initscripts/networking/red
+++ b/src/initscripts/networking/red
@@ -120,8 +120,6 @@ case "${1}" in
grep -v -E "\" /etc/hosts > /tmp/hosts
echo "$GATEWAY gateway" >> /tmp/hosts
mv /tmp/hosts /etc/hosts
- echo -n "${DNS1}" > /var/ipfire/red/dns1
- echo -n "${DNS2}" > /var/ipfire/red/dns2
touch /var/ipfire/red/active
# Create route to default gateway
diff --git a/src/ppp/ip-down b/src/ppp/ip-down
index ea0dcbf94..f67a91ea2 100644
--- a/src/ppp/ip-down
+++ b/src/ppp/ip-down
@@ -22,9 +22,8 @@
. /etc/sysconfig/rc
. $rc_functions
-eval $(/usr/local/bin/readhash /var/ipfire/ppp/settings)
-
-rm -f /var/ipfire/red/active
+rm -f /var/ipfire/red/active \
+ /var/run/dns1 /var/run/dns2
run_subdir ${rc_base}/init.d/networking/red.down/
diff --git a/src/ppp/ip-up b/src/ppp/ip-up
index c7357708a..ee1683fdd 100644
--- a/src/ppp/ip-up
+++ b/src/ppp/ip-up
@@ -22,32 +22,17 @@
. /etc/sysconfig/rc
. $rc_functions
-PRIMARY_DNS=$DNS1
-SECONDARY_DNS=$DNS2
-
eval $(/usr/local/bin/readhash /var/ipfire/ppp/settings)
-if [ "$DNS" == "Automatic" ]; then
- if [ "$TYPE" == "isdn" ]; then
- echo -n "$MS_DNS1" > /var/ipfire/red/dns1
- echo -n "$MS_DNS2" > /var/ipfire/red/dns2
- else
- if [ "$PRIMARY_DNS" == "10.11.12.13" ]; then
- echo -n "$DNS1" > /var/ipfire/red/dns1
- else
- echo -n "$PRIMARY_DNS" > /var/ipfire/red/dns1
- fi
- if [ "$SECONDARY_DNS" == "10.11.12.14" ]; then
- echo -n "$DNS2" > /var/ipfire/red/dns2
- else
- echo -n "$SECONDARY_DNS" > /var/ipfire/red/dns2
- fi
- fi
-else
- echo -n "$DNS1" > /var/ipfire/red/dns1
- echo -n "$DNS2" > /var/ipfire/red/dns2
+if [ "$TYPE" = "isdn" ]; then
+ DNS1="${MS_DNS1}"
+ DNS2="${MS_DNS2}"
fi
+# Write DNS servers to configuration
+echo "${DNS1}" > /var/run/dns1
+echo "${DNS2}" > /var/run/dns2
+
echo -n "$1" > /var/ipfire/red/iface
echo -n "$4" > /var/ipfire/red/local-ipaddress
echo -n "$5" > /var/ipfire/red/remote-ipaddress
diff --git a/src/scripts/convert-dns-settings b/src/scripts/convert-dns-settings
index 82e471a7f..bacee66f6 100644
--- a/src/scripts/convert-dns-settings
+++ b/src/scripts/convert-dns-settings
@@ -27,6 +27,9 @@ main() {
if [ -s "/var/ipfire/ppp/settings" ]; then
eval $(/usr/local/bin/readhash /var/ipfire/ppp/settings)
+
+ # Remove DNS, DNS1 and DNS2
+ sed -i "/^DNS[12]?=/d" /var/ipfire/ppp/settings
elif [ -s "/var/ipfire/dns/settings" ]; then
eval $(/usr/local/bin/readhash /var/ipfire/dns/settings)
fi