NetworkManager.git
8 years agodevice: renew dhcp leases on awake for software devices master
Nikolay Martynov [Sat, 26 Mar 2016 05:26:36 +0000 (01:26 -0400)]
device: renew dhcp leases on awake for software devices

This makes sure that devices like bond get their dhcp renewed

[thaller@redhat.com: original patch modified to rename
 now-public function update_dynamic_ip_setup()]

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

8 years agoman: discourage use of monitor-connection-files=yes in NetworkManager.conf manual
Thomas Haller [Thu, 31 Mar 2016 12:42:54 +0000 (14:42 +0200)]
man: discourage use of monitor-connection-files=yes in NetworkManager.conf manual

https://bugzilla.gnome.org/show_bug.cgi?id=764402
Related: https://bugzilla.redhat.com/show_bug.cgi?id=754677
Related: https://bugzilla.redhat.com/show_bug.cgi?id=1272617

8 years agodevice: merge branch 'th/unmanaged-external-down-bgo763236' (early part)
Thomas Haller [Thu, 31 Mar 2016 08:45:11 +0000 (10:45 +0200)]
device: merge branch 'th/unmanaged-external-down-bgo763236' (early part)

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

8 years agodevice: refactor by adding set_unmanaged_external_down() function
Thomas Haller [Thu, 24 Mar 2016 13:15:49 +0000 (14:15 +0100)]
device: refactor by adding set_unmanaged_external_down() function

No functional change.

8 years agodevice: refactor setting unmanaged flag EXTERNAL_DOWN
Thomas Haller [Mon, 21 Mar 2016 13:56:15 +0000 (14:56 +0100)]
device: refactor setting unmanaged flag EXTERNAL_DOWN

This should not actually change how we handle EXTERNAL_DOWN
unmanaged devices.

8 years agodevice: add nm_device_get_unmanaged_mask()
Thomas Haller [Wed, 23 Mar 2016 08:39:22 +0000 (09:39 +0100)]
device: add nm_device_get_unmanaged_mask()

8 years agodevice: trival refactoring in can_unmanaged_external_down()
Thomas Haller [Wed, 23 Mar 2016 08:49:39 +0000 (09:49 +0100)]
device: trival refactoring in can_unmanaged_external_down()

Swap order of operands so that the "cheaper" is evaluated first.

8 years agocli: fix setting 'slave-type' for `nmcli connection add type *-slave`
Thomas Haller [Wed, 30 Mar 2016 16:33:14 +0000 (18:33 +0200)]
cli: fix setting 'slave-type' for `nmcli connection add type *-slave`

  $ nmcli connection add type bond-slave ifname eth1 con-name bond0.0 master nm-bond
  Error: Failed to add 'bond0.0' connection: connection.slave-type: Cannot set 'master' without 'slave-type'

Fixes: 8ad218e71c3a82d491af6daa516464dd020608f2

8 years agocli/trivial: fix indention and whitespace
Thomas Haller [Wed, 30 Mar 2016 16:14:50 +0000 (18:14 +0200)]
cli/trivial: fix indention and whitespace

8 years agoifcfg-rh: don't chain up after failure of replace_and_commit()
Beniamino Galvani [Wed, 30 Mar 2016 15:44:46 +0000 (17:44 +0200)]
ifcfg-rh: don't chain up after failure of replace_and_commit()

If replace_and_commit() found existing route files (and the callback
has potentially already been invoked), it is wrong to chain up to
parent class and continue the update.

Fixes: f79d62692ec4fe5ba21bbeab26286b2a3b250fdd

8 years agobuild: drop internal field __nm_git_sha from libraries
Thomas Haller [Wed, 30 Mar 2016 13:48:52 +0000 (15:48 +0200)]
build: drop internal field __nm_git_sha from libraries

The problem is that you cannot be sure which patches
were applied on top of a source tree, so the __nm_git_sha
value is unreliable.

Also, after running autoreconf during the package build,
NM_GIT_SHA is reset as well.

8 years agocontrib/rpm: add comments to build.sh to list script arguments
Thomas Haller [Wed, 30 Mar 2016 13:00:02 +0000 (15:00 +0200)]
contrib/rpm: add comments to build.sh to list script arguments

8 years agocontrib/rpm: fix obtaining SOURCE via git-archive
Thomas Haller [Wed, 30 Mar 2016 11:46:36 +0000 (13:46 +0200)]
contrib/rpm: fix obtaining SOURCE via git-archive

- when user provided a $SOURCE argument, do call abs_path on
  it. abs_path allows the user to provide relative paths in
  the original directory.

- don't call abs_path on "$GITDIR/NetworkManager-$VERSION".tar.xz
  abs_path is there to verify user input and it will abort the script
  if the file doesn't exist.

- when creating a temporary tarball via git-archive, put it
  into the output directory and not overwriting files in
  $GITDIR.

- fix abs_path to return an error code and let callers abort
  the script

- add a new parameter $SOURCE_FROM_GIT so that you can control
  whether git-archive is used. You can now specify either $SOURCE
  or $SOURCE_FROM_GIT. In case of absence of both, it tries to
  detect a tar file in the $GITDIR directory.

Fixes: 9e9ec1a3da47c07bb0bb0b42014292a8df1c1e0b

8 years agoplatform: don't assume that netlink message is as big as at compile time
Lubomir Rintel [Wed, 30 Mar 2016 10:46:04 +0000 (12:46 +0200)]
platform: don't assume that netlink message is as big as at compile time

The link_stats structure grew between 4.5 and 4.6 and this would cause
the messages to me ignored when compiling with 4.6 headers and running
on 4.5.

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

8 years agocontrib/rpm: allow building of a git archive
Lubomir Rintel [Wed, 30 Mar 2016 11:25:33 +0000 (13:25 +0200)]
contrib/rpm: allow building of a git archive

No need for a make dist.

8 years agocontrib/rpm: allow building w/o prebuilt documentation
Lubomir Rintel [Tue, 29 Mar 2016 16:07:53 +0000 (18:07 +0200)]
contrib/rpm: allow building w/o prebuilt documentation

8 years agomanager: make some error reporting a bit more specific
Lubomir Rintel [Wed, 30 Mar 2016 07:00:06 +0000 (09:00 +0200)]
manager: make some error reporting a bit more specific

Make sure there's always the device and connection as well as the reason
when a slave activation fails. The slave connection could in fact be
chosen automatically on "nmcli d connect" and the user might not be
aware activation of which connection was attempted:

  $ nmcli d connect enp0s25
  Error: Device activation failed: Master connection not found or invalid

8 years agoman,libnm-core: fix typos
Beniamino Galvani [Wed, 30 Mar 2016 10:00:54 +0000 (12:00 +0200)]
man,libnm-core: fix typos

8 years agolibnm-core: remove trailing quote from message in nm-setting-macvlan.c
Beniamino Galvani [Tue, 29 Mar 2016 22:26:21 +0000 (00:26 +0200)]
libnm-core: remove trailing quote from message in nm-setting-macvlan.c

Reported-by: Anders Jonsson <anders.jonsson@norsjovallen.se>
8 years agomerge: branch 'dcbw/dupe-pc-signals-bgo764039'
Dan Williams [Tue, 29 Mar 2016 22:11:37 +0000 (17:11 -0500)]
merge: branch 'dcbw/dupe-pc-signals-bgo764039'

8 years agocore: fix duplicate values in NM-specific PropertiesChanged signals
Dan Williams [Tue, 22 Mar 2016 18:00:56 +0000 (13:00 -0500)]
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.

8 years agocore: don't leak ActiveConnection object on AddAndActivate failure
Dan Williams [Mon, 21 Mar 2016 21:24:12 +0000 (16:24 -0500)]
core: don't leak ActiveConnection object on AddAndActivate failure

8 years agocore: don't emit double PropertiesChanged signal for new active connections
Dan Williams [Mon, 21 Mar 2016 21:09:30 +0000 (16:09 -0500)]
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.

8 years agosettings: add persistent hostname support for Slackware
Robby Workman [Thu, 24 Mar 2016 19:09:44 +0000 (14:09 -0500)]
settings: add persistent hostname support for Slackware

