platform/upstream/connman.git
11 years agodnsproxy: Check the result of socket creation when resolving
Patrik Flykt [Mon, 19 Nov 2012 08:21:00 +0000 (10:21 +0200)]
dnsproxy: Check the result of socket creation when resolving

If the socket creation failed, continue with the next server.

11 years agodnsproxy: Check GIO channel for NULL before use
Patrik Flykt [Fri, 16 Nov 2012 12:12:46 +0000 (14:12 +0200)]
dnsproxy: Check GIO channel for NULL before use

Check GIO channel for NULL before using it. Also shut down the GIO channel
so that already pending input will not use the free'd structure.

12 years agodnsproxy: Close the UDP socket on error condition.
Forest Bond [Thu, 15 Nov 2012 15:23:50 +0000 (10:23 -0500)]
dnsproxy: Close the UDP socket on error condition.

The socket is created again on the next request.

Previously, an error condition only caused the event watch to be removed
and then added again on the next request to avoid processing spurious
error events.  But in some network environments, the error condition is
caused by an overly aggressive firewall that rejects our UDP packets and
sends an ICMP error packet indicating an unreachable host and/or port.
In some of these cases we can recover by using a different UDP source
port for outgoing requests (i.e. by closing and re-opening the socket).

12 years agoofono: Remove network if GPRS context is removed
Daniel Wagner [Thu, 15 Nov 2012 09:50:15 +0000 (10:50 +0100)]
ofono: Remove network if GPRS context is removed

Whenever the GPRS contextext is removed we need also to remove
the network object. Following sequence was observed:

  cm_update_attached() /huawei_1 Attached 1
  modem_changed() /huawei_1 Interfaces 0x07

Plugin creates network object and registers it at core

   cm_update_attached() /huawei_1 Attached 0
   service.c:run_auto_connect()
   set_property() /huawei_1 path /huawei_1/context1 org.ofono.ConnectionContext.Active

Obviously, the context is not attached at this point so we get an

   Failed to change property: /huawei_1/context1 org.ofono.ConnectionContext.Active: org.ofono.Error.NotAttached GPRS is not
attached

Fixes BMC#25725

12 years agoiptables: A file descriptor cannot be a nagative integer
Danny Jeongseok Seo [Tue, 13 Nov 2012 01:44:26 +0000 (10:44 +0900)]
iptables: A file descriptor cannot be a nagative integer

When a socket() has failed and a negative file descriptor has been set,
close() cannot accept a negative number as a parameter.

12 years agomanager: Fix negative error code
Danny Jeongseok Seo [Mon, 12 Nov 2012 11:34:42 +0000 (20:34 +0900)]
manager: Fix negative error code

Fix error code for __connman_error_failed

12 years agowifi: Handle D-Bus method call failure
Patrik Flykt [Fri, 9 Nov 2012 08:54:21 +0000 (10:54 +0200)]
wifi: Handle D-Bus method call failure

If -ECONNABORTED is received from the gsupplicant network disconnect
callback, it's an indication that the interface has already been
removed from wpa_supplicant side. This can happen due to a race condition
between rtnl and wpa_supplicant interface removal when a USB WiFi dongle
is pulled out.

The pointers given to the callback can no longer be trusted, don't touch
them in the callback. The have been removed by other code at this point.

12 years agosupplicant: Handle race condition on WiFi dongle removal
Patrik Flykt [Fri, 9 Nov 2012 08:54:20 +0000 (10:54 +0200)]
supplicant: Handle race condition on WiFi dongle removal

When a WiFi USB dongle is removed, both rtnl and wpa_supplicant will
be telling that the device is gone. While disconnecting and removing
an interface via gsupplicant, check that D-Bus doesn't give us an
error indicating the interface is already unregistered from D-Bus.

The gdb output looks like:
 (gdb) where
 #0  0x0042247c in network_connect (network=0x2) at plugins/wifi.c:1197
 #1  0x004228f0 in disconnect_callback (result=<value optimized out>,
 interface=0x0, user_data=0x99) at plugins/wifi.c:1254
 #2  0x0042b910 in network_remove_result (error=0x4d5458
 "org.freedesktop.DBus.Error.UnknownMethod", iter=<value optimized
 out>,
     user_data=<value optimized out>) at gsupplicant/supplicant.c:3593
 #3  0x0042ede0 in method_call_reply (call=0x4c6fd0,
 user_data=0x4d3be8) at gsupplicant/dbus.c:386
 #4  0x2abfddb4 in complete_pending_call_and_unlock () from
 /usr/lib/libdbus-1.so.3

