mirror of
https://github.com/pi-hole/dnsmasq.git
synced 2025-12-19 10:18:25 +00:00
New DBus methods.
This commit is contained in:
committed by
Simon Kelley
parent
4b34f5d22f
commit
c4638f9e66
@@ -8,6 +8,9 @@ version 2.72
|
|||||||
interface goes down and up rapidly. Thanks to Conrad
|
interface goes down and up rapidly. Thanks to Conrad
|
||||||
Kostecki for helping to chase this down.
|
Kostecki for helping to chase this down.
|
||||||
|
|
||||||
|
Add DBus methods SetFilterWin2KOption and SetBogusPrivOption
|
||||||
|
Thanks to the Smoothwall project for the patch.
|
||||||
|
|
||||||
|
|
||||||
version 2.71
|
version 2.71
|
||||||
Subtle change to error handling to help DNSSEC validation
|
Subtle change to error handling to help DNSSEC validation
|
||||||
|
|||||||
@@ -40,6 +40,14 @@ ClearCache
|
|||||||
Returns nothing. Clears the domain name cache and re-reads
|
Returns nothing. Clears the domain name cache and re-reads
|
||||||
/etc/hosts. The same as sending dnsmasq a HUP signal.
|
/etc/hosts. The same as sending dnsmasq a HUP signal.
|
||||||
|
|
||||||
|
SetFilterWin2KOption
|
||||||
|
--------------------
|
||||||
|
Takes boolean, sets or resets the --filterwin2k option.
|
||||||
|
|
||||||
|
SetBogusPrivOption
|
||||||
|
------------------
|
||||||
|
Takes boolean, sets or resets the --bogus-priv option.
|
||||||
|
|
||||||
SetServers
|
SetServers
|
||||||
----------
|
----------
|
||||||
Returns nothing. Takes a set of arguments representing the new
|
Returns nothing. Takes a set of arguments representing the new
|
||||||
|
|||||||
38
src/dbus.c
38
src/dbus.c
@@ -44,6 +44,12 @@ const char* introspection_xml_template =
|
|||||||
" <method name=\"SetServersEx\">\n"
|
" <method name=\"SetServersEx\">\n"
|
||||||
" <arg name=\"servers\" direction=\"in\" type=\"aas\"/>\n"
|
" <arg name=\"servers\" direction=\"in\" type=\"aas\"/>\n"
|
||||||
" </method>\n"
|
" </method>\n"
|
||||||
|
" <method name=\"SetFilterWin2KOption\">\n"
|
||||||
|
" <arg name=\"filterwin2k\" direction=\"in\" type=\"b\"/>\n"
|
||||||
|
" </method>\n"
|
||||||
|
" <method name=\"SetBogusPrivOption\">\n"
|
||||||
|
" <arg name=\"boguspriv\" direction=\"in\" type=\"b\"/>\n"
|
||||||
|
" </method>\n"
|
||||||
" <signal name=\"DhcpLeaseAdded\">\n"
|
" <signal name=\"DhcpLeaseAdded\">\n"
|
||||||
" <arg name=\"ipaddr\" type=\"s\"/>\n"
|
" <arg name=\"ipaddr\" type=\"s\"/>\n"
|
||||||
" <arg name=\"hwaddr\" type=\"s\"/>\n"
|
" <arg name=\"hwaddr\" type=\"s\"/>\n"
|
||||||
@@ -372,6 +378,30 @@ static DBusMessage* dbus_read_servers_ex(DBusMessage *message, int strings)
|
|||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static DBusMessage *dbus_set_bool(DBusMessage *message, int flag, char *name)
|
||||||
|
{
|
||||||
|
DBusMessageIter iter;
|
||||||
|
dbus_bool_t enabled;
|
||||||
|
|
||||||
|
if (!dbus_message_iter_init(message, &iter) || dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_BOOLEAN)
|
||||||
|
return dbus_message_new_error(message, DBUS_ERROR_INVALID_ARGS, "Expected boolean argument");
|
||||||
|
|
||||||
|
dbus_message_iter_get_basic(&iter, &enabled);
|
||||||
|
|
||||||
|
if (enabled)
|
||||||
|
{
|
||||||
|
my_syslog(LOG_INFO, "Enabling --%s option from D-Bus", name);
|
||||||
|
set_option_bool(flag);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
my_syslog(LOG_INFO, "Disabling --$s option from D-Bus", name);
|
||||||
|
reset_option_bool(flag);
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
DBusHandlerResult message_handler(DBusConnection *connection,
|
DBusHandlerResult message_handler(DBusConnection *connection,
|
||||||
DBusMessage *message,
|
DBusMessage *message,
|
||||||
void *user_data)
|
void *user_data)
|
||||||
@@ -415,6 +445,14 @@ DBusHandlerResult message_handler(DBusConnection *connection,
|
|||||||
reply = dbus_read_servers_ex(message, 1);
|
reply = dbus_read_servers_ex(message, 1);
|
||||||
new_servers = 1;
|
new_servers = 1;
|
||||||
}
|
}
|
||||||
|
else if (strcmp(method, "SetFilterWin2KOption") == 0)
|
||||||
|
{
|
||||||
|
reply = dbus_set_bool(message, OPT_FILTER, "filterwin2k");
|
||||||
|
}
|
||||||
|
else if (strcmp(method, "SetBogusPrivOption") == 0)
|
||||||
|
{
|
||||||
|
reply = dbus_set_bool(message, OPT_BOGUSPRIV, "bogus-priv");
|
||||||
|
}
|
||||||
else if (strcmp(method, "ClearCache") == 0)
|
else if (strcmp(method, "ClearCache") == 0)
|
||||||
clear_cache = 1;
|
clear_cache = 1;
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user