Commit Graph

22377 Commits

Author SHA1 Message Date
Beniamino Galvani
22c87f0df8 clients: fix GVariantBuilder memory leak
Fixes: acf86f68b3
2019-03-05 09:21:07 +01:00
Beniamino Galvani
91a644d4a5 clients: fix i/o stream memory leaks
Fixes: 5a0d67f739
2019-03-04 18:09:46 +01:00
Beniamino Galvani
082ae508a0 clients: fix keyfile string memory leak
The return value of g_key_file_get_string() was leaked.

Fixes: 5a0d67f739
2019-03-04 18:09:46 +01:00
Beniamino Galvani
b57a3a4cc6 clients: fix double free
@secrets is unreferenced at the end of request_secrets_from_ui() and
so try_spawn_vpn_auth_helper() must take a reference to it.

Fixes: 1a0fc8d437
2019-03-04 18:08:08 +01:00
Beniamino Galvani
93bbe43695 manager: ignore ovs-system master when assuming connections
This change allows NM to assume after a restart a device that has been
enslaved externally to an ovs bridge.

https://bugzilla.redhat.com/show_bug.cgi?id=1676551
2019-03-04 10:47:00 +01:00
Thomas Haller
6580f2931d ifcfg-rh: avoid duplicate cache lookup in is_wifi_device() 2019-03-04 10:10:47 +01:00
Kristjan SCHMIDT
da10058118 po: update Esperanto (eo) translation
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/86
2019-02-26 19:17:12 +01:00
Beniamino Galvani
60365f9dec wifi: merge branch 'bg/pmf-fix-issue129'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/129
2019-02-26 18:32:14 +01:00
Beniamino Galvani
560a35dd43 supplicant: fix setting pmf when the supplicant doesn't advertise support
wpa_supplicant only advertises pmf support since commit [1], which is
after 2.6. When using a version without that commit (for example,
plain 2.6), we would unconditionally set the global Pmf property to 1
(optional) and then skip setting the per-network property. The result
was that pmf was enabled without the possibility to disable it by
user. The correct behavior is instead to disable pmf on such versions.

[1] https://w1.fi/cgit/hostap/commit/?id=3cdb4ac074f76accf24a51d143db545afad2c90b

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/129
2019-02-26 18:31:24 +01:00
Beniamino Galvani
cab17ff8e0 supplicant: clarify ready_count usage 2019-02-26 18:31:24 +01:00
Thomas Haller
6aa9e52bd8 examples: fix handling secrets in nm-wg-set
When setting any secrets via D-Bus' Update2 call, then
it assumes that all settings are reset. That means, when
we modify any secrets in the client, we need to first load
them all.

Anyway, load always all secrets, then we can also print them
in the get output.

Honor WG_HIDE_KEYS like `wg` does.
2019-02-26 09:34:35 +01:00
Thomas Haller
b5a458c5ff examples: improve hints about existing WireGuard profiles in nm-wg-set 2019-02-26 09:34:35 +01:00
Thomas Haller
8f6a8d0517 libnm,core: fix device TYPE for Wi-Fi P2P devices
Don't use "wifip2p" for the type description.

    $ nmcli device
    DEVICE             TYPE      STATE         CONNECTION
    wlan0              wifi      connected     x
    p2p-dev-wlan0      wifip2p   disconnected  --

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/87
2019-02-26 09:13:03 +01:00
Thomas Haller
8afc075c04 cli/tests: fix cli tests after changing Polish translations
The tests run nmcli with Polish locale and compare the output.
After modifying Polish translation we must regenerate the expected
output.

Fixes: 01b7b32afb
2019-02-25 13:58:13 +01:00
Piotr Drąg
01b7b32afb po: update Polish (pl) translation
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/91
2019-02-25 13:17:51 +01:00
Piotr Drąg
bccf68da1b Mark broken strings in translations as fuzzy
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/89
2019-02-25 13:08:27 +01:00
Thomas Haller
6c1c59d556 release: update NEWS 2019-02-23 12:10:01 +01:00
Thomas Haller
a537e0dcce release: bump version to 1.17.0 (development) 2019-02-23 10:15:58 +01:00
Thomas Haller
11f02622aa release: bump version to 1.15.90 (1.16-rc1) 2019-02-23 10:12:12 +01:00
Thomas Haller
efbd292801 release: update NEWS 2019-02-23 10:10:38 +01:00
Thomas Haller
e4147a7d18 release: update NEWS with entires from 1.14.6 2019-02-23 09:44:35 +01:00
Thomas Haller
5551b3ab55 Revert "build/meson: name platform tests like autotools"
Older versions of meson don't support building the same names
multiple times.

  Meson encountered an error in file src/tests/meson.build, line 14, column 2:
  Tried to create target "test-general", but a target of that name already exists.