Also don't call the same callback twice.

12 years agobridge: Close socket on error
Patrik Flykt [Tue, 13 Nov 2012 12:11:18 +0000 (14:11 +0200)]
bridge: Close socket on error

12 years agogdhcp: Fix resource leak
Danny Jeongseok Seo [Fri, 9 Nov 2012 08:21:24 +0000 (17:21 +0900)]
gdhcp: Fix resource leak

The socket was not closed when the sendto failed.

12 years agogweb: Check null before reference
Danny Jeongseok Seo [Fri, 9 Nov 2012 05:44:12 +0000 (14:44 +0900)]
gweb: Check null before reference

12 years agoinet: Fix resource leak
Danny Jeongseok Seo [Fri, 9 Nov 2012 05:46:27 +0000 (14:46 +0900)]
inet: Fix resource leak

The socket was not closed when err < 0 is true.

12 years agowifi: Skip service if there is error while loading its settings
Jukka Rissanen [Wed, 7 Nov 2012 08:14:05 +0000 (10:14 +0200)]
wifi: Skip service if there is error while loading its settings

If service settings cannot be loaded, then skip that service.
Thanks for Felipe Tonello for reporting the issue.

12 years agoREADME: Add information about network interface clearing at startup
Jukka Rissanen [Thu, 1 Nov 2012 12:41:55 +0000 (14:41 +0200)]
README: Add information about network interface clearing at startup

12 years agosession: Register session after policy plugin returned config
Daniel Wagner [Wed, 31 Oct 2012 09:33:39 +0000 (10:33 +0100)]
session: Register session after policy plugin returned config

Move the configuration part of __connman_session_create() into
session_create_cb(). With this change the policy plugin is able
to do async work to retrieve a configuration.

12 years agosession: Factor out user settings in __connman_session_create()
Daniel Wagner [Wed, 31 Oct 2012 09:33:38 +0000 (10:33 +0100)]
session: Factor out user settings in __connman_session_create()

In order to be able to pass the user configuration provided through from
the D-Bus Manager.SessionCreate() call to the callback we need to store
the configuration into a local data data structure. This data structure
can then be passed into the callback introduced later on.

12 years agosession: Remove struct connman_session_bearer
Daniel Wagner [Wed, 31 Oct 2012 09:33:37 +0000 (10:33 +0100)]
session: Remove struct connman_session_bearer

Instead start using enum connman_service_type directly.

12 years agosession: Handle no match case in parse_bearers()
Daniel Wagner [Wed, 31 Oct 2012 09:33:36 +0000 (10:33 +0100)]
session: Handle no match case in parse_bearers()

12 years agosession: parse_bearers() should check for invalid types
Daniel Wagner [Wed, 31 Oct 2012 09:33:35 +0000 (10:33 +0100)]
session: parse_bearers() should check for invalid types

12 years agosession: Rename session_parse_allowed_bearers() to parse_bearers()
Daniel Wagner [Wed, 31 Oct 2012 09:33:34 +0000 (10:33 +0100)]
session: Rename session_parse_allowed_bearers() to parse_bearers()

This function name was a source of confusion because in a later patch
we introduce connman_session_parse_allowed_bearers() which will
call parse_bearers(). With this change it should be more readable.

12 years agosession: Remove match_all from connman_session_bearer
Daniel Wagner [Wed, 31 Oct 2012 09:33:33 +0000 (10:33 +0100)]
session: Remove match_all from connman_session_bearer

The match_all will be expressed through CONNMAN_SESSION_TYPE_UNKNOWN.
The 'no match' case happens when allowed_bearers is NULL.

12 years agosession: Remove name variable from connman_session_bearer
Daniel Wagner [Wed, 31 Oct 2012 09:33:32 +0000 (10:33 +0100)]
session: Remove name variable from connman_session_bearer

The string is only used when appending the bearer to the D-Bus
message in append_allowed_bearers(). Let's use
__connman_session_type2string() in append_allowed_bearers(). This
saves a bit of memory.

