Commit Graph

21692 Commits

Author SHA1 Message Date
Thomas Haller
d61d6e4276 config: use cleanup attribute for variables in init_sync()
Fixes leaks when we "return FALSE;" above. And in general,
don't use explicit free/unref it's error prone (Q.E.D.).

Fixes: c263f5355c
2018-12-01 15:16:48 +01:00
Beniamino Galvani
446e5b27d6 core: add checks on connection default properties
Add a new CON_DEFAULT() macro that places a property name into a
special section used at runtime to check whether it is a supported
connection default.

Unfortunately, this mechanism doesn't work for plugins so we have to
enumerate the connection defaults from plugins in the daemon using
another CON_DEFAULT_NOP() macro.
2018-12-01 15:16:48 +01:00
Beniamino Galvani
2e45d4ada6 build: check that the list of supported config options is up to date
Add a script run during 'make check' to verify that all config options
are in the list of supported ones.
2018-12-01 15:16:48 +01:00
Beniamino Galvani
32f4abe90b config: warn about unknown keys in config files
Emit a warning when we find an unsupported option in a configuration
file.
2018-12-01 15:16:48 +01:00
Beniamino Galvani
d46b70328d config: use macros for config keys
Every configuration option should be listed in the header file.
2018-12-01 15:16:48 +01:00
Beniamino Galvani
a482b27593 man: add missing connection defaults 2018-12-01 15:16:48 +01:00
Beniamino Galvani
218d7687a0 device: fix wrong connection default property
Fixes: 96cabbcbb8
2018-12-01 15:16:48 +01:00
Thomas Haller
c6f8c0632c shared: allow optional trailing comma in NM_MAKE_STRV()
Supporting a trailing comma in NM_MAKE_STRV() can be desirable, because it
allows to extend the code with less noise in the diff.

Now, there may or may not be a trailing comma at the end.

There is a downside to this: the following no longer work:

  const char *const v1[]  = NM_MAKE_STRV ("a", "b");
  const char *const v2[3] = NM_MAKE_STRV ("a", "b");

but then, above can be written more simply already as:

  const char *const v1[]  = { "a", "b", NULL };
  const char *const v2[3] = { "a", "b" };

so the fact that the macro won't work in that case may be preferable,
because it forces you to use the already existing better variant.
2018-12-01 15:16:48 +01:00
Thomas Haller
122aa550d2 gitlab-ci: patch gtk-doc to generate valid documentation
We generate documentation for pages ([1], [2]), hence, we need to patch
gtk-doc [3].

[1] https://networkmanager.pages.freedesktop.org/NetworkManager/NetworkManager/
[2] https://networkmanager.pages.freedesktop.org/NetworkManager/libnm/
[3] https://gitlab.gnome.org/GNOME/gtk-doc/merge_requests/2
2018-12-01 08:55:44 +01:00
Beniamino Galvani
cf1126f60b cli: avoid crash on device disconnect
When nm_device_disconnect_async() returns, the device could be still
in DEACTIVATING state, and so we also register to device-state signal
notifications to know when the device state goes to DISCONNECTED.

Sometimes it happens that the device state goes to DISCONNECTED before
nm_device_disconnect_async() returns. In this case the signal handler
exits the main loop and then the callback for disconnect_async() is
executed anyway because it was already dispatched, leading to an
invalid memory access.

To avoid this we should cancel nm_device_disconnect_async() when we
are quitting the main loop.

Reproducer:
  nmcli connection add type team ifname t1 con-name t1
  nmcli connection up t1
  nmcli device disconnect t1 & nmcli device delete t1

