Commit graph

21279 commits

Author SHA1 Message Date
Lubomir Rintel
5e8d7bfbd1 release: bump version to 1.14.5 (development) 2018-10-24 10:03:52 +02:00
Lubomir Rintel
66cad942f2 release: bump version to 1.14.4 2018-10-24 10:03:52 +02:00
Lubomir Rintel
8619214faa release: update NEWS 2018-10-24 10:03:52 +02:00
Taegil Bae
4f2c6dd264 meson: set RPATH for libnm_device_plugin_wwan.so
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/26
(cherry picked from commit 4b2dc8826d)
2018-10-24 09:59:46 +02:00
Taegil Bae
4ebe6f1e26 meson: set RPATH for libnm_device_plugin_bluetooth.so
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/26
(cherry picked from commit 82b8ef2252)
2018-10-24 09:59:44 +02:00
Michael Biebl
0ffb390bf3 settings/ifupdown: fix block_name typo in initialize()
In commit f0938948bc a typo creeped in and
"block->name" got replaced by "block_name". Variable block_name is used
for a different purpose and not initialized at this point.
As a result g_str_has_prefix crashes with a segfault.

Spotted by Bernhard Übelacker <bernhardu@mailbox.org>

Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=911621
Fixes: f0938948bc

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/31
(cherry picked from commit 8179b23d76)
2018-10-23 23:01:35 +02:00
Lubomir Rintel
576f0877f3 cli: initialize readline before installing the redisplay handler
Otherwise readline decides to initialize terminal handling at the first
readline call, and if that happens at the point it sees our
non-echoing rl_redisplay.

At that point, unless already intialized, readline wrongly convinces itself we
do our own handling of terminal peculiarities (such as cursor movement, or
erases).  We do not -- we merely wrap the stock rl_redisplay(), temporarily
hiding the actual characters.

The rl_initialize() in nmc_readline_echo()s fixes broken line editing in
password prompts that weren't preceded a previous non-password prompt.
The other one is there for consistency only. (I guess we should be
initializing readline before use anyway; although it seems to initialize
itself anyway if we fail to do so...)

https://github.com/NetworkManager/NetworkManager/pull/241
(cherry picked from commit 05d6c993dd)
2018-10-23 23:01:30 +02:00
Beniamino Galvani
2e5d0f3046 initrd: cmdline-reader: fix setting uint properties
Previously a uint property was assigned with a guint64 value, which
has a different size. Fix this and add a warning when the read value
can't be converted.

Fixes: ecc074b2f8

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/66
(cherry picked from commit d0a99176a7)
2018-10-23 13:24:42 +02:00
Beniamino Galvani
147081bd72 dhcp: dhclient: fix memory leak
Fixes: c263f5355c
(cherry picked from commit 0ba0f52cb7)
2018-10-23 09:10:06 +02:00
Lubomir Rintel
506f781488 ndisc: mark a keep-alive variable unused
Fixed build with clang:

  src/ndisc/nm-lndp-ndisc.c:494:27: error: unused variable 'ndisc_keep_alive' [-Werror,-Wunused-variable]
        gs_unref_object NMNDisc *ndisc_keep_alive = g_object_ref (ndisc);
                                 ^
Fixes: 9aa628cedb

(cherry picked from commit 7c7e4cf134)
2018-10-22 18:24:36 +02:00
Thomas Haller
aaf6d27ce5 test/meson: increase timeout for some tests
During gitlab-ci, some tests may take a long time. Increase
the default timeout.

(cherry picked from commit 43b28e06ed)
2018-10-22 16:20:59 +02:00
Beniamino Galvani
3fc592219e device: fix crash in nm_device_generate_connection()
Fixes: 89d1c9fb30

https://bugzilla.redhat.com/show_bug.cgi?id=1631741
(cherry picked from commit f744e29dd3)
2018-10-22 15:02:37 +02:00
Thomas Haller
ea4f8a0cad checkpatch: support ranges for "checkpatch-feature-branch.sh"
Improve "checkpatch-feature-branch.sh" to support accepting
range as argument.

