framework/connectivity/connman.git
12 years agodevice: Return -EOPNOTSUPP if the device does not support scanning
Patrik Flykt [Wed, 1 Feb 2012 14:43:54 +0000 (16:43 +0200)]
device: Return -EOPNOTSUPP if the device does not support scanning

12 years agowifi: Always set scanning to FALSE in scan callback
Patrik Flykt [Wed, 1 Feb 2012 14:43:53 +0000 (16:43 +0200)]
wifi: Always set scanning to FALSE in scan callback

By always setting scanning to FALSE in the scan callback,
information for a stopped scan will be processed in
device.c.

12 years agovpn: Reference of provider not taken
Jukka Rissanen [Fri, 3 Feb 2012 11:31:28 +0000 (13:31 +0200)]
vpn: Reference of provider not taken

VPN plugin hooks itself into rtnl newlink watch and gives
provider pointer as user data. We must take reference of the
user data pointer as otherwise we might access invalid pointer
if provider is already removed when rtnl watch is triggered.
This seems to be a rare issue but I had one valgrind crash
because of this.

12 years agoiptables: add capability to check for an existing rule
Tomasz Bursztyka [Wed, 1 Feb 2012 14:38:18 +0000 (16:38 +0200)]
iptables: add capability to check for an existing rule

12 years agoiptables: refactor how an existing rule is found
Tomasz Bursztyka [Wed, 1 Feb 2012 14:38:17 +0000 (16:38 +0200)]
iptables: refactor how an existing rule is found

12 years agotest: adding a fonction to compare a rule against the actual ones
Tomasz Bursztyka [Wed, 1 Feb 2012 14:38:16 +0000 (16:38 +0200)]
test: adding a fonction to compare a rule against the actual ones

12 years agotest: refactoring rule finding part into iptables-test
Tomasz Bursztyka [Wed, 1 Feb 2012 14:38:15 +0000 (16:38 +0200)]
test: refactoring rule finding part into iptables-test

12 years agoTODO: Remove IP ranges allocation and check entry
Daniel Wagner [Fri, 27 Jan 2012 14:32:01 +0000 (15:32 +0100)]
TODO: Remove IP ranges allocation and check entry

12 years agoipconfig: Add/del IP address from IP pool
Daniel Wagner [Fri, 27 Jan 2012 14:10:58 +0000 (15:10 +0100)]
ipconfig: Add/del IP address from IP pool

12 years agotethering: Add notification callback implementation
Guillaume Zajac [Mon, 29 Aug 2011 09:32:36 +0000 (11:32 +0200)]
tethering: Add notification callback implementation

12 years agotest-ippool: Add collision unit test
Daniel Wagner [Thu, 26 Jan 2012 14:07:45 +0000 (15:07 +0100)]
test-ippool: Add collision unit test

12 years agoippool: Add API to notify when IP is externally assigned
Daniel Wagner [Thu, 26 Jan 2012 13:30:17 +0000 (14:30 +0100)]
ippool: Add API to notify when IP is externally assigned

12 years agotethering: Use IP pool API with DHCP
Guillaume Zajac [Mon, 29 Aug 2011 09:32:34 +0000 (11:32 +0200)]
tethering: Use IP pool API with DHCP

12 years agotethering: Use IP pool API with private network
Guillaume Zajac [Mon, 29 Aug 2011 09:32:33 +0000 (11:32 +0200)]
tethering: Use IP pool API with private network

12 years agotest-ippool: Add unit test for ippool
Daniel Wagner [Thu, 26 Jan 2012 15:03:32 +0000 (16:03 +0100)]
test-ippool: Add unit test for ippool

12 years agoippool: Add IP pool layer
Daniel Wagner [Thu, 26 Jan 2012 15:46:37 +0000 (16:46 +0100)]
ippool: Add IP pool layer

This is based on Guillaume Zajac intial IP pool patches.

12 years agovpnc: Fix compiler warning
Daniel Wagner [Mon, 30 Jan 2012 14:46:16 +0000 (15:46 +0100)]
vpnc: Fix compiler warning

Assignment discards ‘const’ qualifier from pointer target type.

12 years agosession: Send SessionMode property change message
Daniel Wagner [Tue, 31 Jan 2012 15:41:51 +0000 (16:41 +0100)]
session: Send SessionMode property change message

