Andrew Zaborowski
178af02678
wifi: skip nm_platform_wifi_get_capabilities/get_mode for IWD backend
...
Only call nm_platform_wifi_get_capabilities and
nm_platform_wifi_get_mode with the wpa_supplicant backend. They're used
to initialize the wireless-capabilities property and to skip creating
NMDevices for interfaces in unknown wifi mode which IWD handles already.
2018-10-11 16:07:15 +02:00
Andrew Zaborowski
7a6d5ab5a2
wifi/iwd: set capabilities property based on IWD support
...
Parse the Adapter.SupportedModes dbus property and set the
gobject property wireless-capabilities based on that.
2018-10-11 16:07:15 +02:00
Thomas Haller
6e41d79067
ndisc: merge branch 'th/ndisc-fixes'
...
https://github.com/NetworkManager/NetworkManager/pull/219
2018-10-11 14:51:08 +02:00
Thomas Haller
98ec56c670
ndisc: always emit changed signal if an ndisc parameter changes
...
Note how the nm_ndisc_add_*() return a boolean to indicate whether
anything changes. That is taken to decide whether to emit a changed
signal.
Previously, we would not consider all fields which are exposed
as public API.
Note that nm-ip6-config.c would care about the lifetime of NMNDiscAddress.
For that, nm_ndisc_add_address() would correctly consider a change of
the lifetime as relevant. So, this was for the most part not broken.
However, for example nm_ndisc_add_route() would ignore changes to the
gateway.
Always signal changes if anything changes at all. It's more correct
and robust.
2018-10-11 05:56:18 +02:00
Thomas Haller
4f78d82fcd
ndisc/trivial: move code
2018-10-11 05:56:18 +02:00
Thomas Haller
d444fcde34
ndisc: abort handling IO in event_ready() if we are unable to switch namespace
...
It should never happen that we are unable to switch the namespace.
However, in case it does, we cannot just return G_SOURCE_CONTINUE,
because we will just endlessly trying to process IO without actually
reading from the socket.
This shouldn't happen, but the instance is hosed and something is
very wrong. No longer handle the socket to avoid an endless loop.
2018-10-11 05:56:18 +02:00
Thomas Haller
9aa628cedb
ndisc: keep NMNDisc instance alive while processing IO in event_ready()
...
event_ready() calls ndp_callall_eventfd_handler(), which invokes
our own callback, which may invoke change notification.
At that point, it's not guaranteed that the signal handler won't
destroy the ndisc instance, which means, the "struct ndp" gets destroyed
while invoking callbacks. That's bad, because libndp is not robust
against that.
Ensure the object stays alive long enough.
2018-10-11 05:56:18 +02:00
Thomas Haller
1f856b7cb3
ndisc: first reschedule timeout before invoking change event in check_timestamps()
...
It's just ugly to invoke external code in the middel of an operation.
You never know, whether the handler won' unref the ndisc instance.
2018-10-11 05:56:18 +02:00
Thomas Haller
8de09bb119
keyfile/tests: drop unused variables
...
Fixes: e886e5364e
2018-10-10 12:38:33 +02:00
Thomas Haller
c295d45a3b
platform/netlink: fix overrun in attribute iteration in nla_ok()
...
See-also: 123dc07bcc
See-also: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=1045b03e07d85f3545118510a587035536030c1c
2018-10-10 12:04:27 +02:00
Thomas Haller
82652c1415
cli: merge branch 'th/cli-drop-some-global'
...
https://github.com/NetworkManager/NetworkManager/pull/225
2018-10-10 09:57:17 +02:00
Thomas Haller
86502bef9c
cli: don't needlessly cast function pointer for rl_attempted_completion_function
2018-10-10 09:55:45 +02:00
Thomas Haller
5d684597c4
cli: don't access global nm_cli variable from nmc_setting_set_property()
2018-10-10 09:55:45 +02:00
Thomas Haller
99d3b6930b
cli: don't use global variable nm_cli in nmc_terminal_spawn_pager()
...
print_required_fields() still accesses the global variable.
We can only move the uses of globals up the call-stack, one
bit at a time.
2018-10-10 09:55:45 +02:00
Thomas Haller
411243c654
cli: don't use global nm_cli in nmc_readline_*()
...
Globals are bad. Don't let nmc_readline_helper() access
nm_cli.
Instead, pass nmc_config along. nmc_config albeit being
a complex struct, is much more begning:
- the configuration nmc_config is initialized early on
and afterwards immutable.
- it only contains simple fields, which affect the behavior.
- it's not a global. While passing around the complex configuration
struct, it is clear that all callpaths don't access additional
global information.
2018-10-10 09:55:45 +02:00
Thomas Haller
0be65a4b78
cli: don't pass complex info argument to active_connection_hint()
...
Untangle the amount or agruments passed to active_connection_hint().
2018-10-10 09:55:45 +02:00
Lubomir Rintel
aa0e395530
devices/olpc: correct the signal handler arguments
...
Commit 631ca806 ("devices/wifi: flip meaning of scanning allowed
signal") added a "periodic" argument, but the OLPC companion handler was
not adjusted. Fix it now.
https://github.com/NetworkManager/NetworkManager/pull/222
Fixes: 631ca80692
2018-10-09 20:07:02 +02:00
Beniamino Galvani
09d0e5590c
cli: fix memory leak
...
activate_connection_editor_cb() must free @info and unref the device.
2018-10-09 09:58:27 +02:00
Beniamino Galvani
d091cbdc2f
cli: fix cleanup after activation from editor
...
progress_activation_editor_cb() is called multiple times every 120
milliseconds and it must free resources only the last time.
Fixes: f0a2686545
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/51
2018-10-09 09:58:27 +02:00
Beniamino Galvani
17a942b458
libnm-core: fix other int comparisons in team setting
...
I forgot to update them when applying commit 72b4541771 .
Fixes: 72b4541771
2018-10-08 11:28:14 +02:00
Lubomir Rintel
fb2ae67da6
merge: branch 'lr/wpan-channel'
...
https://github.com/NetworkManager/NetworkManager/pull/209
2018-10-07 15:46:51 +02:00
Lubomir Rintel
c21b4c3d0a
cli: add support for wpan.page and wpan.channel properties
2018-10-07 15:46:02 +02:00
Lubomir Rintel
bd6074095d
devices/wpan: set channel on activation
2018-10-07 15:46:02 +02:00
Lubomir Rintel
0573656eeb
platform/wpan: allow setting channel
2018-10-07 15:46:02 +02:00
Lubomir Rintel
ae38d43e66
core/setting-wpan: add page and channel properties
2018-10-07 15:46:02 +02:00
Lubomir Rintel
a745f0c952
core/setting-wpan: fix some whitespace errors
2018-10-07 15:46:02 +02:00
Lubomir Rintel
0d3c6072f5
contrib/checkpatch: remove the first character off a diff
...
Otherwise the leading whitespace checks won't work on patches.
2018-10-07 15:46:02 +02:00
Lubomir Rintel
587f006690
contrib/checkpatch: check some more whitespace trouble
2018-10-07 15:46:02 +02:00
Lubomir Rintel
1d57aefa41
contrib/checkpatch: correctly separate indentation across hunks
2018-10-07 15:46:02 +02:00
Beniamino Galvani
0cb5c4f611
merge: branch 'bg/covscan'
...
Some coverity fixes.
https://github.com/NetworkManager/NetworkManager/pull/220
2018-10-07 14:01:08 +02:00
Thomas Haller
72b4541771
libnm-core: fix int comparisons in team setting
2018-10-07 13:57:11 +02:00
Beniamino Galvani
d0f85092b9
libnm-core: remove unneeded comparisons
...
a_gendata and b_gendata cannot be NULL. This makes coverity happy.
2018-10-06 10:03:48 +02:00
Beniamino Galvani
e4154895ff
shared/nm-utils: avoid a coverity warning
...
1. NetworkManager-1.14.0/shared/nm-utils/nm-shared-utils.c:1242: value_overwrite: Overwriting previous write to "ch" with value from "v".
2. NetworkManager-1.14.0/shared/nm-utils/nm-shared-utils.c:1239: assigned_value: Assigning value from "++str[0]" to "ch" here, but that stored value is overwritten before it can be used.
# 1237| if (ch >= '0' && ch <= '7') {
# 1238| v = v * 8 + (ch - '0');
# 1239|-> ch = (++str)[0];
# 1240| }
# 1241| }
Don't assign ch when it is going to be overwritten.
2018-10-06 10:03:48 +02:00
Beniamino Galvani
e3b9606b24
device: fix a wrong comparison
...
'i <= G_MAXINT' is always true.
2018-10-06 10:03:48 +02:00
Beniamino Galvani
9e43821e17
dispatcher: fix shellcheck warnings
...
Prefer [ p ] && [ q ] as [ p -a q ] is not well defined.
And likewise, prefer [ p ] || [ q ] over [ p -o q ].
https://github.com/koalaman/shellcheck/wiki/SC2166
2018-10-06 10:03:48 +02:00
Beniamino Galvani
27ab932a49
libnm-core: use g_variant_type_equal() to compare variant types
...
Even if a direct pointer comparison should be fine, use the proper
function. GVariantType documentation says:
"Two types may not be compared by value; use g_variant_type_equal()
or g_variant_type_is_subtype_of()."
This also fixes coverity warnings.
2018-10-06 10:03:48 +02:00
Beniamino Galvani
9b04b871a0
libnm-core: fix coverity warning
...
3. NetworkManager-1.14.0/libnm-core/nm-utils.c:4944: var_compare_op: Comparing "str" to null implies that "str" might be null.
4. NetworkManager-1.14.0/libnm-core/nm-utils.c:4958: var_deref_op: Dereferencing null pointer "str".
# 4956|
# 4957| /* do some very basic validation to see if this might be a JSON object. */
# 4958|-> if (str[0] == '{') {
# 4959| gsize l;
# 4960|
2018-10-06 10:03:48 +02:00
Thomas Haller
4791782f46
systemd: merge branch systemd into master
...
https://github.com/NetworkManager/NetworkManager/pull/186
2018-10-05 01:24:08 +02:00
Thomas Haller
5f1ad6a482
systemd: comment out unused code in utf8.c
...
Unused code is nice, because on update we don't need to check
whether a patch affects behavior.
Mark code that is unused as such.
2018-10-05 01:00:32 +02:00
Evgeny Vereshchagin
7cb7cffc49
dhcp6: fix an off-by-one error in dhcp6_option_parse_domainname
...
==14==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60200055fa9c at pc 0x0000005458f1 bp 0x7ffc78940d90 sp 0x7ffc78940d88
READ of size 1 at 0x60200055fa9c thread T0
#0 0x5458f0 in dhcp6_option_parse_domainname /work/build/../../src/systemd/src/libsystemd-network/dhcp6-option.c:555:29
#1 0x54706e in dhcp6_lease_set_domains /work/build/../../src/systemd/src/libsystemd-network/sd-dhcp6-lease.c:242:13
#2 0x53fce0 in client_parse_message /work/build/../../src/systemd/src/libsystemd-network/sd-dhcp6-client.c:984:29
#3 0x53f3bc in client_receive_advertise /work/build/../../src/systemd/src/libsystemd-network/sd-dhcp6-client.c:1083:13
#4 0x53d57f in client_receive_message /work/build/../../src/systemd/src/libsystemd-network/sd-dhcp6-client.c:1182:21
#5 0x7f0f7159deee in source_dispatch /work/build/../../src/systemd/src/libsystemd/sd-event/sd-event.c:3042:21
#6 0x7f0f7159d431 in sd_event_dispatch /work/build/../../src/systemd/src/libsystemd/sd-event/sd-event.c:3455:21
#7 0x7f0f7159ea8d in sd_event_run /work/build/../../src/systemd/src/libsystemd/sd-event/sd-event.c:3512:21
#8 0x531f2b in fuzz_client /work/build/../../src/systemd/src/fuzz/fuzz-dhcp6-client.c:44:9
#9 0x531bc1 in LLVMFuzzerTestOneInput /work/build/../../src/systemd/src/fuzz/fuzz-dhcp6-client.c:53:9
#10 0x57bec8 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) /src/libfuzzer/FuzzerLoop.cpp:570:15
#11 0x579d67 in fuzzer::Fuzzer::RunOne(unsigned char const*, unsigned long, bool, fuzzer::InputInfo*, bool*) /src/libfuzzer/FuzzerLoop.cpp:479:3
#12 0x57dc92 in fuzzer::Fuzzer::MutateAndTestOne() /src/libfuzzer/FuzzerLoop.cpp:707:19
#13 0x580ca6 in fuzzer::Fuzzer::Loop(std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, fuzzer::fuzzer_allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&) /src/libfuzzer/FuzzerLoop.cpp:838:5
#14 0x55e968 in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) /src/libfuzzer/FuzzerDriver.cpp:764:6
#15 0x551a1c in main /src/libfuzzer/FuzzerMain.cpp:20:10
#16 0x7f0f701a082f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
#17 0x41e928 in _start (/out/fuzz-dhcp6-client+0x41e928)
https://github.com/systemd/systemd/pull/10200
b387d3c132
2018-10-05 00:44:27 +02:00
Yu Watanabe
484e92e17f
dhcp6: check option length before reading values
...
Fixes oss-fuzz#10746
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=10746 .
https://github.com/systemd/systemd/pull/10213
84452783b8
2018-10-05 00:38:09 +02:00
Thomas Haller
2e5d35f29d
systemd: update code from upstream (2018-10-04)
...
This is a direct dump from systemd git.
======
SYSTEMD_DIR=../systemd
COMMIT=b62f9008668a5330c61b4de7e0d48147bcd1edf7
(
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-05 00:20:48 +02:00
Thomas Haller
09581d3aa1
keyfile: merge branch 'th/keyfile-various'
...
https://github.com/NetworkManager/NetworkManager/pull/218
2018-10-04 11:05:30 +02:00
Thomas Haller
837d44ffa4
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.
2018-10-04 11:03:23 +02:00
Thomas Haller
02c8844178
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.
2018-10-04 10:58:50 +02:00
Thomas Haller
2e5985f2e9
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.
2018-10-04 10:58:50 +02:00
Thomas Haller
345c91a0a4
keyfile: move file permission check of keyfile to helper function
2018-10-04 10:58:50 +02:00
Thomas Haller
2e0a95530f
keyfile/tests: assert against auto generated UUID for keyfile
...
The algorithm for generating the UUID must be stable. Assert
against that.
2018-10-04 10:58:50 +02:00
Thomas Haller
e886e5364e
keyfile/tests: refactor loading of keyfiles in tests
2018-10-04 10:58:50 +02:00
Thomas Haller
5345cac151
core: add code comment to nm_utils_read_link_absolute() and minor cleanup
2018-10-04 10:58:50 +02:00