(cherry picked from commit 924a895a1a)
2018-10-22 14:13:34 +02:00
Thomas Haller
79a5417ffc platform/tests: extend timeout for link-linux tests with meson
Our gitlab CI sometimes takes a long time with the
"/link/create-many-links/1000" test.

(cherry picked from commit 948abdb84d)
2018-10-22 13:57:53 +02:00
Thomas Haller
f41a69d416 checkpatch: fix "checkpatch-feature-branch.sh" for master branch
The main purpose of "checkpatch-feature-branch.sh" is to test all
patches of a feature branch. When we run the script against master
(or nm-1-*), then there is no feature branch.

Previously, the script would just error out.

That is not very useful, in particular as we call this from gitlab-ci,
which also runs on master.

Instead, in that case, test the HEAD.

(cherry picked from commit 4543785438)
2018-10-22 13:57:52 +02:00
Thomas Haller
52542cbf6a gitlab: merge branch 'th/gitlab-ci'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/25

(cherry picked from commit 31f13acdc9)
2018-10-22 13:26:14 +02:00
Thomas Haller
e29d62bcf5 gitlab: add .gitlab-ci.yml for gitlab CI
See-also: https://docs.gitlab.com/ee/ci/yaml/
(cherry picked from commit a0a0824564)
2018-10-22 13:25:50 +02:00
Thomas Haller
91657c7761 checkpatch: add "contrib/scripts/checkpatch-feature-branch.sh" script
This takes current HEAD branch, and finds all the commits what
are not on master or one of the nm-1-* branches, and runs
checkpatch.pl on each.

The use is to run checkpatch.pl on all patches of a feature
branch.

(cherry picked from commit 369446eae6)
2018-10-22 13:25:50 +02:00
Thomas Haller
7fc7a893ed contrib: make "contrib/fedora/REQUIRED_PACKAGES" executable script
It will be called by .gitlab-ci.yml to install the packages.

(cherry picked from commit a487d34fc4)
2018-10-22 13:25:50 +02:00
Jan Alexander Steffens (heftig)
aca7fd801a meson: Fix platform tests
All platform tests were run twice with the `linux` platform, instead of
`fake` and `linux`, as expected.

(cherry picked from commit e0b168d6a8)
2018-10-22 13:25:50 +02:00
Thomas Haller
3505998ef7 platform/tests: fix test-nmp-object when running on system without udev
Fix the test, to check that the nmp-object was deleted. It is
no longer visible and no longer alive.

(cherry picked from commit 581be6b8d2)
2018-10-22 13:25:50 +02:00
Thomas Haller
06f06dbf0c platform/tests: don't compare dangling pointer in "test-nmp-object.c"
This wouldn't even dereference the dangling pointer, but
merely comparing it for pointer equality. Still, it's actually
undefined behavior. Avoid it.

(cherry picked from commit cfc0565604)
2018-10-22 13:25:50 +02:00
Thomas Haller
60f0b9111d gitignore: ignore "/shared/nm-utils/tests"
This directory is only present on master. But it's annoying
to show up as untracked files when switching branch.
2018-10-22 13:25:17 +02:00
Beniamino Galvani
8123c42e61 cli: fix crash when removing devices
When a software device is removed by nmcli in parallel with a
disconnection, e.g.:

     nmcli connection add type team ifname t1 con-name t1
     sleep 1
     nmcli connection down t1 & nmcli device delete t1