12 years agotechnology: Fix technology refcounting
Alok Barsode [Wed, 25 Jan 2012 12:16:41 +0000 (14:16 +0200)]
technology: Fix technology refcounting

technology_add_device and technology_add_rfkill should increment
technology refcount. The refcount denotes the total number of devices
and rfkill switches in the technology. Similarly technology_remove_device
and technology_remove_rfkill should decrement technology refcount.
Once the refcount is 0, which means that there are no devices and rfkill
switches in this technology, technology should be freed.

12 years agotechnology: Create a list for technology orphaned rfkill switches
Alok Barsode [Mon, 30 Jan 2012 10:23:58 +0000 (12:23 +0200)]
technology: Create a list for technology orphaned rfkill switches

If we get a rfkill switch before the technology driver was registered we
would lose track of it as we currently ignoed it. Adding a global rfkill
hash table which can keep a track of technologyless switches untill the
driver for them is loaded. If the driver is not compiled in the switches
will remain in the hash but will not be handled by connman.

12 years agotechnology: Create a list for technology orphaned devices
Alok Barsode [Mon, 30 Jan 2012 10:16:25 +0000 (12:16 +0200)]
technology: Create a list for technology orphaned devices

If we get a device before the technology driver was registered we
would lose track of it as we ignoed it. Adding a device list which
can keep a track of technologyless devices untill the driver for
them is loaded. If the driver is not compiled in the devices will
remain in the list.

12 years agoAUTHORS: Mention Guillaume Zajac's contributions
Samuel Ortiz [Fri, 27 Jan 2012 10:49:38 +0000 (11:49 +0100)]
AUTHORS: Mention Guillaume Zajac's contributions

12 years agooFono: Update documentation
Daniel Wagner [Fri, 27 Jan 2012 10:46:15 +0000 (11:46 +0100)]
oFono: Update documentation

Explain how the plugin works for a GSM modem.

12 years agoshow-introspection: Fix technology introspection
Daniel Wagner [Fri, 20 Jan 2012 13:27:46 +0000 (14:27 +0100)]
show-introspection: Fix technology introspection

12 years agoprovider: Don't remove a provider on error
Patrik Flykt [Wed, 25 Jan 2012 11:49:45 +0000 (13:49 +0200)]
provider: Don't remove a provider on error

When a provider indicates error, set the corresponding
service error but don't remove the provider.

12 years agoprovider: Load providers at provider driver registration time
Patrik Flykt [Wed, 25 Jan 2012 11:49:44 +0000 (13:49 +0200)]
provider: Load providers at provider driver registration time

Load all saved providers that have the same type as the provider
driver being registered. While looking through the storage dir
for directory entries starting with 'provider_', the respective
settings file needs to be opened in order to check the type.
Since the settings file is already opened, load all other settings
as well with the help of the previously factored out functions.

12 years agoprovider: Handle connman_provider_load() in provider_create()
Patrik Flykt [Wed, 25 Jan 2012 11:49:43 +0000 (13:49 +0200)]
provider: Handle connman_provider_load() in provider_create()

Load provider data in provider_create() if provider_register()
returns success.

12 years agoprovider: Factor out service creation
Patrik Flykt [Wed, 25 Jan 2012 11:49:42 +0000 (13:49 +0200)]
provider: Factor out service creation

Factor out the creation of a service when given a provider.

12 years agoprovider: Factor out keyfile loading
Patrik Flykt [Wed, 25 Jan 2012 11:49:41 +0000 (13:49 +0200)]
provider: Factor out keyfile loading

Factor out keyfile loading from connman_provider_load() into
a fuction of its own.

12 years agoprovider: Don't set provider->name when creating provider struct
Patrik Flykt [Wed, 25 Jan 2012 11:49:40 +0000 (13:49 +0200)]
provider: Don't set provider->name when creating provider struct

Don't unnecessarily set provider->name to the value of the provider
identifier in connman_provider_get() since it's going to be reset
immediately to the supplied provider name.

12 years agovpn: Add check for properly initialized driver_hash
Patrik Flykt [Wed, 25 Jan 2012 11:49:39 +0000 (13:49 +0200)]
vpn: Add check for properly initialized driver_hash

12 years agostorage: Function to fetch all saved providers
Patrik Flykt [Wed, 25 Jan 2012 11:49:38 +0000 (13:49 +0200)]
storage: Function to fetch all saved providers