8 years agopo: update Polish (pl) translation (bgo #764317)
Piotr Drąg [Tue, 29 Mar 2016 16:13:56 +0000 (18:13 +0200)]
po: update Polish (pl) translation (bgo #764317)

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

8 years agomerge: branch 'bg/bond-options-rh1299103'
Beniamino Galvani [Tue, 29 Mar 2016 16:10:35 +0000 (18:10 +0200)]
merge: branch 'bg/bond-options-rh1299103'

Add missing bond options and improve connection matching for bond
connections.

8 years agolibnm-core: add test cases for NMSettingBond
Beniamino Galvani [Fri, 18 Mar 2016 15:37:52 +0000 (16:37 +0100)]
libnm-core: add test cases for NMSettingBond

The setting well deserves some testing.

8 years agolibnm-core: implement option matching for NMSettingBond
Beniamino Galvani [Fri, 18 Mar 2016 15:28:38 +0000 (16:28 +0100)]
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.

8 years agobond: add some missing options
Beniamino Galvani [Tue, 15 Mar 2016 16:37:06 +0000 (17:37 +0100)]
bond: add some missing options

https://bugzilla.redhat.com/show_bug.cgi?id=1299103

8 years agobond: fix re-assuming of connections
Beniamino Galvani [Wed, 16 Mar 2016 10:22:07 +0000 (11:22 +0100)]
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.

8 years agocli: allow setting multiple IPs in bond 'arp_ip_target' option
Beniamino Galvani [Wed, 16 Mar 2016 09:20:45 +0000 (10:20 +0100)]
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"

8 years agolibnm,libnm-core: add coverage support
Beniamino Galvani [Fri, 18 Mar 2016 09:57:49 +0000 (10:57 +0100)]
libnm,libnm-core: add coverage support

8 years agolibnm-core: fix check in verification of NMSettingBond
Beniamino Galvani [Fri, 18 Mar 2016 15:08:54 +0000 (16:08 +0100)]
libnm-core: fix check in verification of NMSettingBond

8 years agorelease: bump version to 1.1.92 (1.2-beta3)
Lubomir Rintel [Tue, 29 Mar 2016 14:23:21 +0000 (16:23 +0200)]
release: bump version to 1.1.92 (1.2-beta3)

8 years agorelease: update NEWS
Lubomir Rintel [Tue, 29 Mar 2016 14:10:20 +0000 (16:10 +0200)]
release: update NEWS

8 years agocore: downgrade warning logging message when creating virtual device
Thomas Haller [Tue, 29 Mar 2016 13:39:05 +0000 (15:39 +0200)]
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.

8 years agolibnm: don't check if the agent is still registered when unregistering
Lubomir Rintel [Tue, 29 Mar 2016 12:34:26 +0000 (14:34 +0200)]
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.

8 years agocli/trivial: fix TABs for indention
Thomas Haller [Tue, 29 Mar 2016 12:56:51 +0000 (14:56 +0200)]
cli/trivial: fix TABs for indention

8 years agonmcli: fix slave_type setting
Lubomir Rintel [Tue, 29 Mar 2016 12:51:31 +0000 (14:51 +0200)]
nmcli: fix slave_type setting

8 years agodevice: drop external changes on Reapply
Lubomir Rintel [Tue, 29 Mar 2016 11:50:39 +0000 (13:50 +0200)]
device: drop external changes on Reapply

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

8 years agocli: make the *-slave type option parsing out of the common path
Lubomir Rintel [Tue, 29 Mar 2016 12:08:55 +0000 (14:08 +0200)]
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 00e0fffea221705393637d038dc61ccbc15c3585.

8 years agopolicy: merge branch 'th/policy-cleanup'
Thomas Haller [Tue, 29 Mar 2016 10:20:15 +0000 (12:20 +0200)]
policy: merge branch 'th/policy-cleanup'

8 years agopolicy: use slice allocator for ActivateData
Thomas Haller [Tue, 29 Mar 2016 08:48:01 +0000 (10:48 +0200)]
policy: use slice allocator for ActivateData

8 years agopolicy: use slice allocator for PendingSecondaryData
Thomas Haller [Tue, 29 Mar 2016 08:48:01 +0000 (10:48 +0200)]
policy: use slice allocator for PendingSecondaryData

8 years agopolicy/trival: rename "policy" argument to "self"
Thomas Haller [Tue, 29 Mar 2016 08:46:07 +0000 (10:46 +0200)]
policy/trival: rename "policy" argument to "self"

We call the "self" pointer in our source files not after the
type. It's just "self".

8 years agopolicy: remove initialized guard from nm_policy_new()
Thomas Haller [Tue, 29 Mar 2016 08:39:47 +0000 (10:39 +0200)]
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.

8 years agopolicy: initialize object during GObject construction
Thomas Haller [Tue, 29 Mar 2016 08:36:51 +0000 (10:36 +0200)]
policy: initialize object during GObject construction

8 years agopolicy: refactor object properties to notify by property enum
Thomas Haller [Mon, 28 Mar 2016 18:49:18 +0000 (20:49 +0200)]
policy: refactor object properties to notify by property enum

8 years agopolicy/trivial: move code
Thomas Haller [Mon, 28 Mar 2016 14:21:07 +0000 (16:21 +0200)]
policy/trivial: move code

8 years agoall: merge branch 'th/invalid-connections-bgo760907'
Thomas Haller [Tue, 29 Mar 2016 09:56:37 +0000 (11:56 +0200)]
all: merge branch 'th/invalid-connections-bgo760907'

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

8 years agolibnm-glib: allow non-verifiable NMRemoteConnection in libnm-glib
Thomas Haller [Sat, 26 Mar 2016 12:47:30 +0000 (13:47 +0100)]
libnm-glib: allow non-verifiable NMRemoteConnection in libnm-glib

8 years agolibnm-glib: don't fail creating connection in NMVPNPlugin
Thomas Haller [Sat, 26 Mar 2016 12:18:30 +0000 (13:18 +0100)]
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.

8 years agolibnm-glib: don't fail creating connection in NMSecretAgent
Thomas Haller [Sat, 26 Mar 2016 12:18:30 +0000 (13:18 +0100)]
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.

8 years agolibnm-util: add non-failing versions of nm_connection_new_from_hash() and replace...
Thomas Haller [Sat, 26 Mar 2016 12:04:43 +0000 (13:04 +0100)]
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.

8 years agolibnm-util: refactor hash_to_connection()
Thomas Haller [Sat, 26 Mar 2016 11:26:54 +0000 (12:26 +0100)]
libnm-util: refactor hash_to_connection()

No functional change, only move the verify-step out of hash_to_connection().

8 years agolibnm-util: don't print any warnings during nm_setting_new_from_hash()
Thomas Haller [Thu, 24 Mar 2016 14:58:28 +0000 (15:58 +0100)]
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.

8 years agolibnm-util: use "nm-shared-utils.h"
Thomas Haller [Thu, 24 Mar 2016 15:03:06 +0000 (16:03 +0100)]
libnm-util: use "nm-shared-utils.h"

8 years agolibnm: add code comments to hint that NMConnection might not validate
Thomas Haller [Wed, 23 Mar 2016 16:36:28 +0000 (17:36 +0100)]
libnm: add code comments to hint that NMConnection might not validate

8 years agocore: be strict about connection argument in D-Bus methods
Thomas Haller [Wed, 23 Mar 2016 14:58:53 +0000 (15:58 +0100)]
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.

8 years agocore: be strict when parsing connection in AddAndActivateConnection
Thomas Haller [Wed, 23 Mar 2016 15:12:12 +0000 (16:12 +0100)]
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.

8 years agocore: be strict about connection argument for Reapply() D-Bus method
Thomas Haller [Wed, 23 Mar 2016 14:50:20 +0000 (15:50 +0100)]
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.

8 years agolibnm: be more accepting for invalid connections from NetworkManager
Thomas Haller [Wed, 23 Mar 2016 15:18:25 +0000 (16:18 +0100)]
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.

8 years agolibnm: accept invalid connections in NMVpnServicePlugin
Thomas Haller [Wed, 23 Mar 2016 14:39:49 +0000 (15:39 +0100)]
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.

8 years agolibnm: accept invalid connections in NMSecretAgentOld
Thomas Haller [Wed, 23 Mar 2016 14:32:43 +0000 (15:32 +0100)]
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.

8 years agolibnm: don't normalize connection for nm_device_get_applied_connection()
Thomas Haller [Thu, 17 Mar 2016 09:37:42 +0000 (10:37 +0100)]
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.

8 years agolibnm-core/tests: refactor call to nm_simple_connection_new_from_dbus()
Thomas Haller [Wed, 23 Mar 2016 15:04:54 +0000 (16:04 +0100)]
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.

8 years agolibnm-core: add _nm_simple_connection_new_from_dbus() function
Thomas Haller [Thu, 17 Mar 2016 09:34:44 +0000 (10:34 +0100)]
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.

8 years agolibnm-core: allow strict and relaxed error behavior for _nm_setting_new_from_dbus()
Thomas Haller [Fri, 18 Mar 2016 12:42:50 +0000 (13:42 +0100)]
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.

8 years agoshared: add nm_g_object_set_property()
Thomas Haller [Fri, 18 Mar 2016 12:56:53 +0000 (13:56 +0100)]
shared: add nm_g_object_set_property()

8 years agolibnm/tests: extend tests for handling invalid connections in NMClient
Thomas Haller [Thu, 17 Mar 2016 11:19:23 +0000 (12:19 +0100)]
libnm/tests: extend tests for handling invalid connections in NMClient

8 years agoshared: move NM_UTILS_ERROR to shared-utils
Thomas Haller [Fri, 18 Mar 2016 12:59:57 +0000 (13:59 +0100)]
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.

8 years agoshared: move _nm_utils_ascii_str_to_int64() to "shared/nm-shared-utils.h"
Thomas Haller [Sun, 20 Mar 2016 09:32:43 +0000 (10:32 +0100)]
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.

8 years agoshared: include "nm-shared-utils.h"
Thomas Haller [Fri, 18 Mar 2016 13:08:41 +0000 (14:08 +0100)]
shared: include "nm-shared-utils.h"

Include it via "nm-default.h" to all projects.

8 years agoshared: add "nm-shared-utils"
Thomas Haller [Fri, 18 Mar 2016 12:45:20 +0000 (13:45 +0100)]
shared: add "nm-shared-utils"

8 years agoshared: add nm_auto_unset_gvalue macro
Thomas Haller [Fri, 18 Mar 2016 15:23:49 +0000 (16:23 +0100)]
shared: add nm_auto_unset_gvalue macro

8 years agonmtst: add nmtst_variant_new_vardict() function
Thomas Haller [Thu, 17 Mar 2016 11:42:54 +0000 (12:42 +0100)]
nmtst: add nmtst_variant_new_vardict() function

8 years agonmtst: fix memleak when using NMTST_VARIANT_DROP_SETTING()
Thomas Haller [Fri, 18 Mar 2016 18:52:48 +0000 (19:52 +0100)]
nmtst: fix memleak when using NMTST_VARIANT_DROP_SETTING()

8 years agolibnm-util: verify connection also for self-assignment in replace_settings_from_conne...
Thomas Haller [Thu, 17 Mar 2016 10:39:08 +0000 (11:39 +0100)]
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.

8 years agomerge: branch 'lr/virtual-parent-bgo762731'
Lubomir Rintel [Sat, 26 Mar 2016 10:31:45 +0000 (11:31 +0100)]
merge: branch 'lr/virtual-parent-bgo762731'

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

8 years agomanager: allow delaying the device activation when the parent is not real
Lubomir Rintel [Thu, 24 Mar 2016 14:20:44 +0000 (15:20 +0100)]
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.

8 years agomanager: separate the traversal to disconected to a separate routine
Lubomir Rintel [Thu, 24 Mar 2016 14:20:44 +0000 (15:20 +0100)]
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.

8 years agoactive-connection: add parent active connection tracking
Lubomir Rintel [Wed, 23 Mar 2016 13:47:02 +0000 (14:47 +0100)]
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.

8 years agodevice: delay the activation if the backing device is not yet there
Lubomir Rintel [Wed, 23 Mar 2016 13:51:53 +0000 (14:51 +0100)]
device: delay the activation if the backing device is not yet there

8 years agodevice: only clear the activate request when the device disconnects
Lubomir Rintel [Wed, 23 Mar 2016 13:51:34 +0000 (14:51 +0100)]
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.

8 years agodevice: _get_available_connections() with _get_best_connection()
Lubomir Rintel [Wed, 23 Mar 2016 09:35:55 +0000 (10:35 +0100)]
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.

8 years agomerge: branch 'lr/developer-gnome'
Lubomir Rintel [Sat, 26 Mar 2016 10:28:44 +0000 (11:28 +0100)]
merge: branch 'lr/developer-gnome'

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

8 years agoman: use replace <programlisting> with <synopsis>
Beniamino Galvani [Sat, 26 Mar 2016 09:19:25 +0000 (10:19 +0100)]
man: use replace <programlisting> with <synopsis>

It makes more sense and actually looks good in rendered HTML.

[lkundrak@v3.sk: wrote the commit message]

8 years agodocs: add manual pages to docbook documentation
Lubomir Rintel [Thu, 24 Mar 2016 12:30:52 +0000 (13:30 +0100)]
docs: add manual pages to docbook documentation

This way they will make it to developer.gnome.org.

8 years agodocs: remove some outdated documentation
Lubomir Rintel [Thu, 24 Mar 2016 12:10:45 +0000 (13:10 +0100)]
docs: remove some outdated documentation

The migration guide and the old D-Bus API are not needed anymore.

8 years agodocs: replace spec.html with docbook D-Bus API reference
Lubomir Rintel [Sat, 26 Mar 2016 09:17:34 +0000 (10:17 +0100)]
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.

8 years agodbus: use the annotations for documentation
Lubomir Rintel [Thu, 24 Mar 2016 13:36:14 +0000 (14:36 +0100)]
dbus: use the annotations for documentation

gdbus only understands those (and gtk docstrings, which we should eventually
use) when generating the documentation.

8 years agointrospection: build docbook when generating the code
Lubomir Rintel [Sat, 26 Mar 2016 09:16:28 +0000 (10:16 +0100)]
introspection: build docbook when generating the code

8 years agopo: update German (de) translation (bgo #764175)
Christian Kirbach [Fri, 25 Mar 2016 00:08:39 +0000 (00:08 +0000)]
po: update German (de) translation (bgo #764175)

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

8 years agoplatform/tests: fix bug in netns test which can cause mounting tmpfs over /run
Thomas Haller [Thu, 24 Mar 2016 16:05:39 +0000 (17:05 +0100)]
platform/tests: fix bug in netns test which can cause mounting tmpfs over /run

The root-test "/general/netns/bind-to-path" mounts a tmpfs
over /var/run for the duration of the test and unmounts it at
the end.

Due to a bug, we first mount the tmpfs, then switch to another
namespace, and finally unmount /var/run on that other namespace.

That means, when you run the tests as root, it will bork /run
on your system.

Fixes: 46f5c07643e6cbf920a44bebe9ac9d3435a5a7b6

8 years agodhcp: don't fail assertions when a DHCP client is not available
Beniamino Galvani [Thu, 24 Mar 2016 10:09:55 +0000 (11:09 +0100)]
dhcp: don't fail assertions when a DHCP client is not available

If no configured client is available, gracefully fail the activation
without throwing runtime errors.

8 years agodhcp: fall back to other clients when an invalid one is specified
Beniamino Galvani [Thu, 24 Mar 2016 09:16:39 +0000 (10:16 +0100)]
dhcp: fall back to other clients when an invalid one is specified

If the user specifies an invalid 'dhcp' option in configuration,
currently we disable DHCP. Instead, fall back to other available
clients, as we do for other options.

8 years agocore: accept zero @wait_before_kill_msec in nm_utils_kill_process_sync()
Beniamino Galvani [Thu, 24 Mar 2016 09:46:01 +0000 (10:46 +0100)]
core: accept zero @wait_before_kill_msec in nm_utils_kill_process_sync()

A zero @wait_before_kill_msec argument should disable the generation
of a SIGKILL signal (after a different signal has been sent).

8 years agodns: fix error cleanup in kill_existing()
Beniamino Galvani [Thu, 24 Mar 2016 09:21:53 +0000 (10:21 +0100)]
dns: fix error cleanup in kill_existing()

Fixes: 3e66813db22918abd8da1da9a9ca4828bc59d589

8 years agoshared: include <stdlib.h> in "nm-macros-internal.h"
Thomas Haller [Wed, 23 Mar 2016 16:55:27 +0000 (17:55 +0100)]
shared: include <stdlib.h> in "nm-macros-internal.h"

"nm-macros-internal.h" uses free() for the "nm_auto_free"
macro. Thus, as long as that code is there, we anyway must
include <stdlib.h> along the line.

Do it in "nm-macros-internal.h" to make the header self-contained.

8 years agodns: merge branch 'th/dns-resolv-conf-file-bgo764004'
Thomas Haller [Wed, 23 Mar 2016 08:12:04 +0000 (09:12 +0100)]
dns: merge branch 'th/dns-resolv-conf-file-bgo764004'

https://mail.gnome.org/archives/networkmanager-list/2016-March/msg00123.html
https://bugzilla.gnome.org/show_bug.cgi?id=764004