Commit graph

21546 commits

Author SHA1 Message Date
Thomas Haller
01239e99d7 libnm: add nm_utils_uuid_is_null() helper 2018-10-31 11:34:31 +01:00
Thomas Haller
4db431191c libnm: add nm_utils_uuid_generate_from_string_bin() function 2018-10-31 11:34:31 +01:00
Thomas Haller
070a4d9355 libnm: add support for SHA1 based version 5 UUIDs
The entire point of using version 3/5 UUIDs is to generate
stable UUIDs based on a string. It's usually important that
we don't change the UUID generation algorithm later on.

Since we didn't have a version 5 implementation, we would always
resort to the MD5 based version 3. Version 5 is recommended by RFC 4122:

   o  Choose either MD5 [4] or SHA-1 [8] as the hash algorithm; If
      backward compatibility is not an issue, SHA-1 is preferred.

Add a version 5 implementation so we can use it in the future.

All test values are generated with python's uuid module or OSSP uuid.
2018-10-31 11:34:31 +01:00
Thomas Haller
2ce5347e4d libnm/tests: add more tests for generating UUIDs
The expected values are checked with python's uuid module
and OSSP uuid.
2018-10-31 09:43:31 +01:00
Thomas Haller
c150b0fa29 libnm/trivial: rename uuid type VARIANT3 to VERSION3
In RFC 4122, this is called "version 3", not "variant 3". While for
UUIDs there is also a concept of "variants", that is something else.

Fix naming.
2018-10-31 09:41:12 +01:00
Thomas Haller
88b081fce4 libnm: expose UUID utils as internal API
We link against libuuid.so, but it was entirely internal to
libnm-core. We only exposed UUIDs in string form.

Add API to also handle UUIDs in binary form.

Note that libuuid already defines a type "uuid_t". However,
don't use it and instead use our own typedef NMUuid.
Reasons:

  - uuid.h should be internal to libnm-core (nm-utils.c specifically),
    and not be used by or exposed it other parts of the code.

  - uuid_t is a typedef for a guchar[16] array. Typedefs
    for arrays are confusing, because depending on whether
    it's an automatic variable or a pointer in a function argument,
    they behave differently regarding whether to take their address
    or not and usage of "sizeof()".
2018-10-31 09:41:12 +01:00
Thomas Haller
3648c58bc5 systemd: merge branch systemd into master 2018-10-28 09:31:31 +01:00
Thomas Haller
5437448a64 systemd: update code from upstream (2018-10-27)
This is a direct dump from systemd git.

======

SYSTEMD_DIR=../systemd
COMMIT=e6b538d06680857fb25e2a6da94fc416bb2340f5

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

git ls-files :/src/systemd/src/ \
             :/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/env-util.c"
nm_copy_sd "src/basic/env-util.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 "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/stat-util.c"
nm_copy_sd "src/basic/stat-util.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-10-27 22:43:21 +02:00
Thomas Haller
ef7312a3ae systemd: merge branch 'systemd-dhcp6-fix'
Backport a series of upstream patches from systemd, related
to out-of-bounds heap write with DHCPv6.

On master, we anyway will do a full re-import of systemd code.
Cherry-pick individual patches first, to make backporting easier.

CVE-2018-15688
2018-10-27 22:33:07 +02:00
Lennart Poettering
58423902ce dhcp6: prefer offsetof() over sizeof() for structs with undefined sizes
This doesn't change anything in the generated source, but I think makes
semantically more sense, as these structures have undefined size, and we
only want to know the size up to the data field in these cases.

(cherry picked from commit 20b55f853847378b85561a4e299604d27b5cd25b)
2018-10-27 22:03:01 +02:00
Lennart Poettering
01ca2053bb dhcp6: make sure we have enough space for the DHCP6 option header
Fixes a vulnerability originally discovered by Felix Wilhelm from
Google.

CVE-2018-15688
LP: #1795921
https://bugzilla.redhat.com/show_bug.cgi?id=1639067

