Commit Graph

22377 Commits

Author SHA1 Message Date
Beniamino Galvani
62e6df1f1c systemd: update code from upstream (2019-02-20)
This is a direct dump from systemd git.

======

SYSTEMD_DIR=../systemd
COMMIT=eb5149ba7462e0e27a349fcf9f8514440b06067c

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

git ls-files -z :/src/systemd/src/ \
                :/shared/systemd/src/ \
                :/shared/nm-utils/unaligned.h | \
  xargs -0 rm -f

nm_copy_sd_shared() {
    mkdir -p "./shared/systemd/$(dirname "$1")"
    cp "$SYSTEMD_DIR/$1" "./shared/systemd/$1"
}

nm_copy_sd_core() {
    mkdir -p "./src/systemd/$(dirname "$1")"
    cp "$SYSTEMD_DIR/$1" "./src/systemd/$1"
}

nm_copy_sd_nmutils() {
    mkdir -p "./shared/nm-utils/"
    cp "$SYSTEMD_DIR/$1" "./shared/nm-utils/${1##*/}"
}

nm_copy_sd_core "src/libsystemd-network/arp-util.c"
nm_copy_sd_core "src/libsystemd-network/arp-util.h"
nm_copy_sd_core "src/libsystemd-network/dhcp-identifier.c"
nm_copy_sd_core "src/libsystemd-network/dhcp-identifier.h"
nm_copy_sd_core "src/libsystemd-network/dhcp-internal.h"
nm_copy_sd_core "src/libsystemd-network/dhcp-lease-internal.h"
nm_copy_sd_core "src/libsystemd-network/dhcp-network.c"
nm_copy_sd_core "src/libsystemd-network/dhcp-option.c"
nm_copy_sd_core "src/libsystemd-network/dhcp-packet.c"
nm_copy_sd_core "src/libsystemd-network/dhcp-protocol.h"
nm_copy_sd_core "src/libsystemd-network/dhcp6-internal.h"
nm_copy_sd_core "src/libsystemd-network/dhcp6-lease-internal.h"
nm_copy_sd_core "src/libsystemd-network/dhcp6-network.c"
nm_copy_sd_core "src/libsystemd-network/dhcp6-option.c"
nm_copy_sd_core "src/libsystemd-network/dhcp6-protocol.h"
nm_copy_sd_core "src/libsystemd-network/lldp-internal.h"
nm_copy_sd_core "src/libsystemd-network/lldp-neighbor.c"
nm_copy_sd_core "src/libsystemd-network/lldp-neighbor.h"
nm_copy_sd_core "src/libsystemd-network/lldp-network.c"
nm_copy_sd_core "src/libsystemd-network/lldp-network.h"
nm_copy_sd_core "src/libsystemd-network/network-internal.c"
nm_copy_sd_core "src/libsystemd-network/network-internal.h"
nm_copy_sd_core "src/libsystemd-network/sd-dhcp-client.c"
nm_copy_sd_core "src/libsystemd-network/sd-dhcp-lease.c"
nm_copy_sd_core "src/libsystemd-network/sd-dhcp6-client.c"
nm_copy_sd_core "src/libsystemd-network/sd-dhcp6-lease.c"
nm_copy_sd_core "src/libsystemd-network/sd-ipv4acd.c"
nm_copy_sd_core "src/libsystemd-network/sd-ipv4ll.c"
nm_copy_sd_core "src/libsystemd-network/sd-lldp.c"
nm_copy_sd_core "src/libsystemd/sd-event/event-source.h"
nm_copy_sd_core "src/libsystemd/sd-event/event-util.c"
nm_copy_sd_core "src/libsystemd/sd-event/event-util.h"
nm_copy_sd_core "src/libsystemd/sd-event/sd-event.c"
nm_copy_sd_core "src/libsystemd/sd-id128/id128-util.c"
nm_copy_sd_core "src/libsystemd/sd-id128/id128-util.h"
nm_copy_sd_core "src/libsystemd/sd-id128/sd-id128.c"
nm_copy_sd_core "src/shared/dns-domain.c"
nm_copy_sd_core "src/shared/dns-domain.h"
nm_copy_sd_core "src/systemd/_sd-common.h"
nm_copy_sd_core "src/systemd/sd-dhcp-client.h"
nm_copy_sd_core "src/systemd/sd-dhcp-lease.h"
nm_copy_sd_core "src/systemd/sd-dhcp6-client.h"
nm_copy_sd_core "src/systemd/sd-dhcp6-lease.h"
nm_copy_sd_core "src/systemd/sd-event.h"
nm_copy_sd_core "src/systemd/sd-id128.h"
nm_copy_sd_core "src/systemd/sd-ipv4acd.h"
nm_copy_sd_core "src/systemd/sd-ipv4ll.h"
nm_copy_sd_core "src/systemd/sd-lldp.h"
nm_copy_sd_core "src/systemd/sd-ndisc.h"
nm_copy_sd_nmutils "src/basic/unaligned.h"
nm_copy_sd_shared "src/basic/alloc-util.c"
nm_copy_sd_shared "src/basic/alloc-util.h"
nm_copy_sd_shared "src/basic/async.h"
nm_copy_sd_shared "src/basic/env-file.c"
nm_copy_sd_shared "src/basic/env-file.h"
nm_copy_sd_shared "src/basic/env-util.c"
nm_copy_sd_shared "src/basic/env-util.h"
nm_copy_sd_shared "src/basic/escape.c"
nm_copy_sd_shared "src/basic/escape.h"
nm_copy_sd_shared "src/basic/ether-addr-util.c"
nm_copy_sd_shared "src/basic/ether-addr-util.h"
nm_copy_sd_shared "src/basic/extract-word.c"
nm_copy_sd_shared "src/basic/extract-word.h"
nm_copy_sd_shared "src/basic/fd-util.c"
nm_copy_sd_shared "src/basic/fd-util.h"
nm_copy_sd_shared "src/basic/fileio.c"
nm_copy_sd_shared "src/basic/fileio.h"
nm_copy_sd_shared "src/basic/fs-util.c"
nm_copy_sd_shared "src/basic/fs-util.h"
nm_copy_sd_shared "src/basic/hash-funcs.c"
nm_copy_sd_shared "src/basic/hash-funcs.h"
nm_copy_sd_shared "src/basic/hashmap.c"
nm_copy_sd_shared "src/basic/hashmap.h"
nm_copy_sd_shared "src/basic/hexdecoct.c"
nm_copy_sd_shared "src/basic/hexdecoct.h"
nm_copy_sd_shared "src/basic/hostname-util.c"
nm_copy_sd_shared "src/basic/hostname-util.h"
nm_copy_sd_shared "src/basic/in-addr-util.c"
nm_copy_sd_shared "src/basic/in-addr-util.h"
nm_copy_sd_shared "src/basic/io-util.c"
nm_copy_sd_shared "src/basic/io-util.h"
nm_copy_sd_shared "src/basic/list.h"
nm_copy_sd_shared "src/basic/log.h"
nm_copy_sd_shared "src/basic/macro.h"
nm_copy_sd_shared "src/basic/mempool.c"
nm_copy_sd_shared "src/basic/mempool.h"
nm_copy_sd_shared "src/basic/missing_fcntl.h"
nm_copy_sd_shared "src/basic/missing_type.h"
nm_copy_sd_shared "src/basic/parse-util.c"
nm_copy_sd_shared "src/basic/parse-util.h"
nm_copy_sd_shared "src/basic/path-util.c"
nm_copy_sd_shared "src/basic/path-util.h"
nm_copy_sd_shared "src/basic/prioq.c"
nm_copy_sd_shared "src/basic/prioq.h"
nm_copy_sd_shared "src/basic/process-util.c"
nm_copy_sd_shared "src/basic/process-util.h"
nm_copy_sd_shared "src/basic/random-util.c"
nm_copy_sd_shared "src/basic/random-util.h"
nm_copy_sd_shared "src/basic/refcnt.h"
nm_copy_sd_shared "src/basic/set.h"
nm_copy_sd_shared "src/basic/signal-util.h"
nm_copy_sd_shared "src/basic/siphash24.h"
nm_copy_sd_shared "src/basic/socket-util.c"
nm_copy_sd_shared "src/basic/socket-util.h"
nm_copy_sd_shared "src/basic/sparse-endian.h"
nm_copy_sd_shared "src/basic/stat-util.c"
nm_copy_sd_shared "src/basic/stat-util.h"
nm_copy_sd_shared "src/basic/stdio-util.h"
nm_copy_sd_shared "src/basic/string-table.c"
nm_copy_sd_shared "src/basic/string-table.h"
nm_copy_sd_shared "src/basic/string-util.c"
nm_copy_sd_shared "src/basic/string-util.h"
nm_copy_sd_shared "src/basic/strv.c"
nm_copy_sd_shared "src/basic/strv.h"
nm_copy_sd_shared "src/basic/time-util.c"
nm_copy_sd_shared "src/basic/time-util.h"
nm_copy_sd_shared "src/basic/tmpfile-util.c"
nm_copy_sd_shared "src/basic/tmpfile-util.h"
nm_copy_sd_shared "src/basic/umask-util.h"
nm_copy_sd_shared "src/basic/utf8.c"
nm_copy_sd_shared "src/basic/utf8.h"
nm_copy_sd_shared "src/basic/util.c"
nm_copy_sd_shared "src/basic/util.h"
2019-02-20 17:53:22 +01:00
Thomas Haller
209ff015e2 dhcp: merge branch 'th/dhcp-internal-mulitple-routers'
https://bugzilla.redhat.com/show_bug.cgi?id=1634657

