[PATCH 0/2] DHCPv6 infinite expiry times
by Patrik Flykt
Hi,
This patch set is heavily influenced by the patch set from
wangfe(a)nestlabs.com. The difference is that T1, T2 and expiry
timeouts are all set to 0xffffffff (infinite) when the expiry
time is infinite. With this it is believed any further changes
will be much smaller, as the code already checks for T1 and
T2 being unequal to 0xffffffff.
Wang Feng, does this work with your setup?
Cheers,
Patrik
Patrik Flykt (2):
dhcpv6: Return -EISCONN when the expiry time is inifinite
gdhcp: Set T1 and T2 to infinite if expiry time is infinite
gdhcp/client.c | 9 ++++++---
src/dhcpv6.c | 5 +++++
2 files changed, 11 insertions(+), 3 deletions(-)
--
2.8.1
4 years, 2 months
[PATCH 1/3] docs: update manager-api.txt to include BrowserOnly Key
by Atul Anand
It has been documented that we are adding a new dict key BrowserOnly
on PACrunner DBus interface.
---
doc/manager-api.txt | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/doc/manager-api.txt b/doc/manager-api.txt
index 9e6209d..0e0b7aa 100644
--- a/doc/manager-api.txt
+++ b/doc/manager-api.txt
@@ -60,6 +60,12 @@ Methods object CreateProxyConfiguration(dict settings)
Interface name like "wlan0" etc. to provide
consistent results for myIpAddress function.
+ boolean BrowserOnly [optional]
+
+ If this value is set, proxy configuration will
+ be used for only browser schemes. If no Key is
+ received PACrunner assumes FALSE by default.
+
array{string} Domains [optional]
Domain names and IP range for which this proxy
--
2.5.5
4 years, 4 months
[PATCH 0/1] Fix nameserver and search domain ordering when writing resolv.conf
by Sam Nazarko
Hi,
This patch fixes an issue where DNS servers and search domains are written to
resolv.conf in the reverse order. This has caused problems with some OSMC users that
have relied on the primary DNS server to be listed first and have a faulty or intermittent
secondary DNS server. While I am in agreement that these users should fix their secondary
DNS server, we should still respect the ordering that they configure or get via DHCP.
I previously submitted a patch to this mailing list in hope of addressing an issue
however the ConnMan mailing list disappeared for a while and I lost my post. This
new patch resolves both search domains and DNS servers being out of order.
Sam Nazarko
4 years, 4 months
[PATCH v0 0/2] OpenVPN logging
by Daniel Wagner
From: Daniel Wagner <daniel.wagner(a)bmw-carit.de>
Hi,
I am debugging some network setups here and found out that we don't
log anything from OpenVPN which is pretty sad. Let's fix this.
cheers,
daniel
Daniel Wagner (2):
openvpn: Fix stdout/stderr forwarding from deamon
openvpn: Add verbose flag
vpn/plugins/openvpn.c | 49 ++++++++++++++++++++++++++++++++++++++++++++-----
1 file changed, 44 insertions(+), 5 deletions(-)
--
2.5.5
4 years, 4 months
[PATCH] timezone: Add support for setting timezone using timedated
by Philip Withnall
If we are running under systemd, the ProtectSystem key in our .service
file prevents us from writing to /etc/localtime. Instead, set the
timezone by using org.freedesktop.timedate1 over D-Bus, if it is
available. If it is not available, fall back to /etc/localtime.
Signed-off-by: Philip Withnall <philip.withnall(a)collabora.co.uk>
---
src/timezone.c | 213 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 210 insertions(+), 3 deletions(-)
diff --git a/src/timezone.c b/src/timezone.c
index e346b11..c74bfdd 100644
--- a/src/timezone.c
+++ b/src/timezone.c
@@ -38,11 +38,46 @@
#include <glib.h>
#include "connman.h"
+#include "gdbus.h"
#define ETC_LOCALTIME "/etc/localtime"
#define ETC_SYSCONFIG_CLOCK "/etc/sysconfig/clock"
#define USR_SHARE_ZONEINFO "/usr/share/zoneinfo"
+/* See https://www.freedesktop.org/wiki/Software/systemd/timedated/ for
+ * reference. */
+#define TIMEDATED_SERVICE "org.freedesktop.timedate1"
+#define TIMEDATED_INTERFACE TIMEDATED_SERVICE
+#define TIMEDATED_PATH "/org/freedesktop/timedate1"
+
+static GDBusClient *timedated_client = NULL;
+static GDBusProxy *timedated_proxy = NULL;
+static gchar *timedated_timezone = NULL;
+
+static void timedate_property_changed(GDBusProxy *proxy, const char *name,
+ DBusMessageIter *iter, void *user_data)
+{
+ DBG("Property %s", name);
+
+ if (g_str_equal(name, "Timezone")) {
+ const char *str;
+
+ if (!iter) {
+ g_dbus_proxy_refresh_property(proxy, name);
+ return;
+ }
+
+ if (dbus_message_iter_get_arg_type(iter) != DBUS_TYPE_STRING)
+ return;
+
+ dbus_message_iter_get_basic(iter, &str);
+ g_free(timedated_timezone);
+ timedated_timezone = g_strdup(str);
+
+ DBG("Timezone set to %s", timedated_timezone);
+ }
+}
+
static char *read_key_file(const char *pathname, const char *key)
{
struct stat st;
@@ -226,7 +261,36 @@ static char *find_origin(void *src_map, struct stat *src_st,
return NULL;
}
-char *__connman_timezone_lookup(void)
+/* Query the timezone from org.freedesktop.timedate1. */
+static char *__connman_timezone_lookup_dbus(void)
+{
+ DBusMessageIter iter;
+ const char *str;
+
+ DBG("");
+
+ /* If timedated_timezone is set, we have been notified of the timezone
+ * previously. */
+ if (timedated_proxy && timedated_timezone)
+ return timedated_timezone;
+
+ /* Not connected to the D-Bus service? */
+ if (!timedated_proxy)
+ return NULL;
+
+ /* Query D-Bus and update the cache. */
+ if (!g_dbus_proxy_get_property(timedated_proxy, "Timezone", &iter))
+ return NULL;
+ dbus_message_iter_get_basic(&iter, &str);
+
+ g_free(timedated_timezone);
+ timedated_timezone = g_strdup(str);
+
+ return g_strdup(timedated_timezone);
+}
+
+/* Look up the timezone from /etc/sysconfig/clock or /etc/localtime. */
+static char *__connman_timezone_lookup_filesystem(void)
{
struct stat st;
void *map;
@@ -284,6 +348,20 @@ done:
return zone;
}
+char *__connman_timezone_lookup(void)
+{
+ char *timezone;
+
+ DBG("");
+
+ /* Try D-Bus first; then fall back to the filesystem. */
+ timezone = __connman_timezone_lookup_dbus();
+ if (timezone)
+ return timezone;
+
+ return __connman_timezone_lookup_filesystem();
+}
+
static int write_file(void *src_map, struct stat *src_st, const char *pathname)
{
struct stat st;
@@ -311,7 +389,53 @@ static int write_file(void *src_map, struct stat *src_st, const char *pathname)
return 0;
}
-int __connman_timezone_change(const char *zone)
+static void timezone_change_dbus_cb(DBusMessage *message, void *user_data)
+{
+ const char *zone = user_data;
+
+ if (dbus_message_get_type(message) == DBUS_MESSAGE_TYPE_ERROR) {
+ const char *dbus_error = dbus_message_get_error_name(message);
+
+ DBG("zone %s %s", zone, dbus_error);
+ } else {
+ DBG("zone %s success", zone);
+ }
+}
+
+static void timezone_change_dbus_append(DBusMessageIter *iter,
+ void *user_data)
+{
+ const char *zone = user_data;
+ dbus_bool_t user_interaction = FALSE;
+
+ /* The second parameter is user_interaction — whether polkit should ask
+ * for credentials interactively if necessary. We do not want that.
+ *
+ * The polkit action controlling this is:
+ * org.freedesktop.timedate1.set-timezone. */
+ dbus_message_iter_append_basic(iter, DBUS_TYPE_STRING, &zone);
+ dbus_message_iter_append_basic(iter, DBUS_TYPE_BOOLEAN, &user_interaction);
+}
+
+/* Set the timezone using org.freedesktop.timedate1. */
+static int __connman_timezone_change_dbus(const char *zone)
+{
+ /* Are we connected to the D-Bus service? */
+ if (!timedated_proxy)
+ return -ENOENT;
+
+ DBG("zone %s", zone);
+
+ if (!g_dbus_proxy_method_call(timedated_proxy, "SetTimezone",
+ timezone_change_dbus_append, timezone_change_dbus_cb,
+ g_strdup(zone), g_free))
+ return -EIO;
+
+ return -EINPROGRESS;
+}
+
+/* Set the timezone by overwriting /etc/localtime. */
+static int __connman_timezone_change_filesystem(const char *zone)
{
struct stat st;
char *map, pathname[PATH_MAX];
@@ -345,6 +469,23 @@ int __connman_timezone_change(const char *zone)
return err;
}
+int __connman_timezone_change(const char *zone)
+{
+ int err;
+
+ DBG("");
+
+ /* Try D-Bus first; then fall back to the filesystem. This order is
+ * important, as if we are running under systemd, /etc will be mounted
+ * read-only (due to the ProtectSystem key in our .service file), and
+ * hence only org.freedesktop.timedate1 can be used. */
+ err = __connman_timezone_change_dbus(zone);
+ if (err >= 0 || err == -EINPROGRESS)
+ return 0;
+
+ return __connman_timezone_change_filesystem(zone);
+}
+
static guint inotify_watch = 0;
static gboolean inotify_data(GIOChannel *channel, GIOCondition cond,
@@ -402,7 +543,45 @@ static gboolean inotify_data(GIOChannel *channel, GIOCondition cond,
return TRUE;
}
-int __connman_timezone_init(void)
+static int __connman_timezone_init_dbus(void)
+{
+ DBusConnection *connection;
+ int err = -EIO;
+
+ DBG("");
+
+ /* Try connecting to org.freedesktop.timedate1 first. If that fails,
+ * try /etc/localtime as a fallback. */
+ connection = connman_dbus_get_connection();
+
+ timedated_client = g_dbus_client_new(connection, TIMEDATED_SERVICE,
+ TIMEDATED_PATH);
+ if (!timedated_client)
+ goto error;
+
+ timedated_proxy = g_dbus_proxy_new(timedated_client, TIMEDATED_PATH,
+ TIMEDATED_INTERFACE);
+ if (!timedated_proxy)
+ goto error;
+
+ g_dbus_proxy_set_property_watch(timedated_proxy,
+ timedate_property_changed, NULL);
+
+ dbus_connection_unref(connection);
+
+ return 0;
+error:
+ if (timedated_client) {
+ g_dbus_client_unref(timedated_client);
+ timedated_client = NULL;
+ }
+
+ dbus_connection_unref(connection);
+
+ return err;
+}
+
+static int __connman_timezone_init_filesystem(void)
{
GIOChannel *channel;
char *dirname;
@@ -443,6 +622,21 @@ int __connman_timezone_init(void)
return 0;
}
+int __connman_timezone_init(void)
+{
+ int err;
+
+ DBG("");
+
+ /* Try connecting to org.freedesktop.timedate1 first. If that fails,
+ * try /etc/localtime as a fallback. */
+ err = __connman_timezone_init_dbus();
+ if (err >= 0)
+ return err;
+
+ return __connman_timezone_init_filesystem();
+}
+
void __connman_timezone_cleanup(void)
{
DBG("");
@@ -451,4 +645,17 @@ void __connman_timezone_cleanup(void)
g_source_remove(inotify_watch);
inotify_watch = 0;
}
+
+ if (timedated_proxy) {
+ g_dbus_proxy_unref(timedated_proxy);
+ timedated_proxy = NULL;
+ }
+
+ if (timedated_client) {
+ g_dbus_client_unref(timedated_client);
+ timedated_client = NULL;
+ }
+
+ g_free(timedated_timezone);
+ timedated_timezone = NULL;
}
--
2.7.4
4 years, 4 months
Question about "MoveBefore" and notifications
by l.genevet
Hello,
I am working on an connman integrated in an embedded system for home
automation.
We are using Connman 1.23 with an Ofono plugin to be able to switch to a
GSM modem in case of an issue with the ethernet interface.
If we are not able to ping our server even if the ethernet service is
ready, we would like to force the switch to the GSM.
For that, we use the connman Service MoveBefore API.
After MoveBefore :
- the GSM interface is used.
- the default route is up to date.
But
- connman does not notify a change of State on the ethernet or the GSM
interface.
- the services are not reordered after the switch.
Is this seems like a normal behaviour ?
Are there any other way to be notified via connman that the default
route has changed?
I saw that IPv4 "Gateway" field of the ethernet interface disappears
once MoveBefore GSM has changed -> can I use that information to be sure
ethernet does not have the default route anymore?
Thanks by advance for your help,
Regards,
Lidwine
4 years, 5 months
[PATCH v2] Port pacrunner to mozjs24
by Jeremy Linton
This patch moves pacrunner to mozjs24. This is still
a little behind the times, but gnome/etc are using mozjs24
so the distro's are on the hook for supporting it.
v1->v2 Change automake script so that --disable-mozjs doesn't require
pacrunner to depend on the C++ support libraries.
Jeremy Linton (1):
Pull pacrunner forward to mozjs24
Makefile.am | 20 +++++++++++++-------
configure.ac | 4 ++--
plugins/{mozjs.c => mozjs.cpp} | 36 +++++++++++++++++++-----------------
3 files changed, 34 insertions(+), 26 deletions(-)
rename plugins/{mozjs.c => mozjs.cpp} (82%)
--
2.9.2
4 years, 5 months
[PATCH v4 0/6] [PATCH v3 0/6] Add nftables support
by Daniel Wagner
From: Daniel Wagner <daniel.wagner(a)bmw-carit.de>
Thanks Dragos for testing and feedback. I tested NAT so far which
works nicely for me.
changes v4:
- fixed nat rule (routing)
- rebased on current HEAD
changes v3:
- fixed error handling when cleaning up (this time for real)
- dropped chain handlers (not used)
- tell kernel to load modules if needed via NLM_F_CREATE
- mask saddr address with netmask for NAT rule (bug fix)
changes v2:
- rebased to current master
- fixed some error handling path (memory leak)
- fixed typo and error handling reported by dtatulea
- compiler complains
- issue no warning if table cleaning up was successful
Daniel Wagner (6):
session: Install SNAT rules only once per device
firewall: Initialize iptables directly from firewall.c
firewall: Add explicit feature API
firewall: Rename firewall.c to firewall-iptables.c
firewall: Add nftables build infrastructure
firewall-nftables: Add nftable support for firewall
Makefile.am | 48 +-
configure.ac | 31 +-
src/connman.h | 22 +-
src/firewall-iptables.c | 622 +++++++++++++++++++++++++
src/firewall-nftables.c | 1153 +++++++++++++++++++++++++++++++++++++++++++++++
src/firewall.c | 542 ----------------------
src/main.c | 2 -
src/nat.c | 21 +-
src/session.c | 187 ++++----
tools/iptables-unit.c | 112 -----
10 files changed, 1940 insertions(+), 800 deletions(-)
create mode 100644 src/firewall-iptables.c
create mode 100644 src/firewall-nftables.c
delete mode 100644 src/firewall.c
--
2.7.4
4 years, 5 months
[PATCH 0/3] New WPS Implementation
by Jose Blanquicet
Hi,
this is the WPS implementation following our previous agreements.
Please, let us know what do you think.
Best Regards,
Jose Blanquicet
Jose Blanquicet (3):
technology: Add specific D-Bus methods for WPS connections
technology: Add WPS Cancel feature
client: Add commands for new specific WPS D-Bus methods
client/commands.c | 125 ++++++++++++++++
client/dbus_helpers.c | 2 +-
doc/agent-api.txt | 6 +
doc/connmanctl.1.in | 14 +-
doc/technology-api.txt | 43 ++++++
gsupplicant/gsupplicant.h | 18 +++
gsupplicant/supplicant.c | 321 ++++++++++++++++++++++++++++------------
include/technology.h | 11 ++
plugins/wifi.c | 364 +++++++++++++++++++++++++++++++++++++++++++---
src/connman.h | 1 +
src/peer.c | 5 +-
src/technology.c | 160 ++++++++++++++++++++
12 files changed, 949 insertions(+), 121 deletions(-)
--
1.9.1
4 years, 5 months
Connman on Android/Brillo
by Naveen Singh
Hi Patrick
I had this talk with Marcel few weeks back about compiling connman on
Android/Brillo. This would surely give connman the penetration into
Android world and future IoT devices which are based of Brillo.
I actually got it compiled and working. There are two challenges:
a) Some of the libraries that are required by connman are missing. For
my work I got those libraries compiled first.
b) Changes in connman itself: Open source connman does not compile as
such for Android/Brillo. There are some changes needed in connman to
get this going. I would like to see if we can upstream these changes.
The intent of this email is to discuss those changes. Following are
the changes needed:
1) Backtrace system call: In log.c from function print_backtrace we
call backtrace. It is a glibc API and is no present in bionic. There
is an equivalent function in bionic for doing this.
2) hard check for ns_initparse in libresolv.so: There is no
libresolv.so for android/Brillo. All these ns_* symbols are part of
libc.so. So hard check has to go. We may need to check in configure.ac
whether we are compiling against glibc or bionic early on and do stuff
differently.
3) NTP code calls adjtime to adjust clock. This function is missing in
bionic. We may need to find a similar function in bionic for doing
this.
4) struct in6_pktinfo is defined in connman code (file gdhcp/common.h)
under #ifndef __USE_GNU. Now this structure is defined in bionic
header file libc/kernel/uapi/ipv6.h. Not sure what is the intent of
#ifndef __USE_GNU? Should this go away? Similarly struct in6_ifreq is
defined in inet.c file and it is also defined in the same bionic
header file. I had to comment out this definition to compile connman.
5) Some of the structures which are needed for connman compilation are
defined under #ifdef __USE_BSD in bionic header file. For Bionic
__USE_BSD is defined only if _GNU_SOURCE is defined. So for those
files in connman we have to define _GNU_SOURCE as the first line in
that file. Example is ipv4ll.c. I hope this should be OK.
6) GResolv structure in gresolv.c: struct __res_state is a member for
GResolv structure. This structure is defined in resolv.h file in
glibc. struct __res_state in bionic requires inclusion of two other
header files resolv_private.h and res_private. Also this structure is
defined very differently between bionic and glibc. This caused changes
in gresolv.c, the way it accesses various members of this structure.
7) Struct sockaddr_in6 defined differently b/w bionic and glibc.
8) ETH_ALEN is not defined in bionic header file
9) Need to include resolv_params.h in resolver.c. This is because
"MAXDNSRCH" etc is defined in resolv_params.h in bionic.
10) Needed to remove "-lresolv -lrt" from Makefile.am.
Some of these changes are easily doable if we can have #ifdef ANDROID
in code. Through configure.ac we can detect if we are compiling
against bionic or glibc and appropriately turn on this flag. Not sure
what your thought are on this.
Regards
Naveen
4 years, 5 months