Implement __connman_storage_get_providers() to fetch all stored
providers.

12 years agoAUTHORS: Mention Daniel's contributions
Daniel Wagner [Wed, 25 Jan 2012 09:14:48 +0000 (10:14 +0100)]
AUTHORS: Mention Daniel's contributions

12 years agoiptables: Avoid NULL pointer dereference in table_cleanup()
Daniel Mack [Wed, 21 Dec 2011 10:18:20 +0000 (11:18 +0100)]
iptables: Avoid NULL pointer dereference in table_cleanup()

12 years agotechnology: Remove 'State' property from Technology
Patrik Flykt [Fri, 20 Jan 2012 14:30:39 +0000 (16:30 +0200)]
technology: Remove 'State' property from Technology

12 years agotechnology: Add 'Connected' Technology property
Patrik Flykt [Fri, 20 Jan 2012 14:30:38 +0000 (16:30 +0200)]
technology: Add 'Connected' Technology property

Set Technology property 'Connected' to true if at least one service
for the Technology is connected; false otherwise.

12 years agonetwork: Add caller information to ref/unref debug prints.
Jukka Rissanen [Fri, 20 Jan 2012 10:01:49 +0000 (12:01 +0200)]
network: Add caller information to ref/unref debug prints.

12 years agodevice: Add caller information to ref/unref debug prints.
Jukka Rissanen [Fri, 20 Jan 2012 10:01:48 +0000 (12:01 +0200)]
device: Add caller information to ref/unref debug prints.

12 years agoprovider: Add caller information to ref/unref debug prints.
Jukka Rissanen [Fri, 20 Jan 2012 10:01:47 +0000 (12:01 +0200)]
provider: Add caller information to ref/unref debug prints.

12 years agoipconfig: Add caller information to ref/unref debug prints.
Jukka Rissanen [Fri, 20 Jan 2012 10:01:46 +0000 (12:01 +0200)]
ipconfig: Add caller information to ref/unref debug prints.

12 years agoservice: Add caller information to ref/unref debug prints.
Jukka Rissanen [Fri, 20 Jan 2012 10:01:45 +0000 (12:01 +0200)]
service: Add caller information to ref/unref debug prints.

This helps to pin point the exact line/function who is taking the reference.

12 years agotest-connman: Use Powered property to enable/disable Technologies
Patrik Flykt [Fri, 20 Jan 2012 12:01:28 +0000 (14:01 +0200)]
test-connman: Use Powered property to enable/disable Technologies

12 years agotechnology: Add object path to TechnologyAdded signal
Daniel Wagner [Fri, 20 Jan 2012 08:05:12 +0000 (09:05 +0100)]
technology: Add object path to TechnologyAdded signal

As it is described in the manager-api.txt document.

12 years agodnsproxy: Check that cache is valid before accessing it.
Jukka Rissanen [Fri, 20 Jan 2012 07:53:58 +0000 (09:53 +0200)]
dnsproxy: Check that cache is valid before accessing it.

The cache can become invalid by just disconnecting a service.
In that case we must not access the cache hash.

12 years agonetwork: Avoid double network disconnect.
Jukka Rissanen [Tue, 10 Jan 2012 09:22:01 +0000 (11:22 +0200)]
network: Avoid double network disconnect.

12 years agonetwork: Refactor set_connected() function.
Jukka Rissanen [Tue, 10 Jan 2012 09:22:00 +0000 (11:22 +0200)]
network: Refactor set_connected() function.

The set_connected() is split to two parts, the disconnect
part is in set_disconnected() function.

12 years agoofono: Cancel pending SetProperty
Daniel Wagner [Thu, 19 Jan 2012 10:24:16 +0000 (11:24 +0100)]
ofono: Cancel pending SetProperty

If the cellular technolgy is disabled while ConnMan is connected
to a cellular network, the plugin gets first a network_disconnect()
call and shortly after that a modem_disable(). network_disconnect()
will set org.ofono.ConnectionContext.Active to false while this call
is pending modem_disable() tries to set org.ofono.Modem.Online to false.

There is no point in waiting for the first call to succeed or fail.
Just cancel it and set the modem offline.

Fixes BMC#24651.

