]> git.ipfire.org Git - ipfire-2.x.git/commitdiff
dnsmasq: Disable parsing leases when DNS Update is enabled
authorMichael Tremer <michael.tremer@ipfire.org>
Sun, 15 Mar 2015 23:54:42 +0000 (00:54 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Mon, 16 Mar 2015 00:11:29 +0000 (01:11 +0100)
html/cgi-bin/dhcp.cgi
src/initscripts/init.d/dnsmasq

index f4cb0ddcb72c263da7baa11b17f33c420a1569d0..f192856a8ae047a18f6919fae3b64929f9234c8e 100644 (file)
@@ -646,12 +646,12 @@ print <<END
                <td width='10%' class='boldbase'>$Lang::tr{'dhcp dns key name'}:</td>
                <td width='20%'><input type='text' name='DNS_UPDATE_KEY_NAME_${itf}' value='$dhcpsettings{"DNS_UPDATE_KEY_NAME_${itf}"}'></td>
                <td width='10%' class='boldbase' align='right'>$Lang::tr{'dhcp dns update secret'}:&nbsp;&nbsp;</td>
-               <td width='20%'><input type='password' name='DNS_UPDATE_SECRET_${itf}' value='$dhcpsettings{"DNS_UPDATE_SECRET_${itf}"}'></td>
+               <td width='20%'><input type='password' name='DNS_UPDATE_KEY_SECRET_${itf}' value='$dhcpsettings{"DNS_UPDATE_KEY_SECRET_${itf}"}'></td>
                <td width='10%' class='boldbase' align='right'>$Lang::tr{'dhcp dns update algo'}:&nbsp;&nbsp;</td>
                <td width='20%'>
-                       <select name='DNS_UPDATE_ALGO_${itf}'>
-                               <option value='hmac-sha1' $selected{'DNS_UPDATE_ALGO_${itf}'}{'hmac-sha1'}>HMAC-SHA1</option>
-                               <option value='hmac-md5' $selected{'DNS_UPDATE_ALGO_${itf}'}{'hmac-md5'}>HMAC-MD5</option>
+                       <select name='DNS_UPDATE_KEY_ALGO_${itf}'>
+                               <option value='hmac-sha1' $selected{'DNS_UPDATE_KEY_ALGO_${itf}'}{'hmac-sha1'}>HMAC-SHA1</option>
+                               <option value='hmac-md5' $selected{'DNS_UPDATE_KEY_ALGO_${itf}'}{'hmac-md5'}>HMAC-MD5</option>
                        </select>
                </td>
        </tr>
@@ -1220,12 +1220,13 @@ sub buildconf {
            }
        }# on    
     }# foreach line
+    print FILE "\n";
 
     #Subnet range definition
     foreach my $itf (@ITFs) {
        my $lc_itf=lc($itf);
        if ($dhcpsettings{"ENABLE_${itf}"} eq 'on' ){
-           print FILE "\nsubnet " . $netsettings{"${itf}_NETADDRESS"} . " netmask ". $netsettings{"${itf}_NETMASK"} . " #$itf\n";
+           print FILE "subnet " . $netsettings{"${itf}_NETADDRESS"} . " netmask ". $netsettings{"${itf}_NETMASK"} . " #$itf\n";
            print FILE "{\n";
            print FILE "\trange " . $dhcpsettings{"START_ADDR_${itf}"} . ' ' . $dhcpsettings{"END_ADDR_${itf}"}.";\n" if ($dhcpsettings{"START_ADDR_${itf}"});
            print FILE "\toption subnet-mask "   . $netsettings{"${itf}_NETMASK"} . ";\n";
@@ -1262,10 +1263,10 @@ sub buildconf {
                    }
                }# on    
            }# foreach line
-           print FILE "} #$itf\n";
+           print FILE "} #$itf\n\n";
 
            if (($dhcpsettings{"DNS_UPDATE_ENABLED"} eq "on") && ($dhcpsettings{"DNS_UPDATE_KEY_NAME_${itf}"} ne "")) {
-               print FILE "key " . $dhcpsettings{"DNS_UPDATE_KEY_NAME_${itf}"} . "{\n";
+               print FILE "key " . $dhcpsettings{"DNS_UPDATE_KEY_NAME_${itf}"} . " {\n";
                print FILE "\talgorithm " . $dhcpsettings{"DNS_UPDATE_KEY_ALGO_${itf}"} . ";\n";
                print FILE "\tsecret \"" . $dhcpsettings{"DNS_UPDATE_KEY_SECRET_${itf}"} . "\";\n";
                print FILE "};\n\n";
index 4e37925171a4687d056f4f93ef3ec7b317ed8e3d..b033e2b4c88645623f667537be18e27a5fde3a86 100644 (file)
@@ -54,6 +54,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...
@@ -64,7 +79,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)
@@ -94,7 +112,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}"