Commit graph

21188 commits

Author SHA1 Message Date
Thomas Haller
efb9e2bc6b 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.

(cherry picked from commit 9aa628cedb)
2018-10-13 17:34:54 +02:00
Thomas Haller
a3c73e783b 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.

(cherry picked from commit 1f856b7cb3)
2018-10-13 17:34:41 +02:00
Lubomir Rintel
d947c27fd7 all: remove \n endings from log calls
The extra newlines look bad when logging to the console.

https://github.com/NetworkManager/NetworkManager/pull/223
(cherry picked from commit 02958bba80)
2018-10-12 14:36:22 +02:00
Lubomir Rintel
514aadd75b release: update NEWS 2018-10-12 12:59:16 +02:00
Lubomir Rintel
7e793bf3b4 devices/olpc: don't assert we're waiting for companion on device_added_cb()
We're hooking the signal on construction, but we only queue a pending
action on reaching UNAVAILABLE state. The signal could fire in between:

  <info>  [1539282167.9666] manager: (msh0): new 802.11 OLPC Mesh device (/org/freedesktop/NetworkManager/Devices/4)
  <info>  [1539282168.1440] manager: (wlan0): new 802.11 WiFi device (/org/freedesktop/NetworkManager/Devices/5)
  <info>  [1539282168.1831] device (msh0): found companion WiFi device wlan0
  <warn>  [1539282168.2110] device (msh0): remove_pending_action (1): 'waiting-for-companion' not pending
  file src/devices/nm-device.c: line 13966 (<dropped>): should not be reached

https://github.com/NetworkManager/NetworkManager/pull/229
(cherry picked from commit 08225c5e96)
2018-10-12 12:57:12 +02:00
Thomas Haller
00f14736e6 wwan: don't assume DNS info is always available for IPv6
See also "5df024f57a wwan: don't assume DNS info is always available"
which does the same for IPv4.

(cherry picked from commit cec7ade86c)
2018-10-12 00:18:09 +02:00
Thomas Haller
ec1c512e40 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
(cherry picked from commit c295d45a3b)
2018-10-10 12:16:52 +02:00
Lubomir Rintel
8f1631c679 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
(cherry picked from commit aa0e395530)
2018-10-09 20:23:59 +02:00
Beniamino Galvani
628c976f54 core: merge branch 'bg/preserve-routes-down-rh1626004'
https://bugzilla.redhat.com/show_bug.cgi?id=1623740
https://bugzilla.redhat.com/show_bug.cgi?id=1626004

https://github.com/NetworkManager/NetworkManager/pull/210
(cherry picked from commit b1a6454b6c)
2018-10-08 18:10:59 +02:00
Beniamino Galvani
ce2d403530 device: don't remove routes when the interface is down
In update update_ext_ip_config() we remove from various internal
configurations those addresses and routes that were removed externally
by users.

When the interface is brought down, the kernel automatically removes
routes associated with it and so we should not consider them as
"removed by users".

Instead, keep them so that they can be restored when the interface
comes up again.

(cherry picked from commit f069c98cc9)
2018-10-08 18:10:26 +02:00
Beniamino Galvani
bd79e67c55 ip-config: add @intersect_routes argument to intersect functions
In some cases we want to intersect two IP configurations without
considering routes.

