platform/upstream/connman.git
11 years agogdbus: Fix compilation error due to missing #defines
Syam Sidhardhan [Wed, 14 Nov 2012 13:07:10 +0000 (18:37 +0530)]
gdbus: Fix compilation error due to missing #defines

Since these are simple #define strings, we are defining it here
instead of upgrading to D-Bus 1.5 or later.

Log:
  CC     gdbus/object.o
gdbus/object.c: In function ‘properties_set’:
gdbus/object.c:876:7: error: ‘DBUS_ERROR_UNKNOWN_PROPERTY’ undeclared
 (first use in this function)
gdbus/object.c:876:7: note: each undeclared identifier is reported
 only once for each function it appears in
gdbus/object.c:881:6: error: ‘DBUS_ERROR_PROPERTY_READ_ONLY’
 undeclared (first use in this function)
make[1]: *** [gdbus/object.o] Error 1
make: *** [all] Error 2

11 years agogdbus: Remove connection from pending_property functions
Lucas De Marchi [Wed, 17 Oct 2012 15:14:28 +0000 (12:14 -0300)]
gdbus: Remove connection from pending_property functions

The reply to a DBus.Properties.Set() method call should go through the
same D-Bus connection. Thus remove the DBusConnection parameter from the
following functions:

    - g_dbus_pending_property_success()
    - g_dbus_pending_property_error_valist()
    - g_dbus_pending_property_error()

11 years agogdbus: Fix invalid memory access during interface removal
Johan Hedberg [Mon, 15 Oct 2012 10:21:11 +0000 (13:21 +0300)]
gdbus: Fix invalid memory access during interface removal

If an interface is removed from the root path during the same mainloop
iteration that it was added we need to check for data->added before
doing the check for data->parent == NULL in the remove_interface()
function. Otherwise the added interface doesn't get removed from the
data->added list and will result in accessing freed memory:

==337== Invalid read of size 8
==337==    at 0x4F65AFA: dbus_message_iter_append_basic (in /usr/lib64/libdbus-1.so.3.7.1)
==337==    by 0x1247B5: append_interface (object.c:556)
==337==    by 0x4C8DC5C: g_slist_foreach (gslist.c:840)
==337==    by 0x1261F7: process_changes (object.c:594)
==337==    by 0x126372: generic_unregister (object.c:997)
==337==    by 0x4F69669: ??? (in /usr/lib64/libdbus-1.so.3.7.1)
==337==    by 0x4F5CE51: dbus_connection_unregister_object_path (in /usr/lib64/libdbus-1.so.3.7.1)
==337==    by 0x125E81: object_path_unref (object.c:1236)
==337==    by 0x126136: g_dbus_unregister_interface (object.c:1361)
==337==    by 0x14CDF0: service_exit (service.c:581)
==337==    by 0x177556: plugin_cleanup (plugin.c:242)
==337==    by 0x12221F: main (main.c:559)
==337==  Address 0x5bc1550 is 0 bytes inside a block of size 56 free'd
==337==    at 0x4A079AE: free (vg_replace_malloc.c:427)
==337==    by 0x4C7850E: g_free (gmem.c:252)
==337==    by 0x125DB0: remove_interface (object.c:671)
==337==    by 0x125E3B: object_path_unref (object.c:1230)
==337==    by 0x126136: g_dbus_unregister_interface (object.c:1361)
==337==    by 0x14CDF0: service_exit (service.c:581)
==337==    by 0x177556: plugin_cleanup (plugin.c:242)
==337==    by 0x12221F: main (main.c:559)

11 years agogdbus: Add g_dbus_get_properties function
Johan Hedberg [Fri, 12 Oct 2012 08:55:37 +0000 (10:55 +0200)]
gdbus: Add g_dbus_get_properties function

This function can be used to construct custom D-Bus messages containing
the properties for a specific interface on a given path.

11 years agogdbus: Add support for invalidated properties
Johan Hedberg [Thu, 11 Oct 2012 09:53:27 +0000 (11:53 +0200)]
gdbus: Add support for invalidated properties

If there's a pending property but its exists() callback returns false
the property should be considered invalidated and included in the
relevant list of the PropertiesChanged signal.