12 years agosession: Add callback to policy create()
Daniel Wagner [Wed, 31 Oct 2012 09:33:31 +0000 (10:33 +0100)]
session: Add callback to policy create()

Instead returning directly a config when create() is called
in policy plugin, use a callback function for handing over a valid
configuration from the plugin to the session core. This prepares
support for asynchronous create call.

12 years agosession: Policy register should check callback existence
Daniel Wagner [Wed, 31 Oct 2012 09:33:30 +0000 (10:33 +0100)]
session: Policy register should check callback existence

Let's ensure that the policy plugin has all necessary callbacks
installed when connman_session_policy_register() is called. The rest
of the code expects that the create() and destroy() callbacks exist
whenever a plugin is used.

12 years agosession: Pick directly first policy in list
Daniel Wagner [Wed, 31 Oct 2012 09:33:29 +0000 (10:33 +0100)]
session: Pick directly first policy in list

There is no point in iterating over the list when we always
pick the first element in the list.

12 years agosession: Factor out memory release part of cleanup_session
Daniel Wagner [Wed, 31 Oct 2012 09:33:28 +0000 (10:33 +0100)]
session: Factor out memory release part of cleanup_session

We want to reuse this code snippet for the error case in
__connman_session_create() too.

12 years agomanager: Allow async CreateSession method call
Daniel Wagner [Wed, 31 Oct 2012 09:33:27 +0000 (10:33 +0100)]
manager: Allow async CreateSession method call

The CreateSession D-Bus call should be marked as async call in order
to allow the session core to defer the response.

12 years agostorage: Add void if function does not have any arguments
Daniel Wagner [Wed, 31 Oct 2012 09:33:26 +0000 (10:33 +0100)]
storage: Add void if function does not have any arguments

12 years agodhcp: Clear ipaddresses from ipconfig before starting DHCP
Jukka Rissanen [Thu, 1 Nov 2012 12:16:24 +0000 (14:16 +0200)]
dhcp: Clear ipaddresses from ipconfig before starting DHCP

This is needed if manually configured addresses were used and later
DHCP was taken into use. If the manually configured IP information
(address, netmask and gateway) and the information given by DHCP is the
same, DHCP will not set the IP address to the interface.

12 years agoipconfig: Add function to clear ipaddress information
Jukka Rissanen [Thu, 1 Nov 2012 12:16:23 +0000 (14:16 +0200)]
ipconfig: Add function to clear ipaddress information

12 years agoopenvpn: Support '--tls-auth <file>' with optional '<direction>' argument
Emil Renner Berthing [Tue, 23 Oct 2012 10:29:24 +0000 (13:29 +0300)]
openvpn: Support '--tls-auth <file>' with optional '<direction>' argument

Connman              OpenVPN

OpenVPN.TLSAuth      --tls-auth <file> [<direction>]
OpenVPN.TLSAuthDir   optional <direction> argument to '--tls-auth'

Since 'OpenVPN.TLSAuthDir' contains the optional <direction> argument for
'OpenVPN.TLSAuth', handle them separately. The special handling is
identified by setting openvpn command line argument to NULL.

12 years agoopenvpn: Add more options
Emil Renner Berthing [Tue, 23 Oct 2012 10:29:23 +0000 (13:29 +0300)]
openvpn: Add more options

Connman              OpenVPN

OpenVPN.NSCertType   --ns-cert-type <client|server>
OpenVPN.AskPass      --askpass <file>
OpenVPN.AuthNoCache  --auth-nocache

12 years agoRelease 1.9 1.9
Marcel Holtmann [Fri, 26 Oct 2012 08:48:16 +0000 (01:48 -0700)]
Release 1.9

12 years agotechnology: Do not proceed with tethering if technology is not enabled
Tomasz Bursztyka [Fri, 26 Oct 2012 07:33:11 +0000 (10:33 +0300)]
technology: Do not proceed with tethering if technology is not enabled

Fixes BMC#25846

12 years agosystemd: prevent duplicate logging messages in journal
Marti Raudsepp [Thu, 25 Oct 2012 18:30:44 +0000 (21:30 +0300)]
systemd: prevent duplicate logging messages in journal

By default, both stdout and syslog messages go to the systemd journal,
which results in duplicate messages being logged.