Crash example:
 ==14955==ERROR: AddressSanitizer: SEGV on unknown address 0xffffffff0000000b (pc 0x7f128c8ba3dd bp 0x0000004be080 sp 0x7ffcda7dc6e0 T0)
 ==14955==The signal is caused by a READ memory access.
    0 0x7f128c8ba3dc in g_string_truncate (/lib64/libglib-2.0.so.0+0x713dc)
    1 0x7f128c8bb4bb in g_string_printf (/lib64/libglib-2.0.so.0+0x724bb)
    2 0x45bdfa in disconnect_device_cb clients/cli/devices.c:2321
    3 0x7f128ca3d1a9 in g_simple_async_result_complete /usr/src/debug/glib2-2.58.1-1.fc29.x86_64/gio/gsimpleasyncresult.c:802
    4 0x7f128cf85d0e in device_disconnect_cb libnm/nm-device.c:2354
    5 0x7f128ca4ff73 in g_task_return_now /usr/src/debug/glib2-2.58.1-1.fc29.x86_64/gio/gtask.c:1148
    6 0x7f128ca508d5 in g_task_return /usr/src/debug/glib2-2.58.1-1.fc29.x86_64/gio/gtask.c:1206
    7 0x7f128ca8ecfc in reply_cb /usr/src/debug/glib2-2.58.1-1.fc29.x86_64/gio/gdbusproxy.c:2586
    8 0x7f128ca4ff73 in g_task_return_now /usr/src/debug/glib2-2.58.1-1.fc29.x86_64/gio/gtask.c:1148
    9 0x7f128ca508d5 in g_task_return /usr/src/debug/glib2-2.58.1-1.fc29.x86_64/gio/gtask.c:1206
    10 0x7f128ca83440 in g_dbus_connection_call_done /usr/src/debug/glib2-2.58.1-1.fc29.x86_64/gio/gdbusconnection.c:5713
    11 0x7f128ca4ff73 in g_task_return_now /usr/src/debug/glib2-2.58.1-1.fc29.x86_64/gio/gtask.c:1148
    12 0x7f128ca4ffac in complete_in_idle_cb /usr/src/debug/glib2-2.58.1-1.fc29.x86_64/gio/gtask.c:1162
    13 0x7f128c893b7a in g_idle_dispatch gmain.c:5620
    14 0x7f128c89726c in g_main_dispatch gmain.c:3182
    15 0x7f128c897637 in g_main_context_iterate gmain.c:3920
    16 0x7f128c897961 in g_main_loop_run (/lib64/libglib-2.0.so.0+0x4e961)
    17 0x473afb in main clients/cli/nmcli.c:1067
    18 0x7f128c6a1412 in __libc_start_main (/lib64/libc.so.6+0x24412)
    19 0x416c39 in _start (/usr/bin/nmcli+0x416c39)

https://github.com/NetworkManager/NetworkManager/pull/254
https://bugzilla.redhat.com/show_bug.cgi?id=1546061
2018-11-30 14:15:27 +01:00
Lubomir Rintel
7f74c66a64 merge: branch 'lr/olpc-fixes2'
https://github.com/NetworkManager/NetworkManager/pull/252
2018-11-29 17:54:02 +01:00
Lubomir Rintel
64e51241e6 cli: fix a couple of typos 2018-11-29 17:53:35 +01:00
Lubomir Rintel
b385ad0159 all: say Wi-Fi instead of "wifi" or "WiFi"
Correct the spelling across the *entire* tree, including translations,
comments, etc. It's easier that way.

Even the places where it's not exposed to the user, such as tests, so
that we learn how is it spelled correctly.
2018-11-29 17:53:35 +01:00
Lubomir Rintel
3a999475ef wifi/olpc-mesh: allow autoconnect
There's no reason the mesh shouldn't autoconnect. Almost.

The mesh and regular Wi-Fi shares the same radio. There, in the first
place, probably shouldn't have been separate NMDevices. Not sure whether
we can fix it at this point, but we can surely avoid unnecessary
competition between the two devices: give the regular Wi-Fi priority and
only connect mesh if the regular companion stays disconnected.

For the record; connections shipped on XO-1 laptops all have
autoconnect=off and thus are not affected by this.
2018-11-29 17:50:00 +01:00
Lubomir Rintel
64b95d567b wifi/wext: fix double quoting
_nm_utils_ssid_to_string_arr() already escapes/quotes the string.
2018-11-29 17:50:00 +01:00
Lubomir Rintel
d64e577272 wifi: do not persist the mac address on AddAndActivate
If the client wants to pinpoint the connection to a particular device
they can just add an appropriate property.

That said, MAC address probably even doesn't count as appropriate; an
interface name is supposed to stay stable and could be used in such
cases.

