Commit Graph

21088 Commits

Author SHA1 Message Date
Thomas Haller
03d5479320 policy: use slice allocator for PendingSecondaryData 2016-03-29 12:18:15 +02:00
Thomas Haller
0ea3880238 policy/trival: rename "policy" argument to "self"
We call the "self" pointer in our source files not after the
type. It's just "self".
2016-03-29 12:18:15 +02:00
Thomas Haller
6a7ba9b5e1 policy: remove initialized guard from nm_policy_new()
If we want to ensure that we create only one single instance of
NMPolicy, just don't create multiple instances. The nm_policy_new()
method should not be restriced and behave like other *new() functions
and create a new object as requested.
2016-03-29 12:18:15 +02:00
Thomas Haller
caebe764a5 policy: initialize object during GObject construction 2016-03-29 12:18:15 +02:00
Thomas Haller
bff0b02d9a policy: refactor object properties to notify by property enum 2016-03-29 12:18:15 +02:00
Thomas Haller
446d5c3a9e policy/trivial: move code 2016-03-29 12:18:15 +02:00
Thomas Haller
23136ecf89 all: merge branch 'th/invalid-connections-bgo760907'
https://bugzilla.gnome.org/show_bug.cgi?id=760907
2016-03-29 11:57:49 +02:00
Thomas Haller
1c932aade1 libnm-glib: allow non-verifiable NMRemoteConnection in libnm-glib 2016-03-29 11:56:27 +02:00
Thomas Haller
0578be928b libnm-glib: don't fail creating connection in NMVPNPlugin
The connection should be created best-effort. If the connection doesn't
validate, the request can still make sense for the plugin.
2016-03-29 11:56:27 +02:00
Thomas Haller
fbb1662269 libnm-glib: don't fail creating connection in NMSecretAgent
The connection should be created best-effort. If the connection doesn't
validate, the connection request still can be answered by the agent.
2016-03-29 11:56:27 +02:00
Thomas Haller
9bf3933855 libnm-util: add non-failing versions of nm_connection_new_from_hash() and replace-settings
Add internal functions _nm_connection_replace_settings() and
_nm_connection_new_from_hash() that cannot fail.

Altough they are not public API, we have to expose them via
libnm-util.ver so that they can be used from libnm-glib.
2016-03-29 11:56:27 +02:00
Thomas Haller
6cd03bf205 libnm-util: refactor hash_to_connection()
No functional change, only move the verify-step out of hash_to_connection().
2016-03-29 11:56:27 +02:00
Thomas Haller
f8a6b13369 libnm-util: don't print any warnings during nm_setting_new_from_hash()
Warnings aren't great, especially if they can realistically be triggered
by a newer NetworkManager version. Just accept what we can and ignore
the rest silently.
2016-03-29 11:56:27 +02:00
Thomas Haller
564cf78f69 libnm-util: use "nm-shared-utils.h" 2016-03-29 11:56:27 +02:00
Thomas Haller
52bd08de05 libnm: add code comments to hint that NMConnection might not validate 2016-03-29 11:56:27 +02:00
Thomas Haller
7991298c51 core: be strict about connection argument in D-Bus methods
There is no excuse for clients to send connections to NetworkManager
that have invalid/unknown fields. Just reject them.

This is a dangerous change, because we might now reject connections
that we were accepting previously. Who know what clients were sending
and it used to work.
2016-03-29 11:56:26 +02:00
Thomas Haller
0c5b98b464 core: be strict when parsing connection in AddAndActivateConnection
AddAndActivateConnection is allowed to provide an incomplete connection
that will be completed by NetworkManager. That is, a connection that
does not verify.

But we still want to catch invalid properties or unknown setting types.
Thus, we want to reject invalid partial connections.

This possibly rejects invalid requests from clients that were accepted
before. Thus this change has the potential to break misbehaving clients.
2016-03-29 11:55:24 +02:00
Thomas Haller
d4c201272e core: be strict about connection argument for Reapply() D-Bus method
There is no excuse for clients to send connections to NetworkManager
that have invalid/unknown fields. Just reject them.

As Reapply() is new API in nm-1-1, there is no problem with backward
compatibility.
2016-03-26 12:10:54 +01:00
Thomas Haller
4aa7e09d1f libnm: be more accepting for invalid connections from NetworkManager
Relax our error checking which will allow us to try harder to
make the best out of whatever NetworkManager sends us.

