]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blobdiff - src/initscripts/init.d/dnsmasq
Merge remote-tracking branch 'ms/dhcp-rfc2136-broken-down' into next
[people/pmueller/ipfire-2.x.git] / src / initscripts / init.d / dnsmasq
index ce7689f4e1ed874d666bf46cb58f3673bcc5916f..059ffacdd8e92abd3bab4f8e93969378afe60531 100644 (file)
@@ -55,6 +55,21 @@ function dns_forward_args() {
        echo "${cmdline}"
 }
 
+function dns_leases_args() {
+       eval $(/usr/local/bin/readhash /var/ipfire/dhcp/settings)
+
+       # If the DHCP server is enabled and DNS Update (RFC2136) is
+       # enabled, too, we won't overlay the internal domain with
+       # the dynamic/static leases.
+
+       if ([ "${ENABLE_GREEN}" = "on" ] || [ "${ENABLE_BLUE}" = "on" ]) \
+                       && [ "${DNS_UPDATE_ENABLED}" = "on" ]; then
+               return
+       fi
+
+       echo "-l /var/state/dhcp/dhcpd.leases"
+}
+
 case "${1}" in
        start)
                # kill already running copy of dnsmasq...
@@ -65,7 +80,10 @@ case "${1}" in
                eval $(/usr/local/bin/readhash /var/ipfire/ethernet/settings)
                ARGS="$CUSTOM_ARGS"
                [ "$DOMAIN_NAME_GREEN" != "" ] && ARGS="$ARGS -s $DOMAIN_NAME_GREEN"
-               
+
+               # DHCP configuration
+               ARGS="${ARGS} $(dns_leases_args)"
+
                echo > /var/ipfire/red/resolv.conf # Clear it
                if [ -e "/var/ipfire/red/dns1" ]; then
                    DNS1=$(cat /var/ipfire/red/dns1 2>/dev/null)
@@ -95,7 +113,7 @@ case "${1}" in
                        ARGS="${ARGS} --cache-size=${CACHE_SIZE}"
                fi
 
-               loadproc /usr/sbin/dnsmasq -l /var/state/dhcp/dhcpd.leases $ARGS
+               loadproc /usr/sbin/dnsmasq ${ARGS}
                
                if [ "${SHOW_SRV}" -eq 1 ] && [ "${DNS1}" != "" -o "${DNS2}" != "" ]; then
                    boot_mesg "Using DNS server(s): ${DNS1} ${DNS2}"