Commit graph

24094 commits

Author SHA1 Message Date
Thomas Haller
eea8ee2321 initrd/tests: check for the parsed values in detail for rd.znet test 2019-09-27 09:20:06 +02:00
Thomas Haller
19604cb126 initrd: avoid modifying the argv argument in nmi_cmdline_reader_parse()
While nmi_cmdline_reader_parse() only has one caller, which indeed has the
argv parameter at hand and doesn't care it to be modified, I think it
is ugly.

Arguments preferably are strictly either input or output arguments,
with input arguments not being modified by the call.
2019-09-27 09:20:06 +02:00
Thomas Haller
9b3d37721b libnm: fix variable type for holding g_strv_length() result in "nm-setting-wired.c"'s verify() 2019-09-27 09:20:05 +02:00
Thomas Haller
783fe28465 initrd: avoid assertion inparse_rd_znet() and cleanup
- nm_setting_wired_add_s390_option() asserts that a "value" argument
  is given. Check that the string contains a '=' where we can split.

- pass the requested NM_SETTING_WIRED_SETTING_NAME type to get_conn().
  Otherwise, @s_wired might be %NULL, resulting in an assertion.
  I do wonder whether this always retrieves a connection of the
  appropriate type for modification, or whether a profile could
  be returned that was created for a different purpose. But that
  isn't changed.

- avoid "g_strcmp0 (nettype, "ctc") != 0". I find it unexpected, that we add the
  3rd subchannel component, if the nettype is "ctc" (intuitively, I'd expect it
  to be the opposite). The reasons for this are not documented, but I
  presume it is correct.
  Anyway, using streq() makes this slightly more clear to me, as with
  strcmp() I would wonder whether this was just a typo while with
  streq() I'd be more confident that this is indeed intended.

- don't initialize local variables unnecessarily. The compiler would
  warn if we would forget about this. Also, don'\''t use { } for a
  one-line block.
2019-09-27 09:18:43 +02:00
Dan Horák
df07539105 nm-initrd-generator - add test for rd.znet 2019-09-27 09:17:57 +02:00
Dan Horák
11d4412ee1 process s390 specific device info from rd.znet parameter in nm-initrd-generator
syntax: rd.znet=<nettype>,<subchannels>,<options>

The s390 specific options used to create the network interface in the kernel
are currently not processed by nm-initrd-generator causing incomplete ifcfg file.

fixes https://bugzilla.redhat.com/show_bug.cgi?id=1753975
2019-09-27 09:17:57 +02:00
Thomas Haller
7df769600b settings: fix creation of default-wired-connection in device_realized()
Fixes-test: @allow_wired_connections

Fixes: 3e39d2a586 ('settings: shortcut check for whether to create auto-default wired connection')
2019-09-27 09:12:35 +02:00
Thomas Haller
41fc9196aa core: merge branch 'th/config-log-no-auto-default'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/290
2019-09-26 19:34:13 +02:00
Thomas Haller
9cec6a1bc1 core: log why no "auto-default" connection was created
Add trace logging to aid debugging.
2019-09-26 19:33:05 +02:00
Thomas Haller
54de101f6e core: log the content of "/var/lib/NetworkManager/no-auto-default.state"
To understand why a profile gets not created, it's necessary to see
the content of "/var/lib/NetworkManager/no-auto-default.state".
Log it.
2019-09-26 19:33:05 +02:00
Thomas Haller
efa51ba9a2 shared: add nm_utils_g_slist_strlist_join() util 2019-09-26 19:33:05 +02:00
Thomas Haller
ad3ef326aa clients/tests: don't include the source line number with client tests output
The client tests compare the test output with a .expected file that is
commit to git and that contains the expected output.

The expected output contains data like

    size: 395
    location: clients/tests/test-client.py:842:test_001()/1
    cmd: $NMCLI
    lang: C
    returncode: 0
    stdout: 277 bytes
    >>>
    ...

Note that there is the line number (clients/tests/test-client.py:842) of
the source code where nmcli is called. This is to help correlate the output
with the test code.