Also, drop the g_warning(). First, now we really don't expect this
function to fail. And even in that case, raising a g_warning() from
the library is not very friendly to the user of libnm.
2016-03-26 12:10:54 +01:00
Thomas Haller
559ab7bd7c libnm: accept invalid connections in NMVpnServicePlugin
When we receive a connection from NetworkManager it is not guaranteed
that the connection verifies. For example, if the current libnm version
is older then the NetworkManager version.

Be more accepting and don't do any verification of the connection.

For NMVpnPluginOld this change is uncritical, because there are probably
no users of this API anyway.

NMVpnServicePlugin is new API since nm-1-1. However, this API is already
strongly used by all the plugins we ported over. So this change is
affecting them.
This should only matter if libnm's and NetworkManager's version differ,
because NetworkManager just doesn't send out an invalid connection. It
actually only matters if NetworkManager is a newer version and sends an
invalid connection to the client. That is anyway badly tested and probably
this changes rather improves compatibility than breaking existing users.
2016-03-26 12:10:54 +01:00
Thomas Haller
9a31bbcbc3 libnm: accept invalid connections in NMSecretAgentOld
When we receive a connection from NetworkManager it is not guaranteed
that the connection verifies. For example, if the current libnm version
is older then the NetworkManager version.

Be more accepting and don't do any verification of the connection.

This is a change in behavior in that we accept also invalid connections
and pass them down to the sub-classes.
2016-03-26 12:10:54 +01:00
Thomas Haller
a37c1d1e17 libnm: don't normalize connection for nm_device_get_applied_connection()
Normalizing means that we fail on invalid connections.
Which can happen when the server is newer than the libnm
version. We just want to return whatever we can. The
caller should make sense of this.

This makes libnm more accepting and thus is not going to break
existing applications. Also, nm_device_get_applied_connection()
is new API since nm-1-1.
2016-03-26 12:10:54 +01:00
Thomas Haller
df405942de libnm-core/tests: refactor call to nm_simple_connection_new_from_dbus()
No actual change, let's just not directly call nm_simple_connection_new_from_dbus().
Instead, add a wrapper to define in once place the flags we use for loading the
connection.
2016-03-26 12:10:54 +01:00
Thomas Haller
3d8776108c libnm-core: add _nm_simple_connection_new_from_dbus() function
Contary to nm_simple_connection_new_from_dbus(), this internal
function allows to specify parse-flags.
2016-03-26 12:10:54 +01:00
Thomas Haller
737c8cc532 libnm-core: allow strict and relaxed error behavior for _nm_setting_new_from_dbus()
In some situations, we want strict checking of errors, for example when
NetworkManager receives a new connection from a client, the connection
must make sense as a whole (and since NetworkManager service is backward
compatible to the clients and not the other way around, there is no
excuse for sending invalid data to the server).

In other situations, we want a best-effort behavior. Like when
NetworkManager sends a connection to its clients, those clients
want to extract as many properties as they understand, but in order
to be forward compatible against newer server versions, invalid
or unknown properties must be accepted.

Previously, a mixture of both was done. Some issues caused a failure
to create a new NMSetting, other invalid parts were just silently
ignored or triggered a g_warning() in glib.

Now allow for both. When doing strict-validation, be more strict and
reject all unknown properties and catch when the user sets an invalid
argument. On the other hand, allow for a best-effort mode that
effectively cannot fail and will return a new NMSetting instance.

For now, add NMSettingParseFlags so that the caller can choose the
old behavior, strict parsing, or best effort.

This patch doesn't have any externally visible change except that
no more g_warnings will be emitted.
2016-03-26 12:10:54 +01:00
Thomas Haller
88655999df shared: add nm_g_object_set_property() 2016-03-26 12:10:54 +01:00
Thomas Haller
c5786f3839 libnm/tests: extend tests for handling invalid connections in NMClient 2016-03-26 12:10:53 +01:00
Thomas Haller
72216f7359 shared: move NM_UTILS_ERROR to shared-utils
NM_UTILS_ERROR is our way to say, that we don't care about
the GError domain and code. nmcli sometimes passes domain "1"
and code "0" to g_set_error(), which could be considered
a bug.

We usually don't care about the error but only about the error
message, so let's have a universally available error quark around.
2016-03-26 12:10:53 +01:00
Thomas Haller
fafc90526b shared: move _nm_utils_ascii_str_to_int64() to "shared/nm-shared-utils.h"
_nm_utils_ascii_str_to_int64() was declared in libnm-core's internal
header "nm-core-internal.h" and thus available for libnm-core, libnm,
NetworkManager and related.