This fixes the case where "nmcli d wifi connect ..." ends up with a
connection tied to a rather random device that happened to be around
even without the "ifname" argument.
2018-11-29 17:50:00 +01:00
Soapux
a31271d154 meson/libnm.pc: set vpnservicedir path relative to ${prefix}
Make it possible to relocate it under a different prefix:

  $ pkg-config --define-variable=prefix=/whatever
               --variable=vpnservicedir libnm

https://github.com/NetworkManager/NetworkManager/pull/202
2018-11-29 16:10:00 +01:00
Thomas Haller
803514df27 dnsmasq/shared: fix setting DNS nameserver and search for shared dnsmasq
Fixes: c8fa7b6f57
2018-11-29 14:20:24 +01:00
Thomas Haller
a8f0da9f91 device: merge branch 'th/device-set-mac-addr-no-down'
https://bugzilla.redhat.com/show_bug.cgi?id=1639274

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/54
2018-11-29 14:02:22 +01:00
Thomas Haller
e206a34732 device: avoid taking down link to change MAC address
A lot of drivers actually support changing the MAC address of a link
without taking it down.

Taking down a link is very bad, because kernel will remove routes
and IPv6 addresses.

For example, if the user used a dispatcher script to add routes,
these will be lost. Note that we may change the MAC address of a
device any time. For example, a VLAN device watches the parent's
MAC address and configures it (with a logging message "parent hardware
address changed to ...").

Try first whether we can change the MAC address without taking the
link down. Only if that fails, retry with taking it down first.

https://bugzilla.redhat.com/show_bug.cgi?id=1639274
2018-11-29 13:50:10 +01:00
Thomas Haller
b445b1f8fe platform: add nm_platform_link_get_ifi_flags() helper
Add helper nm_platform_link_get_ifi_flags() to access the
ifi-flags.

This replaces the internal API _link_get_flags() and makes it public.
However, the return value also allows to distinguish between errors
and valid flags.

Also, consider non-visible links. These are links that are in netlink,
but not visible in udev. The ifi-flags are inherrently netlink specific,
so it seems wrong to pretend that the link doesn't exist.
2018-11-29 13:50:10 +01:00
Sebastien Fabre
dc0cdbb57e dbus: register object manager object before requesting dbus name
Working on NetworkManager 1.12.4 and sometimes (rarely), when creating
a NM client object before NetworkManager service start, this object will
never be running.
In that case, we can see the following log:
"[GLIB-GLib-GIO WARN] Error calling GetManagedObjects() when name
owner :1.5 for name org.freedesktop.NetworkManager came back:
GDBus.Error:org.freedesktop.DBus.Error.UnknownMethod:
No such interface 'org.freedesktop.DBus.ObjectManager' on object
at path /org/freedesktop".

Object Manager object shall be registered before requesting dbus name
to be sure that 'org.freedesktop.Dbus.ObjectManager' interface is present
when name owner change is received by libnm.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/51
2018-11-29 07:55:16 +01:00
Thomas Haller
15a2a291ea dhcp: merge branch 'th/internal-dhcp6-iaid'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/52
2018-11-29 07:52:02 +01:00
Thomas Haller
80ac8e40a2 dhcp: disable systemd's dhcp_identifier_set_iaid()
dhcp_identifier_set_iaid() is no longer called. Replace
the code with an assertion and always fail.

The function was already annoying previously, because it would
require udev API to generate the IAID. So, we were already required
to patch this function.
2018-11-29 07:48:20 +01:00
Thomas Haller
f2f44a7aca dhcp: always explicitly set IAID of internal DHCPv6 client
During start, sd_dhcp6_client would call client_ensure_iaid(),
to initialize the IAID.

First of all, the IAID is important to us, we should not leave the
used IAID up to an implementation detail. In the future, we possibly
want to make this configurable.

The problem is that client_ensure_iaid() calls dhcp_identifier_set_iaid()
which looks up the interface name via if_indextoname() (in our fork).
The problem is that dhcp_identifier_set_iaid() looks up information by
quering the system, which makes it hard for testing and also makes it
unpredictable. It's better to use our implementation nm_utils_create_dhcp_iaid(),
which is solely based on the interface-name, which is given as a well
defined parameter to the DHCP client instance.
2018-11-29 07:48:20 +01:00
Thomas Haller
0ae18f0680 core: add nm_utils_create_dhcp_iaid() util
Split out nm_utils_create_dhcp_iaid(), we will need it later.
This is also a re-implementation of systemd's dhcp_identifier_set_iaid().
2018-11-29 07:48:20 +01:00
Thomas Haller
39a1323181 dhcp6-client: handle IAID with value zero
config_parse_iaid(), dhcp_identifier_set_iaid() and sd_dhcp6_client_set_iaid() all
allow for the IAID to be zero. Also, RFC 3315 makes no mention that zero
would be invalid.

However, client_ensure_iaid() would take an IAID of zero as a sign that
the values was unset. Fix that by keeping track whether IAID is
initialized.

https://github.com/systemd/systemd/pull/10895
0e408b82b8
2018-11-29 07:46:57 +01:00
Damien Cassou
b104b9b828 wifi: improve description of D-Bus' RequestScan()
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/56
2018-11-28 20:47:11 +01:00
Thomas Haller
d83e8ddb33 platform,shared: merge branch 'th/monotonic-timestamp-cleanup'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/55
2018-11-28 16:15:41 +01:00
Thomas Haller
32073288e8 shared: thread safe initialization of nm_utils_get_monotonic_timestamp*()
nm_utils_get_monotonic_timestamp*() inherrently use static data. Let's
initialize it in a thread safe manner.

nm_utils_get_monotonic_timestamp*() are a fundamental utility function
that should work correctly in all cases. Such a low level function should
be thread safe.
2018-11-28 16:13:04 +01:00
Thomas Haller
e180464bcc platform/tests: fix assertion for unit test for address lifetime
Sometimes the test fail:

    $ make -j 10 src/platform/tests/test-address-linux
    $ while true; do
          NMTST_DEBUG=d ./tools/run-nm-test.sh src/platform/tests/test-address-linux 2>&1 > log.txt || break;
      done

fails with:

    ERROR: src/platform/tests/test-address-linux - Bail out! test:ERROR:src/platform/tests/test-common.c:790:nmtstp_ip_address_assert_lifetime: assertion failed (adr <= lft): (1001 <= 1000)

That is, because of a wrong check. Fix it.
2018-11-28 16:13:04 +01:00
Thomas Haller
de3f6cfb98 doc,all: fix spelling of Open vSwitch (instead of OpenVSwitch)
Also affects documentation and translated strings.

Reported-by: Flavio Leitner <fbl@redhat.com>
2018-11-28 14:26:42 +01:00
Lubomir Rintel
d6c2f23b9e initrd: actually use the constructed filename
Otherwise the file gets dumped into CWD instead of the intended location
in the connection dir.

Fixes: 61717cc575
2018-11-27 11:18:08 +01:00
Patrick Talbert
25a0739658 clients: Fix typo in _dump_team_link_watcher output
This makes the output of a 'con show' for a team device look suspect.

Signed-off-by: Patrick Talbert <ptalbert@redhat.com>

Fixes: 4657390d45

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/53
2018-11-23 17:37:44 +01:00
Beniamino Galvani
94ea3a5e1b team: make teamd log to syslog
When teamd is started in foreground it logs to stderr and its output
appears in the journal as coming from NM, which is quite confusing.

Use the new TEAM_LOG_OUTPUT environment variable [1] to tell teamd to
log through syslog, unless NetworkManager is in debug mode.

[1] https://github.com/jpirko/libteam/commit/e47d5db53873

https://bugzilla.redhat.com/show_bug.cgi?id=1596917
2018-11-23 13:59:37 +01:00
Thomas Haller
9d122e7b80 systemd: merge branch systemd into master 2018-11-23 11:38:02 +01:00
Thomas Haller
48d64de177 systemd: update code from upstream (2018-11-23)
This is a direct dump from systemd git.

======

SYSTEMD_DIR=../systemd
COMMIT=91540eaa5c636f4073955f025c4e72b1bbb4f2e9

(
  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-ipv4acd.c"
nm_copy_sd "src/libsystemd-network/sd-ipv4ll.c"
nm_copy_sd "src/libsystemd-network/sd-lldp.c"
nm_copy_sd "src/libsystemd/sd-event/event-source.h"
nm_copy_sd "src/libsystemd/sd-event/event-util.c"
nm_copy_sd "src/libsystemd/sd-event/event-util.h"
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-11-23 10:53:12 +01:00
Thomas Haller
a294ca3eec man: advise against configuring "monitor-connection-files" in NetworkManager.conf 2018-11-23 09:57:24 +01:00
Thomas Haller
108eccf016 core: use nm_g_object_set_property() for setting properties from D-Bus
g_object_set_property() cannot fail nor signal an error reason when
invalid arguments are passed. Use our wrapper nm_g_object_set_property()
instead.

Note that the input argument comes from untrusted (although authenticated)
source.
2018-11-22 14:51:21 +01:00
Beniamino Galvani
e909778710 lldp: fix parsing of vlan-name attribute
We used to read 3 bytes after the TLV, fix this.

Also, check that string length is at most 32 bytes as specified in
figure E.3 of IEEE 802.1AB-2009.

Fixes: 18133ea142

https://bugzilla.redhat.com/show_bug.cgi?id=1652210
2018-11-22 09:08:00 +01:00
Thomas Haller
1994f200ce libnm/doc: document NMActiveConnection::state-changed signal 2018-11-21 14:09:04 +01:00
Lubomir Rintel
3a282cb2b9 merge: branch 'lr/ac-sort'
https://github.com/NetworkManager/NetworkManager/pull/249
2018-11-21 11:46:38 +01:00
Lubomir Rintel
def03fd7cf cli/connections: improve sort by active connections
When sorting the active connections, use the same policy as "nmcli" and
"nmcli d", not just the connection state. It looks better that way.
2018-11-21 11:46:22 +01:00
Lubomir Rintel
13d2d332dd cli: deduplicate active connections sort
Both connections and devices need to sort active connections. Make the
more sensible policy default.
2018-11-21 11:46:22 +01:00
Lubomir Rintel
522fd14251 cli/connections: export nmc_active_connection_cmp()
To be able to sensibly sort devices we want to be able to sort their
active connections. Currently it's implemented redundantly.
2018-11-21 11:46:21 +01:00
Lubomir Rintel
2a7e60d724 cli/devices: sort hotspots above in nmcli output
In general we want to keep the connections that the user is most likely
to want to see topmost. Default connections should be close to the top,
but the connections that are likely to have been brought up manually
shall be above them. It applies to VPN connections and should apply to
Hotspots too.
2018-11-21 11:46:21 +01:00
Lubomir Rintel
42e4d09844 libnm/remote-connection: fix "flags" property getter
Fixes: acc8244ca2

https://github.com/NetworkManager/NetworkManager/pull/250
2018-11-21 11:44:29 +01:00
Beniamino Galvani
8af4f76638 cli: merge branch 'bg/cli-editor-save-rh1546805'
https://github.com/NetworkManager/NetworkManager/pull/244
https://bugzilla.redhat.com/show_bug.cgi?id=1546805
2018-11-20 15:20:20 +01:00
Beniamino Galvani
a370faeb59 cli: wait for changed signal after updating a connection
In editor_menu_main(), after saving a connection we wait that the
Update2() D-Bus call returns and then we copy the NMRemoteConnection
instance over to @connection.

This assumes that when Update2() returns the remote connection
instance is already updated with new settings. Indeed, on server side
the NMSettingsConnection first emits the "Updated" signal and then
returns to Update2(). However, the Updated signal doesn't include the
new setting values and so libnm has to fire an asynchronous
nmdbus_settings_connection_call_get_setting() to fetch the new
settings, which terminates after the Update2().

So, to be sure that the remote connection got updated we have also to
listen to the connection-changed signal, which is always emitted after
an update.

https://bugzilla.redhat.com/show_bug.cgi?id=1546805
2018-11-20 15:16:53 +01:00
Beniamino Galvani
096eef61d4 cli: editor: reload secrets after updating connection
Connection secrets are lost after calling
nm_connection_replace_settings_from_connection() because @con_tmp
doesn't contain secrets; refetch them like we do when starting the
editor.
2018-11-20 15:15:58 +01:00