11 years agogdbus: Fix processing pending properties in remove_interface()
Johan Hedberg [Mon, 8 Oct 2012 12:36:12 +0000 (14:36 +0200)]
gdbus: Fix processing pending properties in remove_interface()

11 years agogdbus: Fix up Properties.Set() code path
Lucas De Marchi [Sat, 6 Oct 2012 07:02:35 +0000 (04:02 -0300)]
gdbus: Fix up Properties.Set() code path

Minor fixes to make setter actually work:

- Add propdata in pending_property_set
- Break loop when we are removing propdata from list and we
  found it
- in_args and out_args were swapped
- interface and method name arguments were swapped

11 years agogdbus: Fix invalid memory access while unregistering
Lucas De Marchi [Thu, 4 Oct 2012 20:42:33 +0000 (17:42 -0300)]
gdbus: Fix invalid memory access while unregistering

If an interface is added and removed on the same mailoop iteration,
ObjectManager would try to send InterfacesAdded signal while running the
idler because the interface was added to data->added list.

This is easily reproduced by forcing an error path in a plugin
registration, like on sap_server_register(), resulting in the following
error:

==11795== Invalid read of size 4
==11795==    at 0x496F592: dbus_message_iter_append_basic (dbus-message.c:2598)
==11795==    by 0x117B39: append_interface (object.c:554)
==11795==    by 0x48955E7: g_slist_foreach (gslist.c:840)
==11795==    by 0x11923B: process_changes (object.c:592)
==11795==    by 0x11956D: generic_unregister (object.c:980)
==11795==    by 0x4973BAC: _dbus_object_tree_unregister_and_unlock (dbus-object-tree.c:516)
==11795==    by 0x4965240: dbus_connection_unregister_object_path (dbus-connection.c:5776)
==11795==    by 0x1178A5: object_path_unref (object.c:1219)
==11795==    by 0x118517: g_dbus_unregister_interface (object.c:1344)
==11795==    by 0x19AF5B: sap_exit (sap.c:385)
==11795==    by 0x13E9E2: sap_server_register (server.c:1428)
==11795==    by 0x13C092: sap_server_probe (manager.c:44)

With this patch we don't send the InterfacesAdded signal, removing it
from data->added while unregistering.

11 years agogdbus: Implement PropertiesChanged signal
Lucas De Marchi [Thu, 4 Oct 2012 07:26:37 +0000 (04:26 -0300)]
gdbus: Implement PropertiesChanged signal

11 years agogdbus: Simplify code for appending properties
Luiz Augusto von Dentz [Thu, 4 Oct 2012 07:26:36 +0000 (04:26 -0300)]
gdbus: Simplify code for appending properties

This reuse append_properties for GetAll and GetManagedObjects

11 years agogdbus: Integrates ObjectManager with Properties interface
Luiz Augusto von Dentz [Thu, 4 Oct 2012 07:26:35 +0000 (04:26 -0300)]
gdbus: Integrates ObjectManager with Properties interface

This appends the properties and its values when using ObjectManager.

11 years agogdbus: Only export ObjectManager interface on root path
Luiz Augusto von Dentz [Thu, 4 Oct 2012 07:26:34 +0000 (04:26 -0300)]
gdbus: Only export ObjectManager interface on root path

ObjectManager should be exported only in the root path and list all
the children paths.

11 years agogdbus: Group interface changes to reduce the amount of signals emitted
Luiz Augusto von Dentz [Thu, 4 Oct 2012 07:26:33 +0000 (04:26 -0300)]
gdbus: Group interface changes to reduce the amount of signals emitted

InterfacesAdded and InterfacesRemoved can group all the interfaces
changes together in one message.

11 years agogdbus: Add support for org.freedesktop.DBus.ObjectManager interface
Luiz Augusto von Dentz [Thu, 4 Oct 2012 07:26:32 +0000 (04:26 -0300)]
gdbus: Add support for org.freedesktop.DBus.ObjectManager interface

This implements initial support for ObjectManager, it automatically adds
objects to its parents so no action is needed by daemons to get their
objects managed by this interface.