It also means, the function was not available in libnm-util, libnm-glib,
clients or dispatcher. So, we either reimplemented it (nmc_string_to_int_base)
or struggle with the awkward strtol* API.
2016-03-26 12:10:53 +01:00
Thomas Haller
5de30dd029 shared: include "nm-shared-utils.h"
Include it via "nm-default.h" to all projects.
2016-03-26 12:10:53 +01:00
Thomas Haller
330026db90 shared: add "nm-shared-utils" 2016-03-26 12:10:53 +01:00
Thomas Haller
3025bfc8b2 shared: add nm_auto_unset_gvalue macro 2016-03-26 12:10:53 +01:00
Thomas Haller
2c8ef153a1 nmtst: add nmtst_variant_new_vardict() function 2016-03-26 12:10:53 +01:00
Thomas Haller
d45107c1de nmtst: fix memleak when using NMTST_VARIANT_DROP_SETTING() 2016-03-26 12:10:53 +01:00
Thomas Haller
ce6fdc3e5e libnm-util: verify connection also for self-assignment in replace_settings_from_connection()
nm_connection_replace_settings_from_connection() would return whether the
connection verifies at the end of the operation. While that is not very
useful, the API is like that and cannot be changed.

For consistency, also perform the verification step in case of self-assignment.
Self-assigment is anyway a case that probably never happens.
2016-03-26 12:10:53 +01:00
Lubomir Rintel
bbc941245d merge: branch 'lr/virtual-parent-bgo762731'
https://bugzilla.gnome.org/show_bug.cgi?id=762731
2016-03-26 11:31:45 +01:00
Lubomir Rintel
b26159b149 manager: allow delaying the device activation when the parent is not real
Don't try to realize our device when the parent device is not real.
Instead, enqueue the activation and wait until it is active before
realizing our device and progressing the device to DISCONNECTED so that
it can get connected.
2016-03-26 11:31:21 +01:00
Lubomir Rintel
da226ae137 manager: separate the traversal to disconected to a separate routine
Will be useful when we'll be able to defer the realization of the
device.
2016-03-26 11:31:20 +01:00
Lubomir Rintel
6e382ea91d active-connection: add parent active connection tracking
Make it possible to let active connection know about an active
connection it depends on and emit a signal when the parent is active.
2016-03-26 11:31:18 +01:00
Lubomir Rintel
ce745e098a device: delay the activation if the backing device is not yet there 2016-03-26 11:29:41 +01:00
Lubomir Rintel
2a45d30cc5 device: only clear the activate request when the device disconnects
If it's traversing from unavailable to disconnected (e.g. realizing
of the device was delayed because it was awaiting the parent connection),
then we just want to progress the activation.
2016-03-26 11:29:41 +01:00
Lubomir Rintel
6219759490 device: _get_available_connections() with _get_best_connection()
We'll need to share the best conneciton logic and it's the only caller
of nm_device_get_available_connections(). Let's just move it all to
NMDevice and provide the best connection from there instead.
2016-03-26 11:29:41 +01:00
Lubomir Rintel
b37418157b merge: branch 'lr/developer-gnome'
https://bugzilla.gnome.org/show_bug.cgi?id=764145
2016-03-26 11:28:44 +01:00
Beniamino Galvani
f67bf52046 man: use replace <programlisting> with <synopsis>
It makes more sense and actually looks good in rendered HTML.

[lkundrak@v3.sk: wrote the commit message]
2016-03-26 11:28:19 +01:00
Lubomir Rintel
5ce4c9fd84 docs: add manual pages to docbook documentation
This way they will make it to developer.gnome.org.
2016-03-26 11:28:19 +01:00
Lubomir Rintel
8f8c15fb3a docs: remove some outdated documentation
The migration guide and the old D-Bus API are not needed anymore.
2016-03-26 11:28:19 +01:00
Lubomir Rintel
3a2803b42c docs: replace spec.html with docbook D-Bus API reference
May use a lot of improvement (actually documenting the names and
objects that use the interfaces in question), but at least this looks a
lot better on developer.gnome.org.
2016-03-26 11:28:19 +01:00
Lubomir Rintel
618373a14f dbus: use the annotations for documentation
gdbus only understands those (and gtk docstrings, which we should eventually
use) when generating the documentation.
2016-03-26 11:28:19 +01:00
Lubomir Rintel
f88dd66e6d introspection: build docbook when generating the code 2016-03-26 11:28:19 +01:00
Christian Kirbach
96f937bb3d po: update German (de) translation (bgo #764175)
https://bugzilla.gnome.org/show_bug.cgi?id=764175
2016-03-25 21:04:09 +01:00