NetworkManager.git
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

8 years agodns: always reload the dns configuration mode on SIGHUP
Thomas Haller [Tue, 22 Mar 2016 09:31:23 +0000 (10:31 +0100)]
dns: always reload the dns configuration mode on SIGHUP

8 years agodns: enable dns plugins also with immutable resolv.conf
Thomas Haller [Mon, 21 Mar 2016 21:12:25 +0000 (22:12 +0100)]
dns: enable dns plugins also with immutable resolv.conf

We check whether /etc/resolv.conf is set as immutable. But even then
we still want to support our dns plugins like dnsmasq and unbound.

8 years agodns: add new "rc-manager=file"
Thomas Haller [Mon, 21 Mar 2016 20:01:25 +0000 (21:01 +0100)]
dns: add new "rc-manager=file"

8 years agodns: split create_resolv_conf() out of write_resolv_conf()
Thomas Haller [Mon, 21 Mar 2016 15:34:05 +0000 (16:34 +0100)]
dns: split create_resolv_conf() out of write_resolv_conf()

8 years agodns: refactor NMDnsManagerResolvConfMode to string conversion
Thomas Haller [Mon, 21 Mar 2016 15:43:09 +0000 (16:43 +0100)]
dns: refactor NMDnsManagerResolvConfMode to string conversion

8 years agodns: fix _NMLOG() macro
Thomas Haller [Tue, 22 Mar 2016 10:00:54 +0000 (11:00 +0100)]
dns: fix _NMLOG() macro

The buffer was too small to contain _NMLOG_PREFIX_NAME and the pointer,
resulting in truncated messages like:

  dns-mgr[0x561d1183d: set resolv-conf-mode: none

8 years agodnsmasq: use _LOG() macros
Thomas Haller [Tue, 22 Mar 2016 15:41:22 +0000 (16:41 +0100)]
dnsmasq: use _LOG() macros

The _LOG*() macros based on _NMLOG() prefix each line with a
context. Since we no longer log the location of the logging line,
this is the more important.

8 years agodns: refactor kill_existing() to always unlink pidfile
Thomas Haller [Tue, 22 Mar 2016 15:22:31 +0000 (16:22 +0100)]
dns: refactor kill_existing() to always unlink pidfile

When a pidfile exists, it is always stale after this point
and kill_existing() should always unlink it.

Also, refactor kill_existing() to use nm_utils_kill_process_sync()
which waits for the process to be gone.

8 years agodns: cleanup disposing of NMDnsPlugin
Thomas Haller [Tue, 22 Mar 2016 15:08:07 +0000 (16:08 +0100)]
dns: cleanup disposing of NMDnsPlugin

8 years agodns: refactor cleanup and unlink of pidfile
Thomas Haller [Tue, 22 Mar 2016 15:06:55 +0000 (16:06 +0100)]
dns: refactor cleanup and unlink of pidfile

8 years agodns: cleanup pid file when dnsmasq process terminated
Mathieu Trudel-Lapierre [Tue, 22 Mar 2016 14:03:44 +0000 (10:03 -0400)]
dns: cleanup pid file when dnsmasq process terminated

[thaller@redhat.com: extracted the patch from a larger one]

https://mail.gnome.org/archives/networkmanager-list/2016-March/msg00144.html

Signed-off-by: Mathieu Trudel-Lapierre <mathieu.trudel-lapierre@canonical.com>
8 years agodns/trivial: fix indention
Thomas Haller [Tue, 22 Mar 2016 15:30:20 +0000 (16:30 +0100)]
dns/trivial: fix indention

8 years agosystemd: merge branch systemd into master
Thomas Haller [Tue, 22 Mar 2016 12:57:47 +0000 (13:57 +0100)]
systemd: merge branch systemd into master

Update systemd code from upstream. In the meantime, two
patches that we applied early in NetworkManager core were
applied in upstream systemd too. So, resync.

8 years agosystemd: update code from upstream
Thomas Haller [Tue, 22 Mar 2016 09:23:12 +0000 (10:23 +0100)]
systemd: update code from upstream

This is a direct dump from systemd git on 2016-03-22, git commit
99d91109a6ed7f8bcdeef164fe9497112128944a.

======

SYSTEMD_DIR=../systemd
COMMIT=99d91109a6ed7f8bcdeef164fe9497112128944a

(
  cd "$SYSTEMD_DIR"
  git checkout "$COMMIT"
  git reset --hard
  git clean -fdx
)

git ls-files :/src/systemd/src/ | xargs -d '\n' rm -f

nm_copy_sd() {
    mkdir -p "./src/systemd/$(dirname "$1")"
    cp "$SYSTEMD_DIR/$1" "./src/systemd/$1"
}

nm_copy_sd "src/basic/alloc-util.c"
nm_copy_sd "src/basic/alloc-util.h"
nm_copy_sd "src/basic/async.h"
nm_copy_sd "src/basic/escape.c"
nm_copy_sd "src/basic/escape.h"
nm_copy_sd "src/basic/ether-addr-util.c"
nm_copy_sd "src/basic/ether-addr-util.h"
nm_copy_sd "src/basic/fileio.c"
nm_copy_sd "src/basic/fileio.h"
nm_copy_sd "src/basic/fd-util.c"
nm_copy_sd "src/basic/fd-util.h"
nm_copy_sd "src/basic/fs-util.c"
nm_copy_sd "src/basic/fs-util.h"
nm_copy_sd "src/basic/hash-funcs.c"
nm_copy_sd "src/basic/hash-funcs.h"
nm_copy_sd "src/basic/hashmap.c"
nm_copy_sd "src/basic/hashmap.h"
nm_copy_sd "src/basic/hexdecoct.c"
nm_copy_sd "src/basic/hexdecoct.h"
nm_copy_sd "src/basic/hostname-util.c"
nm_copy_sd "src/basic/hostname-util.h"
nm_copy_sd "src/basic/in-addr-util.c"
nm_copy_sd "src/basic/in-addr-util.h"
nm_copy_sd "src/basic/io-util.c"
nm_copy_sd "src/basic/io-util.h"
nm_copy_sd "src/basic/list.h"
nm_copy_sd "src/basic/log.h"
nm_copy_sd "src/basic/macro.h"
nm_copy_sd "src/basic/mempool.h"
nm_copy_sd "src/basic/mempool.c"
nm_copy_sd "src/basic/parse-util.c"
nm_copy_sd "src/basic/parse-util.h"
nm_copy_sd "src/basic/path-util.c"
nm_copy_sd "src/basic/path-util.h"
nm_copy_sd "src/basic/prioq.h"
nm_copy_sd "src/basic/prioq.c"
nm_copy_sd "src/basic/random-util.c"
nm_copy_sd "src/basic/random-util.h"
nm_copy_sd "src/basic/refcnt.h"
nm_copy_sd "src/basic/set.h"
nm_copy_sd "src/basic/siphash24.c"
nm_copy_sd "src/basic/siphash24.h"
nm_copy_sd "src/basic/socket-util.c"
nm_copy_sd "src/basic/socket-util.h"
nm_copy_sd "src/basic/sparse-endian.h"
nm_copy_sd "src/basic/stdio-util.h"
nm_copy_sd "src/basic/string-table.c"
nm_copy_sd "src/basic/string-table.h"
nm_copy_sd "src/basic/string-util.c"
nm_copy_sd "src/basic/string-util.h"
nm_copy_sd "src/basic/strv.c"
nm_copy_sd "src/basic/strv.h"
nm_copy_sd "src/basic/time-util.c"
nm_copy_sd "src/basic/time-util.h"
nm_copy_sd "src/basic/umask-util.h"
nm_copy_sd "src/basic/unaligned.h"
nm_copy_sd "src/basic/utf8.c"
nm_copy_sd "src/basic/utf8.h"
nm_copy_sd "src/basic/util.c"
nm_copy_sd "src/basic/util.h"
nm_copy_sd "src/libsystemd-network/arp-util.c"
nm_copy_sd "src/libsystemd-network/arp-util.h"
nm_copy_sd "src/libsystemd-network/dhcp6-internal.h"
nm_copy_sd "src/libsystemd-network/dhcp6-lease-internal.h"
nm_copy_sd "src/libsystemd-network/dhcp6-network.c"
nm_copy_sd "src/libsystemd-network/dhcp6-option.c"
nm_copy_sd "src/libsystemd-network/dhcp6-protocol.h"
nm_copy_sd "src/libsystemd-network/dhcp-identifier.c"
nm_copy_sd "src/libsystemd-network/dhcp-identifier.h"
nm_copy_sd "src/libsystemd-network/dhcp-internal.h"
nm_copy_sd "src/libsystemd-network/dhcp-lease-internal.h"
nm_copy_sd "src/libsystemd-network/dhcp-network.c"
nm_copy_sd "src/libsystemd-network/dhcp-option.c"
nm_copy_sd "src/libsystemd-network/dhcp-packet.c"
nm_copy_sd "src/libsystemd-network/dhcp-protocol.h"
nm_copy_sd "src/libsystemd-network/lldp.h"
nm_copy_sd "src/libsystemd-network/lldp-internal.h"
nm_copy_sd "src/libsystemd-network/lldp-neighbor.c"
nm_copy_sd "src/libsystemd-network/lldp-neighbor.h"
nm_copy_sd "src/libsystemd-network/lldp-network.c"
nm_copy_sd "src/libsystemd-network/lldp-network.h"
nm_copy_sd "src/libsystemd-network/network-internal.c"
nm_copy_sd "src/libsystemd-network/network-internal.h"
nm_copy_sd "src/libsystemd-network/sd-dhcp6-client.c"
nm_copy_sd "src/libsystemd-network/sd-dhcp6-lease.c"
nm_copy_sd "src/libsystemd-network/sd-dhcp-client.c"
nm_copy_sd "src/libsystemd-network/sd-dhcp-lease.c"
nm_copy_sd "src/libsystemd-network/sd-ipv4ll.c"
nm_copy_sd "src/libsystemd-network/sd-ipv4acd.c"
nm_copy_sd "src/libsystemd-network/sd-lldp.c"
nm_copy_sd "src/libsystemd/sd-event/sd-event.c"
nm_copy_sd "src/libsystemd/sd-id128/sd-id128.c"
nm_copy_sd "src/shared/dns-domain.c"
nm_copy_sd "src/shared/dns-domain.h"
nm_copy_sd "src/systemd/_sd-common.h"
nm_copy_sd "src/systemd/sd-dhcp6-client.h"
nm_copy_sd "src/systemd/sd-dhcp6-lease.h"
nm_copy_sd "src/systemd/sd-dhcp-client.h"
nm_copy_sd "src/systemd/sd-dhcp-lease.h"
nm_copy_sd "src/systemd/sd-event.h"
nm_copy_sd "src/systemd/sd-ndisc.h"
nm_copy_sd "src/systemd/sd-id128.h"
nm_copy_sd "src/systemd/sd-ipv4acd.h"
nm_copy_sd "src/systemd/sd-ipv4ll.h"
nm_copy_sd "src/systemd/sd-lldp.h"

8 years agodbus: fix a typo in the comment
Lubomir Rintel [Mon, 21 Mar 2016 13:05:49 +0000 (14:05 +0100)]
dbus: fix a typo in the comment

8 years agobuild: dist $(docbook_generated_man_pages)
Thomas Haller [Mon, 21 Mar 2016 10:55:52 +0000 (11:55 +0100)]
build: dist $(docbook_generated_man_pages)

Otherwise, the pre-generated manual pages from docbook
are not part of the source tarball.

8 years agomain: create parent directories of NMSTATEDIR with permissions 755
Thomas Haller [Mon, 21 Mar 2016 11:01:26 +0000 (12:01 +0100)]
main: create parent directories of NMSTATEDIR with permissions 755

In case, "$PREFIX/var/lib" does not exist, we want to create those
directories with permissions 755, not 700.

8 years agomain: create NMSTATEDIR with permissions 700
Thomas Haller [Mon, 21 Mar 2016 10:40:42 +0000 (11:40 +0100)]
main: create NMSTATEDIR with permissions 700

"NMSTATEDIR" is "nmstatedir" is "'${localstatedir}'/lib/$PACKAGE" is
usually "/var/lib/NetworkManager".

The "install-data-hook" in "src/Makefile.am" properly installs the
directory with permissions 700. When creating the directory at startup,
we must also use those permissions.

8 years agosrc/Makefile.am: create $rundir mode 0755 instead of 0700
Robby Workman [Mon, 21 Mar 2016 06:51:08 +0000 (01:51 -0500)]
src/Makefile.am: create $rundir mode 0755 instead of 0700

Otherwise, $NMRUNDIR/resolv.conf isn't readable by unprivileged
users.

https://mail.gnome.org/archives/networkmanager-list/2016-March/msg00124.html

8 years agosupplicant-config: fix misleading indentation
Lubomir Rintel [Sun, 20 Mar 2016 16:05:35 +0000 (17:05 +0100)]
supplicant-config: fix misleading indentation

8 years agodbus: don't do <deny send_interface="..." /> in dbus service file
Lubomir Rintel [Sun, 20 Mar 2016 11:06:42 +0000 (12:06 +0100)]
dbus: don't do <deny send_interface="..." /> in dbus service file

It does more than intended; apart from denying messages to that particular
interface it also denies all messages non-qualified with an
interface globally.
This blocks messages completely unrelated to wpa_supplicant, such as
NetworkManager communication with the VPN plugins.

From the dbus-daemon manual:

  Be careful with send_interface/receive_interface, because the
  interface field in messages is optional. In particular, do NOT
  specify <deny send_interface="org.foo.Bar"/>! This will cause
  no-interface messages to be blocked for all services, which is
  almost certainly not what you intended. Always use rules of the form:
  <deny send_interface="org.foo.Bar" send_destination="org.foo.Service"/>

We can just safely remove those rules, since we're sufficiently protected
by the send_destination matches and method calls are disallowed by default
anyway.

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

8 years agoman: document IPv4 subnet for "shared" method
Thomas Haller [Sun, 20 Mar 2016 10:15:24 +0000 (11:15 +0100)]
man: document IPv4 subnet for "shared" method

8 years agodevice: optimize hashtable usage for shared_ips
Thomas Haller [Sun, 20 Mar 2016 09:59:37 +0000 (10:59 +0100)]
device: optimize hashtable usage for shared_ips

No point ins storing "TRUE" as value in the @shared_ips hash
table. That forces glib to allocate a separate storage for the
value. Just use g_hash_table_add() instead.

8 years agovpn-connection: do not leak the connection if there's no timeout
Lubomir Rintel [Fri, 18 Mar 2016 16:41:00 +0000 (17:41 +0100)]
vpn-connection: do not leak the connection if there's no timeout

8 years agovpn-connection: don't dispose the proxy before we get the disconnect response
Lubomir Rintel [Fri, 18 Mar 2016 14:30:57 +0000 (15:30 +0100)]
vpn-connection: don't dispose the proxy before we get the disconnect response

The return_method would be rejected by the dbus-daemon when the NM drops
its match, resulting in an ugly message in the log:

  method call time=1458301860.187048 sender=:1.267 -> destination=:1.276
    serial=5302 path=/org/freedesktop/NetworkManager/VPN/Plugin;
    interface=org.freedesktop.NetworkManager.VPN.Plugin; member=Disconnect
  method call time=1458301860.187054 sender=:1.267 -> destination=org.freedesktop.DBus
    serial=5303 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus;
    member=RemoveMatch
     string "type='signal',sender='org.freedesktop.DBus',
                                   interface='org.freedesktop.DBus',
                                   member='NameOwnerChanged',
                                   path='/org/freedesktop/DBus',
                                   arg0='org.freedesktop.NetworkManager.libreswan.Connection_10'"
  method return time=1458301860.187061 sender=org.freedesktop.DBus -> destination=:1.267
    serial=1835 reply_serial=5303
  ...
  method return time=1458301860.195351 sender=:1.276 -> destination=:1.267
    serial=19 reply_serial=5302
  error time=1458301860.195361 sender=org.freedesktop.DBus -> destination=:1.276
    error_name=org.freedesktop.DBus.Error.AccessDenied reply_serial=19
     string "Rejected send message, 7 matched rules; type="method_return",
             sender=":1.276" (uid=0 pid=26915
             comm="/usr/libexec/nm-libreswan-service --bus-name org.f")
             interface="(unset)" member="(unset)" error name="(unset)"
             requested_reply="0" destination=":1.267" (uid=0 pid=25724
             comm="/usr/sbin/NetworkManager --no-daemon ")"

Also, refcount the connection instance. While the proxy is alive, it
invokes singal callbacks that get the object as a parameter.

8 years agodhcp: fix GBytes leak in nm_dhcp_client_start_ip4()
Francesco Giudici [Fri, 18 Mar 2016 09:46:16 +0000 (10:46 +0100)]
dhcp: fix GBytes leak in nm_dhcp_client_start_ip4()

8 years agodhcp: support _LOGx_ENABLED() macro in dhcp-client
Thomas Haller [Thu, 17 Mar 2016 16:55:25 +0000 (17:55 +0100)]
dhcp: support _LOGx_ENABLED() macro in dhcp-client

The macro _LOGx_ENABLED() is defined with a default implementation
that depends on _NMLOG_DOMAIN. Although that default does not
check for LOGD_DHCP4 vs. LOGD_DHCP6, still provide it.
Determining the correct domain might involve a larger performance
impact that what we would safe.

8 years agotest-nm-client: fix the remaining counter
Lubomir Rintel [Thu, 17 Mar 2016 16:12:30 +0000 (17:12 +0100)]
test-nm-client: fix the remaining counter

We're expecting four callbacks: a client::devices change,
client::active-connections change, client::activate callback,
and a device::active-connection change.

We only hook the second one in the callback to the first one, and
only if client::active-connections is not set already. If it is
(when running slowly in valgrind), we just decrement the counter.

However, as the counter is one less than it should be, it would
underflow and we wait forever* instead.

For the value of forever=20s, given that's the timeout of the
mockup service.

8 years agordisc: fix setting netns during consturction of NMRDisc
Thomas Haller [Thu, 17 Mar 2016 15:19:02 +0000 (16:19 +0100)]
rdisc: fix setting netns during consturction of NMRDisc

We obtain the netns from the platform instance that is passed
in. It's wrong to set the current netns in nm_rdisc_init().

Fixes: 3ba944472853d5221ed83c369a77f80ee7305648

8 years agolldp: merge branch 'th/lldp-bgo763499'
Thomas Haller [Thu, 17 Mar 2016 14:14:53 +0000 (15:14 +0100)]
lldp: merge branch 'th/lldp-bgo763499'

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

8 years agolldp: refactor keeping tlv data and order entries in neighbor GVariant
Thomas Haller [Wed, 16 Mar 2016 17:46:41 +0000 (18:46 +0100)]
lldp: refactor keeping tlv data and order entries in neighbor GVariant

The fields in the neighbor variant should have a defined order.

Instead of sorting the hash table entries while constructing the
variant in lldp_neighbor_to_variant(), refactor the management of
the TLV attributes.
As we only support known attributes, we can
store them in an array at a known index instead of putting them
in a hash table.
An alternative would be to have explict fields for every known
attribute. That would be even more efficient, but requires more
work when adding new attributes.

8 years agolldp: ensure stable order of variants in LLDP neighbor list
Thomas Haller [Wed, 16 Mar 2016 12:50:09 +0000 (13:50 +0100)]
lldp: ensure stable order of variants in LLDP neighbor list

8 years agolldp: drop process_lldp_neighbors()
Thomas Haller [Tue, 15 Mar 2016 12:05:07 +0000 (13:05 +0100)]
lldp: drop process_lldp_neighbors()

We register the callback early on, so we get notified about
every single neighbor as they show up. No need to iterate over
them explicitly -- and probably, at that early state, there are
no neighbors yet.

8 years agolldp: process one neighbor at a time
Thomas Haller [Fri, 11 Mar 2016 13:02:22 +0000 (14:02 +0100)]
lldp: process one neighbor at a time

The systemd event tells which neighbor changed. Make use
of this information and don't rebuild all the neighbors
all the time.

That means, we must also change our rate limiting. Instead of
rate limiting the processing of all neighbors, we process neighbors
right away but limit the notification that gobject property changed.

8 years agolldp: implement properties via NM_GOBJECT_PROPERTIES_DEFINE()
Thomas Haller [Fri, 11 Mar 2016 13:28:43 +0000 (14:28 +0100)]
lldp: implement properties via NM_GOBJECT_PROPERTIES_DEFINE()

8 years agolldp: improve logging
Thomas Haller [Fri, 11 Mar 2016 13:09:50 +0000 (14:09 +0100)]
lldp: improve logging

8 years agolldp: let lldp_neighbor_new() also create invalid objects
Thomas Haller [Fri, 11 Mar 2016 12:47:17 +0000 (13:47 +0100)]
lldp: let lldp_neighbor_new() also create invalid objects

When we receive an update for a certain neighbor, the update
might be invalid and we want to reject it. However, we still
must create an invalid object to compare whether the update
causes a remove of a previously valid neighbor.

Let lldp_neighbor_new() create an instance as long as the
id fields are present.

8 years agolldp: cache the GVariant in LldpNeighbor
Thomas Haller [Fri, 11 Mar 2016 11:48:43 +0000 (12:48 +0100)]
lldp: cache the GVariant in LldpNeighbor

8 years agolldp: factor out lldp_neighbor_to_variant()
Thomas Haller [Fri, 11 Mar 2016 11:40:10 +0000 (12:40 +0100)]
lldp: factor out lldp_neighbor_to_variant()

8 years agolldp: refactor processing all lldp-neighbors
Thomas Haller [Fri, 11 Mar 2016 11:34:30 +0000 (12:34 +0100)]
lldp: refactor processing all lldp-neighbors

Instead of replacing the whole hash with a new one (and all new by a new one,
LldpNeighbor instances), update the existing hash.

One point of this is that our process-all function requires less
comparisons and avoids duplicate work right earlier. E.g. if a neighbor
didn't change, we don't have to put it into a hash to compare later for
equality.

But more importantly, we preserve our LldpNeighbor instance instead
of recreating them all the time. Later, the LldpNeighbor will cache
the GVariant.

8 years agolldp: split out creation of LldpNeighbor instance
Thomas Haller [Fri, 11 Mar 2016 10:40:34 +0000 (11:40 +0100)]
lldp: split out creation of LldpNeighbor instance

8 years agolldp/trivial: rename internal type LLDPNeighbor to LldpNeighbor
Thomas Haller [Fri, 11 Mar 2016 10:16:31 +0000 (11:16 +0100)]
lldp/trivial: rename internal type LLDPNeighbor to LldpNeighbor

Our convention is to use camel case for abbreviations
that are longer then 2 charaters.

8 years agosystemd: lldp: fix starting ttl timer for lldp neighbor
Thomas Haller [Fri, 11 Mar 2016 14:54:07 +0000 (15:54 +0100)]
systemd: lldp: fix starting ttl timer for lldp neighbor

lldp_start_timer() was only called during sd_lldp_get_neighbors().
Ensure that the timer is (re-)started when a new neighbor appears.
Otherwise, the timer is not started when relying on the events alone.

https://github.com/systemd/systemd/pull/2826

8 years agologging: add new logging domain "SYSTEMD" for internal systemd logging
Thomas Haller [Fri, 11 Mar 2016 15:11:04 +0000 (16:11 +0100)]
logging: add new logging domain "SYSTEMD" for internal systemd logging

8 years agoshared: add nm_unauto() helper macro
Thomas Haller [Fri, 11 Mar 2016 12:38:30 +0000 (13:38 +0100)]
shared: add nm_unauto() helper macro

8 years agoshared: add nm_assert_not_reached()
Thomas Haller [Wed, 16 Mar 2016 13:50:23 +0000 (14:50 +0100)]
shared: add nm_assert_not_reached()

8 years agoutils/core: add NM_UTILS_NS_PER_MSEC macro
Thomas Haller [Fri, 11 Mar 2016 13:40:58 +0000 (14:40 +0100)]
utils/core: add NM_UTILS_NS_PER_MSEC macro

8 years agolibnm: declare internal function as static
Thomas Haller [Thu, 17 Mar 2016 10:23:05 +0000 (11:23 +0100)]
libnm: declare internal function as static

8 years agomerge: branch 'bg/8021x-domain-suffix-match-bgo341323'
Beniamino Galvani [Wed, 16 Mar 2016 16:34:52 +0000 (17:34 +0100)]
merge: branch 'bg/8021x-domain-suffix-match-bgo341323'

Add domain-suffix-match properties to NMSetting8021x.

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

8 years agolibnm-core: nm-setting-8021x: treat some empty properties as NULL
Beniamino Galvani [Tue, 8 Mar 2016 14:22:05 +0000 (15:22 +0100)]
libnm-core: nm-setting-8021x: treat some empty properties as NULL

For some properties as *subject-match and *domain-suffix-match an
empty string means that we don't want to do any filtering and should
be stored as NULL.

8 years agosupplicant: honor the domain-suffix-match properties
Beniamino Galvani [Fri, 4 Mar 2016 08:58:28 +0000 (09:58 +0100)]
supplicant: honor the domain-suffix-match properties

8 years agocli: add support for NMSetting8021x domain-suffix-match properties
Beniamino Galvani [Thu, 3 Mar 2016 21:47:56 +0000 (22:47 +0100)]
cli: add support for NMSetting8021x domain-suffix-match properties

8 years agoifcfg-rh: add support for domain-suffix-match properties
Beniamino Galvani [Fri, 4 Mar 2016 09:39:26 +0000 (10:39 +0100)]
ifcfg-rh: add support for domain-suffix-match properties

8 years agolibnm-core: add domain-suffix-match properties to NMSetting8021x
Beniamino Galvani [Thu, 3 Mar 2016 21:42:35 +0000 (22:42 +0100)]
libnm-core: add domain-suffix-match properties to NMSetting8021x

The new domain-suffix-match and phase2-domain-suffix-match properties
can be used to match against a given server domain suffix in the
dNSName elements or in the SubjectName CN of the server certificate.

Also, add a comment to the old subject-match properties documentation
to suggest that they are deprecated and should not be used anymore.