12 years agoprovider: Remove provider from the hash properly
Jukka Rissanen [Thu, 19 Jan 2012 14:31:44 +0000 (16:31 +0200)]
provider: Remove provider from the hash properly

We must not just do connman_provider_unref(provider) as that will
leave the provider to the provider_hash and we will get free memory
access error. We can just remove the provider from the hash and
that will unref the provider automagically.

12 years agoprovider: VPN service can be null
Jukka Rissanen [Thu, 19 Jan 2012 14:31:43 +0000 (16:31 +0200)]
provider: VPN service can be null

12 years agotechnology: Fix g_dbus_emit_signal argument
Alok Barsode [Wed, 18 Jan 2012 15:13:49 +0000 (15:13 +0000)]
technology: Fix g_dbus_emit_signal argument

Fixes BMC#24636

12 years agotechnology: Remove unused notifier functions
Patrik Flykt [Thu, 19 Jan 2012 12:27:51 +0000 (14:27 +0200)]
technology: Remove unused notifier functions

12 years agonotifier: Remove unused technology notifiers
Patrik Flykt [Thu, 19 Jan 2012 12:27:50 +0000 (14:27 +0200)]
notifier: Remove unused technology notifiers

Since there only user of  __connman_notifier_is_enabled()
and __connman_notifier_is_register() was removed with the
technology method calls in Manager, remove the now unnecessary
support functions.

12 years agotechnology: Add 'Powered' Technology property
Patrik Flykt [Thu, 19 Jan 2012 12:27:49 +0000 (14:27 +0200)]
technology: Add 'Powered' Technology property

Remove __connman_technology_enable/disable functions but reuse
their contents for 'Powered' property implementation. As a result
move code around as the new functions are now static.

12 years agomanager: Remove EnableTechnology and DisableTechnology
Patrik Flykt [Thu, 19 Jan 2012 12:27:48 +0000 (14:27 +0200)]
manager: Remove EnableTechnology and DisableTechnology

Remove EnableTechnology and DisableTechnology D-Bus method calls
from Manager API.

12 years agotest-manager: Pretty-print SessionMode as 'true'/'false'
Patrik Flykt [Wed, 18 Jan 2012 13:06:28 +0000 (15:06 +0200)]
test-manager: Pretty-print SessionMode as 'true'/'false'

12 years agotest-manager: Update test-manager with Technology changes
Patrik Flykt [Wed, 18 Jan 2012 13:06:27 +0000 (15:06 +0200)]
test-manager: Update test-manager with Technology changes

test-manager now gets the full set of technology paths and
properties from Manager GetTechnologies() D-Bus method call.

Fixes BMC#24637

12 years agoipconfig: Possible to have double unref
Jukka Rissanen [Wed, 18 Jan 2012 10:48:35 +0000 (12:48 +0200)]
ipconfig: Possible to have double unref

Because we do not check that origin pointer is not this ipconfig,
it is possible that we might try to unref the ipconfig one time
too many.
Something like this was seen in the log file:

connmand[19208]: src/ipconfig.c:enable_ipv6()
connmand[19208]: src/ipconfig.c:__connman_ipconfig_unref() ipconfig 0x47502f0 refcount 0
connmand[19208]: src/ipconfig.c:__connman_ipconfig_disable() ipconfig 0x47502f0
connmand[19208]: src/ipconfig.c:disable_ipv6()
connmand[19208]: src/ipconfig.c:__connman_ipconfig_unref() ipconfig 0x47502f0 refcount -1

12 years agoproxy: Service was saved but not referenced
Jukka Rissanen [Wed, 18 Jan 2012 14:46:37 +0000 (16:46 +0200)]
proxy: Service was saved but not referenced

12 years agoconnection: Only take service ref when saving service
Jukka Rissanen [Wed, 18 Jan 2012 14:46:36 +0000 (16:46 +0200)]
connection: Only take service ref when saving service

The fix b68795352dd5a9ac41eab31c765ade0c88329a6e was only partly
working. We must only take the ref when we are saving stuff
to hash (no need to take ref if we are only modifying value
in the hash). This patch reverts the commit b68795

12 years agoservice: Properly ref/unref the network
Jukka Rissanen [Wed, 18 Jan 2012 14:46:35 +0000 (16:46 +0200)]
service: Properly ref/unref the network

We only took reference to network when the network was
created by service. This needs to be changed as the network
might disappear while service is using network pointer.
So now we take network ref when necessary and release it
when service is removed or if underlaying network is changed.

12 years agoservice: Refactor the service unref function
Jukka Rissanen [Wed, 18 Jan 2012 14:46:34 +0000 (16:46 +0200)]
service: Refactor the service unref function

12 years agoservice: Add ref counting debug
Jukka Rissanen [Wed, 18 Jan 2012 14:46:33 +0000 (16:46 +0200)]
service: Add ref counting debug

12 years agoservice: Cleanup of already removed functionality
Jukka Rissanen [Wed, 18 Jan 2012 14:46:32 +0000 (16:46 +0200)]
service: Cleanup of already removed functionality

The commit 87318d768c9bf6842ec4dc74f03220ee8b6a9c72 removed
code from service but left the network_created flag intact.
This patch removes the useless flag.

12 years agodhcpv6: Do not start release if we are not connected
Jukka Rissanen [Wed, 18 Jan 2012 13:25:02 +0000 (15:25 +0200)]
dhcpv6: Do not start release if we are not connected

We do not need to start the RELEASE procedure if we have not
yet contacted the server.

12 years agonetwork: Do not start IPv6 autoconfiguration if already pending
Jukka Rissanen [Wed, 18 Jan 2012 13:25:01 +0000 (15:25 +0200)]
network: Do not start IPv6 autoconfiguration if already pending

12 years agodhcpv6: Prevent user from starting DHCPv6 multiple times
Jukka Rissanen [Wed, 18 Jan 2012 13:25:00 +0000 (15:25 +0200)]
dhcpv6: Prevent user from starting DHCPv6 multiple times

We must make sure that user cannot start DHCPv6 many times
for a given network.

12 years agonetwork: Add more debug prints
Jukka Rissanen [Wed, 18 Jan 2012 13:24:59 +0000 (15:24 +0200)]
network: Add more debug prints

12 years agonetwork: Verify we are connected before starting DHCPv6
Jukka Rissanen [Wed, 18 Jan 2012 13:24:58 +0000 (15:24 +0200)]
network: Verify we are connected before starting DHCPv6

12 years agodhcpv6: Add more debug prints
Jukka Rissanen [Wed, 18 Jan 2012 13:24:57 +0000 (15:24 +0200)]
dhcpv6: Add more debug prints

12 years agodhcpv6: Do not wait answer to RELEASE message
Jukka Rissanen [Wed, 18 Jan 2012 13:24:56 +0000 (15:24 +0200)]
dhcpv6: Do not wait answer to RELEASE message

We do not want to wait the answer to release message that
was sent to the DHCPv6 server because the reply from server
might take some time and we must continue the network
disconnect procedure. So we just inform the server that we
are done with the addresses but ignore server reply as there
is nothing to be done anyway after sending the release.

12 years agoofono: Register technology driver
Daniel Wagner [Thu, 19 Jan 2012 08:03:47 +0000 (09:03 +0100)]
ofono: Register technology driver

With e1d92d253c5db96bdc8fe2a21e463fc730570311 we need to register a driver
for each technology.

Fixes BMC#24702.

12 years agotechnology: Register a technology is there's a driver for it
Alok Barsode [Thu, 12 Jan 2012 13:13:41 +0000 (15:13 +0200)]
technology: Register a technology is there's a driver for it

Connman should not handle technologies whose drivers are not compiled in.
This patch also avoids connman controlling the rfkill switches for
technologies not compiled in.

Fixes BMC#24549.

12 years agoethernet: Add technology driver for handling ethernet
Alok Barsode [Thu, 12 Jan 2012 13:13:40 +0000 (15:13 +0200)]
ethernet: Add technology driver for handling ethernet

12 years agotechnology: Assign driver to technology at creation time
Alok Barsode [Thu, 12 Jan 2012 13:13:39 +0000 (15:13 +0200)]
technology: Assign driver to technology at creation time

No need to assign driver to technolog during driver registration.

12 years agodnsproxy: Fix invalid hash table cleanup
Daniel Wagner [Mon, 16 Jan 2012 08:18:12 +0000 (09:18 +0100)]
dnsproxy: Fix invalid hash table cleanup

The remove_listener() should not call __connman_dnsproxy_remove_listener
because that function will modify the hash table.