(cherry picked from commit 8f07b3ac4f)
2018-10-08 18:10:23 +02:00
Beniamino Galvani
81aaf0ff93 device: fix updating device information after link change
device_link_changed() can't use nm_device_update_from_platform_link()
to update the device private fields because the latter overwrites
priv->iface and priv->up, and so the checks below as:

  if (info.name[0] && strcmp (priv->iface, info.name) != 0) {

and:

  was_up = priv->up;
  priv->up = NM_FLAGS_HAS (info.n_ifi_flags, IFF_UP);
  ...
  if (priv->up && !was_up) {

never succeed.

Fixes: d7f7725ae8
(cherry picked from commit 46ed756112)
2018-10-08 18:10:17 +02:00
Beniamino Galvani
0b1ffdbdb5 core: improve nm_ip_config_dump()
Previously we had nm_ip{4,6}_config_dump() for debugging purposes, but
they were inconveniently printing to stdout and so the output was not
ordered in the journal.

Implement a unified nm_ip_config_dump() that logs through the usual
logging mechanism.

(cherry picked from commit 3b49d1075d)
2018-10-08 18:10:16 +02:00
Beniamino Galvani
3a6da57b16 libnm-core: fix other int comparisons in team setting
I forgot to update them when applying commit 72b4541771.

Fixes: 72b4541771
(cherry picked from commit 17a942b458)
2018-10-08 11:52:58 +02:00
Beniamino Galvani
faeda5fdbf merge: branch 'bg/covscan'
Some coverity fixes.

https://github.com/NetworkManager/NetworkManager/pull/220
(cherry picked from commit 0cb5c4f611)
2018-10-07 14:15:39 +02:00
Thomas Haller
1d718cd16f libnm-core: fix int comparisons in team setting
(cherry picked from commit 72b4541771)
2018-10-07 14:15:22 +02:00
Beniamino Galvani
c81d35d352 libnm-core: remove unneeded comparisons
a_gendata and b_gendata cannot be NULL. This makes coverity happy.

(cherry picked from commit d0f85092b9)
2018-10-07 14:15:20 +02:00
Beniamino Galvani
8fb85b1f5b 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.

(cherry picked from commit e4154895ff)
2018-10-07 14:15:18 +02:00
Beniamino Galvani
8cbc08ce29 device: fix a wrong comparison
'i <= G_MAXINT' is always true.

(cherry picked from commit e3b9606b24)
2018-10-07 14:15:17 +02:00
Beniamino Galvani
6df6ed4483 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
(cherry picked from commit 9e43821e17)
2018-10-07 14:15:16 +02:00
Beniamino Galvani
1d25a49485 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.

(cherry picked from commit 27ab932a49)
2018-10-07 14:15:15 +02:00
Beniamino Galvani
da3e0af01a 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|

(cherry picked from commit 9b04b871a0)
2018-10-07 14:15:13 +02:00
Evgeny Vereshchagin
cd3aacefdd 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
(cherry picked from commit 7cb7cffc49)
2018-10-05 01:41:38 +02:00
Yu Watanabe
0cec1cb93e 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
(cherry picked from commit 484e92e17f)
2018-10-05 01:41:37 +02:00
Beniamino Galvani
1c3722b6a7 build: meson: merge branch 'bg/rpm-meson'
Add meson support to RPM spec file.

https://github.com/NetworkManager/NetworkManager/pull/212
(cherry picked from commit d6db262597)
2018-10-02 10:02:57 +02:00
Beniamino Galvani
c762160692 contrib/rpm: support building with meson
Add support for building with meson, enabled by '--with meson' so that
we can regularly test the whole build+test+install procedure with
meson. I compared the RPM contents of NM, NM-libnm, NM-libnm-devel
packages and they match the autotools ones. It's also faster:

  $ time contrib/fedora/rpm/build_clean.sh -g -Q -f

  real    3m54.239s
  user    11m15.000s
  sys     1m28.456s

  $ time contrib/fedora/rpm/build_clean.sh -g -Q -f -w meson

  real    3m9.938s
  user    9m5.225s
  sys     1m4.392s

(cherry picked from commit 295b9d5b81)
2018-10-02 10:02:39 +02:00
Beniamino Galvani
d04dd3385c contrib/rpm: remove duplicate documentation
In NetworkManager-libnm-devel we ship the same documentation in two
different places:

 /usr/share/doc/NetworkManager-libnm-devel
 /usr/share/gtk-doc/html/NetworkManager

Remove the former, which was added in commit e01c17523a.

Also, remove the same documentation from NetworkManager-glib-devel
since it's already present in NetworkManager-libnm-devel.

(cherry picked from commit 1f18783404)
2018-10-02 10:02:34 +02:00
Beniamino Galvani
4c9aa0ced0 build: meson: install ifcfg-rh files and directory
(cherry picked from commit 34ffd9fcab)
2018-10-02 10:02:32 +02:00
Beniamino Galvani
db6b9ca63b build: meson: fix install script
Fix directory paths and modes.

Fixes: 98b4a19a53
(cherry picked from commit 24fc3c54a3)
2018-10-02 10:02:29 +02:00
Beniamino Galvani
aeb7eb7376 build: meson: fix generation of api docs
We need to copy all introspection files to the same directory when
building the documentation.

Note that we only require Meson 0.44, but for the documentation at
least 0.46 is needed because of a new functionality of
gnome.gdbus_codegen(). In this way we can still build on Travis CI
(without documentation).

(cherry picked from commit dcfddeef7a)
2018-10-02 10:02:26 +02:00
Beniamino Galvani
4109ab8318 build: meson: ifcfg-rh plugin should not enable ibft
This is not the case with autotools.

(cherry picked from commit e22c7150e0)
2018-10-02 10:02:00 +02:00
Beniamino Galvani
8ac6aa4f97 merge: branch 'bg/meson-fixes'
https://github.com/NetworkManager/NetworkManager/pull/204
(cherry picked from commit c7c3acf280)
2018-10-02 10:00:54 +02:00
Beniamino Galvani
fb432eec25 travis: disable gtk-doc for meson builds
Introspection can't be enabled on travis due to a GLib bug [1].
Therefore, gtk-doc must be disabled as well.

[1] https://bugzilla.gnome.org/show_bug.cgi?id=774368

(cherry picked from commit 5af7d46be4)
2018-10-02 10:00:33 +02:00
Beniamino Galvani
6a815260db build: meson: GTK documentation requires introspection
(cherry picked from commit 84701c049c)
2018-10-02 10:00:27 +02:00
Beniamino Galvani
3711c31467 build: meson: fix computing NM exported symbols
The script didn't include all the symbols needed by plugins because
libNetworkManager.a, as built by meson, doesn't include symbols from
other static libraries that are linked in. Since we used
libNetworkManager.a to know which symbols are potentiall available
from NM, the result was an incomplete list.

Unfortunately, the only way to include the whole static library is to
create a dependency object and use 'link_whole', but this is only
available in meson >= 0.46. Since 'link_whole' is available for
executables in meson >= 0.40, create a fake executable and use that to
enumerate symbols.

Also add tests to check that plugins can be loaded correctly.

Fixes: dfa2a2b40c
(cherry picked from commit 19a718bc13)
2018-10-02 10:00:25 +02:00
Beniamino Galvani
fc22330c1c docs: include openvswitch(7) man page only when ovs is enabled
(cherry picked from commit 6da369252a)
2018-10-02 10:00:19 +02:00
Beniamino Galvani
b459ffbdd8 build: meson: gtk-doc needs common.ent
(cherry picked from commit c06a6aec1a)
2018-10-02 09:59:51 +02:00
Beniamino Galvani
bb892155af build: meson: man files depend on common.ent
(cherry picked from commit c8636449b3)
2018-10-02 09:59:49 +02:00
Beniamino Galvani
7f57600fce build: meson: check vapi prerequisites and allow autodetection
Turn the vapi option into a combo that allows autodetection and check
whether all prerequisites are satisfied (including introspection
support) when vapi is explicitly enabled.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/28
(cherry picked from commit 37954c91bd)
2018-10-02 09:59:46 +02:00
Beniamino Galvani
bd519d88e4 build: meson: support $DESTDIR in installation script
Adapt the meson post-installation script to handle the $DESTDIR
variable supplied by user to specify the installation target
directory. While at it, convert the script to shell because it seems
simpler to me.

(cherry picked from commit 98b4a19a53)
2018-10-02 09:59:41 +02:00
Thomas Haller
353cc20683 build: silence message in "tools/create-exports-NetworkManager.sh" about missing directory
When building with meson -Dppp=false, the following message is printed
during build:

  [623/671] Generating NetworkManager.ver with a custom command. find: ‘./src/ppp/’: No such file or directory

The message is harmless. Hide it.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/43
(cherry picked from commit 15857ad958)
2018-10-01 18:42:23 +02:00
AsciiWolf
73b69b626b po: update Czech (cz) translation
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/20
2018-09-30 22:08:28 +02:00
Beniamino Galvani
f235d57a3a wifi: support hidden ssid in AP mode
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/48
(cherry picked from commit 5d97e76c7d)
2018-09-27 14:10:22 +02:00
Thomas Haller
0d32344781 wifi: log warning when active scanning for hidden networks
When there are profiles with wifi.hidden=yes, NetworkManager
will actively scan for these SSIDs. This makes the scan request
(and thus the user) recognizable and trackable.

It seems generally a bad idea to use hidden networks, as they
compromise either the privacy or usablity for the clients.

Log a (rate-limited) warning about this.

(cherry picked from commit 365079c09e)
2018-09-26 14:23:06 +02:00
Andrew Zaborowski
8cc306bba4 wifi/iwd: handle IWD Station interface disappearing
The net.connman.iwd.Station interface, unlike the Device interface, can
go away and come back when the device changes modes or goes DOWN and UP.
The GDbusProxy for the interface becomes invalid after the interface
disappeared and reappeared.  This would make the IWD backend stop
working after rfkill was used or after suspend/resume (provided the
suspend/resume events are detected, without them everything works and is
really fast too).

Redo the handling of the Powered property changes, corresponding to
device UP state, to get a new GDBusProxy when the Station interface
reappears.  Simplify some checks knowing that priv->can_scan implies for
example that the Station interface is present, and that priv->enabled
implies the NM device state is >= DISCONNECTED.

https://github.com/NetworkManager/NetworkManager/pull/211
(cherry picked from commit bfacd24f83)
2018-09-26 14:21:57 +02:00
Thomas Haller
393f2ad4cc wifi/iwd: merge branch 'balrog-kun/iwd-fixes' (pr#206)
https://github.com/NetworkManager/NetworkManager/pull/206

(cherry picked from commit 57780600dc)
2018-09-26 14:21:48 +02:00
Andrew Zaborowski
41b3c45699 wifi/iwd: don't change state in secrets callback
Also make sure the secrets request callback only send a reply to IWD and
the Connect method return callback executes the device state change to
"disconnected".

(cherry picked from commit 061913c588)
2018-09-26 14:21:01 +02:00
Andrew Zaborowski
b31d2ea02a wifi/iwd: actually wait for Connect() call return
state_changed (called when IWD signalled device state change) was
supposed to not change NM device state on connect success or failure and
instead wait for the DBus Connect() method callback but it would
actually still call nm_device_emit_recheck_auto_activate on failure so
refactor state_changed and network_connect_cb to make sure
the state change and nm_device_emit_recheck_auto_activate are only
called from network_connect_cb.

This fixes a race where during a switch from one network to another NM
would immediately start a new activation after state_changed and
network_connect_cb would then handle the Connect failure and mark the
new activation as failed.

(cherry picked from commit 44af62eb1f)
2018-09-26 14:21:01 +02:00
Andrew Zaborowski
0060b63782 wifi/iwd: don't save secrets in mirror NM connections
When creating the mirror 802.1x connections for IWD 802.1x profiles
set the NM_SETTING_SECRET_FLAG_NOT_SAVED flag on the secrets that
may at some point be requested from our agent.  The saved secrets could
not be used anyway because of our use of
NM_SECRET_AGENT_GET_SECRETS_FLAG_REQUEST_NEW in
nm_device_iwd_agent_query.  But also try to respect whatever secret
caching policy has been configured in the IWD profile for those secrets,
IWD would be responsible for storing them if it was allowed in the
profile.

(cherry picked from commit e3aba12d14)
2018-09-26 14:21:01 +02:00
Andrew Zaborowski
9bc58e251c wifi/iwd: access Network objects through ObjectManager
In two places stop using g_dbus_proxy_new_* to create whole new
interface proxy objects for net.connman.iwd.Network as this will
normally have a huge overhead compared to asking the ObjectManager
client that we already have in NMIwdManager for those proxies.
dbus-monitor shows that for each network path returned by
GetOrderedNetworks () -- and we call it every 10 or 20 seconds and may
get many dozens of networks back -- gdbus would do the following each
time:
org.freedesktop.DBus.AddMatch("member=PropertiesChanged")
org.freedesktop.DBus.StartServiceByName("net.connman.iwd")
org.freedesktop.DBus.GetNameOwner("net.connman.iwd")
org.freedesktop.DBus.Properties.GetAll("net.connman.iwd.Network")
org.freedesktop.DBus.RemoveMatch("member=PropertiesChanged")

(cherry picked from commit fd1cfa6db4)
2018-09-26 14:21:01 +02:00