ObjectManager is part of D-Bus spec since revision 0.17:
http://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces-objectmanager

11 years agogdbus: Add properties into Introspectable interface
Lucas De Marchi [Thu, 4 Oct 2012 07:26:31 +0000 (04:26 -0300)]
gdbus: Add properties into Introspectable interface

11 years agogdbus: Implement DBus.Properties.Set method
Lucas De Marchi [Thu, 4 Oct 2012 07:26:30 +0000 (04:26 -0300)]
gdbus: Implement DBus.Properties.Set method

Contrary to Get() and GetAll(), Set() is asynchronous so we pass an id
to the setter so later it can declare the Set() as successful or
otherwise.

11 years agogdbus: Implement DBus.Properties.GetAll method
Lucas De Marchi [Thu, 4 Oct 2012 07:26:29 +0000 (04:26 -0300)]
gdbus: Implement DBus.Properties.GetAll method

11 years agogdbus: Implement DBus.Properties.Get method
Lucas De Marchi [Thu, 4 Oct 2012 07:26:28 +0000 (04:26 -0300)]
gdbus: Implement DBus.Properties.Get method

11 years agogdbus: Add skeleton of DBus.Properties interface
Lucas De Marchi [Thu, 4 Oct 2012 07:26:27 +0000 (04:26 -0300)]
gdbus: Add skeleton of DBus.Properties interface

This interface is responsible for handling properties of all objects in
a given path. Right now it only registers itself, doing nothing useful.
A conversion to this new layout will be done by subsequent patches.

org.freedesktop.org.DBus.Properties spec can be found at
http://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces-properties

11 years agogdbus: Use macros to add annotations
Lucas De Marchi [Thu, 4 Oct 2012 07:26:26 +0000 (04:26 -0300)]
gdbus: Use macros to add annotations

Besides being more readable this way it avoids going over 80 chars.

11 years agogdbus: Move typedefs up
Lucas De Marchi [Thu, 4 Oct 2012 07:26:25 +0000 (04:26 -0300)]
gdbus: Move typedefs up

Move the typedefs up so they can be used by functions and callbacks.

11 years agoTODO: systemd no longer log twice to syslog
Jukka Rissanen [Wed, 31 Oct 2012 09:05:58 +0000 (11:05 +0200)]
TODO: systemd no longer log twice to syslog

Fixed by 295cc8b57ce12257a9e90ea2e15e0d610e072e0a

11 years agosession_policy_ivi: Implement policy load function
Daniel Wagner [Tue, 13 Nov 2012 16:28:15 +0000 (17:28 +0100)]
session_policy_ivi: Implement policy load function

If config file should also be parsed and the values then stored in
the config object.

11 years agosession_policy_ivi: Watch for changes on policy files
Daniel Wagner [Wed, 14 Nov 2012 16:16:39 +0000 (17:16 +0100)]
session_policy_ivi: Watch for changes on policy files

Monitor changes on the config files. Either create, modify or destroy
them according the events we get from the inotify interface.

11 years agosession_policy_ivi: Add hash table to track idents
Daniel Wagner [Fri, 2 Nov 2012 16:26:22 +0000 (17:26 +0100)]
session_policy_ivi: Add hash table to track idents

Introduce the second hash table which tracks the config object lifetime
based on the file existens. The parsing of the file and creation of the
config object is part of the next patch.

11 years agosession_policy_ivi: Create session config
Daniel Wagner [Fri, 2 Nov 2012 16:26:21 +0000 (17:26 +0100)]
session_policy_ivi: Create session config

The policy data object is refcounted because the policy data
object can be created either through the session core or
from the file based policy. In order to avoid complex logic
which tries to figure out when to is safe to destroy the object
we just fall back to refcountig.

polich_hash is the owner of the policy object. When a object is
created it is stored there. The key is the identitfier. Since the
session core does not know about the identifier we introduce
an additional hash table which maps from session pointer to the policy
object.

11 years agosession_policy_ivi: Get SELinux context of session owner
Daniel Wagner [Fri, 2 Nov 2012 16:26:20 +0000 (17:26 +0100)]
session_policy_ivi: Get SELinux context of session owner

