Commit Graph

21088 Commits

Author SHA1 Message Date
Thomas Haller
e8c3fcae2a manager: use nm_utils_user_data_pack() instead of explicit AddAndActivateInfo structure 2018-04-24 09:03:39 +02:00
Thomas Haller
9abe3dc1a4 core: rework passing user-data to nm_active_connection_authorize()
Previously, nm_active_connection_authorize() accepts two user-data
pointers for convenience.

nm_active_connection_authorize() has three callers. One only requires
one user-data, one passes two user-data pointers, and one requires
three pointer.

Also, the way how the third passes the user data (via
g_object_set_qdata_full()) is not great.

Let's only use one user-data pointer. We commonly do that, and it's easy
enough to allocate a buffer to pack multiple pointers together.
2018-04-24 09:03:39 +02:00
Thomas Haller
dc138da420 shared: add nm_utils_user_data_pack() and unpack helpers 2018-04-24 09:03:39 +02:00
Thomas Haller
45fe57aea4 contrib/rpm: build config-connectivity-fedora package conditionally
On RHEL, we don't have NetworkManager-config-connectivity-fedora package.
Hence, the spec files for RHEL differ from upstream in this regard.

The aim is that contrib/rpm's spec file can be used almost as-is for
RHEL, Fedora and possibly other distros. Hence, build the subpackage
conditionally to minimize the difference.
2018-04-23 18:40:47 +02:00
Beniamino Galvani
3d509f6d63 merge: branch 'bg/dns-resolved-fix'
https://github.com/NetworkManager/NetworkManager/pull/102
2018-04-23 17:21:23 +02:00
Beniamino Galvani
4672499b95 core: fix bus initialization order
We currently start the bus manager only after the creation of a
NMManager because the NMManager is needed to handle set-property bus
calls. However, objects created by NMManager
(e.g. NMDnsSystemdResolved) need a bus connection and so their
initialization currently fail.

To fix this, split nm_dbus_manager_start() in two parts: first only
create the connection and acquire the bus.  After this step the
NMManager can be set up. In the second step, set NMManager as the
set-property handler and start exporting objects on the bus.

Fixes: 297d4985ab
2018-04-23 17:21:13 +02:00
Beniamino Galvani
0498c5487f libnm-core: fix validation of connection.mdns setting
Commit 9d92848ada ("libnm: rename MDns flag UNKNOWN to DEFAULT")
changed the enum order without updating verify().

Fixes: 9d92848ada
2018-04-23 17:21:13 +02:00
Beniamino Galvani
ff9ecbad62 core: fix misspellings of 'acquire' 2018-04-23 17:21:13 +02:00
Thomas Haller
6daafb1df6 core,cli: merge branch 'th/dhcp-options-sort'
https://github.com/NetworkManager/NetworkManager/pull/101
2018-04-23 15:52:57 +02:00
Thomas Haller
f2109cb810 cli: sort DHCP options in connection show output
Otherwise, the output is unstable and changes every time.
2018-04-23 15:44:44 +02:00
Thomas Haller
5e69b8b9f1 cli: merge IPv4 and IPv6 variants of print_dhcp_config() 2018-04-23 15:43:39 +02:00
Thomas Haller
e96b1270a6 core: sort DHCP options that are exported on D-Bus
Otherwise, the order is undefined and unstable. If you call
GetManagedObjects() on D-Bus multiple times, it's a very nice
property if the diff is small and not full not noise.
2018-04-23 15:43:39 +02:00
Thomas Haller
86b54a65e6 core: add nm_utils_strdict_to_variant() helper 2018-04-23 15:43:39 +02:00
Thomas Haller
9329844929 systemd: merge branch systemd into master 2018-04-23 13:35:52 +02:00
Thomas Haller
5d5b9d7ce0 release: bump version to 1.11.3 (development) 2018-04-23 10:43:42 +02:00
Thomas Haller
c4dd620889 systemd: update code from upstream (2018-04-23)
This is a direct dump from systemd git.

======

