Simon Kelley | 3d8df26 | 2005-08-29 12:19:27 +0100 | [diff] [blame] | 1 | DBus support must be enabled at compile-time and run-time. Ensure |
| 2 | that src/config.h contains the line |
| 3 | |
| 4 | #define HAVE_DBUS. |
| 5 | |
| 6 | and that /etc/dnsmasq.conf contains the line |
| 7 | |
| 8 | enable-dbus |
| 9 | |
| 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. |
| 19 | |
| 20 | |
| 21 | Dnsmasq provides one service on the DBus: uk.org.thekelleys.dnsmasq |
| 22 | and a single object: /uk/org/thekelleys/dnsmasq |
| 23 | |
| 24 | Methods are of the form |
| 25 | |
| 26 | uk.org.thekelleys.<method> |
| 27 | |
| 28 | Available methods are: |
| 29 | |
| 30 | GetVersion |
| 31 | ---------- |
| 32 | Returns a string containing the version of dnsmasq running. |
| 33 | |
| 34 | ClearCache |
| 35 | ---------- |
| 36 | Returns nothing. Clears the domain name cache and re-reads |
| 37 | /etc/hosts. The same as sending dnsmasq a HUP signal. |
| 38 | |
| 39 | SetServers |
| 40 | ---------- |
| 41 | Returns nothing. Takes a set of arguments representing the new |
| 42 | upstream DNS servers to be used by dnsmasq. IPv4 addresses are |
| 43 | represented as a UINT32 (in network byte order) and IPv6 addresses |
| 44 | are represented as sixteen BYTEs (since there is no UINT128 type). |
| 45 | Each server address may be followed by one or more STRINGS, which are |
| 46 | the domains for which the preceding server should be used. |
| 47 | |
| 48 | Examples. |
| 49 | |
| 50 | UINT32: <address1> |
| 51 | UNIT32: <address2> |
| 52 | |
| 53 | is equivalent to |
| 54 | |
| 55 | --server=<address1> --server=<address2> |
| 56 | |
| 57 | |
| 58 | UINT32 <address1> |
| 59 | UINT32 <address2> |
| 60 | STRING "somedomain.com" |
| 61 | |
| 62 | is equivalent to |
| 63 | |
| 64 | --server=<address1> --server=/somedomain.com/<address2> |
| 65 | |
| 66 | UINT32 <address1> |
| 67 | UINT32 <address2> |
| 68 | STRING "somedomain.com" |
| 69 | UINT32 <address3> |
| 70 | STRING "anotherdomain.com" |
| 71 | STRING "thirddomain.com" |
| 72 | |
| 73 | is equivalent to |
| 74 | |
| 75 | --server=<address1> |
| 76 | --server=/somedomain.com/<address2> |
| 77 | --server=/anotherdomain.com/thirddomain.com/<address3> |
| 78 | |
| 79 | Am IPv4 address of 0.0.0.0 is interpreted as "no address, local only", |
| 80 | so |
| 81 | |
| 82 | UINT32: <0.0.0.0> |
| 83 | STRING "local.domain" |
| 84 | |
| 85 | is equivalent to |
| 86 | |
| 87 | --local=/local.domain/ |
| 88 | |
| 89 | |
| 90 | Each call to SetServers completely replaces the set of servers |
| 91 | specified by via the DBus, but it leaves any servers specified via the |
| 92 | command line or /etc/dnsmasq.conf or /etc/resolv.conf alone. |
| 93 | |
| 94 | |