nmcli sometimes crashes in the following way:

 ...
 Connection 't1' (e4701688-d1a9-4942-85f0-a2081e120023) successfully added.
 Connection 't1' successfully deactivated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/36)
 Device 't1' successfully removed.
 AddressSanitizer:DEADLYSIGNAL
 =================================================================
 ==15217==ERROR: AddressSanitizer: SEGV on unknown address 0x00000000000b (pc 0x7fa6d92d1c9d bp 0x0000004ba260 sp 0x7ffffe6a6f40 T0)
 ==15217==The signal is caused by a READ memory access.
 ==15217==Hint: address points to the zero page.
     0 0x7fa6d92d1c9c in g_string_truncate (/lib64/libglib-2.0.so.0+0x6ec9c)
     1 0x7fa6d92d2d7b in g_string_printf (/lib64/libglib-2.0.so.0+0x6fd7b)
     2 0x45a6d7 in delete_device_cb clients/cli/devices.c:2465
     3 0x7fa6d9849289 in g_simple_async_result_complete /usr/src/debug/glib2-2.56.1-1.fc28.x86_64/gio/gsimpleasyncresult.c:802
     4 0x7fa6dbaa9836 in device_delete_cb libnm/nm-device.c:2458
     5 0x7fa6d985bcf3 in g_task_return_now /usr/src/debug/glib2-2.56.1-1.fc28.x86_64/gio/gtask.c:1148
     6 0x7fa6d985c7a5 in g_task_return /usr/src/debug/glib2-2.56.1-1.fc28.x86_64/gio/gtask.c:1206
     7 0x7fa6d989ca6c in reply_cb /usr/src/debug/glib2-2.56.1-1.fc28.x86_64/gio/gdbusproxy.c:2586
     8 0x7fa6d985bcf3 in g_task_return_now /usr/src/debug/glib2-2.56.1-1.fc28.x86_64/gio/gtask.c:1148
     9 0x7fa6d985c7a5 in g_task_return /usr/src/debug/glib2-2.56.1-1.fc28.x86_64/gio/gtask.c:1206
     10 0x7fa6d98913c0 in g_dbus_connection_call_done /usr/src/debug/glib2-2.56.1-1.fc28.x86_64/gio/gdbusconnection.c:5722
     11 0x7fa6d985bcf3 in g_task_return_now /usr/src/debug/glib2-2.56.1-1.fc28.x86_64/gio/gtask.c:1148
     12 0x7fa6d985bd2c in complete_in_idle_cb /usr/src/debug/glib2-2.56.1-1.fc28.x86_64/gio/gtask.c:1162
     13 0x7fa6d92ac0ea in g_idle_dispatch gmain.c:5535
     14 0x7fa6d92af7cc in g_main_dispatch gmain.c:3177
     15 0x7fa6d92afb97 in g_main_context_iterate gmain.c:3903
     16 0x7fa6d92afec1 in g_main_loop_run (/lib64/libglib-2.0.so.0+0x4cec1)
     17 0x472892 in main clients/cli/nmcli.c:1067
     18 0x7fa6d8cc31ba in __libc_start_main (/lib64/libc.so.6+0x231ba)
     19 0x4162b9 in _start (/usr/bin/nmcli+0x4162b9)

The reason is that after calling nm_device_delete_async() we also
listen for the manager device-removed signal. When the signal is
received, device_removed_cb() destroy the @info structure and calls
g_main_loop_quit (loop). However, if the delete_device_cb() callback
has already been dispatched it is executed anyway and it tries to
access a stale @info.

It makes little sense to listen for the device-removed signal since
the return value of nm_device_delete_async() already tells us whether
the device was removed successfully or not.

The only advantage would be that when the device goes away for other
reasons we can still return success, but that is racy and should not
be relied upon.

https://bugzilla.redhat.com/show_bug.cgi?id=1639208
(cherry picked from commit 6130a4561e)
2018-10-22 09:28:37 +02:00
Beniamino Galvani
f51eee3aef libnm: add mdns backported symbols from 1.10.14
Add to branch 1.14 mdns symbols that were backported to 1.10.14 to
allow seamless upgrading from 1.10 to 1.14.
2018-10-19 19:27:18 +02:00
Beniamino Galvani
1ff00d51e7 build: meson: add missing man file
Fixes: 9f9609555d
(cherry picked from commit 929298333e)
2018-10-19 18:19:31 +02:00
Lubomir Rintel
18471c9db8 release: bump version to 1.14.3 (development) 2018-10-19 16:50:50 +02:00
Lubomir Rintel
ef5ada1d1d release: bump version to 1.14.2 2018-10-19 16:13:28 +02:00
Thomas Haller
7d3fba9366 keyfile: also add ".nmconnection" extension when writing keyfiles in /etc
This is a change in behavior regarding the filename that we choose when
writing files to "/etc/NetworkManager/system-connections/".