SYSTEMD_DIR=../systemd
COMMIT=41d0da0f6a800b7f1d56d6d15cf90edb6c062050

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

git ls-files :/src/systemd/src/ \
             :/shared/nm-utils/siphash24.c \
             :/shared/nm-utils/siphash24.h \
             :/shared/nm-utils/unaligned.h | \
  xargs -d '\n' rm -f

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

nm_copy_sd_shared() {
    mkdir -p "./shared/nm-utils/"
    cp "$SYSTEMD_DIR/$1" "./shared/nm-utils/${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/extract-word.c"
nm_copy_sd "src/basic/extract-word.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/process-util.h"
nm_copy_sd "src/basic/process-util.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/signal-util.h"
nm_copy_sd_shared "src/basic/siphash24.c"
nm_copy_sd_shared "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_shared "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-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/id128-util.c"
nm_copy_sd "src/libsystemd/sd-id128/id128-util.h"
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"
2018-04-23 10:20:55 +02:00
Lubomir Rintel
de8bf7421d n-acd: don't use a return value in deallocator
...so that its prototype is compatible with GDestroyNotify:

src/devices/nm-acd-manager.c: In function ‘destroy_address_info’:
/usr/include/glib-2.0/glib/gmem.h:120:31: error: cast between incompatible function types from ‘NAcd * (*)(NAcd *)’ {aka ‘struct NAcd * (*)(struct NAcd *)’} to ‘void (*)(void *)’ [-Werror=cast-function-type]
     GDestroyNotify _destroy = (GDestroyNotify) (destroy);                      \
                               ^
src/devices/nm-acd-manager.c:430:2: note: in expansion of macro ‘g_clear_pointer’
  g_clear_pointer (&info->acd, n_acd_free);
  ^~~~~~~~~~~~~~~

The same change was done upstream, so the subsequent subtree pull of n-acd
won't mess this up.
2018-04-23 09:50:12 +02:00
Lubomir Rintel
c898969110 test-common: drop unused variables
src/platform/tests/test-common.c:1500:17: error: unused variable 'dev' [-Werror,-Wunused-variable]
                gs_free char *dev = NULL;
                              ^
src/platform/tests/test-common.c:1501:17: error: unused variable 'local' [-Werror,-Wunused-variable]
                gs_free char *local = NULL, *remote = NULL;
                              ^
src/platform/tests/test-common.c:1501:32: error: unused variable 'remote' [-Werror,-Wunused-variable]
                gs_free char *local = NULL, *remote = NULL;
                                             ^
Fixes: bd8ab54b8e
2018-04-23 08:26:41 +02:00
Lubomir Rintel
40ce80cb50 auth-manager: drop an unused variable
src/nm-auth-manager.c:673:24: error: unused variable 'error_disposing' [-Werror,-Wunused-variable]
        gs_free_error GError *error_disposing = NULL;
                              ^

Fixes: 2ea2df3184
2018-04-23 08:26:05 +02:00
Lubomir Rintel
30814288c9 acd-manager: drop an unused variable
src/devices/nm-acd-manager.c:299:16: error: unused variable 'timeout_str' [-Werror,-Wunused-variable]
        gs_free char *timeout_str = NULL;
                      ^
Fixes: 9f79ae685d
2018-04-23 08:24:17 +02:00
Beniamino Galvani
c2fcf82e63 ifcfg-rh: merge branch 'bg/ifcfg-rh-tc-fixes'
https://github.com/NetworkManager/NetworkManager/pull/95
2018-04-21 22:10:38 +02:00
Beniamino Galvani
805cbe7439 ifcfg-rh: fix parse of tc qdiscs and filters
Fixes: 902bbfdb18
2018-04-21 22:09:05 +02:00
Beniamino Galvani
fa7af768a9 ifcfg-rh: add tests for tc config 2018-04-21 22:09:05 +02:00
Beniamino Galvani
7cea2398a6 manager: merge branch 'bg/manager-vpn-fixes'
https://github.com/NetworkManager/NetworkManager/pull/99
2018-04-20 16:26:46 +02:00
Beniamino Galvani
edcb80d1b0 manager: fix assertions when activating VPNs
_new_active_connection() can be called with both a device and a
specific object set when activating secondaries.

Fixes: 10753c3616
2018-04-20 16:26:26 +02:00
Beniamino Galvani
e732403a9b manager: fix activating VPN connections
nm_manager_activate_connection() is also called for VPNs.

Fixes: 3e3d53ce69
2018-04-20 16:26:26 +02:00
Thomas Haller
164e6b9e6b device/connectivity: fix periodic checks that take a long time to complete
It can easily happen that connectivity checks take a long time to
complete (up to 20 seconds, when they time out).

So, before, during the first 20 seconds no connectivity checks would
return and bump the periodic interval. That meant, for the first 20
seconds we would each second schedule a periodic check.
Then, the checks start timing out, each one second apart as we scheduled
them. Previously, during each completion of the checks, we would bump
the interval every second.

Fix that two ways:

1) when the timer expires, also check whether there are still uncomplete
periodic checks. If there are, already bump the interval at that point.