(cherry picked from commit 4dac5eaba4e419b29c97da38a8b1f82336c2c892)
2018-10-27 22:03:01 +02:00
Lennart Poettering
05872d554f dhcp6: reduce whitespace a bit
(cherry picked from commit 990668aa4cf04ea1c05791af97b1c05080378016)
2018-10-27 22:03:01 +02:00
Lennart Poettering
2dddf5924a dhcp6: split assert_return() to be more debuggable when hit
(cherry picked from commit 3c290c03167cf9334cb419035587ff3057940eee)
2018-10-27 22:03:01 +02:00
Lennart Poettering
d49a036afe dhcp6: constify things where we can
(cherry picked from commit e0a18b74a3b54bd9383b827139cea0df606e4378)
2018-10-27 22:03:01 +02:00
Li Song
915c2f675a sd-dhcp: remove unreachable route after rebinding return NAK
(cherry picked from commit cc3981b1272b9ce37e7d734a7b2f42e84acac535)
2018-10-27 22:03:01 +02:00
Yu Watanabe
83f849ae79 sd-dhcp6: drop empty 'error' label
(cherry picked from commit aae1fa5cc8a49e5071c7e089b186f52bac0da613)
2018-10-27 22:03:01 +02:00
Yu Watanabe
50403cccee sd-dhcp6: make dhcp6_option_parse_domainname() not store empty domain
This improves performance of fuzzer.
C.f. oss-fuzz#11019.