11 years agosession_policy_ivi: Add policy plugin for IVI
Daniel Wagner [Fri, 2 Nov 2012 16:26:19 +0000 (17:26 +0100)]
session_policy_ivi: Add policy plugin for IVI

Add only the empty 'framework'. In the following patches we add
step by step the implementation.

11 years agosession: Don't filter match all out
Daniel Wagner [Fri, 2 Nov 2012 16:26:18 +0000 (17:26 +0100)]
session: Don't filter match all out

If the user provides the match all rule we should add the policy
bearer to the result.

11 years agosession: Store user AllowedBearers configuration
Daniel Wagner [Fri, 2 Nov 2012 16:26:17 +0000 (17:26 +0100)]
session: Store user AllowedBearers configuration

Don't overwrite the user provided AllowedBearers
configuration. Instead just store it at session level. So we always
will apply the bearer filter on the user input.

Obviously, this might need some more improvements on how we want
to handle the AllowedBearers behavior when the policy plugin and
the application provide a configuration. For exmaple should
we update the AllowedBearers if the policy changes or just always
show only the user input. This patch is not perfect but it
improves the situation clearly.

11 years agosession: Factor out set default config helper
Daniel Wagner [Tue, 13 Nov 2012 08:01:48 +0000 (09:01 +0100)]
session: Factor out set default config helper

Whenever a configuration gets invalid (e.g. a configuration
is removed) then we need to be able to drop back to the
default configutation.

11 years agosession: Export session parsing functions
Daniel Wagner [Fri, 2 Nov 2012 16:26:16 +0000 (17:26 +0100)]
session: Export session parsing functions

We want to reuse these functions.

11 years agosession: Add getter for session owner
Daniel Wagner [Fri, 2 Nov 2012 16:26:15 +0000 (17:26 +0100)]
session: Add getter for session owner

11 years agosession: Add destroy function for plugins
Daniel Wagner [Wed, 14 Nov 2012 13:48:57 +0000 (14:48 +0100)]
session: Add destroy function for plugins

The error handling can get easily get pretty hairy, e.g.
reallocating memory for allowed_bearers. If we hit this situation
we allow the plugin to shutdown the session. That is consistent
with what we do when there is a problem while creating a new
session.

11 years agosession: Add sessions config update function
Daniel Wagner [Fri, 2 Nov 2012 16:26:14 +0000 (17:26 +0100)]
session: Add sessions config update function

Give a policy plugin a way to inform the session core that
some of the config values have changed.

This could be done in a more clever way, e.g. figure out only
to update the necessary info entries but we keep it for now
as simple and assume everthing has changed.

11 years agodbus: Add SELinux support
Daniel Wagner [Fri, 2 Nov 2012 16:26:13 +0000 (17:26 +0100)]
dbus: Add SELinux support

ConnMan needs to identify application in a secure way when they are
using the Session API. The current D-Bus server implemention supports
two types of LSM, POSIX and SELinux. In order to support SMACK or
TOMOYO the D-Bus code base needs to be patch. This is the initial work
to support at least POSIX and SELinux. Maybe in the future we are able
to support also the other LSMs.

The idea behind gsec is to keep the LSM related code together in one
directory. The API introduces in this patch is not any way final. It
will need some more time figuring out how are able to intregrate this
in a nice way.

The current API introduces g_sec_get_selinux_label() which will return
the SELinux context. The function will issuing a
GetConnectionSELinuxSecurityContext method call.

Note, that this function is not documented in the D-Bus
specification. See for more details the source code dbus/bus/drivers.c
and dbus/bus/selinux.c in the D-Bus reference implementation.

11 years agoinotify: Watch out for files moved to/from watched dirs
Daniel Wagner [Tue, 13 Nov 2012 12:50:03 +0000 (13:50 +0100)]
inotify: Watch out for files moved to/from watched dirs

When we do not watch watch for IN_MOVED_TO or IN_MOVED_FROM we can
easily inconsistent. The user creates a file and moves it then
from the watched directory. We wouldn't see this change and therefore
keep the configuration. That is a rather anoying behavoir
for the policy plugin.

