platform/upstream/connman.git
12 years agoservice: Clear user connected flag on disconnect
Patrik Flykt [Wed, 17 Oct 2012 10:34:42 +0000 (13:34 +0300)]
service: Clear user connected flag on disconnect

Remember whether the service was connected by the user via D-Bus
until the service gets disconnected.

12 years agoservice: Keep only a single connected technology if configured
Patrik Flykt [Wed, 17 Oct 2012 10:34:41 +0000 (13:34 +0300)]
service: Keep only a single connected technology if configured

If SingleConnectedTechnology is enabled in main.conf, disconnect any
previously connected services when the new service enters ready state.

12 years agomain: Add SingleConnectedTechnology main.conf variable
Patrik Flykt [Wed, 17 Oct 2012 10:34:40 +0000 (13:34 +0300)]
main: Add SingleConnectedTechnology main.conf variable

12 years agomain.conf: Add SingleConnectedTechnology description
Patrik Flykt [Wed, 17 Oct 2012 10:34:39 +0000 (13:34 +0300)]
main.conf: Add SingleConnectedTechnology description

12 years agoservice: Fix default service switching and setting gateway
Patrik Flykt [Wed, 17 Oct 2012 10:34:23 +0000 (13:34 +0300)]
service: Fix default service switching and setting gateway

Calling switch_default_service() didn't change the service order since
the services were already sorted that way. Also update the gateway
immediately.

12 years agomain.conf: Update preferred technology description
Patrik Flykt [Wed, 17 Oct 2012 10:34:22 +0000 (13:34 +0300)]
main.conf: Update preferred technology description

12 years agoservice: A preferred service in state ready is good enough
Patrik Flykt [Wed, 17 Oct 2012 10:34:21 +0000 (13:34 +0300)]
service: A preferred service in state ready is good enough

Simplify the preferred service selection such that a connected
service is good enough, especially since a connecting service
will also terminate the search for the current preferred one.

12 years agoservice: Don't trigger autoconnect when neither service is preferred
Patrik Flykt [Wed, 17 Oct 2012 10:34:20 +0000 (13:34 +0300)]
service: Don't trigger autoconnect when neither service is preferred

Don't trigger a new autoconnect when neither the default nor the new
service is preferred. Rely on the fact that normal autoconnect selection
mechanism has done the work for us already.

12 years agoclient: Add Remove() method support for service
Tomasz Bursztyka [Wed, 17 Oct 2012 07:46:15 +0000 (10:46 +0300)]
client: Add Remove() method support for service

12 years agoclient: Fix various memory leaks in monitor and services parts
Tomasz Bursztyka [Wed, 17 Oct 2012 07:46:14 +0000 (10:46 +0300)]
client: Fix various memory leaks in monitor and services parts

12 years agoclient: Fix some memory leaks in data_manager part
Tomasz Bursztyka [Wed, 17 Oct 2012 07:46:13 +0000 (10:46 +0300)]
client: Fix some memory leaks in data_manager part

12 years agoclient: Fix some memory leaks in commands part
Tomasz Bursztyka [Wed, 17 Oct 2012 07:46:12 +0000 (10:46 +0300)]
client: Fix some memory leaks in commands part

12 years agogresolv: Remove the lookup for real
Jukka Rissanen [Tue, 16 Oct 2012 14:19:25 +0000 (17:19 +0300)]
gresolv: Remove the lookup for real

The call to g_resolv_cancel_lookup() will do nothing
because we just removed the lookup from the queue.
The fix is to remove the lookup directly and not call
the cancel function.

12 years agotechnology: Fix hardblocked state on non hw rfkillable switch added
Tomasz Bursztyka [Mon, 15 Oct 2012 12:35:23 +0000 (15:35 +0300)]
technology: Fix hardblocked state on non hw rfkillable switch added

If hardblock is on and a new device is inserted and detected as not
hardblocked, then it will be possible to enable/disable it (soft rfkill)
independently to the main hw rfkill switch.

12 years agotechnology: Recompute hardblocked state on rfkill remove event
Tomasz Bursztyka [Mon, 15 Oct 2012 12:35:22 +0000 (15:35 +0300)]
technology: Recompute hardblocked state on rfkill remove event