(cherry picked from commit 3c72b6ed4252e7ff5f7704bfe44557ec197b47fa)
2018-10-27 22:03:01 +02:00
Yu Watanabe
1990a3efab sd-dhcp6: do not update serverid when ENOMEM
(cherry picked from commit 33d367589581a9f46fe291181ef2b30b812e5cb3)
2018-10-27 22:03:01 +02:00
Yu Watanabe
a7137ce0ce sd-dhcp6: coding style cleanups
(cherry picked from commit da07cf358231caca214da5d4f161b06e713586be)
2018-10-27 22:03:01 +02:00
Yu Watanabe
373cbfc8c6 sd-dhcp6: fix argument and error handling of dhcp6_option_parse_status()
(cherry picked from commit 91c43f3978fa7c8341550b9ca279e460ba7e74e6)
2018-10-27 22:03:01 +02:00
Yuri Chornoivan
60dda78b74 po: update Ukrainian (uk) translation (#36)
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/36
2018-10-26 12:34:31 +02:00
Thomas Haller
085b769729 man: clarify udev property "NM_UNMANAGED" in man NetworkManager 2018-10-26 09:06:45 +02:00
Thomas Haller
f120bbc7a8 libnm/vpn: merge branch 'th/read-vpn-plugins-tests'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/30
2018-10-25 16:37:43 +02:00
Thomas Haller
9bc33a687e libnm: fix endless loop in nm_vpn_service_plugin_read_vpn_details()
Previously, a "DONE\n" was required to break the loop.
2018-10-25 16:37:35 +02:00
Thomas Haller
21f94e9265 libnm/tests: add test for nm_vpn_service_plugin_read_vpn_details() 2018-10-25 16:37:35 +02:00
Thomas Haller
6dcc0999a6 shared/tests: add NMTST_EXPECT_LIBNM_WARNING() macro 2018-10-25 16:37:35 +02:00
Thomas Haller
50e092a967 build: add configure check for having memfd_create() API 2018-10-25 16:37:35 +02:00
Thomas Haller
ec37e18c64 libnm: fix crash in activate_info_complete() when cancelling
We must disconnect ActivateInfo before invoking callbacks.

Otherwise, it can happen that the callee cancels the cancellable,
which in turn enters activate_info_complete() again, and leads
to a crash.

https://bugzilla.redhat.com/show_bug.cgi?id=1642625
2018-10-25 15:29:55 +02:00
Thomas Haller
ac90593cc2 man: fix "no-auto-default" state dir in NetworkManager.conf manual
Quote from `man NetworkManager.conf`:

  When the default wired connection is deleted or saved to a new
  persistent connection by a plugin, the device is added to a list in the
  file /run/NetworkManager/no-auto-default.state to prevent creating
  the default connection for that device again.

"/run" is obviously wrong. Fix it.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/33
2018-10-25 15:24:38 +02:00
Beniamino Galvani
d9e931acaf client: tests: avoid mixing stdout and stderr output on failure
On failure the self.fail() message often appears in the middle of the
diff between expected/actual output, making it hard to read. Since
print() output goes to stdout (which is buffered) and self.fail() to
stderr (which is not), flush stdout before printing the failure
message to ensure the two don't mix.
2018-10-25 14:52:35 +02:00
Thomas Haller
f8fed7dd52 checkpatch: complain about XXX markers in code
We have a few source code tags like "TODO" and "FIXME".
"XXX" is not intended to be merged, it is for marking
places in code while still working on it.
2018-10-25 11:20:10 +02:00
Thomas Haller
168e8b9b6f build: fix check-docs.sh for out-of-tree builds
Fixes: 7a59cd2744
2018-10-25 11:08:39 +02:00
Thomas Haller
cacd3be1a9 build: merge branch 'fix-bashism-in-tools-check-docs-sh'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/35
2018-10-25 09:45:16 +02:00
Thomas Haller
7a59cd2744 docs: rework check-docs test script
Try to make check-docs.sh script more readable.

Also, previously the script would check that one side was a subset
of the other side. Tighten this check up, now both sides of the
comparison must agree and yield the same lines.
2018-10-25 09:40:53 +02:00
Michael Biebl
e11ee4582a docs: fix bashism in tools/check-docs.sh
[thaller@redhat.com: fixed issue in original patch]
2018-10-25 08:00:40 +02:00
Beniamino Galvani
1408ffd9f6 build: fix ibft option in create-exports-NetworkManager.sh 2018-10-24 22:10:31 +02:00
Beniamino Galvani
587e0e37b2 build: merge branch 'bg/issue65'
ibft-related build fixes.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/65
2018-10-24 22:03:57 +02:00
Thomas Haller
0677b51549 build: enable ibft plugin for make dist-check 2018-10-24 21:43:17 +02:00
Thomas Haller
b660a41c7c build: fix build_clean.sh script to enable ibft
autotools build has/had a bug, where ibft test files would only be disted
if the ibft plugin was enabled.

Regardless of that, `build_clean.sh --release` is our suggested way to
create a release tarball. It should always enable the ibft plugin.

It didn't do so, due to a bug.
2018-10-24 21:43:17 +02:00
Beniamino Galvani
bc6071aed6 build: unconditionally dist ibft test files
Even if ibft support is disabled, test files should be included in
distribution.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/65
2018-10-24 21:05:29 +02:00
Lubomir Rintel
25f625b4fc shared/vpn-plugin-utils: load the editor from the same place as plugin
If passed a relative path, load the editor .so from the same directory
as the plugin .so. This is useful for development, as it allows running
the editor plugin from the build tree conveniently.

https://github.com/NetworkManager/NetworkManager/pull/242
2018-10-24 15:12:43 +02:00
Lubomir Rintel
cb28719e3a shared/vpn-plugin-utils: change the domain of errors
I suppose NM_VPN_PLUGIN_ERROR is slightly less wrong than
NM_CONNECTION_ERROR here. Shall have no practical implications anyway.
2018-10-24 15:12:43 +02:00
Thomas Haller
b1571e687e build/meson: merge branch 'esrevinu/master'
https://bugzilla.gnome.org/show_bug.cgi?id=797324
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/68

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/26
2018-10-24 10:19:02 +02:00
Taegil Bae
4b2dc8826d meson: set RPATH for libnm_device_plugin_wwan.so
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/26
2018-10-24 09:56:46 +02:00
Taegil Bae
82b8ef2252 meson: set RPATH for libnm_device_plugin_bluetooth.so
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/26
2018-10-24 09:56:43 +02:00
Michael Biebl
8179b23d76 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
2018-10-23 22:58:44 +02:00
Lubomir Rintel
05d6c993dd 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
2018-10-23 15:42:19 +02:00
Thomas Haller
d49e88f716 Revert "keyfile: drop with_extension argument from _internal_write_connection()"
For upstream, we changed behavior here. However, I think certain
downstream don't want to do that, and revert patch "d37ad15f12 keyfile:
also add ".nmconnection" extension when writing keyfiles in /etc".

For that to make easier, keep the upstream sources closer to what
was. Revert.

This reverts commit e93d8cdb74.
2018-10-23 13:46:14 +02:00
Thomas Haller
6978558e8c contrib: adjust NM-log for changes to platform logging
Fixes: 8f107f5c00
2018-10-23 12:03:59 +02:00
Thomas Haller
43955828c0 wifi/iwd: merge branch 'balrog-kun/iwd-fixes' (#236)
https://github.com/NetworkManager/NetworkManager/pull/236
2018-10-23 11:33:16 +02:00