(cherry picked from commit d37ad15f12)
2018-10-19 15:24:15 +02:00
Thomas Haller
095bac3019 initrd: add .nmconnection extension when writing keyfiles
initrd does not use keyfile API from "src/settings/plugins/keyfile",
hence it does not use nms_keyfile_utils_escape_filename() to add
the ".nmconnection" file extension.

I think that is problematic, because it also misses escapings which
are necessary so that NetworkManager will accept the file.

Anyway, the proper solution here would be to move the keyfile utility
functions to libnm-core, alongside base keyfile API. That way, it
could be used by initrd generator.

For now, just dirty fix the generated filename.

Fixes: 648c256b90
(cherry picked from commit 4ca7fa7f4a)
2018-10-19 12:39:53 +02:00
Thomas Haller
3a368f351b keyfile: merge branch 'th/nm-1-14-keyfile-changes'
https://github.com/NetworkManager/NetworkManager/pull/237
2018-10-19 10:14:50 +02:00
Thomas Haller
7685cf2840 keyfile: write keyfiles to "/run" directory with ".nmconnection" file suffix
For profiles in "/etc/NetworkManager/system-connections", we did not enforce
that the keyfiles have a special suffix, nor did we generate the
filenames in such a manner. In hindsight, I think that was a mistake.

Recently we added "/run/NetworkManager/system-connections" as additional
keyfile directory. Enforce a suffix and write keyfiles with such a name.

In principle, we could also start writing keyfiles in /etc with the
same suffix. But let's not do that, because we anyway cannot enforce
it.

An ugly part is, that during `nmcli connection load` we need to
determine whether the to-be-loaded connection is under /etc or /run.
Preferably, we would allow any kind of symlinking as what matters
is the file object (inode) and not the path. Anyway, we don't do
that but compare plain paths. That means, paths which are not
in an expected form, will be rejected. In particular, the paths
starting with "/run/..." and "/var/run/..." will be treated differently,
and one of them will be rejected.

Note that ifcfg-rh plugin strictly enforces that the path
starts with IFCFG_DIR as well. So, while this is a breaking
change for keyfile, I think it's reasonable.

(cherry picked from commit 648c256b90)
2018-10-19 00:14:54 +02:00
Thomas Haller
ae5a09d720 keyfile: split automatically setting ID/UUID for keyfile
keyfile already supports omitting the "connection.id" and
"connection.uuid". In that case, the ID would be taken from the
keyfile's name, and the UUID was generated by md5 hashing the
full filename.

No longer do this during nm_keyfile_read(), instead let all
callers call nm_keyfile_read_ensure_*() to their liking. This is done
for two reasons:

 - a minor reason is, that one day we want to expose keyfile API
   as public API. That means, we also want to read keyfiles from
   stdin, where there is no filename available. The implementation
   which parses stdio needs to define their own way of auto-generating
   ID and UUID. Note how nm_keyfile_read()'s API no longer takes a
   filename as argument, which would be awkward for the stdin case.

 - Currently, we only support one keyfile directory, which (configurably)
   is "/etc/NetworkManager/system-connections".
   In the future, we want to support multiple keyfile dirctories, like
   "/var/run/NetworkManager/profiles" or "/usr/lib/NetworkManager/profiles".
   Here we want that a file "foo" (which does not specify a UUID) gets the
   same UUID regardless of the directory it is in. That seems better, because
   then the UUID won't change as you move the file between directories.
   Yes, that means, that the same UUID will be provided by multiple
   files, but NetworkManager must already cope with that situation anyway.
   Unfortunately, the UUID generation scheme hashes the full path. That
   means, we must hash the path name of the file "foo" inside the
   original "system-connections" directory.
   Refactor the code so that it accounds for a difference between the
   filename of the keyfile, and the profile_dir used for generating
   the UUID.

(cherry picked from commit 837d44ffa4)
2018-10-19 00:14:54 +02:00
Thomas Haller
0642fc2d35 keyfile: refactor setting default ID/UUID in nm_keyfile_read()
Split out the functionality for auto-detecting the ID and UUID of
a connection. First of all, nm_keyfile_read() is already overcomplicated.
The next commit will require the caller to explicitly call these
functions.