Thanks to Vinicius Costa Gomes for pointing out this problem.

12 years agotechnology: Do not presume a technology being hardblocked when created
Tomasz Bursztyka [Thu, 25 Oct 2012 07:54:57 +0000 (10:54 +0300)]
technology: Do not presume a technology being hardblocked when created

This fixes an issue with the TechnologyAdded signal when the first
un-hardblock event occurs:
- when a technology was created, D-Bus registration was done and hardblock
  was set to TRUE even if there was no evidence that the technology was
  rfkill driven
- when the technology was updated to be rfkill driven, hardblock was already
  set to TRUE and thus the technology was not unregistered
- when an rfkill event un-hardblocks the technology, the TechnologyAdded
  signal was not sent since the technology was already registered to D-Bus

12 years agodnsproxy: Add reply host part length checking
Patrik Flykt [Thu, 25 Oct 2012 10:52:22 +0000 (13:52 +0300)]
dnsproxy: Add reply host part length checking

Check that the first part of the name is not of zero length before
attempting to calculate the length of the domain part. Also ensure
the domain lenght checking does not run outside of the receive
buffer.

Also add debug messages for ids and lengths in order to pinpoint
any possible problems.

12 years agowispr: Free wispr portal context in the relevant place
Tomasz Bursztyka [Tue, 23 Oct 2012 07:26:44 +0000 (10:26 +0300)]
wispr: Free wispr portal context in the relevant place

This fixes 2 issues:
- calling __connman_service_ipconfig_indicate_state() might lead to
  restart wispr_portal check, so context should not be freed afterward
  but beforehand.
- freeing the context in wispr_manage_message() should not happen since
  wispr_manage_message() will return back to wispr_portal_web_result()
  where we can still use the context.

Thanks to Julien Massot <jmassot@aldebaran-robotics.com> who reported
the issue and provided logs.

12 years agodevice: Do not mark connecting networks unavailable
Tomasz Bursztyka [Mon, 22 Oct 2012 07:07:49 +0000 (10:07 +0300)]
device: Do not mark connecting networks unavailable

When autoscan fallback code is started, it sets scanning to true which
in turn marks all networks unavailable except for the ones that are
already connected. When connecting during an ongoing autoscan, the
connection attempt stops autoscan and all unavailable networks are
removed, also the one to be connected.

The fix is to ignore both connected and connecting networks when
marking networks unavailable.

12 years agonetwork: Fix typo in debug print
Jukka Rissanen [Fri, 19 Oct 2012 07:44:03 +0000 (10:44 +0300)]
network: Fix typo in debug print

12 years agoweb: Make debug func print more useful information
Jukka Rissanen [Thu, 18 Oct 2012 11:35:19 +0000 (14:35 +0300)]
web: Make debug func print more useful information

The file and function name are printed in debug prints.

12 years agogresolv: Remove query from queue before destroying the query
Jukka Rissanen [Thu, 18 Oct 2012 11:35:18 +0000 (14:35 +0300)]
gresolv: Remove query from queue before destroying the query

The order of actions is important here.

12 years agogresolv: Make sure we will not receive DNS data after closing
Jukka Rissanen [Thu, 18 Oct 2012 11:35:17 +0000 (14:35 +0300)]
gresolv: Make sure we will not receive DNS data after closing

We must close the channel when freeing the resolver object,
otherwise we might still receive data when the resolver has been
freed already.

Fixes BMC#25757

12 years agogresolv: Add more debug prints
Jukka Rissanen [Thu, 18 Oct 2012 11:35:16 +0000 (14:35 +0300)]
gresolv: Add more debug prints

12 years agogresolv: Make debug func print more useful information
Jukka Rissanen [Thu, 18 Oct 2012 11:35:15 +0000 (14:35 +0300)]
gresolv: Make debug func print more useful information

The file and function names are printed in debug prints.

12 years agoservice: Prefer user connected services with SingleConnectedTechnology
Patrik Flykt [Wed, 17 Oct 2012 10:34:43 +0000 (13:34 +0300)]
service: Prefer user connected services with SingleConnectedTechnology

Don't override user connected services with the ones selected by the
preferred technology list when SingleConnectedTechnology is enabled.
Do this by checking each connected service sorted in the beginning of
the service list for the userconnect flag.

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')