11 years agoinotify: Move inotify code into its own file
Daniel Wagner [Fri, 2 Nov 2012 16:26:12 +0000 (17:26 +0100)]
inotify: Move inotify code into its own file

The inotify code will be used by the core (config.c) and the session
policy plugin. We introduce a new API for file modifcation
notifcation.

We move the factored out code part from the last patch into a new file
and also change the inotify code so that it allows to monitor not only
STORAGEDIR. When registering a new observer, the callee has to tell
which directory should be watched. inotify.c will group the observers
together.

11 years agoconfig: Factor out config inotify handler
Daniel Wagner [Fri, 2 Nov 2012 16:26:11 +0000 (17:26 +0100)]
config: Factor out config inotify handler

The inotify code can be reused. So before we introduce a new generic
inotify API, let's factor out in order to simplify the review process.

11 years agobuild: No FORTIFY flags when building without optimization
Daniel Wagner [Fri, 2 Nov 2012 16:26:10 +0000 (17:26 +0100)]
build: No FORTIFY flags when building without optimization

When building with --disable-optimiziation we need to make
sure the compiler flags do not include -O0 and FORTITFY when compiling
the resolv.h header file.

11 years agoprovider: Set the state properly when removing provider
Jukka Rissanen [Fri, 23 Nov 2012 11:41:22 +0000 (13:41 +0200)]
provider: Set the state properly when removing provider

We need to set the provider into idle state when removing,
otherwise the default route will not be set properly after
provider removal.

Fixes BMC#25658

11 years agoopenvpn-script: Removed extra empty line
Jukka Rissanen [Fri, 23 Nov 2012 11:39:33 +0000 (13:39 +0200)]
openvpn-script: Removed extra empty line

11 years agodoc: Clarify UserRoutes and ServerRoutes documentation
Jukka Rissanen [Fri, 23 Nov 2012 11:39:32 +0000 (13:39 +0200)]
doc: Clarify UserRoutes and ServerRoutes documentation

As the UserRoutes is to be set by the user, then tell that
in the documentation.
Clarify also what the ServerRoutes mean.

11 years agoopenvpn: Set default options if user has not supplied a config file
Jukka Rissanen [Thu, 22 Nov 2012 12:05:19 +0000 (14:05 +0200)]
openvpn: Set default options if user has not supplied a config file

If the user is using config file option, then do not set the optional
default options. All the mandatory options needed for connman and
openvpn interaction are still set in command line.

11 years agoopenvpn: Allow configuration via user supplied config file
Jukka Rissanen [Thu, 22 Nov 2012 12:05:18 +0000 (14:05 +0200)]
openvpn: Allow configuration via user supplied config file

Fixes BMC#25866

11 years agoopenvpn: Remove obsolete --tls-client option
Jukka Rissanen [Thu, 22 Nov 2012 12:05:17 +0000 (14:05 +0200)]
openvpn: Remove obsolete --tls-client option

The --client option activates the --tls-client option
so we can remove the useless one.

11 years agodevice: Include stdlib.h
Daniel Wagner [Fri, 23 Nov 2012 12:16:25 +0000 (13:16 +0100)]
device: Include stdlib.h

gcc complains about missing definition for malloc.

11 years agovpn: Remove unused variable
Daniel Wagner [Fri, 23 Nov 2012 12:15:38 +0000 (13:15 +0100)]
vpn: Remove unused variable

11 years agoipconfig: Do not check device if interface name is not set
Jukka Rissanen [Thu, 22 Nov 2012 13:02:55 +0000 (15:02 +0200)]
ipconfig: Do not check device if interface name is not set

If the interface name is not set, then it is no use
checking if the interface would be ignored.

The interface name is not set if the interface is being
taken down and we get NEWLINK message with NULL interface.

Fixes BMC#25865

11 years agoselinux: Add Type Enforcement rule compilation
Jukka Rissanen [Mon, 12 Nov 2012 12:07:58 +0000 (14:07 +0200)]
selinux: Add Type Enforcement rule compilation

The SELinux rules are needed for VPN. They allow various vpn
clients to send notifications to connman-vpnd via net.connman.Task
dbus interface if the connman processes are run under systemd
and the system is in enforcing mode.