12 years agoipconfig: Move connman_ipaddress declaration to connman.h
Daniel Wagner [Fri, 13 Jan 2012 16:45:02 +0000 (17:45 +0100)]
ipconfig: Move connman_ipaddress declaration to connman.h

12 years agoipconfig: Rename previously public functions
Daniel Wagner [Fri, 13 Jan 2012 16:39:08 +0000 (17:39 +0100)]
ipconfig: Rename previously public functions

Prefix them with a "__".

12 years agoipconfig: Move connman_ipconfig_* to connman.h
Daniel Wagner [Fri, 13 Jan 2012 16:39:07 +0000 (17:39 +0100)]
ipconfig: Move connman_ipconfig_* to connman.h

Non of those function are used in the plugins.
Let's move them to connman.h.

12 years agotechnology: Add missing args termination
Daniel Wagner [Fri, 13 Jan 2012 15:05:31 +0000 (16:05 +0100)]
technology: Add missing args termination

Open argument list has to be terminated.

12 years agotest: Fixes enable/disable tethering script according to new API
Tomasz Bursztyka [Fri, 13 Jan 2012 08:37:20 +0000 (10:37 +0200)]
test: Fixes enable/disable tethering script according to new API

Fixes BMC#24644

12 years agogdhcp: Fix build failure
Samuel Ortiz [Fri, 13 Jan 2012 15:25:09 +0000 (16:25 +0100)]
gdhcp: Fix build failure

<inet.h> doesn't exist.

12 years agoconnection: Fix service refcount
Yu A Wang [Mon, 19 Dec 2011 08:00:17 +0000 (03:00 -0500)]
connection: Fix service refcount

Service may be refcount two times when add_gateway for both ipv4 and
ipv6, we need to unref the service twice according when we have both
ipv6 and ipv4 gateway

12 years agoservice: Fix reply_pending in __connman_service_connect
Danny Jeongseok Seo [Fri, 13 Jan 2012 15:11:26 +0000 (16:11 +0100)]
service: Fix reply_pending in __connman_service_connect

12 years agogweb: process_send_file after HTTP Header is sent
Sébastien Bianti [Tue, 10 Jan 2012 09:49:16 +0000 (10:49 +0100)]
gweb: process_send_file after HTTP Header is sent

12 years agosession: Undo empty D-Bus message check
Daniel Wagner [Tue, 10 Jan 2012 13:30:38 +0000 (14:30 +0100)]
session: Undo empty D-Bus message check

This check is wrong.

12 years agoprovider: Undo empty D-Bus message check
Daniel Wagner [Tue, 10 Jan 2012 13:29:26 +0000 (14:29 +0100)]
provider: Undo empty D-Bus message check

This check is wrong.

12 years agoagent: Undo empty D-Bus message check
Daniel Wagner [Tue, 10 Jan 2012 13:27:54 +0000 (14:27 +0100)]
agent: Undo empty D-Bus message check

This check is wrong.

12 years agoAUTHORS: Mention Arjan's contributions
Daniel Wagner [Tue, 10 Jan 2012 12:42:45 +0000 (13:42 +0100)]
AUTHORS: Mention Arjan's contributions

12 years agodnsproxy: Empty lines cleanup
Daniel Wagner [Tue, 10 Jan 2012 12:39:23 +0000 (13:39 +0100)]
dnsproxy: Empty lines cleanup

Add and remove some empty lines.

12 years agodnsproxy: Add cache refreshing logic
Arjan van de Ven [Tue, 10 Jan 2012 00:08:56 +0000 (16:08 -0800)]
dnsproxy: Add cache refreshing logic

This patch adds logic to the DNS cache where it will refresh, rather than purge,
popular DNS entries when they expire. This will cut down latency for the user,
since he doesn't have to wait for a DNS resolve for his popular entries.

It also makes changing DNS servers (say, when joining a VPN) less expensive,
since the popular entries from the cache will be refreshed after the join,
rather than just being dropped

12 years agodnsproxy: Add a "invalidate cache" function
Arjan van de Ven [Tue, 10 Jan 2012 00:08:53 +0000 (16:08 -0800)]
dnsproxy: Add a "invalidate cache" function

When something changes in the network topology, we need to invalidate the cache.
This first implementation will delete all entries (which could have been done
more efficiently), but in later patches in this series we'll enhance this logic
to only delete the cached data, not the names. With keeping the names,
we can then re-lookup popular data in the new topology.