2) at the same time, when this happens mark the handle so that when
they later complete, that they no longer cause another increase of the
interval (no-bump).

Now the bumping is done either by the timeout, or by the completion of
the request. Whatever happens first.
2018-04-20 15:08:23 +02:00
Thomas Haller
ccca5778ba device/connectivity: fix periodic connectivity checks to always reschedule the timer
In concheck_periodic_timeout_cb(), we are not sure that we were
scheduled with the current interval. Instead, the timer might
just cover a part of the interval, for example while resetting
the timer interval.

We must always reschedule the timer.
2018-04-20 13:06:10 +02:00
Thomas Haller
5c4e67ba3d device/connectivity: fix handling of completed periodic checks in concheck_cb() 2018-04-20 12:07:20 +02:00
Thomas Haller
019aebacc1 device/connectivity: fix timeout handling when resetting the periodic interval
A larger issue is that concheck_periodic_schedule_do() requires an
interval in nanoseconds scale. We passed the wrong timeout there.

A smaller issue is, when we reset the max_interval to something
shorter, *and* the previously schedule timeout is pending for a shorter
time than the new new max-interval, we only need to re-adjust the
timeout, but keep cur_basetime unchanged.
2018-04-20 10:51:47 +02:00
Thomas Haller
8c30aa0e73 device/connectivity: improve logging about cancelled connectivity check
There can be other reasons why the check was cancelled, not only because
the current item was obsoleted. For example, the caller who scheduled a
check externally, might have cancelled it or NMDevice might be
disposed().
2018-04-20 10:39:43 +02:00
Christian Kellner
89af7fbfa6 all: add support for thunderbolt networking
Load the thunderbolt-net module if we see a host-to-host connection
and configure the resulting ethernet connection automatically to be
a link-local only one. The latter is done by setting a new udev
property "NM_AUTO_DEFAULT_LINK_LOCAL_ONLY" which is picked up when
we configure the connection for the device.

https://github.com/NetworkManager/NetworkManager/pull/97
2018-04-19 14:20:04 +02:00
Beniamino Galvani
8cbce0e18f manager: fix auth-subject cleanup
Fixes: bac7a2821f
2018-04-19 11:54:03 +02:00
Beniamino Galvani
236edfc908 manager: trust the state file more when assuming connections
If we can't generate a connection and maybe_later is TRUE, it means
that the device can generate/assume connections but it failed for the
moment due to missing master/slaves/addresses. In this case, just
assume the connection from state file.