11 years agomain: Plugin and provider cleanup order fixed
Jukka Rissanen [Mon, 12 Nov 2012 12:07:57 +0000 (14:07 +0200)]
main: Plugin and provider cleanup order fixed

We must cleanup the plugin first before cleaning up the provider
because the vpn plugin needs providers from provider hash.

11 years agovpn: Go to failure state if vpn information cannot be found
Jukka Rissanen [Mon, 12 Nov 2012 12:07:56 +0000 (14:07 +0200)]
vpn: Go to failure state if vpn information cannot be found

11 years agoopenconnect-script: Print errors to syslog instead of stderr
Jukka Rissanen [Mon, 12 Nov 2012 12:07:55 +0000 (14:07 +0200)]
openconnect-script: Print errors to syslog instead of stderr

Use syslog for error printing because normally the stderr
goes to /dev/null and we do not see the errors.

11 years agoopenvpn-script: Print errors to syslog instead of stderr
Jukka Rissanen [Mon, 12 Nov 2012 12:07:54 +0000 (14:07 +0200)]
openvpn-script: Print errors to syslog instead of stderr

Use syslog for error printing because normally the stderr
goes to /dev/null and we do not see the errors.

11 years agovpnd: Quit if no VPN configurations are found
Jukka Rissanen [Mon, 12 Nov 2012 12:07:53 +0000 (14:07 +0200)]
vpnd: Quit if no VPN configurations are found

11 years agovpnd: Add function that quits vpnd if no VPN configurations are found
Jukka Rissanen [Mon, 12 Nov 2012 12:07:52 +0000 (14:07 +0200)]
vpnd: Add function that quits vpnd if no VPN configurations are found

11 years agovpn-plugin: Set state correctly if vpn client process cannot be started
Jukka Rissanen [Mon, 12 Nov 2012 12:07:51 +0000 (14:07 +0200)]
vpn-plugin: Set state correctly if vpn client process cannot be started

11 years agovpnd: Make sure provider is taken to ready state
Jukka Rissanen [Mon, 12 Nov 2012 12:07:50 +0000 (14:07 +0200)]
vpnd: Make sure provider is taken to ready state

If the connman_inet_ifup() says the interface is already UP,
then it is possible that we might not get a call to vpn_newlink().
That would be really bad as the provider would then never go to
ready state. So in this case we manually call vpn_newlink() to
take the interface UP. If the newlink was called before our call,
then our manual call will be ignored.

11 years agopptp: Remember the connection password
Jukka Rissanen [Mon, 12 Nov 2012 12:07:49 +0000 (14:07 +0200)]
pptp: Remember the connection password

11 years agol2tp: Remember the connection password
Jukka Rissanen [Mon, 12 Nov 2012 12:07:48 +0000 (14:07 +0200)]
l2tp: Remember the connection password

11 years agovpn-provider: Remove vpn provider from storage when needed
Jukka Rissanen [Mon, 12 Nov 2012 12:07:47 +0000 (14:07 +0200)]
vpn-provider: Remove vpn provider from storage when needed

11 years agovpn-provider: Send ConnectionRemoved signal when needed
Jukka Rissanen [Mon, 12 Nov 2012 12:07:46 +0000 (14:07 +0200)]
vpn-provider: Send ConnectionRemoved signal when needed

11 years agoprovider: Do not remove the provider as it would remove it from storage
Jukka Rissanen [Mon, 12 Nov 2012 12:07:45 +0000 (14:07 +0200)]
provider: Do not remove the provider as it would remove it from storage

11 years agostorage: Add function to remove provider files
Jukka Rissanen [Mon, 12 Nov 2012 12:07:44 +0000 (14:07 +0200)]
storage: Add function to remove provider files

11 years agoprovider: Add callback when creating vpn provider
Jukka Rissanen [Mon, 12 Nov 2012 12:07:43 +0000 (14:07 +0200)]
provider: Add callback when creating vpn provider

Because the vpnd Create() in manager API only creates and does
not connect the vpn, we must do the connect part after the
vpn is created. This requires a callback which is called when
the connection is established. Eventually this patch becomes
obsolete because the CreateProvider() connman API is deprecated.