However, Python 3.8 changes behavior and for function calls that span multiple
lines, frame.f_lineno will give now the starting line (previously, it gave the last
line) (see [1]).

No longer include the line number, as it is not stable accross Python versions.

If you really care, you can set NM_TEST_WITH_LINENO to get the line numbers back.
Of course, then the expected output won't match anymore, and you'd have to regenerate
it first. This is only useful if you debug tests, and want to have it easier to
correlate output with the tests while developing them.

[1] https://bugs.python.org/issue38283

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/292
2019-09-26 19:31:56 +02:00
Thomas Haller
d7b9906666 clients/tests: skip client tests with python 3.8-beta
It's unclear how to workaround this issue, so that the tests
work with older python versions and 3.8-beta.

Let's wait whether this will really be released as 3.8 and
for now just skip the test.
2019-09-26 12:07:45 +02:00
Thomas Haller
35c83138ce dns: merge branch 'th/dnsmasq-rework'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/254
2019-09-26 08:31:08 +02:00
Thomas Haller
93d5efb486 dns: move ratelimiting and restart from NMDnsManager to NMDnsDnsmasq
Note that the only DNS plugin that actually emits the FAILED signal was
NMDnsDnsmasq. Let's not handle restart, retry and rate-limiting by
NMDnsManager but by NMDnsDnsmasq itself.

There are three goals here:

(1) we want that when dnsmasq (infrequently) crashes, that we always keep
  retrying. A random crash should be automatically resolved and
  eventually dnsmasq should be working again.
  Note that we anyway cannot fully detect whether something is wrong.
  OK, we detect crashes, but if dnsmasq just gets catatonic, it's just
  as broken. Point being: our ability to detect non-working dnsmasq is limited.

(2) when dnsmasq keeps crashing all the time, then rate limit the retry.
  Of course, at this point there is already something seriously wrong,
  but we shouldn't kill the system by respawning the process without rate
  limiting.

(3) previously, when NMDnsManager noticed that the pluging was broken
  (and rate-limiting kicked in), it would temporarily disable the plugin.
  Basically, that meant to write the real name servers to /etc/resolv.conf
  directly, instead of setting localhost. This partly conflicts with
  (1), because we want to retry and recover automatically. So what good
  is it to notice a problem, resort to plain /etc/resolv.conf for a
  short time, and then run into the issues again? If something is really
  broken, there is no way but to involve the user to investigate and
  fix the issue. Hence, we don't need to concern NMDnsManager with this either.
  The only thing that the manager notices is when the dnsmasq binary is not
  available. In that case, update() fails right away, and the manager falls back
  to configure the name servers in /etc/resolv.conf directly.

Also, change the backoff time from 5 minutes to 1 minute (twice the
burst interval). There is not particularly strong reason for either
choice, I think that if the ratelimit kicks in, then something is
already so wrong that it doesn't matter either way. Anyway, also 60
seconds is long enough to not kill the machine otherwise.
2019-09-26 08:18:58 +02:00
Thomas Haller
a780b04837 dns/dnsmasq: refactor tracking of dnsmasq process
Several points.

- We spawn the dnsmasq process directly. That has several downsides:

  - The lifetime of the process is tied to NetworkManager's. When
    stopping NetworkManager, we usually also stop dnsmasq. Or we keep
    the process running, but later the process is no longer a child process
    of NetworkManager and we can only kill it using the pidfile.

  - We don't do special sandboxing of the dnsmasq process.

- Note that we want to ensure that only one dnsmasq process is running
at any time. We should track that in a singletone. Note that NMDnsDnsmasq
is not a singleton. While there is only one instance active at any time,
the DNS plugin can be swapped (e.g. during SIGHUP). Hence, don't track the
process per-NMDnsDnsmasq instance, but in a global variable "gl_pid".

- Usually, when NetworkManager quits, it also stops the dnsmasq process.
Previously, we would always try to terminate the process based on the
pidfile. That is wrong. Most of the time, NetworkManager spawned the
process itself, as a child process. Hence, the PID is known and NetworkManager
will get a signal when dnsmasq exits. The only moment when NetworkManager should
use the pidfile, is the first time when checking to kill the previous instance.
That is: only once at the beginning, to kill instances that were
intentionally or unintentionally (crash) left running earlier.
This is now done by _gl_pid_kill_external().