https://github.com/NetworkManager/NetworkManager/pull/265
2019-02-20 10:03:11 +01:00
Thomas Haller
c2b3b9b955 dhcp/internal: handle localhost and 0.0.0.0 DNS/NTP servers specially
- regarding the DHCP options, we should not suppress them. If the lease
  contains such bogus(?) addresses, we still want to expose them on
  D-Bus without modification.

- regrading using the DNS server, ignore localhost addresses like done for
  systemd-networkd ([1], [2]).

Until recently, the DHCP library would internally suppress such
addresses ([3]). That is no longer the case, and we should handle
them specially.

[1] https://github.com/systemd/systemd/issues/4524
[2] d9ec2e632d
[3] 334d5682ae
2019-02-20 10:02:30 +01:00
Thomas Haller
f3e1dea1fe dhcp/internal: handle multiple Router options in internal DHCP clint
https://bugzilla.redhat.com/show_bug.cgi?id=1634657
2019-02-20 10:01:09 +01:00
Thomas Haller
334d5682ae systemd: merge branch 'dhcp-router-option-list'
Also adjust "src/dhcp/nm-dhcp-systemd.c" for the change of the internal
DHCP client API.

https://github.com/systemd/systemd/pull/11208
2019-02-20 09:59:54 +01:00
Thomas Haller
1d0b07bcfc dhcp/internal: cleanup logging and failure handling in lease_to_ip4_config()
... and lease_to_ip6_config().

- Handle reasons that render the lease invalid first, before logging
  anything. This way, upon invalid lease we don't have partially logged
  about the lease.

- prefer logging one line for options that contain multiple values, for
  example for search domains.

- reorder statements to consistently log first before calling add_option().

- prefer

      g_string_append (nm_gstring_add_space_delimiter (str), ...

  over

      g_string_append_printf (str, "%s%s", str->len ? " " : "", ...

- use @addr_str buffer directly, instead of assigning to another
  temporary variable.
2019-02-19 16:18:57 +01:00
Thomas Haller
ca540adfeb systemd: network: avoid inet_ntoa() in favor of inet_ntop()
Imported from systemd:

    inet_ntop() is not documented to be thread-safe, so it should not
    be used in the DHCP library. Arguably, glibc uses a thread local
    buffer, so indeed there is no problem with a suitable libc. Anyway,
    just avoid it.

189255d2b5
2019-02-19 16:18:57 +01:00
Thomas Haller
47123e493a shared: add nm_ip4_addr_is_localhost() util 2019-02-19 16:18:57 +01:00
Thomas Haller
19c3d1f58b systemd: dhcp: move filtering of bogus DNS/NTP addresses out of DHCP client
Imported from systemd:

    The DHCP client should not pre-filter addresses beyond what RFC
    requires. If a client's user (like networkd) wishes to skip/filter
    certain addresses, it's their responsibility.

    The point of this is that the DHCP library does not hide/abstract
    information that might be relevant for certain users. For example,
    NetworkManager exposes DHCP options in its API. When doing that, the
    options should be close to the actual lease.

    This is related to commit d9ec2e632df4905201facf76d6a205edc952116a
    (dhcp4: filter bogus DNS/NTP server addresses silently).

072320eab0
2019-02-19 16:18:57 +01:00
Thomas Haller
39ac79c55d systemd: dhcp: handle multiple addresses for "Router" (option 3) in DHCP library
Imported from systemd:

    The Router DHCP option may contain a list of one or more
    routers ([1]). Extend the API of sd_dhcp_lease to return a
    list instead of only the first.

    Note that networkd still only uses the first router (if present).
    Aside from extending the internal API of the DHCP client, there
    is almost no change in behavior. The only visible difference in
    behavior is that the "ROUTER" variable in the lease file is now a
    list of addresses.

    Note how RFC 2132 does not define certain IP addresses as invalid for the
    router option. Still, previously sd_dhcp_lease_get_router() would never
    return a "0.0.0.0" address. In fact, the previous API could not
    differenciate whether no router option was present, whether it
    was invalid, or whether its first router was "0.0.0.0". No longer let
    the DHCP client library impose additional restrictions that are not
    part of RFC. Instead, the caller should handle this. The patch does
    that, and networkd only consideres the first router entry if it is not
    "0.0.0.0".

    [1] https://tools.ietf.org/html/rfc2132#section-3.5

This also required adjusting "src/dhcp/nm-dhcp-systemd.c" due to the
changed internal API.

f8862395e8
2019-02-19 16:18:57 +01:00
Thomas Haller
2b8434ea46 systemd: network: don't return allocated buffer of zero length from deserialize_in_addrs()
Imported from systemd:

    deserialize_in_addrs() allocates the buffer before trying to parse
    the IP address. Since a parsing error is silently ignored, the returned
    size might be zero. In such a case we shouldn't return any buffer.

    Anyway, there was no leak, because there are only two callers like

        r = deserialize_in_addrs(&lease->dns, dns);

    which both keep the unused buffer and later release it.

    Note that deserialize_in_addrs() doesn't free the pointer before
    reassigning the new output. The caller must take care to to pass
    "ret" with an allocated buffer that would be leaked when returning
    the result.

c24b682162
2019-02-19 16:18:57 +01:00
Thomas Haller
c3f6356a39 docs: use numeric values in enum definitions in public headers
The public headers are parsed with gtk-doc. Define enum values
as plain numbers, otherwise the documentation might have problems
picking up the right value.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/126
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/83
2019-02-19 16:08:11 +01:00
Thomas Haller
83c1a189ff wifi-p2p: merge branch 'benzea/fix-p2p-crash'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/85
2019-02-19 15:25:06 +01:00
Benjamin Berg
3a2aa5632d device: Recheck P2P availability after setting a supplicant interface
The newly set interface may already be in a READY state. In that case,
the device should progress into the DISCONNECTED state rather than
remaining in the UNAVAILABLE state.
2019-02-19 15:00:48 +01:00
Benjamin Berg
3e079e87a5 device: Destroy P2P device with its parent Wifi device
This can for example happen when a wifi device is unmanaged.
2019-02-19 14:04:37 +01:00
Benjamin Berg
27bc2cb22a device: Ensure P2P device is unavailable without wpa_supplicant
Put the device into UNAVAILABLE state when the corresponding WPA
supplicant management interface is unset. This is important to
explicitly clear any pending state changes that are not permissible when
there is no management interface.
2019-02-19 14:01:39 +01:00
Thomas Haller
10600bdb69 libnm: fix leaking checkpoints from NMManager
Fixes: c3efedf54b
2019-02-19 09:33:05 +01:00
Thomas Haller
41ea9fffbb libnm: fix memleak for NMDeviceTun:hw-address
Fixes: 337304f19d
2019-02-19 09:33:05 +01:00
Thomas Haller
25a3825b51 libnm: fix duplicate free in nm_client_checkpoint_rollback()
#0  0x00007fffea7481e5 in _g_log_abort (breakpoint=1) at gmessages.c:554
    #1  0x00007fffea74951d in g_logv (log_domain=0x7fffea78e00e "GLib", log_level=G_LOG_LEVEL_CRITICAL, format=<optimized out>, args=args@entry=0x7fffffffcbb0)
        at gmessages.c:1371
    #2  0x00007fffea7496f3 in g_log
        (log_domain=log_domain@entry=0x7fffea78e00e "GLib", log_level=log_level@entry=G_LOG_LEVEL_CRITICAL, format=format@entry=0x7fffea798320 "%s: assertion '%s' failed")
        at gmessages.c:1413
    #3  0x00007fffea749f2d in g_return_if_fail_warning
        (log_domain=log_domain@entry=0x7fffea78e00e "GLib", pretty_function=pretty_function@entry=0x7fffea799d40 <__func__.4759> "g_atomic_ref_count_dec", expression=expression@entry=0x7fffea799ca1 "g_atomic_int_get (arc) > 0") at gmessages.c:2762
    #4  0x00007fffea754c12 in g_atomic_ref_count_dec (arc=arc@entry=0x5555558c5280) at grefcount.c:260
    #5  0x00007fffea7302c6 in g_hash_table_unref (hash_table=0x5555558c5240) at ghash.c:1101
    #6  0x00007fffea4b6dbc in clear_op_res (simple=0x55555587ed90 [GSimpleAsyncResult]) at gsimpleasyncresult.c:248
    #7  0x00007fffea4b6dbc in g_simple_async_result_finalize (object=0x55555587ed90 [GSimpleAsyncResult]) at gsimpleasyncresult.c:268
    #8  0x00007fffea67b949 in g_object_unref (_object=<optimized out>) at gobject.c:3346
    #9  0x00007fffea67b949 in g_object_unref (_object=0x55555587ed90) at gobject.c:3238
    #10 0x00007fffe95dea2d in checkpoint_rollback_cb (object=<optimized out>, result=<optimized out>, user_data=0x55555587ed90) at libnm/nm-manager.c:1584
    #11 0x00007fffea4ca834 in g_task_return_now (task=0x5555558b5c80 [GTask]) at gtask.c:1148
    #12 0x00007fffea4cb196 in g_task_return (task=0x5555558b5c80 [GTask], type=<optimized out>) at gtask.c:1206
    #13 0x00007fffea5096bb in reply_cb (connection=<optimized out>, res=<optimized out>, user_data=0x5555558b5c80) at gdbusproxy.c:2596
    #14 0x00007fffea4ca834 in g_task_return_now (task=0x5555558b5d50 [GTask]) at gtask.c:1148
    #15 0x00007fffea4cb196 in g_task_return (task=0x5555558b5d50 [GTask], type=<optimized out>) at gtask.c:1206
    #16 0x00007fffea4fdd4a in g_dbus_connection_call_done (source=<optimized out>, result=0x5555558b5e20, user_data=0x5555558b5d50) at gdbusconnection.c:5715
    #17 0x00007fffea4ca834 in g_task_return_now (task=0x5555558b5e20 [GTask]) at gtask.c:1148
    #18 0x00007fffea4ca86d in complete_in_idle_cb (task=task@entry=0x5555558b5e20) at gtask.c:1162
    #19 0x00007fffea73e97b in g_idle_dispatch (source=0x7fffdc04eb90, callback=0x7fffea4ca860 <complete_in_idle_cb>, user_data=0x5555558b5e20) at gmain.c:5620
    #20 0x00007fffea74206d in g_main_dispatch (context=0x5555557c8410) at gmain.c:3182
    #21 0x00007fffea74206d in g_main_context_dispatch (context=context@entry=0x5555557c8410) at gmain.c:3847
    #22 0x00007fffea742438 in g_main_context_iterate (context=0x5555557c8410, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at gmain.c:3920
    #23 0x00007fffea742762 in g_main_loop_run (loop=0x55555584ed00) at gmain.c:4116

Fixes: c3efedf54b
2019-02-19 09:33:05 +01:00
Thomas Haller
c9244d28ae shared: add nm_g_type_find_implementing_class_for_property() helper
A helper method, only useful for printf debugging -- and thus
unused in the source-tree.

It is relatively cumbersome to lookup the GType that implements
a property. For example, for NMDeviceBond.driver, it should return
NMDevice (which implements the "driver" property).
2019-02-19 09:33:05 +01:00
Thomas Haller
fc9d661018 platform/wireguard: fix parsing WGPEER_A_PERSISTENT_KEEPALIVE_INTERVAL from netlink
Fixes: 0827d4c2e4
2019-02-18 15:10:07 +01:00
Thomas Haller
074103f92d all: merge branch 'th/c-list-move'
https://github.com/NetworkManager/NetworkManager/pull/298
2019-02-18 15:01:05 +01:00
Thomas Haller
9ae71bf555 all: use nm_c_list_move_*() helpers 2019-02-18 15:00:10 +01:00
Thomas Haller
a85318f8de shared: add nm_c_list_move_*() helpers 2019-02-18 15:00:10 +01:00
Beniamino Galvani
080f5ee76b ovs: merge branch 'bg/ovs-leaks'
https://github.com/NetworkManager/NetworkManager/pull/296
2019-02-17 19:39:19 +01:00
Beniamino Galvani
29984c07cd ovs: fix dispose()
input and output must be freed only when not NULL.

Also, ovsdb_disconnect() should do nothing if there is no client.

Fixes: 830a5a14cb
2019-02-17 19:39:08 +01:00
Beniamino Galvani
b92f2c9323 ovs: don't leak a GCancellable on connection failure
Every time we clear priv->client we should also clear the cancellable
or it will be leaked.

Fixes: 830a5a14cb
2019-02-17 19:39:08 +01:00
Beniamino Galvani
139b9974fa ovs: fix leak of json objects
Fixes: 830a5a14cb
2019-02-17 19:39:07 +01:00
Beniamino Galvani
8d9685ef98 ovs: use nm_auto_decref_json 2019-02-17 19:39:07 +01:00
Beniamino Galvani
5efa9ff348 shared: add nm_auto_decref_json 2019-02-17 19:39:07 +01:00
Thomas Haller
1423ad24c0 wifi/iwd: fix compiler warning about pointer cast in powered_changed()
../src/devices/wifi/nm-device-iwd.c: In function ‘powered_changed’:
    ../src/devices/wifi/nm-device-iwd.c:2336:15: warning: assignment from incompatible pointer type [enabled by default]
         interface = g_object_ref (priv->dbus_device_proxy);
                   ^
2019-02-17 11:14:08 +01:00
Thomas Haller
9a4cd1efd1 release: update NEWS 2019-02-15 18:40:41 +01:00
Thomas Haller
5923a30c43 settings/ifupdown: fix ifupdown plugin after merging eni_ifaces and connections hashes
The @eni_ifaces hash may now contain %NULL elements. They are only markers
for interface names, but are not actual connections.

They must be skipped.

Fixes: 6aa66426a4

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/124
2019-02-15 16:12:14 +01:00
Thomas Haller
c032690df2 all: merge branch 'th/various-for-wireguard-3'
https://github.com/NetworkManager/NetworkManager/pull/293
2019-02-14 08:00:55 +01:00
Thomas Haller
a3d4dea61f platform: print persistent-keepalive setting of WireGuard peers 2019-02-14 08:00:29 +01:00
Thomas Haller
153b41fa97 platform: add peer_flags argument to nm_platform_link_wireguard_change() 2019-02-14 08:00:29 +01:00
Thomas Haller
1e1b03c089 platform: add flags for setting individual WireGuard options of link 2019-02-14 08:00:29 +01:00
Thomas Haller
2ed01e2e34 platform: add change-flags argument to platform's link_wireguard_change()
We will need more flags.

WireGuard internal tools solve this by embedding the change flags inside
the structure that corresponds to NMPlatformLnkWireGuard. We don't do
that, NMPlatformLnkWireGuard is only for containing the information about
the link.
2019-02-14 08:00:29 +01:00
Thomas Haller
c3751a25a1 device: add mechanism to invoke act_stage2_config() function also for external/assume case
Usually, for external/assume we skip calling act_stage2_config().

Add a flag that allows the device to indicate that it always wants
to be called. This is useful, if the device wants to do some initialization
also for external/assume cases.
2019-02-14 08:00:29 +01:00
Thomas Haller
b45b087bbe device: split activate_stage2_device_config() steps for assumed/external check
Instead of performing a series of steps inside one check for
"!nm_device_sys_iface_state_is_external_or_assume (self)", perform
all steps individually (under the same check).

There is no change in behavior, but this is more logical to me.
We perform a series of steps, depending on condition. Each step
individually depends on a set of conditions, instead of checking
for a set of conditions and doing a series of independent steps.
2019-02-14 08:00:29 +01:00
Thomas Haller
afdf2a21df device: abort device activation if tc_commit() fails in stage2
After we change the device's state to NM_DEVICE_STATE_FAILED,
we must abort processing the current stage.

Fixes: e4bdb21909
2019-02-14 08:00:29 +01:00
Thomas Haller
6f35efe6fe policy: treat WireGuard devices as VPN for DNS
WireGuard devices are (will be) regular NMDevice implementations,
but NMDnsManager should treat them like VPN.

For that, reuse the device's type and nm_device_get_route_metric_default().
2019-02-14 08:00:29 +01:00
Thomas Haller
55ce9d9de9 clients/secret-agent: allow suppressing prompting the entry-id when requesting secrets
When asking for the preshared-key for WireGuard peers, the secret request
will be very verbose with redundant information. Allow suppressing the entry
id from the prompt.
2019-02-14 08:00:29 +01:00
Thomas Haller
ead7c00348 clients/secret-agent: split creation of secret-request data 2019-02-14 08:00:29 +01:00
Thomas Haller
a4f0bda6d4 clients/secret-agent: fail request_secrets_from_ui() if there are no secrets to be requested
From looking at the code above, this likely shouldn't actually happen.
2019-02-14 08:00:29 +01:00
Thomas Haller
6ef825d501 clients/secret-agent: keep setting-name in request-data
It's not really used, but we shouldn't just forget about it.

Currently, we fill requests only based on the connection-type, ignoring
the setting-name. I guess, the concept of requesting secrets for a setting
is utterly broken. But equally broken it is to just look at the connection
(type). At least, don't just throw parts of the request away but keep
it.
2019-02-14 08:00:29 +01:00
Thomas Haller
713e879d76 libnm: add NMSockAddrEndpoint API
NMSockAddrEndpoint is an immutable structure that contains the endpoint
string of a service. It also includes the (naive) parsing of the host and
port/service parts.

This will be used for the endpoint of WireGuard's peers. But since endpoints
are not something specific to WireGuard, give it a general name (and
purpose) independent from WireGuard.

Essentially, this structure takes a string in a manner that libnm
understands, and uses it for node and service arguments for
getaddrinfo().

NMSockAddrEndpoint allows to have endpoints that are not parsable into
a host and port part. That is useful because our settings need to be
able to hold invalid values. That is for forward compatibility (server
sends a new endpoint format) and for better error handling (have
invalid settings that can be constructed without loss, but fail later
during the NMSetting:verify() step).
2019-02-14 08:00:29 +01:00
Thomas Haller
d93845e2c2 libnm: add internal _nm_utils_secret_flags_validate() util 2019-02-14 08:00:29 +01:00
Thomas Haller
28c53ea37e libnm/trivial: rename NM_SETTING_SECRET_FLAG_ALL flag (formerly NM_SETTING_SECRET_FLAGS_ALL)
It should mirror the naming pattern of the flags.
2019-02-14 08:00:29 +01:00
Thomas Haller
99ae5322c9 shared: add macros for initializing NMSecretPtr 2019-02-13 16:03:23 +01:00