Send connman mailing list submissions to
[email protected]
To subscribe or unsubscribe via the World Wide Web, visit
https://lists.01.org/mailman/listinfo/connman
or, via email, send a message with subject or body 'help' to
[email protected]
You can reach the person managing the list at
[email protected]
When replying, please edit your Subject line so it is more specific
than "Re: Contents of connman digest..."
Today's Topics:
1. Re: [PATCH] client: add newline to every error message
(Daniel Wagner)
2. Re: [PATCH v2 1/6] dnsproxy: move dns module prototypes to a
separate file. (Daniel Wagner)
3. Re: [PATCH] peer: Don't try to connect to already connected
peer (Daniel Wagner)
4. [PATCH v3 1/5] dnsproxy: add a new function to the API.
(Ismo Puustinen)
5. [PATCH v3 2/5] resolver: expose dnsproxy mdns support.
(Ismo Puustinen)
6. [PATCH v3 3/5] service: add mDNS support. (Ismo Puustinen)
7. [PATCH v3 4/5] config: support mDNS in service configuration
files. (Ismo Puustinen)
8. [PATCH v3 5/5] connmanctl: add mDNS support. (Ismo Puustinen)
----------------------------------------------------------------------
Message: 1
Date: Fri, 20 Oct 2017 07:56:29 +0200
From: Daniel Wagner <[email protected]>
To: Mikhail Kovyazin <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH] client: add newline to every error message
Message-ID: <[email protected]>
Content-Type: text/plain; charset=utf-8; format=flowed
Hi Mikhail,
On 10/16/2017 04:47 PM, Mikhail Kovyazin wrote:
> ---
> client/commands.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/client/commands.c b/client/commands.c
> index 583095b1..39f15b0a 100644
Patch applied.
Thanks,
Daniel
------------------------------
Message: 2
Date: Fri, 20 Oct 2017 08:09:43 +0200
From: Daniel Wagner <[email protected]>
To: Ismo Puustinen <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH v2 1/6] dnsproxy: move dns module prototypes to a
separate file.
Message-ID: <[email protected]>
Content-Type: text/plain; charset=utf-8; format=flowed
Hi Ismo,
I am terrible sorry I didn't give feedback on this one. I missed it.
On 10/17/2017 02:33 PM, Ismo Puustinen wrote:
> ---
> include/dnsproxy.h | 46
> ++++++++++++++++++++++++++++++++++++++++++++++
> src/connman.h | 7 -------
> src/dns-systemd-resolved.c | 1 +
> src/dnsproxy.c | 1 +
> src/resolver.c | 1 +
> src/tethering.c | 1 +
> 6 files changed, 50 insertions(+), 7 deletions(-)
> create mode 100644 include/dnsproxy.h
So the header files in the include directory are for the interfaces we
offer to the plugins. In this case all changes are inside ConnMan's
core. Also all interfaces are prefixed with '__'.
I suggest you leave the deceleration in the src/connman.h as they are
right now. We just have this big header file with all deceleration :)
The rest looks great. I tested it and works fine.
Thanks,
Daniel
------------------------------
Message: 3
Date: Fri, 20 Oct 2017 08:14:34 +0200
From: Daniel Wagner <[email protected]>
To: Saurav Babu <[email protected]>
Cc: [email protected], [email protected]
Subject: Re: [PATCH] peer: Don't try to connect to already connected
peer
Message-ID: <[email protected]>
Content-Type: text/plain; charset=utf-8; format=flowed
Hi Saurav,
On 10/16/2017 03:57 PM, Saurav Babu wrote:
> Signed-off-by: Saurav Babu <[email protected]>
Patch applied after removing your SoB :)
Thanks,
Daniel
------------------------------
Message: 4
Date: Fri, 20 Oct 2017 13:03:13 +0300
From: Ismo Puustinen <[email protected]>
To: [email protected]
Subject: [PATCH v3 1/5] dnsproxy: add a new function to the API.
Message-ID: <[email protected]>
int __connman_dnsproxy_set_mdns(int index, bool enabled);
Turn mDNS support for the interface with specified interface index
on or off.
---
src/connman.h | 1 +
src/dns-systemd-resolved.c | 35 +++++++++++++++++++++++++++++++++++
src/dnsproxy.c | 5 +++++
3 files changed, 41 insertions(+)
diff --git a/src/connman.h b/src/connman.h
index da4446a4..72f8b113 100644
--- a/src/connman.h
+++ b/src/connman.h
@@ -952,6 +952,7 @@ int __connman_dnsproxy_add_listener(int index);
void __connman_dnsproxy_remove_listener(int index);
int __connman_dnsproxy_append(int index, const char *domain, const char
*server);
int __connman_dnsproxy_remove(int index, const char *domain, const char
*server);
+int __connman_dnsproxy_set_mdns(int index, bool enabled);
int __connman_6to4_probe(struct connman_service *service);
void __connman_6to4_remove(struct connman_ipconfig *ipconfig);
diff --git a/src/dns-systemd-resolved.c b/src/dns-systemd-resolved.c
index 4e9b2ff1..5fe306c3 100644
--- a/src/dns-systemd-resolved.c
+++ b/src/dns-systemd-resolved.c
@@ -36,6 +36,11 @@
#define SYSTEMD_RESOLVED_SERVICE "org.freedesktop.resolve1"
#define SYSTEMD_RESOLVED_PATH "/org/freedesktop/resolve1"
+struct mdns_data {
+ int index;
+ bool enabled;
+};
+
static GHashTable *interface_hash;
static DBusConnection *connection;
static GDBusClient *client;
@@ -399,6 +404,36 @@ static int setup_resolved(void)
return 0;
}
+static void setlinkmulticastdns_append(DBusMessageIter *iter, void *user_data)
{
+ struct mdns_data *data = user_data;
+ char *val = "no";
+
+ if (data->enabled)
+ val = "yes";
+
+ DBG("SetLinkMulticastDNS: %d/%s", data->index, val);
+
+ dbus_message_iter_append_basic(iter, DBUS_TYPE_INT32, &data->index);
+ dbus_message_iter_append_basic(iter, DBUS_TYPE_STRING, &val);
+}
+
+int __connman_dnsproxy_set_mdns(int index, bool enabled)
+{
+ struct mdns_data data = { .index = index, .enabled = enabled };
+
+ if (!resolved_proxy)
+ return -ENOENT;
+
+ if (index < 0)
+ return -EINVAL;
+
+ if (!g_dbus_proxy_method_call(resolved_proxy, "SetLinkMulticastDNS",
+ setlinkmulticastdns_append, NULL, &data, NULL))
+ return -EINVAL;
+
+ return 0;
+}
+
int __connman_dnsproxy_init(void)
{
int ret;
diff --git a/src/dnsproxy.c b/src/dnsproxy.c
index 8b2827a5..1db3eae9 100644
--- a/src/dnsproxy.c
+++ b/src/dnsproxy.c
@@ -3947,6 +3947,11 @@ destroy:
return err;
}
+int __connman_dnsproxy_set_mdns(int index, bool enabled)
+{
+ return -ENOTSUP;
+}
+
void __connman_dnsproxy_cleanup(void)
{
DBG("");
--
2.13.6
------------------------------
Message: 5
Date: Fri, 20 Oct 2017 13:03:14 +0300
From: Ismo Puustinen <[email protected]>
To: [email protected]
Subject: [PATCH v3 2/5] resolver: expose dnsproxy mdns support.
Message-ID: <[email protected]>
Using resolver as an intermediary is required because the system might
be running without dnsproxy support (using -r command line option).
---
src/connman.h | 1 +
src/resolver.c | 8 ++++++++
2 files changed, 9 insertions(+)
diff --git a/src/connman.h b/src/connman.h
index 72f8b113..f105e302 100644
--- a/src/connman.h
+++ b/src/connman.h
@@ -259,6 +259,7 @@ void __connman_resolver_append_fallback_nameservers(void);
int __connman_resolvfile_append(int index, const char *domain, const char
*server);
int __connman_resolvfile_remove(int index, const char *domain, const char
*server);
int __connman_resolver_redo_servers(int index);
+int __connman_resolver_set_mdns(int index, bool enabled);
GKeyFile *__connman_storage_open_global(void);
GKeyFile *__connman_storage_load_global(void);
diff --git a/src/resolver.c b/src/resolver.c
index 75ea5ba6..76f0a8e1 100644
--- a/src/resolver.c
+++ b/src/resolver.c
@@ -652,6 +652,14 @@ static void free_resolvfile(gpointer data)
g_free(entry);
}
+int __connman_resolver_set_mdns(int index, bool enabled)
+{
+ if (!dnsproxy_enabled)
+ return -ENOTSUP;
+
+ return __connman_dnsproxy_set_mdns(index, enabled);
+}
+
int __connman_resolver_init(gboolean dnsproxy)
{
int i;
--
2.13.6
------------------------------
Message: 6
Date: Fri, 20 Oct 2017 13:03:15 +0300
From: Ismo Puustinen <[email protected]>
To: [email protected]
Subject: [PATCH v3 3/5] service: add mDNS support.
Message-ID: <[email protected]>
Add two boolean D-Bus properties for services: mDNS [readonly] and
mDNS.Configuration [readwrite]. The mDNS support for a service is
enabled or disabled by setting true or false to mDNS.Configuration.
Not all DNS backends support mDNS. Currently only systemd-resolved does.
---
doc/service-api.txt | 13 ++++++++
src/connman.h | 2 ++
src/service.c | 88 +++++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 103 insertions(+)
diff --git a/doc/service-api.txt b/doc/service-api.txt
index 6cdb0bb5..194be396 100644
--- a/doc/service-api.txt
+++ b/doc/service-api.txt
@@ -500,3 +500,16 @@ Properties string State [readonly]
Possible values are "half" and "full".
This information is not available.
+
+ bool mDNS [readonly]
+
+ Whether or not mDNS support is enabled. Note that mDNS
+ requires a DNS backend which supports it. Currently the
+ only DNS backend which supports mDNS is
+ systemd-resolved.
+
+ bool mDNS.Configuration [readwrite]
+
+ Same values as mDNS property. The mDNS represents the
+ actual system configuration while this allows user
+ configuration.
diff --git a/src/connman.h b/src/connman.h
index f105e302..f84583b1 100644
--- a/src/connman.h
+++ b/src/connman.h
@@ -709,6 +709,8 @@ int __connman_service_set_ignore(struct connman_service
*service,
bool ignore);
void __connman_service_set_search_domains(struct connman_service *service,
char **domains);
+int __connman_service_set_mdns(struct connman_service *service,
+ bool enabled);
void __connman_service_set_string(struct connman_service *service,
const char *key, const char *value);
diff --git a/src/service.c b/src/service.c
index 21928543..197f2660 100644
--- a/src/service.c
+++ b/src/service.c
@@ -94,6 +94,8 @@ struct connman_service {
char **nameservers_auto;
int nameservers_timeout;
char **domains;
+ bool mdns;
+ bool mdns_config;
char *hostname;
char *domainname;
char **timeservers;
@@ -594,6 +596,9 @@ static int service_load(struct connman_service *service)
service->pac = str;
}
+ service->mdns_config = g_key_file_get_boolean(keyfile,
+ service->identifier, "mDNS", NULL);
+
service->hidden_service = g_key_file_get_boolean(keyfile,
service->identifier, "Hidden", NULL);
@@ -774,6 +779,13 @@ static int service_save(struct connman_service *service)
g_key_file_remove_key(keyfile, service->identifier,
"Proxy.URL", NULL);
+ if (service->mdns_config)
+ g_key_file_set_boolean(keyfile, service->identifier,
+ "mDNS", TRUE);
+ else
+ g_key_file_remove_key(keyfile, service->identifier,
+ "mDNS", NULL);
+
if (service->hidden_service)
g_key_file_set_boolean(keyfile, service->identifier, "Hidden",
TRUE);
@@ -2075,6 +2087,48 @@ static void proxy_configuration_changed(struct
connman_service *service)
proxy_changed(service);
}
+static void mdns_changed(struct connman_service *service)
+{
+ dbus_bool_t mdns = service->mdns;
+
+ if (!allow_property_changed(service))
+ return;
+
+ connman_dbus_property_changed_basic(service->path,
+ CONNMAN_SERVICE_INTERFACE, "mDNS", DBUS_TYPE_BOOLEAN,
+ &mdns);
+}
+
+static void mdns_configuration_changed(struct connman_service *service)
+{
+ dbus_bool_t mdns_config = service->mdns_config;
+
+ if (!allow_property_changed(service))
+ return;
+
+ connman_dbus_property_changed_basic(service->path,
+ CONNMAN_SERVICE_INTERFACE, "mDNS.Configuration",
+ DBUS_TYPE_BOOLEAN, &mdns_config);
+}
+
+static int set_mdns(struct connman_service *service,
+ bool enabled)
+{
+ int result;
+
+ result = __connman_resolver_set_mdns(
+ __connman_service_get_index(service), enabled);
+
+ if (result == 0) {
+ if (service->mdns != enabled) {
+ service->mdns = enabled;
+ mdns_changed(service);
+ }
+ }
+
+ return result;
+}
+
static void timeservers_configuration_changed(struct connman_service *service)
{
if (!allow_property_changed(service))
@@ -2452,6 +2506,14 @@ static void append_properties(DBusMessageIter *dict,
dbus_bool_t limited,
connman_dbus_dict_append_dict(dict, "Proxy.Configuration",
append_proxyconfig, service);
+ val = service->mdns;
+ connman_dbus_dict_append_basic(dict, "mDNS", DBUS_TYPE_BOOLEAN,
+ &val);
+
+ val = service->mdns_config;
+ connman_dbus_dict_append_basic(dict, "mDNS.Configuration",
+ DBUS_TYPE_BOOLEAN, &val);
+
connman_dbus_dict_append_dict(dict, "Provider",
append_provider, service);
}
@@ -3571,6 +3633,23 @@ static DBusMessage *set_property(DBusConnection *conn,
__connman_notifier_proxy_changed(service);
service_save(service);
+ } else if (g_str_equal(name, "mDNS.Configuration")) {
+ dbus_bool_t val;
+
+ if (service->immutable)
+ return __connman_error_not_supported(msg);
+
+ if (type != DBUS_TYPE_BOOLEAN)
+ return __connman_error_invalid_arguments(msg);
+
+ dbus_message_iter_get_basic(&value, &val);
+ service->mdns_config = val;
+
+ mdns_configuration_changed(service);
+
+ set_mdns(service, service->mdns_config);
+
+ service_save(service);
} else if (g_str_equal(name, "IPv4.Configuration") ||
g_str_equal(name, "IPv6.Configuration")) {
@@ -5273,6 +5352,14 @@ void __connman_service_set_search_domains(struct
connman_service *service,
searchdomain_add_all(service);
}
+int __connman_service_set_mdns(struct connman_service *service,
+ bool enabled)
+{
+ service->mdns_config = enabled;
+
+ return set_mdns(service, enabled);
+}
+
static void report_error_cb(void *user_context, bool retry,
void *user_data)
{
@@ -6001,6 +6088,7 @@ int __connman_service_ipconfig_indicate_state(struct
connman_service *service,
"Default service remains in READY state.");
if (type == CONNMAN_IPCONFIG_TYPE_IPV4)
service_rp_filter(service, true);
+ set_mdns(service, service->mdns_config);
break;
case CONNMAN_SERVICE_STATE_ONLINE:
break;
--
2.13.6
------------------------------
Message: 7
Date: Fri, 20 Oct 2017 13:03:16 +0300
From: Ismo Puustinen <[email protected]>
To: [email protected]
Subject: [PATCH v3 4/5] config: support mDNS in service configuration
files.
Message-ID: <[email protected]>
Use key "mDNS" with boolean values. True means that mDNS is enabled --
mDNS domains can be resolved and hostname is registered. False means
that all mDNS functionality for this service is disabled. Note that not
all DNS backends support mDNS: currently systemd-resolved is the only
DNS backend that works with mDNS.
---
doc/config-format.txt | 5 +++++
src/config.c | 8 ++++++++
2 files changed, 13 insertions(+)
diff --git a/doc/config-format.txt b/doc/config-format.txt
index ed3123aa..4e26eddd 100644
--- a/doc/config-format.txt
+++ b/doc/config-format.txt
@@ -63,6 +63,11 @@ Allowed fields:
- SearchDomains: Comma separated list of DNS search domains
- Timeservers: Comma separated list of timeservers
- Domain: Domain name to be used
+- mDNS: Boolean value (true or false). True means that mDNS is enabled --
+ mDNS domains can be resolved and hostname is registered. False means that all
+ mDNS functionality for this service is disabled. Note that not all DNS
+ backends support mDNS: currently systemd-resolved is the only DNS backend
with
+ mDNS.
If IPv4 address is missing then DHCP is used. If IPv6 address is missing,
then SLAAC or DHCPv6 is used.
diff --git a/src/config.c b/src/config.c
index a8c3da89..000a4fbf 100644
--- a/src/config.c
+++ b/src/config.c
@@ -72,6 +72,7 @@ struct connman_config_service {
char *ipv6_gateway;
char *ipv6_privacy;
char *mac;
+ bool mdns;
char **nameservers;
char **search_domains;
char **timeservers;
@@ -112,6 +113,7 @@ static bool cleanup = false;
#define SERVICE_KEY_PASSPHRASE "Passphrase"
#define SERVICE_KEY_SECURITY "Security"
#define SERVICE_KEY_HIDDEN "Hidden"
+#define SERVICE_KEY_MDNS "mDNS"
#define SERVICE_KEY_IPv4 "IPv4"
#define SERVICE_KEY_IPv6 "IPv6"
@@ -152,6 +154,7 @@ static const char *service_possible_keys[] = {
SERVICE_KEY_IPv6,
SERVICE_KEY_IPv6_PRIVACY,
SERVICE_KEY_MAC,
+ SERVICE_KEY_MDNS,
SERVICE_KEY_NAMESERVERS,
SERVICE_KEY_SEARCH_DOMAINS,
SERVICE_KEY_TIMESERVERS,
@@ -514,6 +517,9 @@ static bool load_service_generic(GKeyFile *keyfile,
g_strfreev(strlist);
}
+ service->mdns = __connman_config_get_bool(keyfile, group,
+ SERVICE_KEY_MDNS, NULL);
+
return true;
err:
@@ -1377,6 +1383,8 @@ static int try_provision_service(struct
connman_config_service *config,
__connman_service_set_search_domains(service,
config->search_domains);
+ __connman_service_set_mdns(service, config->mdns);
+
if (config->timeservers)
__connman_service_set_timeservers(service,
config->timeservers);
--
2.13.6
------------------------------
Message: 8
Date: Fri, 20 Oct 2017 13:03:17 +0300
From: Ismo Puustinen <[email protected]>
To: [email protected]
Subject: [PATCH v3 5/5] connmanctl: add mDNS support.
Message-ID: <[email protected]>
Use option 'm' with values 'yes' and 'no'.
---
client/commands.c | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/client/commands.c b/client/commands.c
index 39f15b0a..7488850f 100644
--- a/client/commands.c
+++ b/client/commands.c
@@ -1202,6 +1202,30 @@ static int cmd_config(char *args[], int num, struct
connman_option *options)
config_return, g_strdup(service_name),
NULL, NULL);
break;
+
+ case 'm':
+ switch (parse_boolean(*opt_start)) {
+ case 1:
+ val = TRUE;
+ break;
+ case 0:
+ val = FALSE;
+ break;
+ default:
+ res = -EINVAL;
+ break;
+ }
+ if (res == 0) {
+ res = __connmanctl_dbus_set_property(connection,
+ path, "net.connman.Service",
+ config_return,
+ g_strdup(service_name),
+ "mDNS.Configuration",
+ DBUS_TYPE_BOOLEAN, &val);
+ }
+ index++;
+ break;
+
default:
res = -EINVAL;
break;
@@ -2222,6 +2246,7 @@ static struct connman_option config_options[] = {
{"nameservers", 'n', "<dns1> [<dns2>] [<dns3>]"},
{"timeservers", 't', "<ntp1> [<ntp2>] [...]"},
{"domains", 'd', "<domain1> [<domain2>] [...]"},
+ {"mdns", 'm', "yes|no"},
{"ipv6", 'v', "off|auto [enable|disable|preferred]|\n"
"\t\t\tmanual <address> <prefixlength> <gateway>"},
{"proxy", 'x', "direct|auto <URL>|manual <URL1> [<URL2>] [...]\n"
--
2.13.6
------------------------------
Subject: Digest Footer
_______________________________________________
connman mailing list
[email protected]
https://lists.01.org/mailman/listinfo/connman
------------------------------
End of connman Digest, Vol 24, Issue 24
***************************************