- Previously, before starting a new dnsmasq instance we would kill a
possibly already running one, and block while waiting for the process to
disappear. We should never block. Especially, since we afterwards start
the process also in non-blocking way, there is no reason to kill the
existing process in a blocking way. For the most part, starting dnsmasq
is already asynchronous and so should be the killing of the dnsmasq
process.

- Drop GDBusProxy and only use GDBusConnection. It fully suffices.

- When we kill a dnsmasq instance, we actually don't have to wait at
all. That can happen fully in background. The only pecularity is that
when we restart a new instance before the previous instance is killed,
then we must wait for the previous process to terminate first. Also, if
we are about to exit while killing the dnsmasq instance, we must register
nm_shutdown_wait_obj_*() to wait until the process is fully gone.
2019-09-26 08:18:58 +02:00
Thomas Haller
b288ea1397 dns: move PID handling from NMDnsPlugin to NMDnsDnsmasq implementation
We only have two real DNS plugins: "dnsmasq" and "systemd-resolved" (the "unbound"
plugin is very incomplete and should eventually be dropped).

Of these two, only "dnsmasq" spawns a child process. A lot of the logic
for that is in the parent class NMDnsPlugin, with the purpose for that
logic to be reusable.

However:

 - We are unlikely to add more DNS plugins. Especially because
   systemd-resolved seems the way forward.

 - If we happen to add more plugins, then probably NetworkManager
   should not spawn the process itself. That causes problems with
   restarting the service. Rather, we should let the service manager
   handle the lifetime of such "child" processes. Aside separating
   the lifetime of the DNS plugin process from NetworkManager's,
   this also would allow to sandbox NetworkManager and the DNS plugin
   differently. Currently, NetworkManager itself may might need
   capabilities only to pass them on to the DNS plugin, or (more likely)
   NetworkManager would want to drop additional capabilities for the
   DNS plugin (which we would rather not implement ourself, since that
   seems job of the service management already).

 - The current implementation is far from beautiful. For example,
   it does synchronous (blocking) killing of the running process
   from the PID file, and it uses PID fils. This is not something
   we would want to reuse for other plugins. Also, note that
   dnsmasq already spawns the service asynchronosly (of course).
   Hence, we should also kill it asynchronously, but that is complicated
   by having the logic separated in two different classes while
   providing an abstract API between the two.

Move the code to NMDnsDnsmasq. This is the only place that cares about
this. Also, that makes it actually clearer what is happening, by seeing
the lifetime handling of the child proceess all in one place.
2019-09-26 08:18:58 +02:00
Thomas Haller
5f513d0685 dns/dnsmasq: move creation of update arguments to separate function 2019-09-26 08:18:58 +02:00
Thomas Haller
2223fcd92c dns: return error reason from nm_dns_plugin_update()
For logging, if the plugin fails with update, it should return a reason
that we can log.

Note that both dnsmasq and system-resolved plugins do the update asynchronously
(of course). Hence, usually they never fail right away, and there isn't really
possibility to handle the failure later. Still, we should print something sensible
for that we need information what went wrong.
2019-09-26 08:18:58 +02:00
Thomas Haller
807fd682fb dns: drop get_name() and is_caching() virtual functions for klass variables
The plugin name and whether a plugin is caching only depends on the type,
it does not require a virtual function where types would decided depending
on other reasons.

Convert the virtual functions into fields of the class.
2019-09-26 08:18:58 +02:00
Thomas Haller
5bf2112056 core: use G_DEFINE_ABSTRACT_TYPE() macro instead of G_DEFINE_TYPE_EXTENDED() 2019-09-26 08:18:58 +02:00
Thomas Haller
8d890e27ce core: extend nm_shutdown_wait_obj_*() to support waiting with explicit unregister
The previous to wait-types (NM_SHUTDOWN_WAIT_TYPE_OBJECT and
NM_SHUTDOWN_WAIT_TYPE_CANCELLABLE) both required a GObject/GCancellable,
and the shutdown was automatically unblocked when the object got
destroyed.

