Re: question: settings and profiles for connman

2014-09-02 Thread Patrik Flykt

Hi,

On Fri, 2014-08-29 at 15:01 +0200, Benjamin Block wrote:

 I just wanted to ask, if it is possible to configure connman in a way
 that I can switch to specific settings depending on the location I am at
 (no problem if I have to trigger this switch) and maybe fall back to
 dhcpcd or other stuff like it, if I get to a new location.
 
 Thing is, I use my laptop in 4 different locations, each location has
 its own set of settings. 3 of them require me to use a specific ip, 1
 even a specific firewall-setting (iptables). I'd like to configure one
 profile for each of those location (state the config for each of my
 devices [eth0, wlan0, wwan0]) and then let connman switch between these
 profiles - likely by using a connmanctl-command. If I am at a new
 location, then I'd fall back to all the fancy automation.

ConnMan does not do any additional profile based configuration, so that
has to be added by an external program.

The perhaps easiest way of solving this would be a separate tool, which
moves (copies) required ConnMan .config files to and
from /var/lib/connman. The ownership of that directory should be set
properly, as the current root.root user and owner is merely just a
placeholder for the tool developer or distro maintainer to update when
needed. 

The easiest solution might be to store all .config files relevant to a
certain profile in a specific directory, e.g.
'/var/lib/name-of-tool/profiles/name-of-profile/*.config'. Based on
user selection the .config files based on the previous profile are to be
removed with the .config files for the new profile added
to /var/lib/connman. It is a good idea to remove only the previous
profile specific .config files from /var/lib/connman and not every file,
as some other program(s) or the user him/herself may have added
specific .config files for some other purpose than the profiles handled
by this tool.

 Is that possible and if yes, how? I was locking at the documentation
 coming with connman, but they seem quite outdated in places (for
 example, I was reading `config-format.txt` and tried to create such a
 config at `/var/log/connman/work.conf`; but this was ignored

'/var/lib/connman/work.config' is the correct name and location for this
file.

 completely). Also I wonder how to tell connman how to ignore some of my
 network-devices (I tried the command line option and the option
 `/etc/connman/main.cfg`), it seems to ignore me quite good on this.

And that would be '/etc/connman/main.conf'.

Cheers,

Patrik


___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman


Re: [PATCH] ipconfig: Do not pass a NULL pointer to D-Bus

2014-09-02 Thread Patrik Flykt
On Fri, 2014-08-29 at 10:00 +0300, Hannu Mallat wrote:
 connman_inet_ifname() may return a NULL pointer e.g. if the interface
 does not exist in the kernel anymore but connman isn't yet aware of
 that. Passing a NULL pointer to D-Bus may result in an abort, so check
 the return value.

Applied, thanks!

Patrik

___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman


Re: [PATCH] peer: Add debug msg for peer state

2014-09-02 Thread Patrik Flykt
On Thu, 2014-08-28 at 23:41 -0400, Eduardo Abinader wrote:
 In order to ease the debug task of peer state changes, inserted
 this old state/new state track.

Applied, thanks!

Patrik

___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman


Re: [PATCH] service: Change service state before changing manager state

2014-09-02 Thread Patrik Flykt

Hi,

On Thu, 2014-08-28 at 15:44 +0800, Chengyi Zhao wrote:

 The manager state is a global connection state of the system,
 and it is a result of evaluating various notification states.
 
 In order to ensure the consistency of data, ConnMan should
 change the service state before changing the manager state,
 wheter to change local states or emitting remote signals.

What consistency are you after here? Is it the ordering between
net.connman.Manager and net.connman.Service State properties? If yes, I
believe that setting PreferredTechnologies will still send the Manager
and Service states in the current order.

Cheers,

Patrik

___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman


[PATCH 0/2] Clean group interface and mapping

2014-09-02 Thread Eduardo Abinader
When a p2p group is finished, the peers holding the just
removed group interface shall be updated accordingly. The 
same must happen to group_mapping, as the p2p group was
finished.

Eduardo Abinader (2):
  gsupplicant: Remove peer group interface when group finished
  gsupplicant: Update group_mapping when group finished

 gsupplicant/supplicant.c | 29 +
 1 file changed, 29 insertions(+)

-- 
1.9.1

___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman


[PATCH 2/2] gsupplicant: Update group_mapping when group finished

2014-09-02 Thread Eduardo Abinader
Just updating group_mapping accordingly, as a p2p group
has been signaled as finished.
---
 gsupplicant/supplicant.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/gsupplicant/supplicant.c b/gsupplicant/supplicant.c
index 903def7..9796fe8 100644
--- a/gsupplicant/supplicant.c
+++ b/gsupplicant/supplicant.c
@@ -2915,6 +2915,8 @@ static void signal_group_finished(const char *path, 
DBusMessageIter *iter)
 
remove_peer_group_interface(interface-group_table, 
data.group_obj_path);
 
+   g_hash_table_remove(group_mapping, data.group_obj_path);
+
g_hash_table_remove(interface-group_table, data.group_obj_path);
 }
 
-- 
1.9.1

___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman


[PATCH 1/2] gsupplicant: Remove peer group interface when group finished

2014-09-02 Thread Eduardo Abinader
When a p2p group has finished, update corresponding peers
group interface.
---
 gsupplicant/supplicant.c | 27 +++
 1 file changed, 27 insertions(+)

diff --git a/gsupplicant/supplicant.c b/gsupplicant/supplicant.c
index 049a5b2..903def7 100644
--- a/gsupplicant/supplicant.c
+++ b/gsupplicant/supplicant.c
@@ -2873,6 +2873,31 @@ static void signal_group_started(const char *path, 
DBusMessageIter *iter)
callback_peer_changed(peer, G_SUPPLICANT_PEER_GROUP_STARTED);
 }
 
+static void remove_peer_group_interface(GHashTable *group_table,
+   const char* path)
+{
+   GSupplicantGroup *group;
+   GHashTableIter iter;
+   gpointer value, key;
+
+   if (!group_table)
+   return;
+
+   group = g_hash_table_lookup(group_table, path);
+
+   if (!group || !group-orig_interface)
+   return;
+
+   g_hash_table_iter_init(iter, group-orig_interface-peer_table);
+
+   while (g_hash_table_iter_next(iter, key, value)) {
+   GSupplicantPeer *peer = value;
+
+   if (peer-current_group_iface == group-interface)
+   peer-current_group_iface = NULL;
+   }
+}
+
 static void signal_group_finished(const char *path, DBusMessageIter *iter)
 {
GSupplicantInterface *interface;
@@ -2888,6 +2913,8 @@ static void signal_group_finished(const char *path, 
DBusMessageIter *iter)
if (!data.interface_obj_path || !data.group_obj_path)
return;
 
+   remove_peer_group_interface(interface-group_table, 
data.group_obj_path);
+
g_hash_table_remove(interface-group_table, data.group_obj_path);
 }
 
-- 
1.9.1

___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman


Re: [PATCH 0/2] Clean group interface and mapping

2014-09-02 Thread Tomasz Bursztyka

Hi Eduardo,

ACK on this patch-set

Thanks,

Tomasz
___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman


Re: [PATCH 0/2] Clean group interface and mapping

2014-09-02 Thread Patrik Flykt
On Tue, 2014-09-02 at 08:23 -0400, Eduardo Abinader wrote:
 When a p2p group is finished, the peers holding the just
 removed group interface shall be updated accordingly. The 
 same must happen to group_mapping, as the p2p group was
 finished.

...and applied. Thanks!

Patrik


___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman


Re: [PATCH 0/8] Code cleanups

2014-09-02 Thread Patrik Flykt
On Thu, 2014-08-28 at 15:10 +0300, Patrik Flykt wrote:

 Here is a set of cleanup patches. The first four are not supposed to
 change any functionality but instead provide a bit better readability
 in the code.

Patches 02, 04, 03 and 01 applied in this order.

Patrik


___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman


Re: question: settings and profiles for connman

2014-09-02 Thread Benjamin Block
Hej,

On 09:47 Tue 02 Sep , Patrik Flykt wrote:
 
 On Fri, 2014-08-29 at 15:01 +0200, Benjamin Block wrote:
 
  I just wanted to ask, if it is possible to configure connman in a way
  that I can switch to specific settings depending on the location I am at
  (no problem if I have to trigger this switch) and maybe fall back to
  dhcpcd or other stuff like it, if I get to a new location.
  
  Thing is, I use my laptop in 4 different locations, each location has
  its own set of settings. 3 of them require me to use a specific ip, 1
  even a specific firewall-setting (iptables). I'd like to configure one
  profile for each of those location (state the config for each of my
  devices [eth0, wlan0, wwan0]) and then let connman switch between these
  profiles - likely by using a connmanctl-command. If I am at a new
  location, then I'd fall back to all the fancy automation.
 
 ConnMan does not do any additional profile based configuration, so that
 has to be added by an external program.
 
 The perhaps easiest way of solving this would be a separate tool, which
 moves (copies) required ConnMan .config files to and
 from /var/lib/connman. The ownership of that directory should be set
 properly, as the current root.root user and owner is merely just a
 placeholder for the tool developer or distro maintainer to update when
 needed. 
 
 The easiest solution might be to store all .config files relevant to a
 certain profile in a specific directory, e.g.
 '/var/lib/name-of-tool/profiles/name-of-profile/*.config'. Based on
 user selection the .config files based on the previous profile are to be
 removed with the .config files for the new profile added
 to /var/lib/connman. It is a good idea to remove only the previous
 profile specific .config files from /var/lib/connman and not every file,
 as some other program(s) or the user him/herself may have added
 specific .config files for some other purpose than the profiles handled
 by this tool.

Ok, thx for the elaborate answer. I'll think about it. For my use only
it might be easier/same work to just write a script to handle the
network-settings myself, as most of them are not that complicated
(remove some ips, add some new, add some route and add most turn on
wlan). I've been doing this by hand for some time now, and was only to
lazy to put them into a script. If I find the time, I might also handle
this by augmenting connman.

 
  Is that possible and if yes, how? I was locking at the documentation
  coming with connman, but they seem quite outdated in places (for
  example, I was reading `config-format.txt` and tried to create such a
  config at `/var/log/connman/work.conf`; but this was ignored
 
 '/var/lib/connman/work.config' is the correct name and location for this
 file.

Ah ok, might have been the wrong extension (log was a typo in the
mail).

 
  completely). Also I wonder how to tell connman how to ignore some of my
  network-devices (I tried the command line option and the option
  `/etc/connman/main.cfg`), it seems to ignore me quite good on this.
 
 And that would be '/etc/connman/main.conf'.
 

Indeed, that was the file (typo in mail). In there I put (under
[General]):

  NetworkInterfaceBlacklist=vmnet,vboxnet,virbr,ifb,dummy0,sit0,tunl0

But connman would still handle dummy0 for example (bring it up, mention
it in the log). For some reason it also messed up my wlan0 quit good. Had
to hard reset it via rfkill to get it back to work. But I can't say for
sure, if that was connman's fault or my own, so it might have been my
own.

-- 
BOFH Excuse #197:
I'm sorry a pentium won't do, you need an SGI to connect with us.
--
  best regards,
- Benjamin Block


pgp0LBZ9BhrPN.pgp
Description: PGP signature
___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman

[PATCH] service: Move dbg on service_schedule_removed after sanity check

2014-09-02 Thread Eduardo Abinader
Avoid an invalid read by moving debug message after
sanity check.
---
 src/service.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/service.c b/src/service.c
index f5c0a23..d5f95ed 100644
--- a/src/service.c
+++ b/src/service.c
@@ -4358,13 +4358,13 @@ static void service_schedule_added(struct 
connman_service *service)
 
 static void service_schedule_removed(struct connman_service *service)
 {
-   DBG(service %p %s, service, service-path);
-
if (!service || !service-path) {
DBG(service %p or path is NULL, service);
return;
}
 
+   DBG(service %p %s, service, service-path);
+
g_hash_table_remove(services_notify-add, service-path);
g_hash_table_replace(services_notify-remove, g_strdup(service-path),
NULL);
-- 
1.9.1

___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman


[PATCH] gsupplicant: Add property calls to property_calls list

2014-09-02 Thread Eduardo Abinader
Although the logic for handling property call list was
available, the property call list was not being populated.
---
 gsupplicant/dbus.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/gsupplicant/dbus.c b/gsupplicant/dbus.c
index 130306e..4ff5d50 100644
--- a/gsupplicant/dbus.c
+++ b/gsupplicant/dbus.c
@@ -240,6 +240,8 @@ int supplicant_dbus_property_get_all(const char *path, 
const char *interface,
property_call-function = function;
property_call-user_data = user_data;
 
+   property_calls = g_slist_prepend(property_calls, property_call);
+
dbus_pending_call_set_notify(call, property_get_all_reply,
property_call, property_call_free);
 
@@ -327,6 +329,8 @@ int supplicant_dbus_property_get(const char *path, const 
char *interface,
property_call-function = function;
property_call-user_data = user_data;
 
+   property_calls = g_slist_prepend(property_calls, property_call);
+
dbus_pending_call_set_notify(call, property_get_reply,
property_call, property_call_free);
 
@@ -419,6 +423,8 @@ int supplicant_dbus_property_set(const char *path, const 
char *interface,
property_call-function = function;
property_call-user_data = user_data;
 
+   property_calls = g_slist_prepend(property_calls, property_call);
+
dbus_pending_call_set_notify(call, property_set_reply,
property_call, property_call_free);
 
-- 
1.9.1

___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman