OpenWrt Forum Archive

Topic: Changes to 'dnsmasq' in svn r6000

The content of this topic has been archived on 18 Mar 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

It seems that the init.d for dnsmasq is now configured to be able to parse the /etc/config/dhcp file for the dnsmasq settings, instead of using dnsmasq.conf.  However, the init.d/dnsmasq script seems to be missing support for --address=/domain/ip, which I use for setting up alias for some certain local only services.  I don't like to update /etc/hosts as it seems dnsmasq picks up the first name that matches for an ip sending in a dchp request and adds that name to the dns information instead of the server name.  I already updated /etc/init.d/dnsmasq so it can support the following:

config address
           name 'cacti'
           domain 'cacti.somedomain.com'
           ip        '192.168.15.10'

Which now lets me do 'host cacti.wnlnet.com' and returns an ip address of '192.168.15.10'.  Anyone know how I can go about incorporating those changes into svn so they are included from now one?

Below is a diff file of the changes.
***Oops, had accidentally done the 'diff' backwards****

--- /rom/etc/init.d/dnsmasq     Tue Nov 27 01:59:00 2007
+++ /etc/init.d/dnsmasq Sat Jan  1 11:04:06 2000
@@ -3,6 +3,7 @@

START=60
DNS_SERVERS=""
+DEBUG=0

dhcp_calc() {
        local ip="$1"
@@ -135,6 +136,24 @@
        dhcp_option_add "$cfg" "$name"
}

+dhcp_address_add() {
+       local cfg="$1"
+
+       config_get name "$cfg" name
+       [ -n "$name" ] || return 0
+
+       config_get domain "$cfg" domain
+       [ -n "$domain" ] || return 0
+
+       config_get ip "$cfg" ip
+       [ -n "$ip" ] || return 0
+
+        [ $DEBUG -ne 0 ] && echo "Appending arguments --address=/$domain/$ip"
+       append args "--address=/$domain/$ip"
+
+       dhcp_option_add "$cfg" "$name"
+}
+
dhcp_host_add() {
        local cfg="$1"

@@ -233,6 +252,7 @@

        args=""
        config_foreach dnsmasq dnsmasq
+       config_foreach dhcp_address_add address
        config_foreach dhcp_host_add host
        config_foreach dhcp_mac_add mac
        config_foreach dhcp_vendorclass_add vendorclass

(Last edited by wcastillo on 27 Nov 2007, 17:44)

The discussion might have continued from here.