From: <kr...@us...> - 2006-10-11 18:26:39
|
Revision: 405 http://svn.sourceforge.net/astlinux/?rev=405&view=rev Author: krisk84 Date: 2006-10-11 11:26:30 -0700 (Wed, 11 Oct 2006) Log Message: ----------- implement local dns failover using dnsmasq Modified Paths: -------------- trunk/package/dnsmasq/dnsmasq.init trunk/target/generic/target_skeleton/etc/init.d/network trunk/target/generic/target_skeleton/etc/udhcpc.script trunk/target/generic/target_skeleton/stat/etc/rc.conf Modified: trunk/package/dnsmasq/dnsmasq.init =================================================================== --- trunk/package/dnsmasq/dnsmasq.init 2006-10-11 03:40:28 UTC (rev 404) +++ trunk/package/dnsmasq/dnsmasq.init 2006-10-11 18:26:30 UTC (rev 405) @@ -30,6 +30,15 @@ LAN3IPBASE=`echo $INT3IP | cut -d. -f1-3` fi +if [ "$LOCALDNS" ] +then +RCONF="/tmp/etc/resolv-up.conf" +echo "search $DOMAIN +nameserver 127.0.0.1" > /tmp/etc/resolv.conf +else +RCONF="/tmp/etc/resolv.conf" +fi + echo "domain-needed bogus-priv local=/$DOMAIN/ @@ -45,6 +54,7 @@ dhcp-option=lan,150,$INTIP # dhcp-lease-max=153 +resolv-file=$RCONF dhcp-leasefile=/var/db/dnsmasq.leases cache-size=150" > /tmp/etc/dnsmasq.conf Modified: trunk/target/generic/target_skeleton/etc/init.d/network =================================================================== --- trunk/target/generic/target_skeleton/etc/init.d/network 2006-10-11 03:40:28 UTC (rev 404) +++ trunk/target/generic/target_skeleton/etc/init.d/network 2006-10-11 18:26:30 UTC (rev 405) @@ -27,6 +27,13 @@ $HOSTIP $HOSTNAME.$DOMAIN $HOSTNAME" > /tmp/etc/hosts fi +if [ "$LOCALDNS" ] +then +RCONF="/tmp/etc/resolv-up.conf" +else +RCONF="/tmp/etc/resolv.conf" +fi + if [ -r /stat/etc/ethers ] then cat /stat/etc/ethers >> /tmp/etc/ethers @@ -199,16 +206,16 @@ if [ -f /tmp/etc/ppp/resolv.conf ] then -ln -sf /tmp/etc/ppp/resolv.conf /tmp/etc/resolv.conf +ln -sf /tmp/etc/ppp/resolv.conf $RCONF fi if [ "$DNS" -a "$DOMAIN" ] then -echo "search $DOMAIN" > /tmp/etc/resolv.conf +echo "search $DOMAIN" > $RCONF for h in $DNS do -echo "nameserver $h" >> /tmp/etc/resolv.conf +echo "nameserver $h" >> $RCONF done fi @@ -260,11 +267,11 @@ fi fi -echo "search $DOMAIN" > /tmp/etc/resolv.conf +echo "search $DOMAIN" > $RCONF for h in $DNS do -echo "nameserver $h" >> /tmp/etc/resolv.conf +echo "nameserver $h" >> $RCONF done else Modified: trunk/target/generic/target_skeleton/etc/udhcpc.script =================================================================== --- trunk/target/generic/target_skeleton/etc/udhcpc.script 2006-10-11 03:40:28 UTC (rev 404) +++ trunk/target/generic/target_skeleton/etc/udhcpc.script 2006-10-11 18:26:30 UTC (rev 405) @@ -1,10 +1,22 @@ #!/bin/sh # $Id: udhcpc.script 1681 2004-09-01 18:12:49Z $ +# Modified for AstLinux [ -z "$1" ] && echo "Error: should be called from udhcpc" && exit 1 -RESOLV_CONF="/etc/resolv.conf" +if [ -r /etc/rc.conf ] +then +. /etc/rc.conf +fi + +if [ $LOCALDNS ] +then +RESOLV_CONF="/tmp/etc/resolv-up.conf" +else +RESOLV_CONF="/tmp/etc/resolv.conf" +fi + [ -n "$broadcast" ] && BROADCAST="broadcast $broadcast" [ -n "$subnet" ] && NETMASK="netmask $subnet" Modified: trunk/target/generic/target_skeleton/stat/etc/rc.conf =================================================================== --- trunk/target/generic/target_skeleton/stat/etc/rc.conf 2006-10-11 03:40:28 UTC (rev 404) +++ trunk/target/generic/target_skeleton/stat/etc/rc.conf 2006-10-11 18:26:30 UTC (rev 405) @@ -130,6 +130,11 @@ ##will be 10 seconds. You can change that here. #FAILTIME=10 +##Use local dnsmasq +##This setting controls whether or not we will use the local dnsmasq instance +##for DNS resolution on THIS machine. +#LOCALDNS=yes + ##If you do not define the INTIF, I will not try to start one. ##If you do not define the INTIF, I will also not start the following services: ##dnsmasq iptables astshape (PBX only mode) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |