[PATCH 1/2] plugins: Add logcontrol plugin

2015-01-19 Thread Slava Monich
This plugin implements net.connman.DebugLog D-Bus interface which
allows changing debug log settings at runtime without restarting
connman.
---
 Makefile.plugins |   5 ++
 configure.ac |   5 ++
 plugins/logcontrol.c | 198 +++
 3 files changed, 208 insertions(+)
 create mode 100644 plugins/logcontrol.c

diff --git a/Makefile.plugins b/Makefile.plugins
index e90ad19..a1f6f95 100644
--- a/Makefile.plugins
+++ b/Makefile.plugins
@@ -55,6 +55,11 @@ builtin_modules += dundee
 builtin_sources += plugins/dundee.c
 endif
 
+if LOGCONTROL
+builtin_modules += logcontrol
+builtin_sources += plugins/logcontrol.c
+endif
+
 if VPN
 builtin_modules += vpn
 builtin_sources += plugins/vpn.c
diff --git a/configure.ac b/configure.ac
index e3326ad..bc2b47d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -326,6 +326,11 @@ AC_ARG_ENABLE(wispr, AC_HELP_STRING([--disable-wispr],
[enable_wispr=${enableval}])
 AM_CONDITIONAL(WISPR, test ${enable_wispr} != no)
 
+AC_ARG_ENABLE(logcontrol,
+   AC_HELP_STRING([--enable-logcontrol], [enable jolla GPS support]),
+   [enable_logcontrol=${enableval}], 
[enable_logcontrol=no])
+AM_CONDITIONAL(LOGCONTROL, test ${enable_logcontrol} != no)
+
 AC_ARG_ENABLE(tools, AC_HELP_STRING([--disable-tools],
[disable testing tools]),
[enable_tools=${enableval}])
diff --git a/plugins/logcontrol.c b/plugins/logcontrol.c
new file mode 100644
index 000..203fe7b
--- /dev/null
+++ b/plugins/logcontrol.c
@@ -0,0 +1,198 @@
+/*
+ *
+ *  Connection Manager
+ *
+ *  Copyright (C) 2015 Jolla Ltd. All rights reserved.
+ *  Contact: Slava Monich slava.mon...@jolla.com
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 2 as
+ *  published by the Free Software Foundation.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include config.h
+#endif
+
+#include gdbus.h
+
+#define CONNMAN_API_SUBJECT_TO_CHANGE
+#include connman/plugin.h
+#include connman/log.h
+#include connman.h
+
+#define LOG_INTERFACE  CONNMAN_SERVICE .DebugLog
+#define LOG_PATH   /
+
+static DBusConnection *connection = NULL;
+
+extern struct connman_debug_desc __start___debug[];
+extern struct connman_debug_desc __stop___debug[];
+
+static void logcontrol_update(const char* pattern, unsigned int set_flags,
+   unsigned int clear_flags)
+{
+   struct connman_debug_desc *start = __start___debug;
+   struct connman_debug_desc *stop = __stop___debug;
+   struct connman_debug_desc *desc;
+   const char *alias = NULL, *file = NULL;
+
+   if (!start || !stop)
+   return;
+
+   for (desc = start; desc  stop; desc++) {
+   const char* name;
+
+   if (desc-flags  CONNMAN_DEBUG_FLAG_ALIAS) {
+   file = desc-file;
+   alias = desc-name;
+   continue;
+   }
+
+   if (file  g_strcmp0(desc-file, file)) {
+   file = NULL;
+   alias = NULL;
+   }
+
+   name = desc-name ? desc-name : alias;
+   if ((name  g_pattern_match_simple(pattern, name)) ||
+   (desc-file  g_pattern_match_simple(pattern,
+   desc-file))) {
+   desc-flags |= set_flags;
+   desc-flags = ~clear_flags;
+   }
+   }
+}
+
+static DBusMessage *logcontrol_dbusmsg(DBusConnection *conn, DBusMessage *msg,
+   unsigned int set_flags, unsigned int clear_flags)
+{
+   const char *pattern;
+
+   if (dbus_message_get_args(msg, NULL, DBUS_TYPE_STRING, pattern,
+   DBUS_TYPE_INVALID)) {
+   logcontrol_update(pattern, set_flags, clear_flags);
+   return g_dbus_create_reply(msg, DBUS_TYPE_INVALID);
+   } else {
+   return __connman_error_invalid_arguments(msg);
+   }
+}
+
+static DBusMessage *logcontrol_enable(DBusConnection *conn,
+   DBusMessage *msg, void *data)
+{
+   return logcontrol_dbusmsg(conn, msg, CONNMAN_DEBUG_FLAG_PRINT, 0);
+}
+
+static DBusMessage *logcontrol_disable(DBusConnection *conn,
+ 

[PATCH 2/2] doc: Add net.connman.DebugLog API documentation

2015-01-19 Thread Slava Monich
---
 doc/logcontrol-api.txt | 22 ++
 1 file changed, 22 insertions(+)
 create mode 100644 doc/logcontrol-api.txt

diff --git a/doc/logcontrol-api.txt b/doc/logcontrol-api.txt
new file mode 100644
index 000..c9fdae3
--- /dev/null
+++ b/doc/logcontrol-api.txt
@@ -0,0 +1,22 @@
+Debug log control
+=
+
+Servicenet.connman
+Interface  net.connman.DebugLog
+Object path/
+
+Methodsvoid Enable(string pattern)
+
+   Enables all logs that match the pattern.
+
+   void Disable(string pattern)
+
+   Disables all logs that match the pattern.
+
+   array{string} List()
+
+   Returns all available log names and aliases.
+
+   In order for Enable or Disable call to have any
+   effect, the pattern must match one or more of
+   these strings.
-- 
1.8.3.2

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


[PATCH 0/2] Debug log control API

2015-01-19 Thread Slava Monich
These patches introduce net.connman.DebugLog D-Bus interface
which provides the following methods:

  void Enable(string pattern)
  void Disable(string pattern)
  array{string} List()

This interface allows changing debug log settings at runtime
without restarting connman. It's useful in the situations when
connman breaks in the production environment, where logs are
not enabled at startup.

By default this plugin is not compiled in. It needs to be
explicitely enabled with --enable-logcontrol configure switch.

Slava Monich (2):
  plugins: Add logcontrol plugin
  doc: Add net.connman.DebugLog API documentation

 Makefile.plugins   |   5 ++
 configure.ac   |   5 ++
 doc/logcontrol-api.txt |  22 ++
 plugins/logcontrol.c   | 198 +
 4 files changed, 230 insertions(+)
 create mode 100644 doc/logcontrol-api.txt
 create mode 100644 plugins/logcontrol.c

-- 
1.8.3.2

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


Fwd: Wi-Fi in Dual mode using connman

2015-01-19 Thread techi eth
Hi,

I am not sure if i have clearly explain my view.My comment against below
point.

But AP and STA modes are mutually exclusive as an AP needs to be
available all the time.

With below steps i could able to use both at same time.

/*** Setting AP Mode*/
#iw phy phy0 interface add wlan1 type managed
#ifconfig wlan1 10.4.30.34 netmask 255.255.255.0 up
#hostapd /etc/hostapd.conf 
#udhcpd /etc/udhcpd.conf
#iptables -t nat -A POSTROUTING -o wlan1 -j MASQUERADE

/***Setting STA mode/
#ifconfig wlan0 up
#wpa_supplicant -d -Dnl80211 -c/etc/wpa_supplicant.conf -iwlan0 -B
#udhcpc -R -b -p /var/run/udhcpc.wlan0.pid -i wlan0
#echo 1  /proc/sys/net/ipv4/ip_forward

Is this is possible with connman as well 

Thanks

-- Forwarded message --
From: techi eth techi...@gmail.com
Date: Fri, Jan 16, 2015 at 5:44 PM
Subject: Re: Wi-Fi in Dual mode using connman
To: connman@connman.net


Thanks for answer.

I have tried below steps (Part of TI Wiki). I could able to use both mode
(AP+STA) at same time.

/*** Setting AP Mode*/
#iw phy phy0 interface add wlan1 type managed
#ifconfig wlan1 10.4.30.34 netmask 255.255.255.0 up
#hostapd /etc/hostapd.conf 
#udhcpd /etc/udhcpd.conf
#iptables -t nat -A POSTROUTING -o wlan1 -j MASQUERADE

/***Setting STA mode/
#ifconfig wlan0 up
#wpa_supplicant -d -Dnl80211 -c/etc/wpa_supplicant.conf -iwlan0 -B
#udhcpc -R -b -p /var/run/udhcpc.wlan0.pid -i wlan0
#echo 1  /proc/sys/net/ipv4/ip_forward

Is this is possible with connman as well 

Thanks

On Fri, Jan 2, 2015 at 1:20 PM, Patrik Flykt patrik.fl...@linux.intel.com
wrote:

 On Tue, 2014-12-30 at 19:02 +0530, techi eth wrote:

  AP Requirement : I want any other STA will get connected to my Wi-Fi
 board
   i will serve the request without using internet.

 # connmanctl tether wifi

 No need to have an uplink Internet connection to make this work.

  STA Requirement : I want to connect through other AP (Ex : Wi-Fi router)
  for internet connection to send data outside.

 # connmanctl
 connmanctl scan wifi
 connmanctl agent on
 connmanctl connect wifi_X_Y

 But AP and STA modes are mutually exclusive as an AP needs to be
 available all the time.

 Cheers,

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


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

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


[PATCH] wifi: fix autoscan interval limit

2015-01-19 Thread Jason Abele
From: Jason Abele ja...@aether.com

The comparison to autoscan-limit is performed before setting the new
autoscan-interval, allowing one interval to overshoot the limit.  Fix
this by comparing against the newly calculated interval.
---
 plugins/wifi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/plugins/wifi.c b/plugins/wifi.c
index 68ed5d0..e081f8a 100644
--- a/plugins/wifi.c
+++ b/plugins/wifi.c
@@ -1311,7 +1311,7 @@ static gboolean autoscan_timeout(gpointer data)
} else
interval = autoscan-interval * autoscan-base;
 
-   if (autoscan-interval = autoscan-limit)
+   if (interval  autoscan-limit)
interval = autoscan-limit;
 
throw_wifi_scan(wifi-device, scan_callback_hidden);
-- 
1.9.1

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


Re: [PATCH] Fix bluetooth plugin implemntation of technology_set returns error.

2015-01-19 Thread David Lechner

On 01/14/2015 10:55 PM, David Lechner wrote:

The technology_set implementation in the bluetooth plugin returns
-EINPROGRESS which causes problems.

1.  When setting the Tethering property via D-Bus, D-Bus returns an error
 instead of completing successfuly.
2.  When using the PersistentTetheringMode option, bluetooth tethering
 is not remembered. This is because /var/lib/connman/settings is not
 updated if technology_set returns an error.

This fixes the issue by returning 0 when bluetooth_tech_set_tethering
completes successfully.
---
  plugins/bluetooth.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/plugins/bluetooth.c b/plugins/bluetooth.c
index c6f387e..636c7bf 100644
--- a/plugins/bluetooth.c
+++ b/plugins/bluetooth.c
@@ -899,7 +899,7 @@ static int bluetooth_tech_set_tethering(struct 
connman_technology *technology,
if (i == 0)
return -ENODEV;
  
-   return -EINPROGRESS;

+   return 0;
  }
  
  static struct connman_technology_driver tech_driver = {

Just want to make sure this patch did not get overlooked.
___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman


Re: [PATCH 0/2] Debug log control API

2015-01-19 Thread Jason Abele
On Mon, Jan 19, 2015 at 2:41 PM, Slava Monich slava.mon...@jolla.com
wrote:

 These patches introduce net.connman.DebugLog D-Bus interface
 which provides the following methods:

   void Enable(string pattern)
   void Disable(string pattern)
   array{string} List()


Tested these out and it works for my application ... thanks!

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


RE: would it be possible some of technologies get online state simultaneously?

2015-01-19 Thread Nakamura, Yusuke (ADITJ/SWG)
Hi Patrik

Thank you very much for your reply.

That is doable. With the Session API and its usage of session specific routing 
tables, all session routing tables have the default route set.
The default routing table is the only one that has exactly one default route 
set, this in order not to change the normal behavior if sessions are created.

Sorry Patrik. I didn't understand what this means. Do you mind explaining this 
in more detail?

 The 'online' state indicates that proxies are either not needed or
 configured correctly for pacrunner,
 http://git.kernel.org/cgit/network/connman/pacrunner.git/ Pacrunner
 support is found in Fedora's libproxy package so that all applications using
 libproxy will get the correct proxies and can connect successfully to
 Internet.
 
 But back to your original question, internet is reachable for the WiFi user
 also in state 'ready'.

The problem here is wifi_user can't know the 'ready' status when the status 
gets 'ready'.
I suppose Connman notifies only online/offline status. Therefore wifi_user 
can't receive 'ready' notification from Connman. 
Session_policy_local plugin doesn't set a route(ip route) when the status is 
'ready'.
So in this case wifi_user can use ethernet.

I'd like ethernet_user to use only ethernet and wifi_user to use only wifi.

Could you tell me  my misunderstanding if any.

Best Regards.
Yusuke Nakamura 中村 勇介
Advanced Driver Information Technology
Software Group (SWG)
Engineer
Tel: 0566-61-5117(ext:551-43641)
Fax:0566-25-4774
Email:ynakam...@jp.adit-jv.com



 -Original Message-
 From: Kojima, Tsuyoshi (HISOL; ADITJ/SWG)
 Sent: Monday, January 19, 2015 2:54 PM
 To: Nakamura, Yusuke (ADITJ/SWG)
 Subject: RE: would it be possible some of technologies get online state
 simultaneously?
 
 日本語で返事書いてみました。
 
 -Original Message-
 From: connman [mailto:connman-boun...@connman.net] On Behalf Of Patrik
 Flykt
 Sent: Friday, January 16, 2015 5:18 PM
 To: connman@connman.net
 Cc: Ishikawa, Tetsuri (ADITJ/SWG)
 Subject: Re: would it be possible some of technologies get online state
 simultaneously?
 
 
   Hi,
 
 On Fri, 2015-01-16 at 15:08 +0900, Nakamura, Yusuke (ADITJ/SWG) wrote:
 
  I’m trying to use ConnMan to take care of network arbitration for my
  automotive embedded system.
 
 Cool!
 
  Now the question is whether some of technologies get “online”
  simultaneously.
 
 Only one of the services can be 'online' at any one time. This applies both
 for Session and Service APIs.
 
  I’d like to configure available bearers per application (per user) by
  using session_policy_local_plugin.
 
  For instance while “etherner_user” is connecting to the internet via
  Ethernet, “wifi_user” is connecting to the internet via WiFi.
 
 That is doable. With the Session API and its usage of session specific
 routing tables, all session routing tables have the default route set.
 The default routing table is the only one that has exactly one default route
 set, this in order not to change the normal behavior if sessions are created.
 
  ちょっと何言ってるかわからないです。
 
  I think wifi_user’s session does not get online even if wifi internet
  connection gets available.
 
  I suppose that is because “ethernet” is preferred technology.
 
 Actually, if ethernet is online, it means the connectivity check succeeded.
 Ethernet could also have stayed as 'ready', should the connectivity check
 have failed.
 
  “wifi_user” can’t receive notification through session.
  session_policy_local_plugin configure ip route when get “online”.
 
  Therefore I think in above case “wifi_user” can’t connect to the
  internet.
 
 State 'ready' is enough to be connected to the internet. The difference
 here is that 'online' provides a bit more information, it indicates that
 the additional connectivity check to {ipv4,ipv6}.connman.net succeeded.
 
 The 'online' state indicates that proxies are either not needed or
 configured correctly for pacrunner,
 http://git.kernel.org/cgit/network/connman/pacrunner.git/ Pacrunner
 support is found in Fedora's libproxy package so that all applications using
 libproxy will get the correct proxies and can connect successfully to
 Internet.
 
 But back to your original question, internet is reachable for the WiFi user
 also in state 'ready'.
 
  それはわかっています。問題は、stateがreadyでstayしたとき、wifi_user
 がreadyステータスを知ることができないという事です。
 また、session_policy_local pluginはreadyステータスではルートの設定(ip
 route)をしないので、wifi_userはethernetを使用できてしまいます。
 Ethernet_userにはethernetのみを、wifi_userにはwifiのみを使用させたい
 のです。
 
 Cheers,
 
   Patrik
 
 ___
 connman mailing list
 connman@connman.net
 https://lists.connman.net/mailman/listinfo/connman
___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman

Re: would it be possible some of technologies get online state simultaneously?

2015-01-19 Thread Patrik Flykt
On Mon, 2015-01-19 at 17:20 +0900, Nakamura, Yusuke (ADITJ/SWG) wrote:
 Sorry Patrik. I didn't understand what this means. Do you mind
 explaining this in more detail? 

If you need different routing for different users, use the ConnMan
Session API, doc/session-api.txt, doc/session-overview.txt and
doc/session-policy-format.txt. The applications using Session API are
the only ones that benefit from the rules written for
session_policy_local or other Session policies.

For your problem where you need wifi status and are already configuring
the session plugin, wifi status is available via the Session API.

The default routing table is still identical to the situation where no
sessions are in use and used by everybody else that is not associated
with any sessions.

Cheers,

Patrik

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


wifi scan error

2015-01-19 Thread techi eth
Hi,


When I try to wifi scan I am getting error.Please find below result of scan
  technologies command.


Please suggest me solution ?

---

root@test-board:#connmanctl scan wifi

Error /net/connman/technology/wifi: Not supported


root@test-board:# connmanctl technologies

/net/connman/technology/ethernet

  Name = Wired

  Type = ethernet

  Powered = True

  Connected = True

  Tethering = False

/net/connman/technology/wifi

  Name = WiFi

  Type = wifi

  Powered = True

  Connected = False

  Tethering = False

/net/connman/technology/bluetooth

  Name = Bluetooth

  Type = bluetooth

  Powered = True

  Connected = False

  Tethering = False

---


connman version : 1.26



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


[PATCH 1/2] peer: Refactor when IPv4 settings changed should be notified

2015-01-19 Thread Tomasz Bursztyka
This fixes inconcistant behavior in signaling IPv4 changes when
connected or disconnected happen.
---
 src/peer.c | 10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/peer.c b/src/peer.c
index 5e9006f..99252f9 100644
--- a/src/peer.c
+++ b/src/peer.c
@@ -911,6 +911,10 @@ int connman_peer_set_state(struct connman_peer *peer,
peer-state = new_state;
state_changed(peer);
 
+   if (peer-state == CONNMAN_PEER_STATE_READY ||
+   peer-state == CONNMAN_PEER_STATE_DISCONNECT)
+   settings_changed(peer);
+
return 0;
 }
 
@@ -1002,7 +1006,8 @@ static void peer_ip_bound(struct connman_ipconfig 
*ipconfig,
 
DBG(%s ip bound, ifname);
 
-   settings_changed(peer);
+   if (peer-state == CONNMAN_PEER_STATE_READY)
+   settings_changed(peer);
connman_peer_set_state(peer, CONNMAN_PEER_STATE_READY);
 }
 
@@ -1013,7 +1018,8 @@ static void peer_ip_release(struct connman_ipconfig 
*ipconfig,
 
DBG(%s ip release, ifname);
 
-   settings_changed(peer);
+   if (peer-state == CONNMAN_PEER_STATE_READY)
+   settings_changed(peer);
 }
 
 static const struct connman_ipconfig_ops peer_ip_ops = {
-- 
2.0.5

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


[PATCH 2/2] peer: Reset the lease when dhcp server is stopped.

2015-01-19 Thread Tomasz Bursztyka
This prevent to get a former valid IP in a new connection.
---
 src/peer.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/peer.c b/src/peer.c
index 99252f9..6d3f460 100644
--- a/src/peer.c
+++ b/src/peer.c
@@ -84,6 +84,7 @@ static void stop_dhcp_server(struct connman_peer *peer)
if (peer-ip_pool)
__connman_ippool_unref(peer-ip_pool);
peer-ip_pool = NULL;
+   peer-lease_ip = 0;
 }
 
 static void dhcp_server_debug(const char *str, void *data)
-- 
2.0.5

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


[PATCH 0/2] Peer State and IPv4 signals fixups

2015-01-19 Thread Tomasz Bursztyka
Hi,

This patch-set fixes 2 issues about IPv4 settigns updated through
PropertyChanged signal.
- first patch fixes the order and reliability of the signal
- second patch cleans up the lease when relevant

Tomasz Bursztyka (2):
  peer: Refactor when IPv4 settings changed should be notified
  peer: Reset the lease when dhcp server is stopped.

 src/peer.c | 11 +--
 1 file changed, 9 insertions(+), 2 deletions(-)

-- 
2.0.5

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