12 years agodnsproxy: Deal nicer with a cache-full situation
Arjan van de Ven [Tue, 10 Jan 2012 00:08:49 +0000 (16:08 -0800)]
dnsproxy: Deal nicer with a cache-full situation

Now that we have hit counts for the cache, we can make the cache-full
handling slightly smarter; if we can't make space freeing expired entries,
we can now make space freeing entries that have a very low use count.

12 years agodnsproxy: Track cache hit statistics
Arjan van de Ven [Tue, 10 Jan 2012 00:08:45 +0000 (16:08 -0800)]
dnsproxy: Track cache hit statistics

For various decisions (which entries to prune, which entries to refresh)
and for debugging, it's useful to track how many hits a cache entry
gets.

This patch adds the basic counting for this; the only tricky aspect
is that we serve DNS entries out of the cache, even in case of a miss,
so we need to compensate for that by subtracting a hit first.

12 years agodnsproxy: Have a minimum cache TTL
Arjan van de Ven [Tue, 10 Jan 2012 00:08:42 +0000 (16:08 -0800)]
dnsproxy: Have a minimum cache TTL

some DNS servers return an extremely short TTL causing all kinds of fun.
This patch ensures that we just enforce a minimum TTL of 30 seconds.

12 years agodnsproxy: Cache negative IPv6 entries for the case where we have an IPv4 entry already
Arjan van de Ven [Tue, 10 Jan 2012 00:08:37 +0000 (16:08 -0800)]
dnsproxy: Cache negative IPv6 entries for the case where we have an IPv4 entry already

It's very common for a client to ask for both IPv4 and IPv6 entries for a name,
however until now, Connman would only cache the IPv4 entry. The result is that the
client app still has the full latency of a lookup, the one for the AAAA record.

This patch will cause Connman to cache negative IPv6 entries, but only if a valid
IPv4 entry is already in the cache. The TTL for this negative entry is set to
the TTL of the existing IPv4 entry, with the rationale that these entries go together
anyway.

12 years agodnsproxy: Send the correct TTL to our clients
Arjan van de Ven [Tue, 10 Jan 2012 00:08:33 +0000 (16:08 -0800)]
dnsproxy: Send the correct TTL to our clients

When we send a cached entry to our clients, it won't do to report the TTL
from the original request to our client. The time that an entry has lived
in our cache needs to be subtracted from the TTL that we report to our client.

This patch adds a function to adjust the TTL of a response that we send,
and uses the newly stored "valid_until" value to compute the remaining TTL.

12 years agodnsproxy: Start tracking the end time of the TTL
Arjan van de Ven [Tue, 10 Jan 2012 00:08:29 +0000 (16:08 -0800)]
dnsproxy: Start tracking the end time of the TTL

In order to be able to report an accurate TTL to our client (see next patch
to actually do that), we are going to need to track the end point in time
for this TTL. This also allows us to track separately how long an entry
is valid versus how long we want to cache the entry.

This patch also adds some logic to group end times of the various
cache entries to logical boundaries (10 and 30 seconds); this will
cause cache entries to expire together, which is more efficient in
power/performance, and also later when we add refreshing logic.

12 years agodnsproxy: Delete expired cache entries when they expire
Arjan van de Ven [Tue, 10 Jan 2012 00:08:25 +0000 (16:08 -0800)]
dnsproxy: Delete expired cache entries when they expire

The DNS cache has logic to never replace cached data if it already exists.
However, this only works well if we actually delete the data parts
of the cache entries as they expire.

This patch creates a cache_enforce_validity() function, which will
delete the data portion of cache entries if they are expired.
With this in place, consecutive lookups of the same name can get
cached again.

12 years agodnsproxy: Make sure "rr" is not NULL
Arjan van de Ven [Tue, 10 Jan 2012 00:08:21 +0000 (16:08 -0800)]
dnsproxy: Make sure "rr" is not NULL

I've caught some crashes with connman where "rr" ended up being NULL;
easy to add a check for this and prevent the crash.

12 years agotest-connman: Remove unsupported passphrase support
Daniel Wagner [Tue, 10 Jan 2012 12:19:37 +0000 (13:19 +0100)]
test-connman: Remove unsupported passphrase support