Commit graph

14564 commits

Author SHA1 Message Date
Beniamino Galvani a0206a4f5e man,libnm-core: fix typos 2016-03-30 12:03:36 +02:00
Beniamino Galvani b717c5503b libnm-core: remove trailing quote from message in nm-setting-macvlan.c
Reported-by: Anders Jonsson <anders.jonsson@norsjovallen.se>
2016-03-30 00:33:20 +02:00
Dan Williams 299ef26c39 merge: branch 'dcbw/dupe-pc-signals-bgo764039' 2016-03-29 17:11:46 -05:00
Dan Williams 415e9441ab core: fix duplicate values in NM-specific PropertiesChanged signals
GVariantBuilder doesn't care if you give it multiple dict entries with
the same key.  But that causes duplicate dict entries in the legacy
D-Bus PropertiesChanged signals that NM emits.  So instead go back to
a hash table to ensure that any previous value is dropped in favor of
the new one.
2016-03-29 15:52:23 -05:00
Dan Williams 8b6a1ac62f core: don't leak ActiveConnection object on AddAndActivate failure 2016-03-29 15:52:23 -05:00
Dan Williams f2182fbf9b core: don't emit double PropertiesChanged signal for new active connections
When porting to GDBus property change notifications were converted from a
hash table to a GVariantBuilder.  GVariantBuilder doesn't care about
duplicated properties in the dict so each g_object_notify() will add
an additional item with possibly different values:

signal time=1458571005.592811 sender=:1.10 -> destination=(null destination) serial=64451 path=/org/freedesktop/NetworkManager; interface=org.freedesktop.NetworkManager; member=PropertiesChanged
   array [
      dict entry(
         string "ActiveConnections"
         variant             array [
               object path "/org/freedesktop/NetworkManager/ActiveConnection/19"
               object path "/org/freedesktop/NetworkManager/ActiveConnection/18"
               object path "/org/freedesktop/NetworkManager/ActiveConnection/15"
               object path "/org/freedesktop/NetworkManager/ActiveConnection/0"
            ]
      )
      dict entry(
         string "ActiveConnections"
         variant             array [
               object path "/org/freedesktop/NetworkManager/ActiveConnection/24"
               object path "/org/freedesktop/NetworkManager/ActiveConnection/19"
               object path "/org/freedesktop/NetworkManager/ActiveConnection/18"
               object path "/org/freedesktop/NetworkManager/ActiveConnection/15"
               object path "/org/freedesktop/NetworkManager/ActiveConnection/0"
            ]
      )
   ]

Fix that by not emitting notify events for the manager's ActiveConnections
property until the property has actually been updated in active_connection_add().
The unexport also isn't required for VPN connections since it will get
unexported when it's disposed after _internal_activation_failed() gets called.
2016-03-29 15:52:23 -05:00
Robby Workman c0a506648f settings: add persistent hostname support for Slackware 2016-03-29 15:51:34 -05:00
Piotr Drąg 743107e163 po: update Polish (pl) translation (bgo #764317)
https://bugzilla.gnome.org/show_bug.cgi?id=764317
2016-03-29 18:20:30 +02:00
Beniamino Galvani 6e738c83f1 merge: branch 'bg/bond-options-rh1299103'
Add missing bond options and improve connection matching for bond
connections.
2016-03-29 18:10:35 +02:00
Beniamino Galvani efa559bcc8 libnm-core: add test cases for NMSettingBond
The setting well deserves some testing.
2016-03-29 18:10:05 +02:00
Beniamino Galvani 4839c747c2 libnm-core: implement option matching for NMSettingBond
We cannot simply compare the single values of option hashes to match
connections because some keys are equivalent to others and also
because keys having a default value should be ignored.

Add the compare_property method to implement custom comparison logic.
2016-03-29 18:10:05 +02:00
Beniamino Galvani 260fcc52a8 bond: add some missing options
https://bugzilla.redhat.com/show_bug.cgi?id=1299103
2016-03-29 18:10:05 +02:00
Beniamino Galvani 2324410a75 bond: fix re-assuming of connections
When a value of a TYPE_BOTH option is read back from kernel it
contains both string and numeric values ("balance-rr 0"), so we must
chop off the number before adding the option to the setting. Also
change the default values of options to the string form so that the
option matching logic works.
2016-03-29 18:10:05 +02:00
Beniamino Galvani a9241773d7 cli: allow setting multiple IPs in bond 'arp_ip_target' option
The bond 'arp_ip_target' option contains a list of comma-separated IP
addresses; but comma is also used to separate options and so at the
moment it is not possible to specify multiple IPs as the command

 $ nmcli c m b1 bond.options \
   mode=0,arp_interval=1,arp_ip_target=1.1.1.1,2.2.2.2

interprets 2.2.2.2 as the next option.

Allows spaces to be used as separators for the IPs of the
'arp_ip_target':

 $ nmcli c m b1 bond.options \
   "mode=0,arp_interval=1,arp_ip_target=1.1.1.1 2.2.2.2"
2016-03-29 18:10:05 +02:00
Beniamino Galvani 5f7d7ee497 libnm,libnm-core: add coverage support 2016-03-29 18:10:04 +02:00
Beniamino Galvani e196f2257d libnm-core: fix check in verification of NMSettingBond 2016-03-29 18:10:04 +02:00
Lubomir Rintel 24caeb33b7 release: bump version to 1.1.92 (1.2-beta3) 2016-03-29 16:23:21 +02:00
Lubomir Rintel dbdb455cc8 release: update NEWS 2016-03-29 16:10:25 +02:00
Thomas Haller ff06754fe8 core: downgrade warning logging message when creating virtual device
This can regularly happen when a virtual device depends on a parent/master
that is not yet created. We will retry later when the parent is ready, so
logging a warning about it is wrong and confusing.
2016-03-29 15:46:17 +02:00
Lubomir Rintel 0684632936 libnm: don't check if the agent is still registered when unregistering
The name_owner_chagned() unregisters the agent if NetworkManager goes away and
nmc_cleanup() also tries to unregister an agent, resulting in an assertion
failure:

  # nmcli c up conn666
  <daemon terminates>
  Error: Connection activation failed: Message recipient disconnected from message bus without replying
  (process:8746): libnm-CRITICAL **: nm_secret_agent_old_unregister: assertion 'priv->registered == TRUE' failed

_internal_unregister() already contains a priv->registered check and raising an
error on duplicate unregister attempt from a daemon after a restart is not a
problem either, since nmc_cleanup() doesn't care about the error returned
on teardown anyway.
2016-03-29 15:08:19 +02:00
Thomas Haller 31669329bb cli/trivial: fix TABs for indention 2016-03-29 14:59:01 +02:00
Lubomir Rintel 8ad218e71c nmcli: fix slave_type setting 2016-03-29 14:53:45 +02:00
Lubomir Rintel 2c2662f772 device: drop external changes on Reapply
https://bugzilla.gnome.org/show_bug.cgi?id=762322
2016-03-29 14:20:09 +02:00
Lubomir Rintel e691f01e01 cli: make the *-slave type option parsing out of the common path
We actually don't want to understand these options unless the legacy
*-slave types are used. The properties should be used directly instead.

https://bugzilla.gnome.org/show_bug.cgi?id=748302

This basically undoes most of what has been done in  commit 00e0fffea2.
2016-03-29 14:20:09 +02:00
Thomas Haller b645a3b39d policy: merge branch 'th/policy-cleanup' 2016-03-29 12:20:15 +02:00
Thomas Haller 573f3a9f59 policy: use slice allocator for ActivateData 2016-03-29 12:18:15 +02:00
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