We really need to use unique filenames everywhere. Revert the name
change for now.

This breaks again the valgrind workaround in "tools/run-nm-test.sh".

This reverts commit 5466edc63e.
2019-02-23 07:40:03 +01:00
Thomas Haller
5466edc63e build/meson: name platform tests like autotools
Meson and autotools should name the tests the same way.
Also, all tests binaries built by autotools start on purpose
with "test-". Do that for meson too.

Also, otherwise "tools/run-nm-test.sh" fails to workaround
valgrind failures for platform tests as it does not expect
the tests to be named that way:

    if [ $HAS_ERRORS -eq 0 ]; then
        # valgrind doesn't support setns syscall and spams the logfile.
        # hack around it...
        if [ "$TEST_NAME" = 'test-link-linux' -o \
             "$TEST_NAME" = 'test-acd' ]; then
            if [ -z "$(sed -e '/^--[0-9]\+-- WARNING: unhandled .* syscall: /,/^--[0-9]\+-- it at http.*\.$/d' "$LOGFILE")" ]; then
                HAS_ERRORS=1
            fi
        fi
    fi
2019-02-23 07:24:35 +01:00
Thomas Haller
b1f6d53bc4 build/meson: increase timeouts for some tests
The defaults for test timeouts in meson is 30 seconds. That is not long
enough when running

  $ NMTST_USE_VALGRIND=1 ninja -C build test

Note that meson supports --timeout-multiplier, and automatically
increases the timeout when running under valgrind. However, meson
does not understand that we are running tests under valgrind via
NMTST_USE_VALGRIND=1 environment variable.

Timeouts are really not expected to be reached and are a mean of last
resort. Hence, increasing the timeout to a large value is likely to
have no effect or to fix test failures where the timeout was too rigid.
It's unlikely that the test indeed hangs and the increase of timeout
causes a unnecessary increase of waittime before aborting.
2019-02-23 07:20:49 +01:00
Thomas Haller
8f62c76c0a license: re-license initrd-generator and ibft reader as LGPL
New code we want to add LGPL licensed to make it easier to share code
between libnm and the daemon.

The code in question was only recently added in commit b544f7243d
("initrd: add iBFT reader") and mostly written from scratch by Lubomir.

Some parts were adapted from earlier ibft code.

  $ git shortlog -s -e -- src/settings/plugins/ibft/  ':(exclude)*/meson.build'
       3    Beniamino Galvani <bgalvani@redhat.com>
       1    Colin Walters <walters@verbum.org>
       2    Dan Williams <dcbw@redhat.com>
      17    Dan Winship <danw@redhat.com>
       7    Lubomir Rintel <lkundrak@v3.sk>
      46    Thomas Haller <thaller@redhat.com>

  $ git log --no-merges -L '/^fill_ip4_setting_from_ibft/,/^}/:src/settings/plugins/ifcfg-rh/reader.c' fc9c1f1557b517e799d15802e8f3d0ea43b0daea~ | grep '^Author: ' | sort | uniq
  Author: Dan Williams <dcbw@redhat.com>
  Author: Dan Winship <danw@redhat.org>
  Author: Jiří Klimeš <jklimes@redhat.com>
  Author: Pavel Šimerda <psimerda@redhat.com>

Hence, all non-trival contributions were provided by Red Hat employees
and the copy-right is with Red Hat.

Acked-by: Dan Williams <dcbw@redhat.com>
Acked-by: Dan Winship <danw@redhat.com>
Acked-by: Lubomir Rintel <lkundrak@v3.sk>
2019-02-22 21:06:00 +01:00
Thomas Haller
79af876e0e all/trivial: fix whitespace/indentation 2019-02-22 16:28:12 +01:00
Thomas Haller
46bc5feb99 device: fix suppressing warning log about unsupported IPv6LL handling
Wrongly did not suppress the message

    <warn>  [1550844832.3749] device (tunl0): failed to disable userspace IPv6LL address handling (not-supported)

Fixes: d18f40320d
2019-02-22 15:32:17 +01:00
Beniamino Galvani
de1022285a device: do ARP announcements only after masters have a slave
Delay ARP announcements for masters until the first interfaces gets
enslaved. There is no point in doing it before as the ARP packets
would be dropped in most cases; also, if the first slave is added when
we already started announcing, the MAC of the master is going to
change and so the remaining ARPs will have a wrong "sender mac
address" field.

https://bugzilla.redhat.com/show_bug.cgi?id=1678796

https://github.com/NetworkManager/NetworkManager/pull/301
2019-02-22 14:30:40 +01:00
Thomas Haller
e2fe193566 cli: merge branch 'th/nmcli-wifi-p2p-wfd-ies'
https://github.com/NetworkManager/NetworkManager/pull/300
2019-02-22 14:23:52 +01:00
Thomas Haller
95c8f74f8c cli: support NM_SETTING_WIFI_P2P_WFD_IES property 2019-02-22 14:04:13 +01:00
Thomas Haller
0e7e8adc12 cli: rework NM_SETTING_802_1X_PASSWORD_RAW property functions to operate on generic GBytes
Rework the explicit implementation of NM_SETTING_802_1X_PASSWORD_RAW
handling to generically handle GBytes properties.

Note that the NM_SETTING_802_1X_PASSWORD_RAW setter accepts a legacy
format where hex-words are separated by space. I don't think we want
to support this format for new options.

So, there are two possibilities:

1) either leave _set_fcn_802_1x_password_raw() as-is, with the special
   handling.

2) interpret a property-data gobject_bytes.legacy_format.

1) seems to make more sense, because there is only one such property,
and we won't use this for new properties. However let's do 2), because
it shows nicely the two styles side-by-side. In other words, let's
password-raw also be a _pt_gobject_bytes typed property, with some
special legacy handling. Instead, of having it an entirely separate
property type (with a different setter implementation). I think it's
better to have the parts where they differ pushed down (the "stack") as
much as possible.
2019-02-22 14:04:13 +01:00
Thomas Haller
3059a30da9 cli: use nm_utils_bin2hexstr_full() in nmcli to convert bytes to string
- it's less lines of code (for the caller).

 - it's a function that can be easier unit-tested on its own.
   Possibly there are already other unit-tests that cover it.

 - it's more efficient than the GString based implementation.

 - it reuses our one and only bin-to-hexstr implementation.
2019-02-22 14:04:13 +01:00
Thomas Haller
9d0da3e60b shared: support empty blobs in nm_utils_bin2hexstr_full()
The limitation to not accept a length of 0 is easy to forget.

Handle also empty blobs in a sensible way, by returning the
empty word.
2019-02-22 14:04:13 +01:00
Thomas Haller
53b747fff5 all: move nm_utils_hexstr2bin*() to shared
libnm exposes simplified variants of hexstr2bin in its public API. I
think that was a mistake, because libnm should provide NetworkManager
specific utils. It should not provide such string functions.

However, nmcli used to need this, so it was added to libnm.

The better approach is to add it to our internally shared static
library, so that all interested components can make use of it.
2019-02-22 14:04:13 +01:00
Thomas Haller
974a010d80 cli: use correct define for NM_SETTING_WIFI_P2P_WPS_METHOD name
There is no change in behavior, because NM_SETTING_WIFI_P2P_WPS_METHOD
and NM_SETTING_WIRELESS_SECURITY_WPS_METHOD both are "wps-method".
2019-02-22 14:04:13 +01:00
Thomas Haller
4aaa0ed482 wireguard: merge branch 'th/wireguard-pt3'
https://github.com/NetworkManager/NetworkManager/pull/295
2019-02-22 13:54:48 +01:00
Thomas Haller
6d5aa85181 release: update NEWS 2019-02-22 11:01:32 +01:00
Thomas Haller
2148d09482 core/wireguard: add support for WireGuard peers
That is slightly complex, because we need to (DNS) resolve the endpoints,
and we also have to retry periodically. For example, initially we may be
unable to resolve an endpoint, but later we may be.

What is also interesting is that during assume and reapply, we may not
have all information in the profile. Most notably, the private keys will
be missing. We need to cope with that and not reconfigure keys. However,
we still need to resolve names and update the endpoints.
2019-02-22 11:01:04 +01:00
Thomas Haller
7f455f0519 core/wireguard: add basic support for creating wireguard devices
Configuring peers (and allowed-ips of the peers) is not
yet supported.
2019-02-22 11:00:11 +01:00
Thomas Haller
debd022a6d examples: add python example script "nm-wg-set" for modifying WireGuard profile
Use the script to test how GObject introspection with libnm's WireGuard
support works.

Also, since support for WireGuard peers is not yet implemented in nmcli
(or other clients), this script is rather useful.
2019-02-22 11:00:11 +01:00
Thomas Haller
395a78618b libnm/tests: add tests for creating wireguard connection profiles 2019-02-22 11:00:11 +01:00
Thomas Haller
e148ec07d5 libnm: add NMWireGuardPeer and libnm support for peers 2019-02-22 11:00:10 +01:00
Thomas Haller
b521f426ab libnm,cli: add NMSettingWireGuard
For now only add the core settings, no peers' data.

To support peers and the allowed-ips of the peers is more complicated
and will be done later. It's more complicated because these are nested
lists (allowed-ips) inside a list (peers). That is quite unusual and to
conveniently support that in D-Bus API, in keyfile format, in libnm,
and nmcli, is a effort.
Also, it's further complicated by the fact that each peer has a secret (the
preshared-key). Thus we probably need secret flags for each peer, which
is a novelty as well (until now we require a fixed set of secrets per
profile that is well known).
2019-02-22 11:00:10 +01:00
Thomas Haller
1d47643d95 libnm/docs: fix enum definition that confuses gtk-doc
WARNING: Failed to parse "| NM_SETTING_WIRED_WAKE_ON_LAN_IGNORE, /*< skip >*/" in /data/src/NetworkManager/build/../libnm-core/nm-setting-wired.h

Fixes: c3f6356a39
2019-02-22 10:12:13 +01:00
Thomas Haller
57d0d94ba9 platform: merge branch 'th/platform-netlink-cleanup'
https://github.com/NetworkManager/NetworkManager/pull/299
2019-02-22 10:08:59 +01:00
Thomas Haller
bf863aba93 platform: move creation of nlmsg dump request in separate function
Split out the creation of the nlmsg with the netlink dump request.
Also, add a (still unused) parameter to overwrite the preferred
address family.
2019-02-22 10:08:00 +01:00
Thomas Haller
40e0ff9fbf platform: pass lookup instance to nmp_cache_dirty_set_all() instead of object-type
We already have NMPLookup to express a set of objects that can be looked
up via the multi-index.

Change the behavior of nmp_cache_dirty_set_all(), not to accept an
object-type. Instead, make it generally useful and accept a lookup
instance that is used to filter the elements that should be set as
dirty.
2019-02-22 10:08:00 +01:00
Thomas Haller
d431de70ac platform: refactor FOR_EACH_DELAYED_ACTION() macro to have only one for(;;) statement
for-each macros can be nice to use. However, such macros are potentially
error prone, as they abstract C control statements and scoping blocks.

I find it ugly to expand the macro to:

    for (...)
       if (...)

Instead, move the additional "if" check inside the loop's condition
expression, so that the macro only expands to one "for(;;)" statement.
2019-02-22 10:07:33 +01:00
Thomas Haller
7bb6433214 platform: create id-only objects for deleting qdisc/tfilter in event_valid_msg()
It does not matter too much, but the code optimizes for deletion events.
In that case, we don't require parsing the full netlink message.
Instead, it's enough to parse only the ID part so that we can find the
object in the cache that is to be removed removed.

Fix that for qdisc/tfilter objects.
2019-02-22 10:06:35 +01:00
Thomas Haller
e43d1d90f3 platform: minor cleanup in event_valid_msg() 2019-02-22 10:05:00 +01:00