Add another wait type NM_SHUTDOWN_WAIT_TYPE_HANDLE, which does not take
an object to wait. Instead, shutdown is indefinitely blocked, until the
user unregisters the handle again. While other wait-types allow to
ignore the handle, this wait-type only makes sense if the user keeps
track of the handle.
2019-09-26 08:18:58 +02:00
Thomas Haller
b6acec0fbc shared: add compat macro for G_PID_FORMAT
Having G_PID_FORMAT macro is useful, but it's only available in
recent glib versions. Add a compat implementation and a test that
our assumptions hold.
2019-09-26 08:18:58 +02:00
Thomas Haller
e28460819c release: bump version to 1.21.2-dev 2019-09-26 07:56:25 +02:00
Thomas Haller
a4b7b053f8 supplicant: fix rework condition in nm_supplicant_config_add_bgscan()
Ups, sorry.

Fixes: 6fc37cb779 ('supplicant: rework condition in nm_supplicant_config_add_bgscan()')
2019-09-25 17:29:50 +02:00
Thomas Haller
6fc37cb779 supplicant: rework condition in nm_supplicant_config_add_bgscan()
Avoid the duplicate condition.

Also, fix indentation/whitespace.

No change in behavior.
2019-09-25 17:19:53 +02:00
Lubomir Rintel
140619854e build: regenerate config-extra.h if configure was re-run with different arguments 2019-09-25 15:55:37 +02:00
Kristian Klausen
0f3203338c wifi: roam aggressively if we on a multi-AP network
A multi-AP network isn't always WPA Enterprise or Dynamic WEP.
I have seen multi-AP WPA-PSK networks, so lets try to detect them
and use a shorter bgscan interval. We can detect them by checking
if seen-bssids > 1.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/279
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/248
2019-09-25 15:53:06 +02:00
Thomas Haller
18f890d491 build,tests: merge branch 'th/fix-python-test'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/287
2019-09-25 15:51:05 +02:00
Thomas Haller
b40a3aa727 gitlab-ci: add building on Fedora 31
And don't build Fedora 28 by default. It's aleady end of life.
But for now keep it, so it can be triggered manually.
2019-09-25 15:48:08 +02:00
Thomas Haller
7c7ad97831 build/meson: use python3 interpreter for "generate-setting-docs.py"
Fedora 32 drops "python" from the path. Hence "/usr/bin/env python" won't
work anymore. Of course, who needs a way to invoke the interpreter that works
accross different distributions! WTF.

In this case, easy to work around. We run it from meson, so we have access to
the Python 3 binary. Just call python explicitly, like we do with autotools.
2019-09-25 15:47:39 +02:00
Thomas Haller
9fc4490513 contrib/rpm: drop BuildRequires to deprecated "wireless-tools-devel"
"wireless-tools-devel" is long depreacted and not used by
NetworkManager, not even for WEXT.

Drop it from the build dependencies.
2019-09-25 15:47:39 +02:00
Thomas Haller
3a1b2b9885 tests: don't install bzip2 as REQUIRED_PACKAGES on Fedora/RHEL 2019-09-25 15:47:39 +02:00
Thomas Haller
1a2a5b37b4 tests: don't install unnecessary package in gitlab-ci tests
REQUIRED_PACKAGES has two uses:

 - to setup a system for developing NetworkManager. This installs
   convenience packages like "cscope".

 - to install the packages required for unit testing in gitlab-ci.

For gitlab-ci we should only install the packages that we actually
need.
2019-09-25 15:47:39 +02:00
Thomas Haller
185567559c tests: fix failure installing non-existing packages in REQUIRED_PACKAGES
Previously, dnf/yum used to ignore packages that didn't exist.
In Fedora 32, dnf starts to fail the entire command:

  No match for argument: python-gobject-base
  Error: Unable to find a match: python-gobject-base

Since this script is supposed to work with different RHEL/Fedora
versions, it's expected that not all packages are available everywhere.

