Netzwerkscripts: DHCP vollstaendig getestet und gefixt.
authorms <ms@ea5c0bd1-69bd-2848-81d8-4f18e57aeed8>
Mon, 20 Aug 2007 14:25:59 +0000 (14:25 +0000)
committerms <ms@ea5c0bd1-69bd-2848-81d8-4f18e57aeed8>
Mon, 20 Aug 2007 14:25:59 +0000 (14:25 +0000)
git-svn-id: http://svn.ipfire.org/svn/ipfire/trunk@790 ea5c0bd1-69bd-2848-81d8-4f18e57aeed8

src/initscripts/init.d/dnsmasq
src/initscripts/init.d/networking/dhcpcd.exe
src/initscripts/init.d/networking/red

index 583e55e..78b7879 100644 (file)
 . /etc/sysconfig/rc
 . ${rc_functions}
 
+SHOW_SRV=1
+
 case "${1}" in
        start)
                boot_mesg "Starting Domain Name Service Proxy..."
                
                eval $(/usr/local/bin/readhash /var/ipfire/ethernet/settings)
                ARGS=
-               [ "$DOMAIN_NAME_GREEN" != "" ] && ARGS="-s $DOMAIN_NAME_GREEN "
-               [ -e "/var/ipfire/red/active" ] && ARGS+="-r /var/ipfire/red/resolv.conf"
+               [ "$DOMAIN_NAME_GREEN" != "" ] && ARGS="-s $DOMAIN_NAME_GREEN"
+               
+               echo > /var/ipfire/red/resolv.conf # Clear it
+               if [ -e "/var/ipfire/red/dns1" ]; then
+                   DNS1=$(cat /var/ipfire/red/dns1 2>/dev/null)
+                   echo "nameserver ${DNS1}" >> /var/ipfire/red/resolv.conf
+               fi
+               if [ -e "/var/ipfire/red/dns2" ]; then
+                   DNS2=$(cat /var/ipfire/red/dns2 2>/dev/null)
+                   echo "nameserver ${DNS2}" >> /var/ipfire/red/resolv.conf
+               fi
+               [ -e "/var/ipfire/red/active" ] && ARGS="$ARGS -r /var/ipfire/red/resolv.conf"
                
                loadproc /usr/sbin/dnsmasq -l /var/state/dhcp/dhcpd.leases $ARGS
+               
+               if [ "${SHOW_SRV}" -eq 1 ] && [ "${DNS1}" != "" -o "${DNS2}" != "" ]; then
+                   boot_mesg "Using DNS server(s): ${DNS1} ${DNS2}"
+                   boot_mesg_flush
+               fi
                ;;
 
        stop)
index 5349960..dca1b83 100644 (file)
@@ -21,7 +21,6 @@ case "$2" in
        new)    
                logger -p local0.info -t dhcpcd.exe[$$] "${INTERFACE} has been configured with new IP=${IPADDR}"
                [ -e "/var/ipfire/red/active" ] || touch /var/ipfire/red/active
-               fi
                ;;
        down)
                logger -p local0.info -t dhcpcd.exe[$$] "${INTERFACE} has been brought down"
index d28fd90..465d528 100644 (file)
@@ -278,6 +278,7 @@ case "${1}" in
                        fi
                fi
                
+               rm -f /var/ipfire/red/{active,device,dial-on-demand,dns1,dns2,local-ipaddress,remote-ipaddress,resolv.conf}
                for i in $( ls -v ${rc_base}/init.d/networking/red.down/* 2> /dev/null); do
                        check_script_status
                        OUT=$(echo $(basename ${i}) | awk -F- '{ print $2 }')