(cherry picked from commit 02c8844178)
2018-10-19 00:14:54 +02:00
Thomas Haller
1460ce9f51 keyfile: refactor check whether filename starts with a dot
check_prefix() was only ever called with "." as prefix.
Simplify the implementation to explicitly check for a leading
dot.

(cherry picked from commit 2e5985f2e9)
2018-10-19 00:14:54 +02:00
Thomas Haller
8db02e240b keyfile: move file permission check of keyfile to helper function
(cherry picked from commit 345c91a0a4)
2018-10-19 00:14:54 +02:00
Thomas Haller
12f78af0ec keyfile/tests: assert against auto generated UUID for keyfile
The algorithm for generating the UUID must be stable. Assert
against that.

(cherry picked from commit 2e0a95530f)
2018-10-19 00:14:54 +02:00
Thomas Haller
f8f7b3d160 keyfile/tests: drop unused variables
Fixes: e886e5364e
(cherry picked from commit 8de09bb119)
2018-10-19 00:14:54 +02:00
Thomas Haller
5b8e252d5c keyfile/tests: refactor loading of keyfiles in tests
(cherry picked from commit e886e5364e)
2018-10-19 00:13:08 +02:00
Thomas Haller
2c685fc3e0 shared: add nm_strndup_a() helper
(cherry picked from commit ba491a6674)
2018-10-19 00:13:08 +02:00
Thomas Haller
a1831d1832 man: document nmcli device connect behaviour
Already since 1.0.0 release and commit "3784678177 cli: create a connection
if none exist in 'nmcli dev connect' (rh #1113941)", device-connect can
also create a profile.

That is useful, in particular as opposed to

  $ nmcli connection up ifname "$DEVICE"

which wouldn't create a profile (ever).

Document it.

(cherry picked from commit 1b732e28f7)
2018-10-17 18:19:08 +02:00
Lubomir Rintel
7f173bcfdf initrd/cmdline-reader: fix whitespace errors
Detected by checkpatch.pl

(cherry picked from commit ecde3e9034)
2018-10-17 17:13:01 +02:00
Beniamino Galvani
065551c634 initrd: enable meson builds
(cherry picked from commit 470c5c0a82)
2018-10-17 17:13:00 +02:00
Lubomir Rintel
03e1a2559d manager: initialize a potentially uninitialized variable
(cherry picked from commit a82e9083c1)
2018-10-17 17:13:00 +02:00
Lubomir Rintel
45f7d05629 initrd-generator: add a missing include
(cherry picked from commit 7c270f0860)
2018-10-17 17:07:57 +02:00
Lubomir Rintel
f6c37b6f14 man/NetworkManager: document --configure-and-quit option
(cherry picked from commit 9dab0a5eba)
2018-10-17 17:07:23 +02:00
Lubomir Rintel
9e5d19f38b build: disable ibft settings plugin by default
(cherry picked from commit 298f698c9e)
2018-10-17 17:07:23 +02:00
Lubomir Rintel
bfd7d79fe1 initrd: add configuration generator
nm-initrd-generator scans the command line for options relevant to network
configuration and creates configuration files for an early instance of
NetworkManager run from the initial ramdisk during early boot.

(cherry picked from commit 9f9609555d)
2018-10-17 17:07:21 +02:00
Lubomir Rintel
2a65d1bb80 initrd: add command line parser
(cherry picked from commit ecc074b2f8)
2018-10-17 17:06:29 +02:00
Lubomir Rintel
c24e505b6a initrd: add iBFT reader
This is loosely based on nms-ibft-reader, but with some significant
changes. Notably, it parses /sys/firmware/ibft directly instead of
iscsiadm output.

iscsiadm is not available on early boot (perhaps it's too large) and
turns out that parsing sysfs directly is easier and more
straightforwared anyways. A win-win situation.

It is not useful alone, it's in a separate commit just for the sake of
easier review.

(cherry picked from commit b544f7243d)
2018-10-17 17:06:29 +02:00