This fixes the case of cascading rfkill switches: if enabled, hard rfkilling
such technology might generate contradictory events.

1 - first all switches are hardblocked
2 - then one of these switch (usually: device's switch) gets fully unblocked
3 - then this same switch gets removed

Step 2 is in contradiction with step 1, so we need to care about such switch
getting removed by recomputing the hardblocked state.

12 years agotechnology: Properly handle rfkill driven state
Tomasz Bursztyka [Mon, 15 Oct 2012 12:35:21 +0000 (15:35 +0300)]
technology: Properly handle rfkill driven state

12 years agodevice: Add a getter for powered property
Tomasz Bursztyka [Mon, 15 Oct 2012 12:35:20 +0000 (15:35 +0300)]
device: Add a getter for powered property

12 years agotechnology: Use the right method to enable or disable
Tomasz Bursztyka [Mon, 15 Oct 2012 12:35:19 +0000 (15:35 +0300)]
technology: Use the right method to enable or disable

If rfkill driven, use rfkill soft block/unblock. If not, request the
device to be enabled or disabled.

12 years agotechnology: Change enabled to a boolean and refactor accordingly
Tomasz Bursztyka [Mon, 15 Oct 2012 12:35:18 +0000 (15:35 +0300)]
technology: Change enabled to a boolean and refactor accordingly

12 years agotechnology: Refactor and split functions setting enabled state
Tomasz Bursztyka [Mon, 15 Oct 2012 12:35:17 +0000 (15:35 +0300)]
technology: Refactor and split functions setting enabled state

12 years agotechnology: Refactor rfkill event handling according to soft/hard block
Tomasz Bursztyka [Mon, 15 Oct 2012 12:35:16 +0000 (15:35 +0300)]
technology: Refactor rfkill event handling according to soft/hard block

No need to proceed with softblocked if technology is already hardblocked.
Apply offlinemode and persistant state according to softblocked state.
(saner logic and helped to cleanup code from style point of view too)

12 years agotechnology: Add and handle a marker for softblock status
Tomasz Bursztyka [Mon, 15 Oct 2012 12:35:15 +0000 (15:35 +0300)]
technology: Add and handle a marker for softblock status

12 years agotechnology: Add a marker to know if a technology is rfkill driven
Tomasz Bursztyka [Mon, 15 Oct 2012 12:35:14 +0000 (15:35 +0300)]
technology: Add a marker to know if a technology is rfkill driven

Useful for coming patches: enabling/disabling technologies will be done
differently whether technology is rfkill driven or not:
- if rfkill driven -> enabled will rely on rfkill states
- if not -> enabled will rely on driver/devices states

12 years agotechnology: Refactor how a technology is enabled or disabled
Tomasz Bursztyka [Mon, 15 Oct 2012 12:35:13 +0000 (15:35 +0300)]
technology: Refactor how a technology is enabled or disabled

Refactor how a device list is enabled/disabled: this will be useful
for coming patches. Simplify also the code, and remove useless gotos.

12 years agowispr: Keep track of proxy callback timeout
Patrik Flykt [Tue, 16 Oct 2012 10:56:32 +0000 (13:56 +0300)]
wispr: Keep track of proxy callback timeout

Keep track of the zero-second no proxy callback timeout and remove
it when freeing up the WISPr context.

12 years agowifi: Do not start autoscan if interface was not ready
Tomasz Bursztyka [Tue, 16 Oct 2012 05:35:17 +0000 (08:35 +0300)]
wifi: Do not start autoscan if interface was not ready

12 years agogsupplicant: Send -ENOLINK error on scan reply if interface was not ready
Tomasz Bursztyka [Tue, 16 Oct 2012 05:35:16 +0000 (08:35 +0300)]
gsupplicant: Send -ENOLINK error on scan reply if interface was not ready

12 years agogsupplicant: Add a new state according to 'interface_disabled'
Tomasz Bursztyka [Wed, 10 Oct 2012 08:18:45 +0000 (11:18 +0300)]
gsupplicant: Add a new state according to 'interface_disabled'

When soft rfkill is on, wpa_supplicant sets the interface disabled and
sends a state named 'interface_disabled'. Taking this information into
account fixes the following issue:
- disable wifi (user setting) and hard rfkill it
- then un-hard rfkill it, whereafter rfkill states (soft/hard) will go
  like this:
    * from 1/1 to 0/0
    * from 0/0 to 1/0
    when 0/0 occurs, connman will request to enable wifi

The problem with this is that enabling wifi takes quite some time and
in between ConnMan will soft block wifi to disable it (according to
previous user setting). Thus it will request to disable wifi but since
enabling is still going on, this request won't do anything. Meanwhile
wpa_supplicant will also catch the soft rfkill event and wpa_supplicant
will set the state to 'interface_disabled', but since it's not handled
properly by ConnMan, the wifi_enable() callback will be called and the
function will assume wifi got enabled.

12 years agorfkill: Return the error when write() fails
Tomasz Bursztyka [Tue, 9 Oct 2012 10:35:16 +0000 (13:35 +0300)]
rfkill: Return the error when write() fails

12 years agogresolv: Remove all pending lookups when resolver is removed
Jukka Rissanen [Mon, 15 Oct 2012 10:36:04 +0000 (13:36 +0300)]
gresolv: Remove all pending lookups when resolver is removed

Remove all lookups found in queue when GResolv object is removed.

12 years agogresolv: Avoid accessing already freed memory
Jukka Rissanen [Mon, 15 Oct 2012 10:36:03 +0000 (13:36 +0300)]
gresolv: Avoid accessing already freed memory

We must remove the lookup from lookup queue and query from query queue
before calling user callback. The callback might unref the GResolv which in
turn would remove the lookup/query what we are trying to access after
the callback is returned.

So it is enough to remove the lookup or query entry from queue before
cb is called and then manually remove it after the callback has returned.

12 years agoiptables: Ignore module loading error
Jukka Rissanen [Fri, 12 Oct 2012 11:01:31 +0000 (14:01 +0300)]
iptables: Ignore module loading error

In iptables 1.4.9 module loading gives an error even if the module
is built in. Ignore the loading errors because the missing iptables
support is noticed when trying to get the iptables socket options.

12 years agogdhcp: Returned IP address is already in host byte order
Jukka Rissanen [Fri, 12 Oct 2012 17:13:22 +0000 (20:13 +0300)]
gdhcp: Returned IP address is already in host byte order

12 years agogresolv: Remove lookup from correct queue
Jukka Rissanen [Thu, 11 Oct 2012 10:45:41 +0000 (13:45 +0300)]
gresolv: Remove lookup from correct queue

The lookup must be removed from lookup queue and not from query
queue when cancelling the lookup. Otherwise it is possible that
we might access an already removed lookup that is still found in
lookup queue.

Fixes BMC#25728

12 years agonat: Memory leak when cleaning up
Jukka Rissanen [Thu, 11 Oct 2012 08:21:57 +0000 (11:21 +0300)]
nat: Memory leak when cleaning up

The nat struct was not freed when it is was removed from the hash.

12 years agogdhcp: Use data size specific option setting function
Jukka Rissanen [Thu, 11 Oct 2012 07:11:52 +0000 (10:11 +0300)]
gdhcp: Use data size specific option setting function

Instead of using dhcp_add_simple_option() the gdhcp now uses
three functions for setting uint8, uint16 and uint32 values.

12 years agogdhcp: Use host byte order internally
Jukka Rissanen [Thu, 11 Oct 2012 07:11:51 +0000 (10:11 +0300)]
gdhcp: Use host byte order internally

Convert to network byte order just before sending the packet.

12 years agogdhcp: Add unalignment macros
Jukka Rissanen [Thu, 11 Oct 2012 07:11:50 +0000 (10:11 +0300)]
gdhcp: Add unalignment macros

The alignment macros are copied from Bluez.

12 years agogdhcp: Remove obsolete load lease function
Jukka Rissanen [Thu, 11 Oct 2012 07:11:49 +0000 (10:11 +0300)]
gdhcp: Remove obsolete load lease function

12 years agoRelease 1.8 1.8
Marcel Holtmann [Tue, 9 Oct 2012 15:46:52 +0000 (17:46 +0200)]
Release 1.8

12 years agodoc: State is a string type
Gustavo Padovan [Wed, 3 Oct 2012 20:42:33 +0000 (17:42 -0300)]
doc: State is a string type

12 years agounit: Wrong enum type used in session code
Jukka Rissanen [Mon, 8 Oct 2012 10:01:19 +0000 (13:01 +0300)]
unit: Wrong enum type used in session code

12 years agogdbus: Fix not freeing list node by using g_slist_delete_link
Luiz Augusto von Dentz [Wed, 3 Oct 2012 11:57:06 +0000 (14:57 +0300)]
gdbus: Fix not freeing list node by using g_slist_delete_link

g_slist_remove_link does not free the node which can cause leaks so
replace that with g_slist_delete_link which does free memory properly.

12 years agodnsproxy: Do not overwrite protocol and channel in server struct
Jukka Rissanen [Wed, 3 Oct 2012 10:55:56 +0000 (13:55 +0300)]
dnsproxy: Do not overwrite protocol and channel in server struct

We copied too much data into addrinfo struct which corrupted
the protocol and channel fields.

Fixes BMC#25726

12 years agotechnology: Do not expose a technology which is hard rfkilled
Tomasz Bursztyka [Tue, 2 Oct 2012 09:27:16 +0000 (12:27 +0300)]
technology: Do not expose a technology which is hard rfkilled

If hard rfkilled, a technology will not be exposed through DBus via
GetTechnologies. If hard rfkill status changes, TechnologyAdded and
TechnologyRemoved signals will be sent accordingly.

12 years agotechnology: Add helpers for (un)registering a technology in D-Bus
Tomasz Bursztyka [Tue, 2 Oct 2012 09:27:15 +0000 (12:27 +0300)]
technology: Add helpers for (un)registering a technology in D-Bus

12 years agotechnology: Do not apply Powered setting change if hardblock is on
Tomasz Bursztyka [Wed, 3 Oct 2012 10:29:13 +0000 (13:29 +0300)]
technology: Do not apply Powered setting change if hardblock is on

12 years agotechnology: Simplify set_powered function
Tomasz Bursztyka [Tue, 2 Oct 2012 09:27:13 +0000 (12:27 +0300)]
technology: Simplify set_powered function

12 years agotechnology: Link hard rfkill with actual device's state
Tomasz Bursztyka [Tue, 2 Oct 2012 09:27:12 +0000 (12:27 +0300)]
technology: Link hard rfkill with actual device's state

When hardblocking a technology, it should disable the devices which belongs
to that technology. When un-hardblocking it should do the same but taking
care about user setting (it will enable the devices if only enable_persistent
is on).

12 years agotechnology: Handle harblock if all of them have identical type
Tomasz Bursztyka [Tue, 2 Oct 2012 09:27:11 +0000 (12:27 +0300)]
technology: Handle harblock if all of them have identical type

On some hardware, there exist two rfkill entities for the same type
with a cascading issue: if one is soft blocked, the other one is
hardblocked. But if the hardblock switch is set, all are hardblocked.
This patch figures out that a technology is hardblocked only if all
related rkill events get the same hardblock value.

12 years agotechnology: Handle rfkill hardblock
Tomasz Bursztyka [Tue, 2 Oct 2012 09:27:10 +0000 (12:27 +0300)]
technology: Handle rfkill hardblock

12 years agotechnology: Handle rfkill hash table in a saner way
Tomasz Bursztyka [Tue, 2 Oct 2012 09:27:09 +0000 (12:27 +0300)]
technology: Handle rfkill hash table in a saner way

12 years agoconf: Allow Counter and Notification interfaces in connman-polkit.conf
Tomasz Bursztyka [Wed, 3 Oct 2012 07:39:00 +0000 (10:39 +0300)]
conf: Allow Counter and Notification interfaces in connman-polkit.conf

12 years agobuild: Don't use deprecated INCLUDES variable
Lucas De Marchi [Tue, 2 Oct 2012 15:57:29 +0000 (12:57 -0300)]
build: Don't use deprecated INCLUDES variable

Makefile.am:127: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')

12 years agobuild: Don't use deprecated AM_PROG_MKDIR_P
Lucas De Marchi [Tue, 2 Oct 2012 15:57:28 +0000 (12:57 -0300)]
build: Don't use deprecated AM_PROG_MKDIR_P

AM_PROG_MKDIR_P is deprecated since:

configure.ac:26: warning: The 'AM_PROG_MKDIR_P' macro is deprecated, and will soon be removed.
configure.ac:26: You should use the Autoconf-provided 'AC_PROG_MKDIR_P' macro instead,
configure.ac:26: and use '$(MKDIR_P)' instead of '$(mkdir_p)'in your Makefile.am files.

We are already using $(MKDIR_P) so we just need to call the right macro.

12 years agobuild: Fix missing -lrt for clock_gettime()
Lucas De Marchi [Tue, 2 Oct 2012 14:57:54 +0000 (11:57 -0300)]
build: Fix missing -lrt for clock_gettime()

librt is needed for using clock_gettime():

/usr/bin/ld: src/ntp.o: undefined reference to symbol 'clock_gettime@@GLIBC_2.2.5'
/usr/bin/ld: note: 'clock_gettime@@GLIBC_2.2.5' is defined in DSO /usr/lib/librt.so.1 so try adding it to the linker command line
/usr/lib/librt.so.1: could not read symbols: Invalid operation
collect2: error: ld returned 1 exit status

12 years agosession: If no policy plugin is selected use default config
Daniel Wagner [Tue, 2 Oct 2012 14:11:53 +0000 (16:11 +0200)]
session: If no policy plugin is selected use default config

12 years agosession: Move the default config create part back to core
Daniel Wagner [Tue, 2 Oct 2012 14:04:59 +0000 (16:04 +0200)]
session: Move the default config create part back to core

12 years agoerror: EINPROGRESS error was not handled
Jukka Rissanen [Mon, 1 Oct 2012 10:15:43 +0000 (13:15 +0300)]
error: EINPROGRESS error was not handled

12 years agoinet: Cleanup rtnl callback data properly
Jukka Rissanen [Mon, 1 Oct 2012 10:15:42 +0000 (13:15 +0300)]
inet: Cleanup rtnl callback data properly

The inet_rtnl_cb_data struct allocated in __connman_inet_rtnl_talk()
was not deallocated if we expected data from kernel.

12 years agontp: Calculate transmit time from receive time and monotonic delta
Patrik Flykt [Tue, 25 Sep 2012 10:28:02 +0000 (13:28 +0300)]
ntp: Calculate transmit time from receive time and monotonic delta

Calculate transmit time used in NTP as the reception time minus
the delta of the monotonic receive and transmit times. When
calculated this way, it does not matter if the time happens to
be set to something else between the sending and receiving of the
NTP packet.

On sending the added monotonic time and the previous transmit time
are saved at the same point in time. On reception the monotonic time
is evaluated after the packet has been received by ConnMan. This is
in contrast to the actual reception wall clock time which is added
by the kernel. The difference between the reception times on a normal
system is about 100µs, which is neglible.

12 years agotest: Check test-connman arguments
Patrik Flykt [Mon, 1 Oct 2012 08:22:09 +0000 (11:22 +0300)]
test: Check test-connman arguments

Check test-connman offlinemode arguments and the number of arguments
in general.

Fixes BMC#25723

12 years agotechnology: Update tethering properties when relevant
Tomasz Bursztyka [Thu, 20 Sep 2012 13:33:36 +0000 (16:33 +0300)]
technology: Update tethering properties when relevant

12 years agowispr: Properly handle Agent error
Tomasz Bursztyka [Fri, 28 Sep 2012 12:41:06 +0000 (15:41 +0300)]
wispr: Properly handle Agent error

12 years agogdbus: Refactor filter_data_find()
Lucas De Marchi [Thu, 27 Sep 2012 11:58:59 +0000 (08:58 -0300)]
gdbus: Refactor filter_data_find()

Now this function is only used for searching the listeners of a
connection and the other parameters are not needed anymore.

12 years agogdbus: Fix wrong signal handler match
Lucas De Marchi [Thu, 27 Sep 2012 11:58:58 +0000 (08:58 -0300)]
gdbus: Fix wrong signal handler match

When we add a signal handler with g_dbus_add_signal_watch(), this
function tries to multiplex the matches added in libdbus by checking
if there's a previous filter_data with the same fields. However, if the
field is NULL it accepts as being the same. The result is that the
following watches will use the same filter data:

watch1 = g_dbus_add_signal_watch(conn, BUS_NAME, NULL, iface, member,
cb1, data1, NULL);
watch2 = g_dbus_add_signal_watch(conn, BUS_NAME, "/path2", iface, member,
cb2, data2, NULL);
watch3 = g_dbus_add_signal_watch(conn, BUS_NAME, "/path3", iface, member,
cb3, data3, NULL);

The result is that when a signal arrives with path == "/path2", all 3
callbacks above will be called, with the same signal delivered to all of
them.

Another problem is that, if we invert the calls like below, only signals
to cb1 will never be trigerred, nonetheless it used path == NULL.

watch2 = g_dbus_add_signal_watch(conn, BUS_NAME, "/path2", iface, member,
cb2, data2, NULL);
watch1 = g_dbus_add_signal_watch(conn, BUS_NAME, NULL, iface, member,
cb1, data1, NULL);
watch3 = g_dbus_add_signal_watch(conn, BUS_NAME, "/path3", iface, member,
cb3, data3, NULL);

This is fixed by not multiplexing the matchs with filter data if any of
the fields are different, including being NULL. When a signal arrives,
if a field is NULL we accept it as a match, but not when adding the
signal handler.

12 years agogdbus: Fix crash when getting disconnected from the bus
Johan Hedberg [Thu, 27 Sep 2012 11:58:57 +0000 (08:58 -0300)]
gdbus: Fix crash when getting disconnected from the bus

When getting disconnected from the bus sometimes (maybe always?)
dbus_watch_handle() can cause the "info" context to be free'd meaning
that we should not try to access it after the call. The only member we
need access to is the connection pointer and as the code already has a
ref() call for it it's only natural to solve the issue by adding a local
variable not dependent on "info".

The backtrace of the crash fixed looks as follows:

 Invalid read of size 8
   at 0x121085: watch_func (mainloop.c:105)
   by 0x4C72694: g_main_context_dispatch (gmain.c:2539)
   by 0x4C729C7: g_main_context_iterate.isra.23 (gmain.c:3146)
   by 0x4C72DC1: g_main_loop_run (gmain.c:3340)
   by 0x120541: main (main.c:551)
 Address 0x5bbcd90 is 16 bytes inside a block of size 24 free'd
   at 0x4A079AE: free (vg_replace_malloc.c:427)
   by 0x4C7837E: g_free (gmem.c:252)
   by 0x4F708BF: dbus_watch_set_data (dbus-watch.c:614)
   by 0x4F70938: _dbus_watch_unref (dbus-watch.c:132)
   by 0x4F6E9A7: _dbus_transport_handle_watch (dbus-transport.c:884)
   by 0x4F59AFB: _dbus_connection_handle_watch (dbus-connection.c:1497)
   by 0x4F70AF9: dbus_watch_handle (dbus-watch.c:683)
   by 0x121084: watch_func (mainloop.c:103)
   by 0x4C72694: g_main_context_dispatch (gmain.c:2539)
   by 0x4C729C7: g_main_context_iterate.isra.23 (gmain.c:3146)
   by 0x4C72DC1: g_main_loop_run (gmain.c:3340)
   by 0x120541: main (main.c:551)

12 years agowispr: Service does not need to be reference counted
Patrik Flykt [Thu, 13 Sep 2012 13:44:14 +0000 (16:44 +0300)]
wispr: Service does not need to be reference counted

12 years agowispr: Free wispr portal context struct instead of unreferencing it
Patrik Flykt [Thu, 13 Sep 2012 13:44:13 +0000 (16:44 +0300)]
wispr: Free wispr portal context struct instead of unreferencing it

The structure can now be directly freed, since the reference count
is always one. As a result, remove wispr_portal_context_unref()
function.

12 years agowispr: Remove service usage reset function
Patrik Flykt [Thu, 13 Sep 2012 13:44:12 +0000 (16:44 +0300)]
wispr: Remove service usage reset function

Remove reset_service_usage() as it is now obsolete with the
refcount always being equal to one.

12 years agowispr: Agent calls need not be referenced
Patrik Flykt [Thu, 13 Sep 2012 13:44:11 +0000 (16:44 +0300)]
wispr: Agent calls need not be referenced

There is no need to refcount while doing Agent API calls, since
outstanding Agent API calls are removed when the service is
disconnected.

Also remove wispr_portal_context_ref() as it is no longer used.

12 years agowispr: Clean up reference counting
Patrik Flykt [Thu, 13 Sep 2012 13:44:10 +0000 (16:44 +0300)]
wispr: Clean up reference counting

connman_wispr_portal_context is initialized with refcount set to one.
Don't reference it an additional times while doing asynchronous calls
if the calls can be cancelled. Unreference the structure when done.

12 years agoTODO: Add --nobacktrace removal task
Patrik Flykt [Wed, 26 Sep 2012 13:02:02 +0000 (16:02 +0300)]
TODO: Add --nobacktrace removal task

12 years agolog: Disable stack trace from command line
Patrik Flykt [Wed, 26 Sep 2012 13:01:36 +0000 (16:01 +0300)]
log: Disable stack trace from command line

Add a '--nobacktrace' command line switch to let the system
handle stack traces. The default is to let ConnMan handle them
as before

12 years agotest: Fix PrefixLength setting in set-ipv6-method
Tomasz Bursztyka [Wed, 26 Sep 2012 10:11:16 +0000 (13:11 +0300)]
test: Fix PrefixLength setting in set-ipv6-method

12 years agoipconfig: Fix IPv6.Configuration parsing
Tomasz Bursztyka [Mon, 24 Sep 2012 12:04:26 +0000 (15:04 +0300)]
ipconfig: Fix IPv6.Configuration parsing

PrefixLength is exposed as a byte in the API, but code was
waiting for a string when setting a new value.

12 years agounit: Do not append empty AllowedBearers dictionary
Daniel Wagner [Thu, 20 Sep 2012 14:34:05 +0000 (16:34 +0200)]
unit: Do not append empty AllowedBearers dictionary

An empty AllowedBearers means do not match anything.

12 years agosession: Apply policy on AllowedBearers
Daniel Wagner [Thu, 20 Sep 2012 14:24:04 +0000 (16:24 +0200)]
session: Apply policy on AllowedBearers

12 years agosession: Update AllowedBearers documentation
Daniel Wagner [Thu, 20 Sep 2012 14:46:48 +0000 (16:46 +0200)]
session: Update AllowedBearers documentation

12 years agounit: Support ConnectionType unknown
Daniel Wagner [Thu, 20 Sep 2012 14:34:55 +0000 (16:34 +0200)]
unit: Support ConnectionType unknown

12 years agosession: Apply policy on ConnnectionType
Daniel Wagner [Thu, 20 Sep 2012 15:06:29 +0000 (17:06 +0200)]
session: Apply policy on ConnnectionType

12 years agosession: Enforce correct ConnectionType settings
Daniel Wagner [Thu, 20 Sep 2012 13:03:00 +0000 (15:03 +0200)]
session: Enforce correct ConnectionType settings

Up to now an empty or wrong ConnectionType was interpreted as 'any'.
If the ConnectionType is either wrong ignore it. If no ConnectionType
setting is passed in during creation of the session choose 'any'.

12 years agosession: Update ConnnectionType documentation
Daniel Wagner [Thu, 20 Sep 2012 14:47:14 +0000 (16:47 +0200)]
session: Update ConnnectionType documentation

12 years agosession: Support no match in AllowedBearers
Daniel Wagner [Thu, 20 Sep 2012 13:00:41 +0000 (15:00 +0200)]
session: Support no match in AllowedBearers

Up to now an empty AllowedBearers was interpreted as match any. Let's
make the match all explicit by expecting '*'. If an empty
AllowedBearers is provided, we interpret this as no match. In this
case the application will never get an online notifcation.

12 years agosession_policy: Use bearer free function
Daniel Wagner [Wed, 19 Sep 2012 14:53:09 +0000 (16:53 +0200)]
session_policy: Use bearer free function

12 years agosession: Use g_slist_free_full to free bearer list
Daniel Wagner [Wed, 26 Sep 2012 11:59:01 +0000 (13:59 +0200)]
session: Use g_slist_free_full to free bearer list

12 years agosession: Add bearer list cleanup function
Daniel Wagner [Thu, 20 Sep 2012 14:04:19 +0000 (16:04 +0200)]
session: Add bearer list cleanup function

12 years agosession: Remove unused functions
Daniel Wagner [Wed, 26 Sep 2012 08:58:58 +0000 (10:58 +0200)]
session: Remove unused functions

Basic types are not used for the configuration anymore.

12 years agosession: Get config from policy plugin
Daniel Wagner [Wed, 26 Sep 2012 12:24:56 +0000 (14:24 +0200)]
session: Get config from policy plugin

Let's ask the plugin for the default configuration. AllowedBearers
and ConnectionType are not yet taken fromt the plugin. Instead
the user configuration will be taken.

12 years agosession_policy: Implement create() and destroy()
Daniel Wagner [Wed, 26 Sep 2012 09:08:41 +0000 (11:08 +0200)]
session_policy: Implement create() and destroy()

12 years agosession: Add callbacks for config creation and distruction
Daniel Wagner [Wed, 19 Sep 2012 14:04:51 +0000 (16:04 +0200)]
session: Add callbacks for config creation and distruction

Whenever a new session is created, the core will ask the plugin
the create the config. This config can then be used by the core
to enforce the user settings.

The owner ship of this config stays in the plugin. Therefore, the plugin
will destroy is later.

12 years agosession: Allow plugin access to connman_session_allowed_bearers_any
Daniel Wagner [Wed, 19 Sep 2012 12:58:20 +0000 (14:58 +0200)]
session: Allow plugin access to connman_session_allowed_bearers_any

12 years agosession: Move configuration bits to a public struct
Daniel Wagner [Wed, 26 Sep 2012 11:52:30 +0000 (13:52 +0200)]
session: Move configuration bits to a public struct

Instead of passing basic datatypes between the session core and the
policy plugin, provide a complex data structure which holds
the session configuration.

12 years agosession: Move bearer_info to session.h
Daniel Wagner [Wed, 26 Sep 2012 11:50:07 +0000 (13:50 +0200)]
session: Move bearer_info to session.h

Rename bearer_info to connman_session_bearer. Use also 'bearer' as local
variable instead of 'info' to avoid confusion with session_info.

12 years agosession: Use session pointer instead of string id
Daniel Wagner [Wed, 19 Sep 2012 11:37:14 +0000 (13:37 +0200)]
session: Use session pointer instead of string id

Instead of passing in some string to identify we can use the
connman_session pointer. This allows us to keep the way sessions
are identfied away from the core, e.g. using the D-Bus owner id or
something else.

12 years agosession: Move struct connman_session to session.h
Daniel Wagner [Wed, 19 Sep 2012 11:28:06 +0000 (13:28 +0200)]
session: Move struct connman_session to session.h

12 years agosession: Update session when policy plugin is added or removed
Daniel Wagner [Wed, 26 Sep 2012 08:51:08 +0000 (10:51 +0200)]
session: Update session when policy plugin is added or removed

12 years agosession: Assign config plugin to session
Daniel Wagner [Wed, 26 Sep 2012 08:48:26 +0000 (10:48 +0200)]
session: Assign config plugin to session

Let's pick the first plugin. If needed we can add some more smart code
later on.

12 years agosession: Move get config calls after basic session initialization
Daniel Wagner [Wed, 26 Sep 2012 08:45:38 +0000 (10:45 +0200)]
session: Move get config calls after basic session initialization

The config call will need some context later on. Therefore, create
and initializate with the owner and add the watch on the ownership
before we ask the policy plugin for any configuration.

12 years agosession: Maintain a sorted policy plugin list
Daniel Wagner [Wed, 26 Sep 2012 08:44:50 +0000 (10:44 +0200)]
session: Maintain a sorted policy plugin list