Fix that, by installing packages that we know that they might be missing
one by one (and ignore the error).
2019-09-25 15:47:39 +02:00
Thomas Haller
97646d81ce tests: fix "clients/tests/test-client.py" concatenating binary for Python 3
Python 3 doesn't like this:

    ======================================================================
    ERROR: test_001 (__main__.TestNmcli)
    ----------------------------------------------------------------------
    Traceback (most recent call last):
      File "./clients/tests/test-client.py", line 785, in f
        self._nm_test_post()
      File "./clients/tests/test-client.py", line 767, in _nm_test_post
        content_new = ''.join([r['content'] for r in results])
    TypeError: sequence item 0: expected str instance, bytes found
2019-09-25 15:47:39 +02:00
Thomas Haller
989b26a843 tests: don't compare string literal with "is" in "clients/tests/test-client.py"
Recent Python versions warn about this:

  ./clients/tests/test-client.py:569: SyntaxWarning: "is" with a literal. Did you mean "=="?
    elif lang is de:
  ./clients/tests/test-client.py:572: SyntaxWarning: "is" with a literal. Did you mean "=="?
    elif lang is pl:

And rightly so: https://bugs.python.org/issue34850
2019-09-25 15:47:39 +02:00
Thomas Haller
ceae05cc4b tests: avoid deprecated GLib.IOChannel.add_watch() in "test-networkmanager-service.py"
test_001 (__main__.TestNmcli) ... /tmp/NetworkManager/tools/test-networkmanager-service.py:2346: PyGIDeprecationWarning: add_watch is deprecated; use GLib.io_add_watch() instead
  id1 = GLib.IOChannel(0).add_watch(GLib.IOCondition.HUP,
2019-09-25 15:47:39 +02:00
Thomas Haller
85bdf42112 systemd: merge branch systemd into master 2019-09-25 09:14:30 +02:00
Thomas Haller
503b5f441e systemd: update code from upstream (2019-09-24)
This is a direct dump from systemd git.

======

SYSTEMD_DIR=../systemd
COMMIT=a007d6fc2a2b9c19bafd6465fb4f00910b824c36

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

git ls-files -z :/src/systemd/src/ \
                :/shared/systemd/src/ \
                :/shared/nm-utils/unaligned.h | \
  xargs -0 rm -f

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

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

nm_copy_sd_nmutils() {
    mkdir -p "./shared/nm-utils/"
    cp "$SYSTEMD_DIR/$1" "./shared/nm-utils/${1##*/}"
}

nm_copy_sd_core "src/libsystemd-network/arp-util.c"
nm_copy_sd_core "src/libsystemd-network/arp-util.h"
nm_copy_sd_core "src/libsystemd-network/dhcp-identifier.c"
nm_copy_sd_core "src/libsystemd-network/dhcp-identifier.h"
nm_copy_sd_core "src/libsystemd-network/dhcp-internal.h"
nm_copy_sd_core "src/libsystemd-network/dhcp-lease-internal.h"
nm_copy_sd_core "src/libsystemd-network/dhcp-network.c"
nm_copy_sd_core "src/libsystemd-network/dhcp-option.c"
nm_copy_sd_core "src/libsystemd-network/dhcp-packet.c"
nm_copy_sd_core "src/libsystemd-network/dhcp-protocol.h"
nm_copy_sd_core "src/libsystemd-network/dhcp6-internal.h"
nm_copy_sd_core "src/libsystemd-network/dhcp6-lease-internal.h"
nm_copy_sd_core "src/libsystemd-network/dhcp6-network.c"
nm_copy_sd_core "src/libsystemd-network/dhcp6-option.c"
nm_copy_sd_core "src/libsystemd-network/dhcp6-protocol.h"
nm_copy_sd_core "src/libsystemd-network/lldp-internal.h"
nm_copy_sd_core "src/libsystemd-network/lldp-neighbor.c"
nm_copy_sd_core "src/libsystemd-network/lldp-neighbor.h"
nm_copy_sd_core "src/libsystemd-network/lldp-network.c"
nm_copy_sd_core "src/libsystemd-network/lldp-network.h"
nm_copy_sd_core "src/libsystemd-network/network-internal.c"
nm_copy_sd_core "src/libsystemd-network/network-internal.h"
nm_copy_sd_core "src/libsystemd-network/sd-dhcp-client.c"
nm_copy_sd_core "src/libsystemd-network/sd-dhcp-lease.c"
nm_copy_sd_core "src/libsystemd-network/sd-dhcp6-client.c"
nm_copy_sd_core "src/libsystemd-network/sd-dhcp6-lease.c"
nm_copy_sd_core "src/libsystemd-network/sd-ipv4acd.c"
nm_copy_sd_core "src/libsystemd-network/sd-ipv4ll.c"
nm_copy_sd_core "src/libsystemd-network/sd-lldp.c"
nm_copy_sd_core "src/libsystemd/sd-event/event-source.h"
nm_copy_sd_core "src/libsystemd/sd-event/event-util.c"
nm_copy_sd_core "src/libsystemd/sd-event/event-util.h"
nm_copy_sd_core "src/libsystemd/sd-event/sd-event.c"
nm_copy_sd_core "src/libsystemd/sd-id128/id128-util.c"
nm_copy_sd_core "src/libsystemd/sd-id128/id128-util.h"
nm_copy_sd_core "src/libsystemd/sd-id128/sd-id128.c"
nm_copy_sd_core "src/systemd/_sd-common.h"
nm_copy_sd_core "src/systemd/sd-dhcp-client.h"
nm_copy_sd_core "src/systemd/sd-dhcp-lease.h"
nm_copy_sd_core "src/systemd/sd-dhcp6-client.h"
nm_copy_sd_core "src/systemd/sd-dhcp6-lease.h"
nm_copy_sd_core "src/systemd/sd-event.h"
nm_copy_sd_core "src/systemd/sd-id128.h"
nm_copy_sd_core "src/systemd/sd-ipv4acd.h"
nm_copy_sd_core "src/systemd/sd-ipv4ll.h"
nm_copy_sd_core "src/systemd/sd-lldp.h"
nm_copy_sd_core "src/systemd/sd-ndisc.h"
nm_copy_sd_nmutils "src/basic/unaligned.h"
nm_copy_sd_shared "src/basic/alloc-util.c"
nm_copy_sd_shared "src/basic/alloc-util.h"
nm_copy_sd_shared "src/basic/async.h"
nm_copy_sd_shared "src/basic/env-file.c"
nm_copy_sd_shared "src/basic/env-file.h"
nm_copy_sd_shared "src/basic/env-util.c"
nm_copy_sd_shared "src/basic/env-util.h"
nm_copy_sd_shared "src/basic/errno-util.h"
nm_copy_sd_shared "src/basic/escape.c"
nm_copy_sd_shared "src/basic/escape.h"
nm_copy_sd_shared "src/basic/ether-addr-util.c"
nm_copy_sd_shared "src/basic/ether-addr-util.h"
nm_copy_sd_shared "src/basic/extract-word.c"
nm_copy_sd_shared "src/basic/extract-word.h"
nm_copy_sd_shared "src/basic/fd-util.c"
nm_copy_sd_shared "src/basic/fd-util.h"
nm_copy_sd_shared "src/basic/fileio.c"
nm_copy_sd_shared "src/basic/fileio.h"
nm_copy_sd_shared "src/basic/format-util.c"
nm_copy_sd_shared "src/basic/format-util.h"
nm_copy_sd_shared "src/basic/fs-util.c"
nm_copy_sd_shared "src/basic/fs-util.h"
nm_copy_sd_shared "src/basic/hash-funcs.c"
nm_copy_sd_shared "src/basic/hash-funcs.h"
nm_copy_sd_shared "src/basic/hashmap.c"
nm_copy_sd_shared "src/basic/hashmap.h"
nm_copy_sd_shared "src/basic/hexdecoct.c"
nm_copy_sd_shared "src/basic/hexdecoct.h"
nm_copy_sd_shared "src/basic/hostname-util.c"
nm_copy_sd_shared "src/basic/hostname-util.h"
nm_copy_sd_shared "src/basic/in-addr-util.c"
nm_copy_sd_shared "src/basic/in-addr-util.h"
nm_copy_sd_shared "src/basic/io-util.c"
nm_copy_sd_shared "src/basic/io-util.h"
nm_copy_sd_shared "src/basic/list.h"
nm_copy_sd_shared "src/basic/log.h"
nm_copy_sd_shared "src/basic/macro.h"
nm_copy_sd_shared "src/basic/memory-util.c"
nm_copy_sd_shared "src/basic/memory-util.h"
nm_copy_sd_shared "src/basic/mempool.c"
nm_copy_sd_shared "src/basic/mempool.h"
nm_copy_sd_shared "src/basic/missing_fcntl.h"
nm_copy_sd_shared "src/basic/missing_socket.h"
nm_copy_sd_shared "src/basic/missing_stat.h"
nm_copy_sd_shared "src/basic/missing_type.h"
nm_copy_sd_shared "src/basic/parse-util.c"
nm_copy_sd_shared "src/basic/parse-util.h"
nm_copy_sd_shared "src/basic/path-util.c"
nm_copy_sd_shared "src/basic/path-util.h"
nm_copy_sd_shared "src/basic/prioq.c"
nm_copy_sd_shared "src/basic/prioq.h"
nm_copy_sd_shared "src/basic/process-util.c"
nm_copy_sd_shared "src/basic/process-util.h"
nm_copy_sd_shared "src/basic/random-util.c"
nm_copy_sd_shared "src/basic/random-util.h"
nm_copy_sd_shared "src/basic/set.h"
nm_copy_sd_shared "src/basic/signal-util.h"
nm_copy_sd_shared "src/basic/siphash24.h"
nm_copy_sd_shared "src/basic/socket-util.c"
nm_copy_sd_shared "src/basic/socket-util.h"
nm_copy_sd_shared "src/basic/sort-util.h"
nm_copy_sd_shared "src/basic/sparse-endian.h"
nm_copy_sd_shared "src/basic/stat-util.c"
nm_copy_sd_shared "src/basic/stat-util.h"
nm_copy_sd_shared "src/basic/stdio-util.h"
nm_copy_sd_shared "src/basic/string-table.c"
nm_copy_sd_shared "src/basic/string-table.h"
nm_copy_sd_shared "src/basic/string-util.c"
nm_copy_sd_shared "src/basic/string-util.h"
nm_copy_sd_shared "src/basic/strv.c"
nm_copy_sd_shared "src/basic/strv.h"
nm_copy_sd_shared "src/basic/strxcpyx.c"
nm_copy_sd_shared "src/basic/strxcpyx.h"
nm_copy_sd_shared "src/basic/time-util.c"
nm_copy_sd_shared "src/basic/time-util.h"
nm_copy_sd_shared "src/basic/tmpfile-util.c"
nm_copy_sd_shared "src/basic/tmpfile-util.h"
nm_copy_sd_shared "src/basic/umask-util.h"
nm_copy_sd_shared "src/basic/utf8.c"
nm_copy_sd_shared "src/basic/utf8.h"
nm_copy_sd_shared "src/basic/util.c"
nm_copy_sd_shared "src/basic/util.h"
nm_copy_sd_shared "src/shared/dns-domain.c"
nm_copy_sd_shared "src/shared/dns-domain.h"
2019-09-25 09:09:39 +02:00
Beniamino Galvani
43b7e66948 settings: fix updating agent-owned VPN secrets
property_to_dbus() returns NULL when called with
NM_CONNECTION_SERIALIZE_WITH_SECRETS_AGENT_OWNED and the property is
not an agent-owned secrets. The function doesn't handle VPN secrets
correctly, since they are all stored as a hash in the vpn.secrets
property and the flag for each of them is a matching '*-flags' key in
the vpn.data property. VPN secrets must be handled differently; do it
in the VPN setting to_dbus_fcn() function.

Fixes: 71928a3e5c ('settings: avoid cloning the connection to maintain agent-owned secrets')

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/230
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/280
2019-09-24 17:00:22 +02:00
Beniamino Galvani
a79572c261 build: avoid target redefinition
Makefile.am:3462: warning: $(src_devices_bluetooth_libnm_device_plugin_bluetooth_la_OBJECTS) was already defined in condition TRUE, which includes condition WITH_MODEM_MANAGER_1 ...
 Makefile.am:960: ... '$(src_devices_bluetooth_libnm_device_plugin_bluetooth_la_OBJECTS)' previously defined here

Fixes: 878d4963ed ('bluetooth/tests: add "nm-bt-test helper" program for manual testing of bluetooth code')
2019-09-24 15:39:26 +02:00
Thomas Haller
87680c4148 dhcp/nettools: round time difference when calculating the lease lifetime
nettools does not expose the original lease lifetime. It's a missing
API. Instead, it only exposes the timestamp when the lease will expire.

As a workaround, we calulate the timestamp by subtracting the current
timestamp from the expiration timestamp, assuming that the lease was
received just now. However, it was not received *exactly* now, but a
few milliseconds before. Hence, the calculated timestamp is not exact
here and likely a few milliseconds less then the actual (full integer)
value.

Account for that by rounding the value to the second.
2019-09-23 16:10:51 +02:00
Thomas Haller
3214841765 shared/trivial: rename _nm_g_slice_free_fcn1() macro to nm_g_slice_free_fcn1()
The leading underscore has the notion that this would be a private function.
It really isn't, and it would be fine for the user to call it directly.

Just like we have g_slice_free() and g_slice_free1().
2019-09-23 13:44:36 +02:00
Thomas Haller
4b1cb404fd contrib/rpm: "Suggest" wpa_supplicant for NetworkManager-wifi package
"NetworkManager-wifi" package requires either wpa_supplicant or iwd.
When installing the package without explicitly installing supplicant
or iwd (and not having it installed yet), then we want to drag in
wpa_supplicant by default. That is accomplished by suggesting wpa_supplicant
package.

Otherwise, the user installing NetworkManager-wifi might get iwd,
which is only functioning if the user explicitly enables the backend
in "NetworkManager.conf".

https://bugzilla.redhat.com/show_bug.cgi?id=1743585
2019-09-23 13:29:12 +02:00
Thomas Haller
9aa6c676ef wifi/p2p: fix crash due to invalid signal handler supplicant_group_iface_group_finished_cb()
Fixes: 00e64d1332 ('core/devices: Add P2P Wifi device and peer tracking')

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/249

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/284
2019-09-23 13:22:53 +02:00
Thomas Haller
c03defa3a8 core: merge branch 'th/check-have-connection-for-auto-default'
https://bugzilla.redhat.com/show_bug.cgi?id=1727909

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/232
2019-09-23 13:15:29 +02:00
Thomas Haller
2a506d8a09 settings: drop redundant check from have_connection_for_device()
have_connection_for_device() really should just call nm_device_check_connection_compatible().
Note that nm_device_check_connection_compatible() of course checks the
connection type already, so this is redundant.
2019-09-23 13:13:23 +02:00
Thomas Haller
3e39d2a586 settings: shortcut check for whether to create auto-default wired connection
This check is only useful for devices that implement new_default_connection.
We can shortcut the possibly expensive checks like have_connection_for_device(),
which need to iterate all profiles.
2019-09-23 13:13:23 +02:00
Thomas Haller
5aa50d7c87 core: fix wrongly generating "Wired connection 1" (auto-default) for ethernet with MAC
If a profile has only "ethernet.mac-address" set, but
"connection.interface-name" not, then the previous check

    iface = nm_setting_connection_get_interface_name (s_con);
    if (!nm_streq0 (iface, nm_device_get_iface (device)))
         continue;

would wrongly consider the profile not matching for the device.
As a result, we would wrongly create a auto-default connection.

Fix that. We already call nm_device_check_connection_compatible()
above. That is fully suitable to compare the interface name and
the MAC address. We don't need to duplicate this check (wrongly).

See also commit 77d01c9094 ('settings: ignore incompatible connections
when looking for existing ones') for how this code changed.

https://bugzilla.redhat.com/show_bug.cgi?id=1727909
2019-09-23 13:13:23 +02:00