11 years agovpn-provider: Send ConnectionAdded signal when needed
Jukka Rissanen [Mon, 12 Nov 2012 12:07:42 +0000 (14:07 +0200)]
vpn-provider: Send ConnectionAdded signal when needed

11 years agoprovider: Removed the connect part from the create() function
Jukka Rissanen [Mon, 12 Nov 2012 12:07:41 +0000 (14:07 +0200)]
provider: Removed the connect part from the create() function

The connect operation is done separately from create operation
in connman-vpnd so change the function to reflect that.

11 years agovpn: Free allocated ipconfig struct
Jukka Rissanen [Mon, 12 Nov 2012 12:07:40 +0000 (14:07 +0200)]
vpn: Free allocated ipconfig struct

11 years agoipconfig: Add ipconfig unref function
Jukka Rissanen [Mon, 12 Nov 2012 12:07:39 +0000 (14:07 +0200)]
ipconfig: Add ipconfig unref function

11 years agomanager: Deprecating connect/remove provider API
Jukka Rissanen [Mon, 12 Nov 2012 12:07:38 +0000 (14:07 +0200)]
manager: Deprecating connect/remove provider API

The VPN configuration API is provided by connman-vpnd instead
of connmand.

11 years agovpn: Add preliminary agent support
Jukka Rissanen [Mon, 12 Nov 2012 12:07:37 +0000 (14:07 +0200)]
vpn: Add preliminary agent support

11 years agoagent: Split agent code into generic and service specific parts
Jukka Rissanen [Mon, 12 Nov 2012 12:07:36 +0000 (14:07 +0200)]
agent: Split agent code into generic and service specific parts

11 years agovpn: Introduce config file for vpnd
Jukka Rissanen [Mon, 12 Nov 2012 12:07:35 +0000 (14:07 +0200)]
vpn: Introduce config file for vpnd

11 years agodoc: Example configuration file for vpnd
Jukka Rissanen [Mon, 12 Nov 2012 12:07:34 +0000 (14:07 +0200)]
doc: Example configuration file for vpnd

11 years agovpn: Hash provider data using the ident instead of path
Jukka Rissanen [Mon, 12 Nov 2012 12:07:33 +0000 (14:07 +0200)]
vpn: Hash provider data using the ident instead of path

Needed as sometimes we do not know the path but know the ident.

11 years agovpnd: Add -r option which enables route handling in vpnd
Jukka Rissanen [Mon, 12 Nov 2012 12:07:32 +0000 (14:07 +0200)]
vpnd: Add -r option which enables route handling in vpnd

By default routes are handled by connman daemon.

11 years agovpn: Resolve vpn hostname if necessary
Jukka Rissanen [Mon, 12 Nov 2012 12:07:31 +0000 (14:07 +0200)]
vpn: Resolve vpn hostname if necessary

11 years agoprovider: Refactor server and user route handling
Jukka Rissanen [Mon, 12 Nov 2012 12:07:30 +0000 (14:07 +0200)]
provider: Refactor server and user route handling

The server and user route handling is refactored in order to
reflect the vpn dbus API changes. The routes are now array of
dicts in dbus API.

11 years agoprovider: Initially provider ipconfigs are now OFF
Jukka Rissanen [Mon, 12 Nov 2012 12:07:29 +0000 (14:07 +0200)]
provider: Initially provider ipconfigs are now OFF

The ipconfig is marked as fixed when IP address is set to
that ipconfig.

11 years agoplugin: Add VPN plugin that will interact with vpnd
Jukka Rissanen [Mon, 12 Nov 2012 12:07:28 +0000 (14:07 +0200)]
plugin: Add VPN plugin that will interact with vpnd

11 years agoprovider: Support functions added
Jukka Rissanen [Mon, 12 Nov 2012 12:07:27 +0000 (14:07 +0200)]
provider: Support functions added

11 years agoprovider: Remove functionality that is no longer used
Jukka Rissanen [Mon, 12 Nov 2012 12:07:26 +0000 (14:07 +0200)]
provider: Remove functionality that is no longer used

The VPN support functionality is moved into connman-vpnd.

