[PATCH] gsupplicant: Ensure callback is called after disconnection in WPS use cases
by Jose Blanquicet
In 7784ca7234be2b854f298f4e150ecaa5212c0301 was added a patch to not perform
"RemoveNetwork" in interface_disconnect_result() for WPS use cases because
"AddNetwork" is not done in these cases. However, the disconnection callback is
not called when there was not error(result == 0). Therefore, flags are not clean
and feature initially introduced in 43e6e141ee352e77fdb894b918f280024785f3df to
make sure disconnection is completed before trying to connect a new network will
not work in WPS use cases.
This patch ensures disconnection callback is always called in WPS use cases.
Reported by Eunok Lee <ogi337(a)gmail.com> while testing RFC for WPS proposal
---
gsupplicant/supplicant.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/gsupplicant/supplicant.c b/gsupplicant/supplicant.c
index 4cb533d..0a3815d 100644
--- a/gsupplicant/supplicant.c
+++ b/gsupplicant/supplicant.c
@@ -4952,20 +4952,24 @@ static void interface_disconnect_result(const char *error,
result = -ECONNABORTED;
}
- if (result < 0 && data->callback) {
- data->callback(result, data->interface, data->user_data);
- data->callback = NULL;
- }
-
/* If we are disconnecting from previous WPS successful
* association. i.e.: it did not went through AddNetwork,
* and interface->network_path was never set. */
if (!data->interface->network_path) {
+ if (data->callback)
+ data->callback(result, data->interface,
+ data->user_data);
+
g_free(data->path);
dbus_free(data);
return;
}
+ if (result < 0 && data->callback) {
+ data->callback(result, data->interface, data->user_data);
+ data->callback = NULL;
+ }
+
if (result != -ECONNABORTED) {
if (network_remove(data) < 0) {
g_free(data->path);
--
1.9.1
4 years, 4 months
[PATCH] doc: add --nobacktrace option to connman.8 manpage
by Alexander Sack
---
doc/connman.8.in | 3 +++
1 file changed, 3 insertions(+)
diff --git a/doc/connman.8.in b/doc/connman.8.in
index 9b71779..ddfba09 100644
--- a/doc/connman.8.in
+++ b/doc/connman.8.in
@@ -80,6 +80,9 @@ Never load these plugins. The option can be a pattern containing
Wifi driver that WiFi/Supplicant should use. If this flag is omitted,
then the value "nl80211,wext" is used by default.
.TP
+.BR \-n ", " \-\-nobacktrace
+Don't print out backtrace information.
+.TP
.BR \-n ", " \-\-nodaemon
Do not daemonize. This is useful for debugging, and directs log output to
the controlling terminal in addition to syslog.
--
2.9.3
4 years, 4 months
Connman problem with changing timezone on read-only rootfs
by Viliam Lejcik
Hi all,
Recently we started testing our yocto-based linux OS on a read-only root file system and we've run into a problem with changing a timezone. It happens because the /etc/localtime file is in the read-only partition and connman cannot overwrite it. We've solved the problem by changing the /etc/localtime file to a symlink pointing somewhere to a writeable partition (e.g. /var). In this case connman still tries to delete the /etc/localtime link on a timezone change request (see write_file()), but it doesn't care if it was successful, so the link file stays unchanged and the following open() call will overwrite the target file. If a developer temporarily remouted the filesystem to read-write mode and changed a timezone, the link is replaced with a regular file. Moreover, connman sets inotify_add_watch() for the /etc dir and if the localtime file is a link, it doesn't catch changes in the target file content.
I am enclosing a patch with a more general solution for this problem. It covers situations where /etc/localtime file is:
- regular file, it is overwritten everytime (the same as before)
- link file pointing somewhere into /usr/share/zoneinfo/..., what is usually an initial state after clean OS installation, the link file is removed and replaced with a regular file (the same as before)
- link file pointing somewhere else (e.g. /var/...), the link file is preserved and the target file is overwritten, moreover connman watches for changes in the directory where the link file points to (new behavior)
The patch doesn't handle the situation when /etc/localhost link file is modified by another process or user and is relinked to point into another directory, as I'm not sure if this is necessary.
What do you think about my solution? For us this is sufficient, and I think it may be helpful for others too. Thank you for review.
Best Regards,
Viliam
4 years, 4 months
[PATCH] config: Make storage directory configurable from the command line
by Slava Monich
---
Makefile.am | 6 +++---
src/connman.h | 3 +++
src/main.c | 9 +++++++++
tools/session-test.c | 2 +-
vpn/main.c | 9 +++++++++
5 files changed, 25 insertions(+), 4 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index 9c13630..3f4ea5e 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -223,7 +223,7 @@ AM_CFLAGS = @DBUS_CFLAGS@ @GLIB_CFLAGS@ \
-DVPN_STATEDIR=\""$(vpn_statedir)"\" \
-DPLUGINDIR=\""$(build_plugindir)"\" \
-DSCRIPTDIR=\""$(build_scriptdir)"\" \
- -DSTORAGEDIR=\""$(storagedir)\"" \
+ -DDEFAULT_STORAGEDIR=\""$(storagedir)\"" \
-DVPN_STORAGEDIR=\""$(vpn_storagedir)\"" \
-DCONFIGDIR=\""$(configdir)\""
@@ -239,7 +239,7 @@ src_connmand_CFLAGS = @DBUS_CFLAGS@ @GLIB_CFLAGS@ \
-DSTATEDIR=\""$(statedir)"\" \
-DPLUGINDIR=\""$(build_plugindir)"\" \
-DSCRIPTDIR=\""$(build_scriptdir)"\" \
- -DSTORAGEDIR=\""$(storagedir)\"" \
+ -DDEFAULT_STORAGEDIR=\""$(storagedir)\"" \
-DVPN_STORAGEDIR=\""$(vpn_storagedir)\"" \
-DCONFIGDIR=\""$(configdir)\"" \
-I$(builddir)/src
@@ -255,7 +255,7 @@ vpn_connman_vpnd_CFLAGS = @DBUS_CFLAGS@ @GLIB_CFLAGS@ \
-DVPN_STATEDIR=\""$(vpn_statedir)"\" \
-DPLUGINDIR=\""$(build_vpn_plugindir)"\" \
-DSCRIPTDIR=\""$(build_scriptdir)"\" \
- -DSTORAGEDIR=\""$(storagedir)\"" \
+ -DDEFAULT_STORAGEDIR=\""$(storagedir)\"" \
-DVPN_STORAGEDIR=\""$(vpn_storagedir)\"" \
-DCONFIGDIR=\""$(configdir)\"" \
-I$(builddir)/vpn
diff --git a/src/connman.h b/src/connman.h
index 401e3d7..b743678 100644
--- a/src/connman.h
+++ b/src/connman.h
@@ -253,6 +253,9 @@ int __connman_resolvfile_append(int index, const char *domain, const char *serve
int __connman_resolvfile_remove(int index, const char *domain, const char *server);
int __connman_resolver_redo_servers(int index);
+#define STORAGEDIR __connman_storage_dir()
+
+const char *__connman_storage_dir(void);
GKeyFile *__connman_storage_open_global(void);
GKeyFile *__connman_storage_load_global(void);
int __connman_storage_save_global(GKeyFile *keyfile);
diff --git a/src/main.c b/src/main.c
index fdb4f72..45bdddd 100644
--- a/src/main.c
+++ b/src/main.c
@@ -462,6 +462,7 @@ static void disconnect_callback(DBusConnection *conn, void *user_data)
}
static gchar *option_config = NULL;
+static gchar *option_storagedir = NULL;
static gchar *option_debug = NULL;
static gchar *option_device = NULL;
static gchar *option_plugin = NULL;
@@ -473,6 +474,11 @@ static gboolean option_dnsproxy = TRUE;
static gboolean option_backtrace = TRUE;
static gboolean option_version = FALSE;
+const char *__connman_storage_dir(void)
+{
+ return option_storagedir ? option_storagedir : DEFAULT_STORAGEDIR;
+}
+
static bool parse_debug(const char *key, const char *value,
gpointer user_data, GError **error)
{
@@ -488,6 +494,9 @@ static GOptionEntry options[] = {
{ "config", 'c', 0, G_OPTION_ARG_STRING, &option_config,
"Load the specified configuration file "
"instead of " CONFIGMAINFILE, "FILE" },
+ { "storage", 's', 0, G_OPTION_ARG_STRING, &option_storagedir,
+ "Use the specified storage directory "
+ "instead of " DEFAULT_STORAGEDIR, "DIR" },
{ "debug", 'd', G_OPTION_FLAG_OPTIONAL_ARG,
G_OPTION_ARG_CALLBACK, parse_debug,
"Specify debug options to enable", "DEBUG" },
diff --git a/tools/session-test.c b/tools/session-test.c
index 4319e5a..855bfb6 100644
--- a/tools/session-test.c
+++ b/tools/session-test.c
@@ -32,7 +32,7 @@
#include "session-test.h"
-#define POLICYDIR STORAGEDIR "/session_policy_local"
+#define POLICYDIR DEFAULT_STORAGEDIR "/session_policy_local"
enum test_session_state {
TEST_SESSION_STATE_0 = 0,
diff --git a/vpn/main.c b/vpn/main.c
index ee88aac..3d0c8e8 100644
--- a/vpn/main.c
+++ b/vpn/main.c
@@ -185,6 +185,7 @@ static void disconnect_callback(DBusConnection *conn, void *user_data)
}
static gchar *option_config = NULL;
+static gchar *option_storagedir = NULL;
static gchar *option_debug = NULL;
static gchar *option_plugin = NULL;
static gchar *option_noplugin = NULL;
@@ -192,6 +193,11 @@ static bool option_detach = true;
static bool option_version = false;
static bool option_routes = false;
+const char *__connman_storage_dir(void)
+{
+ return option_storagedir ? option_storagedir : DEFAULT_STORAGEDIR;
+}
+
static bool parse_debug(const char *key, const char *value,
gpointer user_data, GError **error)
{
@@ -207,6 +213,9 @@ static GOptionEntry options[] = {
{ "config", 'c', 0, G_OPTION_ARG_STRING, &option_config,
"Load the specified configuration file "
"instead of " CONFIGMAINFILE, "FILE" },
+ { "storage", 's', 0, G_OPTION_ARG_STRING, &option_storagedir,
+ "Use the specified storage directory "
+ "instead of " DEFAULT_STORAGEDIR, "DIR" },
{ "debug", 'd', G_OPTION_FLAG_OPTIONAL_ARG,
G_OPTION_ARG_CALLBACK, parse_debug,
"Specify debug options to enable", "DEBUG" },
--
1.9.1
4 years, 4 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, 4 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, 4 months