https://bugzilla.redhat.com/show_bug.cgi?id=1551958
2018-04-19 10:30:19 +02:00
Thomas Haller
d795e41745 keyfile: merge branch 'th/keyfile-reader-improvements'
https://github.com/NetworkManager/NetworkManager/pull/94
2018-04-19 09:48:39 +02:00
Thomas Haller
3b03b2caee keyfile: don't hack certain properties to be skipped in reader
For writer there is no such hack either. The property-info table
should describe whether to skip a property or not.
2018-04-19 09:45:19 +02:00
Thomas Haller
8c4ce431a6 keyfile: no special handling to set parser_no_check_key for certain settings
Do not have multiple ways of expressing a certain thing. There is
a way how to express that the parser shouldn't check for keys, and
that is via the parse-information. No extra hacks.
2018-04-19 09:36:41 +02:00
Thomas Haller
9c91d44667 keyfile: drop unused set_default_for_missing_key() 2018-04-19 09:36:41 +02:00
Thomas Haller
7e3b7295a4 keyfile: rework handling of checking for whether a key exists in reader
Rework this to have a value "parser_no_check_key" so that:

- the default value for this is FALSE, so that we don't need to
  explicitly set it in @parse_infos to only get the default.
  Contrary to check_for_key.
- check_for_key only had meaning when also "parser" was set.
  That means, the value was really "pip->parser && pip->check_for_key".
  That came from the fact, that orginally this was tracked as
  key_parsers array, which had "parser" always set.
  That is confusing, don't do that. The field "parser_no_check_key"
  has it's meaning, regardless of whether "parser" is set.
2018-04-19 09:36:41 +02:00
Thomas Haller
87cc309249 keyfile: various cleanup of error paths in keyfile handling 2018-04-19 09:36:41 +02:00
Thomas Haller
4dc933174e keyfile: don't special case skipping connection.read-only property in writer 2018-04-19 09:36:41 +02:00
Thomas Haller
94a96b70d0 keyfile: rework handling not skipping default-values in writer 2018-04-19 09:36:41 +02:00
Thomas Haller
a5c026f90e libnm/keyfile: replace dummy writer implementation with flag to skip writing 2018-04-19 09:36:41 +02:00
Thomas Haller
3695d5273a libnm/keyfile: merge parser/writer vtables for keyfile properties 2018-04-19 09:36:41 +02:00
Thomas Haller
bc1b15cf05 shared: move cmp functions to nm-shared-utils.c
For one, these functions are not often needed. No need to define them in the
"nm-macros-internal.h" header, which is included everywhere. Move them to
"nm-shared-utils.h", which must be explicitly included.

Also, these functions are usually not called directly, but by passing their
function pointer to a sort function or similar. There is no point in having
defined in the header file.
2018-04-19 09:36:41 +02:00
Thomas Haller
21f6058cfe libnm/keyfile: merge keyfile sources (pt2, merge nm-keyfile-writer.c)
Splitting keyfile handling in two "reader.c" and "writer.c" files
is not helpful. What is most interesting, is to see how property XYZ
is serialized to keyfile, and to verify that the parser does the
inverse. For that, it's easier if both the write_xzy() and parse_xyz()
function are beside each other, and not split accross files.

The more important reason is, that both reader and writer have their
separate handler arrays, for special handling of certain properties:
@key_parsers and @key_writers. These two should not be separate but will
be merged. Since they reference static functions, these functions must
all be in the same source file (unless, we put them into headers, which
would be unnecessary complex).

No code was changed, only moved.
2018-04-19 09:36:41 +02:00
Thomas Haller
f99dc6b936 libnm/keyfile: merge keyfile sources (pt1, rename nm-keyfile-reader.c)
I am going to merge the files for keyfile handling in libnm-core.
There is a reason for that, I'll tell you next.
2018-04-19 09:36:41 +02:00
Thomas Haller
22578e5fd3 keyfile: drop unused handling of non-existing "address-lables"
The key_writers array is searched by matching the @key during
write_setting_value(). Note how write_setting_value() is called
by nm_connection_for_each_setting_value(), thus, @key is the name
of a GObject property for NMSettingIP4Config. But NMSettingIP4Config
has no property names "address-labels". Hence, this was unused
since introducing libnm-core (which never had this internal property).
2018-04-19 09:36:41 +02:00
Thomas Haller
1ed8bdd3b1 keyfile/trivial: fix indention 2018-04-19 09:36:41 +02:00
Thomas Haller
c858f9d351 keyfile: avoid cloning the array while parsing DNS entries 2018-04-19 09:36:41 +02:00