11 years agoprovider: Add more driver interface functions needed by vpnd plugin
Jukka Rissanen [Mon, 12 Nov 2012 12:07:25 +0000 (14:07 +0200)]
provider: Add more driver interface functions needed by vpnd plugin

11 years agoprovider: Provider disconnect function made available to plugin
Jukka Rissanen [Mon, 12 Nov 2012 12:07:24 +0000 (14:07 +0200)]
provider: Provider disconnect function made available to plugin

The VPN needs to be able to call the provider disconnect.

11 years agotest: New VPN test script that connect to connman-vpnd
Jukka Rissanen [Mon, 12 Nov 2012 12:07:23 +0000 (14:07 +0200)]
test: New VPN test script that connect to connman-vpnd

11 years agotest: Renamed old VPN scripts
Jukka Rissanen [Mon, 12 Nov 2012 12:07:22 +0000 (14:07 +0200)]
test: Renamed old VPN scripts

Renamed connect-vpn to connect-provider and
disconnect-vpn to remove-provider

In order to not confuse the user, change the name of the old
vpn connect/disconnect script. Now the name of the script
reflects the name of the manager dbus api.
The connect-provider will use the old ConnectProvider
manager dbus interface instead of directly connecting
to connman-vpnd.

11 years agovpn: New vpn daemon that handles vpn connections and clients
Jukka Rissanen [Mon, 12 Nov 2012 12:07:21 +0000 (14:07 +0200)]
vpn: New vpn daemon that handles vpn connections and clients

11 years agolog: Give program name and version in log init
Jukka Rissanen [Mon, 12 Nov 2012 12:07:20 +0000 (14:07 +0200)]
log: Give program name and version in log init

This allows the correct output when the log functions
are used from separate vpn daemon.

11 years agodevice: Move device creation func into device.c
Jukka Rissanen [Mon, 12 Nov 2012 12:07:19 +0000 (14:07 +0200)]
device: Move device creation func into device.c

The device creation function should be part of device.c and
not inet.c. After this change the inet.c can be used by
separate vpn daemon.

11 years agoipconfig: Move IP address API into separate ipaddress.c file
Jukka Rissanen [Mon, 12 Nov 2012 12:07:18 +0000 (14:07 +0200)]
ipconfig: Move IP address API into separate ipaddress.c file

Done so that connman_ipaddress_* functions can be used from
separate vpn daemon.

11 years agodoc: VPN daemon API descriptions
Jukka Rissanen [Mon, 12 Nov 2012 12:07:17 +0000 (14:07 +0200)]
doc: VPN daemon API descriptions

11 years agocore: Use interface index instead of interface name
Patrik Flykt [Wed, 21 Nov 2012 14:25:11 +0000 (16:25 +0200)]
core: Use interface index instead of interface name

Service and network code use only interface indexes. Convert the rest of
the code using interface names to use interface indexes instead. The files
affected are:
   include/resolver.h
   src/connman.h
   src/dnsproxy.c
   src/resolver.c
   src/rtnl.c
   src/service.c
   src/tethering.c

As the network and service code used interface indexes, the interface
name had to be looked up via a SIOCGIFNAME ioctl when needed. If a service
was removed due to the interface and network being taken down, the lookup
wouldn't work. This caused DNS servers to be left behind with broken sockets
since removing the DNS servers was done using the interface name.

11 years agoTODO: Add WiFi plugin data struct handling task
Patrik Flykt [Fri, 16 Nov 2012 13:15:44 +0000 (15:15 +0200)]
TODO: Add WiFi plugin data struct handling task

11 years agodnsproxy: Use TCP connections only for the intended request
Patrik Flykt [Fri, 16 Nov 2012 12:32:58 +0000 (14:32 +0200)]
dnsproxy: Use TCP connections only for the intended request

The DNS proxy code creates and uses a TCP connection only for a single
request at a time. A TCP DNS proxy is added to the end of the server
list, but should not be used for generic requests as the connection
will be closed down after the response to the initial request. Any
other requests sent over the connection will silently disappear.

Add a check to ignore TCP DNS servers for generic lookups.

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.

11 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).

11 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

11 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.

11 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