1 DBus support must be enabled at compile-time and run-time. Ensure
2 that src/config.h contains the line
6 and that /etc/dnsmasq.conf contains the line
10 Because dnsmasq can operate stand-alone from the DBus, and may need to provide
11 service before the dbus daemon is available, it will continue to run
12 if the DBus connection is not available at startup. The DBus will be polled
13 every 250ms until a connection is established. Start of polling and final
14 connection establishment are both logged. When dnsmasq establishes a
15 connection to the dbus, it sends the signal "Up". Anything controlling
16 the server settings in dnsmasq should re-invoke the SetServers method
17 (q.v.) when it sees this signal. This allows dnsmasq to be restarted
18 and avoids startup races with the provider of nameserver information.
21 Dnsmasq provides one service on the DBus: uk.org.thekelleys.dnsmasq
22 and a single object: /uk/org/thekelleys/dnsmasq
23 The name of the service may be changed by giving an argument to --enable-dbus.
28 Methods are of the form
30 uk.org.thekelleys.<method>
32 Available methods are:
36 Returns a string containing the version of dnsmasq running.
40 Returns nothing. Clears the domain name cache and re-reads
41 /etc/hosts. The same as sending dnsmasq a HUP signal.
45 Takes boolean, sets or resets the --filterwin2k option.
49 Takes boolean, sets or resets the --bogus-priv option.
51 SetLocaliseQueriesOption
52 ------------------------
53 Takes boolean, sets or resets the --localise-queries option.
57 Returns nothing. Takes a set of arguments representing the new
58 upstream DNS servers to be used by dnsmasq. IPv4 addresses are
59 represented as a UINT32 (in network byte order) and IPv6 addresses
60 are represented as sixteen BYTEs (since there is no UINT128 type).
61 Each server address may be followed by one or more STRINGS, which are
62 the domains for which the preceding server should be used.
71 --server=<address1> --server=<address2>
76 STRING "somedomain.com"
80 --server=<address1> --server=/somedomain.com/<address2>
84 STRING "somedomain.com"
86 STRING "anotherdomain.com"
87 STRING "thirddomain.com"
92 --server=/somedomain.com/<address2>
93 --server=/anotherdomain.com/thirddomain.com/<address3>
95 Am IPv4 address of 0.0.0.0 is interpreted as "no address, local only",
103 --local=/local.domain/
106 Each call to SetServers completely replaces the set of servers
107 specified by via the DBus, but it leaves any servers specified via the
108 command line or /etc/dnsmasq.conf or /etc/resolv.conf alone.
113 This function is more flexible and the SetServers function, in that it can
114 handle address scoping, port numbers, and is easier for clients to use.
116 Returns nothing. Takes a set of arguments representing the new
117 upstream DNS servers to be used by dnsmasq. All addresses (both IPv4 and IPv6)
118 are represented as STRINGS. Each server address may be followed by one or more
119 STRINGS, which are the domains for which the preceding server should be used.
121 This function takes an array of STRING arrays, where each inner array represents
122 a set of DNS servers and domains for which those servers may be used. Each
123 string represents a list of upstream DNS servers first, and domains second.
124 Mixing of domains and servers within a the string array is not allowed.
129 ["1.2.3.4", "foobar.com"],
130 ["1003:1234:abcd::1%eth0", "eng.mycorp.com", "lab.mycorp.com"]
135 --server=/foobar.com/1.2.3.4 \
136 --server=/eng.mycorp.com/lab.mycorp.com/1003:1234:abcd::1%eth0
138 An IPv4 address of 0.0.0.0 is interpreted as "no address, local only",
141 [ ["0.0.0.0", "local.domain"] ]
145 --local=/local.domain/
148 Each call to SetServersEx completely replaces the set of servers
149 specified by via the DBus, but it leaves any servers specified via the
150 command line or /etc/dnsmasq.conf or /etc/resolv.conf alone.
156 Yes another variation for setting DNS servers, with the capability of
157 SetServersEx, but without using arrays of arrays, which are not
158 sendable with dbus-send. The arguments are an array of strings which
159 are identical to the equivalent arguments --server, so the example
160 for SetServersEx is represented as
163 "/foobar.com/1.2.3.4"
164 "/eng.mycorp.com/lab.mycorp.com/1003:1234:abcd::1%eth0"
170 (Only available if dnsmasq compiled with HAVE_LOOP)
172 Return an array of strings, each string is the IP address of an upstream
173 server which has been found to loop queries back to this dnsmasq instance, and
174 it therefore not being used.
179 Returns nothing. Adds or updates a DHCP or DHCPv6 lease to the internal lease
180 database, as if a client requested and obtained a lease.
182 If a lease for the IPv4 or IPv6 address already exist, it is overwritten.
184 Note that this function will trigger the DhcpLeaseAdded or DhcpLeaseUpdated
185 D-Bus signal and will run the configured DHCP lease script accordingly.
187 This function takes many arguments which are the lease parameters:
188 - A string with the textual representation of the IPv4 or IPv6 address of the
193 "1003:1234:abcd::1%eth0"
196 - A string representing the hardware address of the client, using the same
197 format as the one used in the lease database.
202 "06-00:20:e0:3b:13:af" (token ring)
204 - The hostname of the client, as an array of bytes (so there is no problem
205 with non-ASCII character encoding). May be empty.
207 Example (for "hostname.or.fqdn"):
208 [104, 111, 115, 116, 110, 97, 109, 101, 46, 111, 114, 46, 102, 113, 100, 110]
210 - The client identifier (IPv4) or DUID (IPv6) as an array of bytes. May be
216 [0, 3, 0, 1, 0, 35, 69, 103, 137, 171]
217 DHCPv4 client identifier:
218 [255, 12, 34, 56, 78, 0, 1, 0, 1, 29, 9, 99, 190, 35, 69, 103, 137, 171]
220 - The duration of the lease, in seconds. If the lease is updated, then
221 the duration replaces the previous duration.
227 - The IAID (Identity association identifier) of the DHCPv6 lease, as a network
228 byte-order unsigned integer. For DHCPv4 leases, this must be set to 0.
234 - A boolean which, if true, indicates that the DHCPv6 lease is for a temporary
235 address (IA_TA). If false, the DHCPv6 lease is for a non-temporary address
236 (IA_NA). For DHCPv4 leases, this must be set to false.
241 Returns nothing. Removes a DHCP or DHCPv6 lease to the internal lease
242 database, as if a client sent a release message to abandon a lease.
244 This function takes only one parameter: the text representation of the
245 IPv4 or IPv6 address of the lease to remove.
247 Note that this function will trigger the DhcpLeaseRemoved signal and the
248 configured DHCP lease script will be run with the "del" action.
253 Returns an array with various metrics for DNS and DHCP.
258 Returns per-DNS-server metrics.
263 Clear call metric counters, global and per-server.
268 If dnsmasq's DHCP server is active, it will send signals over DBUS whenever
269 the DHCP lease database changes. Think of these signals as transactions on
270 a database with the IP address acting as the primary key.
272 Signals are of the form:
274 uk.org.thekelleys.<signal>
276 and their parameters are:
278 STRING "192.168.1.115"
279 STRING "01:23:45:67:89:ab"
280 STRING "hostname.or.fqdn"
283 Available signals are:
288 This signal is emitted when a DHCP lease for a given IP address is created.
293 This signal is emitted when a DHCP lease for a given IP address is deleted.
298 This signal is emitted when a DHCP lease for a given IP address is updated.