Commit Graph

27768 Commits

Author SHA1 Message Date
Thomas Haller
a4ca3acb6b build: drop duplicate line from Makefile.am 2021-02-09 12:38:16 +01:00
Thomas Haller
1b8ef3282c core/dhcp: don't include "nm-sd-adapt-shared.h" in "nm-dhcp-nettools.c"
The adapter header is not for direct inclusion. It's only for
the systemd sources.
2021-02-09 12:38:16 +01:00
Thomas Haller
5f47a2d44d build/meson: cleanup clients/***/meson.build 2021-02-09 12:38:16 +01:00
Thomas Haller
a9202a0f3d build/meson: cleanup dispatcher/meson.build 2021-02-09 12:38:16 +01:00
Thomas Haller
ab2dcc3289 meson/build: fix c_args for libnmc
This used c_flags, which was previously defined by dispatcher/meson.build,
something unrelated entirely.
2021-02-09 12:38:16 +01:00
Beniamino Galvani
16d649ea92 wifi: auto-activate devices as soon as the first scan finishes
Currently if we detect that a scan finished in
_scan_notify_is_scanning(), we call immediately _scan_kickoff() (which
might start a new scan) and then we check again whether the device can
autoactivate or whether to remove the wifi-scan pending action.

This means that if the scan takes long enough, when
_scan_notify_is_scanning() is called, it is already time to start
another scan and the device activation will be delayed. It will be
delayed until the scan duration becomes shorter than the
exponentially-growing periodic scan interval.

Fix this by delaying the next scan immediately after a scan result.

Co-authored-by: Thomas Haller <thaller@redhat.com>

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/574
2021-02-09 08:55:52 +01:00
Thomas Haller
60800b33b4 all: drop unnecessary cast of g_object_new()
Our cast macros (like NM_AUTH_SUBJECT()) are plain C pointer casts,
unless when building with more asserts enabled.

Still, they are unnecessary and even their ability to check the type
(with more asserts) is not needed, because we must trust glib's
g_object_new() to return reasonable objects. That is a basic
requirement, that we don't need to assert against.

Also, in the majority of cases we don't do this either.
2021-02-08 17:02:09 +01:00
Thomas Haller
0177cb9ade clients/tests: better explain how to configure localized tests 2021-02-08 16:38:54 +01:00
Thomas Haller
1a629a11ce NEWS: update 2021-02-08 16:32:17 +01:00
Thomas Haller
f72278eff7 ethtool: add more offload features that kernel supports
New features:

 - ethtool.feature-macsec-hw-offload
 - ethtool.feature-rx-gro-list
 - ethtool.feature-rx-udp-gro-forwarding
 - ethtool.feature-tls-hw-rx-offload
 - ethtool.feature-tx-gso-list
 - ethtool.feature-tx-tunnel-remcsum-segmentation

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/735
2021-02-08 15:11:11 +01:00
Thomas Haller
4f9a7f883e systemd: merge branch systemd into master 2021-02-08 14:18:59 +01:00
Beniamino Galvani
26aab27587 dhcp: merge branch 'bg/dhcp6-pd-stateless'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/647
2021-02-08 11:15:16 +01:00
Beniamino Galvani
6ed95bd8e5 dhcp: fix requesting prefixes in stateless mode
According to RFC3315 section 15.12, Information-request messages can't
include a IA option (such as IA_NA or IA_PD).

When doing stateless DHCPv6, we start the client in the appropriate
mode to issue an Information-request message: with "-S" for dhclient or
calling sd_dhcp6_client_set_information_request(TRUE) for systemd.

However, if we need a prefix later, the client must be restarted to
ask the prefix. Currently both dhclient and systemd clients are still
configured to send an Information-request with prefixes. Fix that.
2021-02-08 11:14:52 +01:00
Beniamino Galvani
1460054815 device: preserve the DHCPv6 mode when renewing the lease 2021-02-08 11:14:52 +01:00
Thomas Haller
49ea978f08 release: bump version to 1.29.11 (development) 2021-02-08 10:41:35 +01:00
Thomas Haller
d5bf957387 contrib/release: fix release script after moving src directory 2021-02-08 10:26:03 +01:00
Thomas Haller
c5fe35e098 systemd: update code from upstream (2021-02-08)
This is a direct dump from systemd git.

======

SYSTEMD_DIR=../systemd
COMMIT=b433300e4cd5cc9ea6a3240b8d5755fd62c26d99

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

git ls-files -z :/src/core/systemd/src/ \
                :/shared/systemd/src/ \
                :/shared/nm-std-aux/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/core/systemd/$(dirname "$1")"
    cp "$SYSTEMD_DIR/$1" "./src/core/systemd/$1"
}

nm_copy_sd_stdaux() {
    mkdir -p "./shared/nm-std-aux/"
    cp "$SYSTEMD_DIR/$1" "./shared/nm-std-aux/${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/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-dhcp-option.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-dhcp6-option.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_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/cgroup-util.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/errno-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/format-util.c"
nm_copy_sd_shared "src/basic/format-util.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/memory-util.c"
nm_copy_sd_shared "src/basic/memory-util.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_random.h"
nm_copy_sd_shared "src/basic/missing_socket.h"
nm_copy_sd_shared "src/basic/missing_stat.h"
nm_copy_sd_shared "src/basic/missing_syscall.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/ratelimit.c"
nm_copy_sd_shared "src/basic/ratelimit.h"
nm_copy_sd_shared "src/basic/set.h"
nm_copy_sd_shared "src/basic/signal-util.c"
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/sort-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/strxcpyx.c"
nm_copy_sd_shared "src/basic/strxcpyx.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/user-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"
nm_copy_sd_shared "src/shared/dns-domain.c"
nm_copy_sd_shared "src/shared/dns-domain.h"
nm_copy_sd_shared "src/shared/log-link.h"
nm_copy_sd_shared "src/shared/web-util.c"
nm_copy_sd_shared "src/shared/web-util.h"
nm_copy_sd_stdaux "src/basic/unaligned.h"
2021-02-08 10:09:41 +01:00
Thomas Haller
e0c617a68f all: move "src/" directory to "src/core/"
Like commit ac1a9e03e4 ('all: move "src/" directory to "src/core/"')
2021-02-08 09:56:41 +01:00
Thomas Haller
eebd9c2a86 doc: mention NETMASK as alternative to PREFIX for addresses in man nm-settings-ifcfg-rh
https://bugzilla.redhat.com/show_bug.cgi?id=1925123
2021-02-08 09:28:50 +01:00
Beniamino Galvani
afe600caae device: set firewall zone when re-entering stage3
The ifindex of a virtual device is set when the kernel link
appears. For OVS interfaces, this happens after NM has added the
record to the ovsdb; since NM needs to know the related port and
bridge when it adds ovs-interface record, and since interfaces are
enslaved when they reach stage3, the ifindex is set during stage3.

This means that the first time
nm_device_activate_schedule_stage3_ip_config_start() is called, the
ifindex is unset. Previously we would just set the firewall state as
initialized and the zone would never be set again. Instead, allow the
zone to be set when re-entering stage3.

nm_device_activate_schedule_stage3_ip_config_start() now always check
for the ifindex. This guarantees that we don't try to change zone for
devices without a kernel link (for example, OVS bridges and ports).

Upon reaching state ip-check, the device now changes the zone also if
an ifindex is present and the zone was not set before. I'm not sure
this can actually happen, because if the device has an ifindex it
should be set during stage3. However I'm leaving this extra check for
completeness.

https://bugzilla.redhat.com/show_bug.cgi?id=1921107
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/737
2021-02-04 10:50:15 +01:00
Beniamino Galvani
a980d9916d ovs: avoid race condition when system interface is removed from ovsdb
Failing the system interface device is almost always the right thing
to do when the ovsdb entry is removed.

However, to avoid that a late device-removed signal tears down a
different, newly-activated connection, let's also check that we have a
master.  Or in alternative, that the device is assumed/external: in
such case it's always fine to fail the device

Fixes: 8e55efeb9d ('ovs: fail OVS system interfaces when the db entry gets removed')

https://bugzilla.redhat.com/show_bug.cgi?id=1923248
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/741
2021-02-04 10:47:51 +01:00
Thomas Haller
cbb59e3308 autotools: add check-progs target
If you configure with "--enable-tests=no", then the tests
are not build during `make all`, but only during `make check`.
That is convenient for development, so if you don't work on tests,
they usually don't get build and the (partial) compilation is faster.

However, there is no target to build the tests without running them.

Add `make check-progs` for that.
2021-02-04 10:05:28 +01:00
Thomas Haller
ac1a9e03e4 all: move "src/" directory to "src/core/"
Currently "src/" mostly contains the source code of the daemon.
I say mostly, because that is not true, there are also the device,
settings, wwan, ppp plugins, the initrd generator, the pppd and dhcp
helper, and probably more.

Also we have source code under libnm-core/, libnm/, clients/, and
shared/ directories. That is all confusing.

We should have one "src" directory, that contains subdirectories. Those
subdirectories should contain individual parts (libraries or
applications), that possibly have dependencies on other subdirectories.
There should be a flat hierarchy of directories under src/, which
contains individual modules.

As the name "src/" is already taken, that prevents any sensible
restructuring of the code.

As a first step, move "src/" to "src/core/". This gives space to
reorganize the code better by moving individual components into "src/".

For inspiration, look at systemd's "src/" directory.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/743
2021-02-04 09:45:55 +01:00
Thomas Haller
97ed143e04 udev/trivial: rename nm_udev_client_unref() to nm_udev_client_destory()
NMUdevClient does not actually implement ref-counting, because it's not
used. Still, the destroy function was named nm_udev_client_unref(),
because theoretically then we could later, as the need arises, make
the type ref-counted. Then unref function already had the right name.

However, NMUdevClient also has a callback function that emits monitor
events. Again for simplicity, this callback function cannot be reset, it
can only be set once (in the constructor) and can also not be unset nor
disabled.

When the user of NMUdevClient is done with the instance and calls
"unref", then it must be sure that the callback is no longer invoked
afterwards. In practice that is already the case, but "unref" makes it
sound as if somebody else could also still hold a reference -- in which
case the user would have to first unset/disable the callback.

Rename the function to "destroy()", so that it's clear that the instance
is gone afterwards and that the callback will not be invoked anymore.
2021-02-03 14:58:00 +01:00
Thomas Haller
41a28ca9c3 all/udev: use NM_MAKE_STRV() for arguments of nm_udev_client_new() 2021-02-03 14:46:55 +01:00
Beniamino Galvani
fc2844e263 device: group boolean fields together 2021-02-03 13:46:30 +01:00
Thomas Haller
684019d6f1 cloud-setup: add Documentation link to "nm-cloud-setup.service" 2021-02-02 18:13:02 +01:00
Thomas Haller
150c18130e cloud-setup: add comment to "nm-cloud-setup.service" about drop-in files 2021-02-02 18:09:27 +01:00
Thomas Haller
a3d686a0ee man: clarify use of systemctl edit in man nm-cloud-setup 2021-02-02 17:50:58 +01:00
Thomas Haller
81369ac83c libnm/docs: hook up new nm-keyfile API in libnm documentation (fix)
Fixes: 25d64c861c ('libnm/docs: hook up new nm-keyfile API in libnm documentation')
2021-02-02 16:14:04 +01:00
Thomas Haller
25d64c861c libnm/docs: hook up new nm-keyfile API in libnm documentation 2021-02-02 14:44:56 +01:00
Thomas Haller
1ccbae6e4e contrib/rpm: add "enabled=true" key to "20-connectivity-{fedora,redhat}.conf"
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/649
2021-02-02 14:02:31 +01:00
Frederic Martinsons
38331fc02c tests: add a dbus test function to change delay of active connection state change
Signed-off-by: Frederic Martinsons <frederic.martinsons@sigfox.com>

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/740
2021-02-02 10:42:33 +01:00
Antonio Cardace
5a7df5deee bond: merge branch 'ac/bond_change_mode_fix'
https://bugzilla.redhat.com/show_bug.cgi?id=1870691
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/731

Signed-off-by: Antonio Cardace <acardace@redhat.com>
2021-02-02 10:41:28 +01:00
Antonio Cardace
136081957d device: fix bond-slave creation race-condition
In some cases the enslavement event of a device gets
processed by nm-platform before the master NMDevice is
created, in such cases the enslavement information is simply
lost by NM, to prevent this let NMDevice connect to the
'device-ifindex-changed' signal to be notified of when its master
NMDevice appears so that eventually the NMDevices will be consistent
with the kernel network state.

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

Signed-off-by: Antonio Cardace <acardace@redhat.com>
2021-02-02 09:51:58 +01:00
Antonio Cardace
374cc96126 core: add 'device-ifindex-changed' signal
NMManager now emits a 'device-ifindex-changed' whenever
a device ifindex gets changed.

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

Signed-off-by: Antonio Cardace <acardace@redhat.com>
2021-02-02 09:51:58 +01:00
Antonio Cardace
84dc705159 device: add 'master_ifindex' field to NMDevice
https://bugzilla.redhat.com/show_bug.cgi?id=1870691

Signed-off-by: Antonio Cardace <acardace@redhat.com>
2021-02-02 09:51:58 +01:00
Antonio Cardace
d2d74f99a9 bond: release slaves prior to changing mode
Bonds need to release all enslaved devices when
the bond mode is to be changed.

Also release slaves when they're external interfaces as
it means the master it's now managed by NetworkManager.

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

Signed-off-by: Antonio Cardace <acardace@redhat.com>
2021-02-02 09:51:57 +01:00
Antonio Cardace
a4d37612c8 device: take over unmanaged devices when explicitely deactivated
https://bugzilla.redhat.com/show_bug.cgi?id=1870691

Signed-off-by: Antonio Cardace <acardace@redhat.com>
2021-02-02 09:51:57 +01:00
Antonio Cardace
91766a6910 device: make devices 'external' when going to 'unmanaged' state
This is the default state for new devices hence they should
return back to this state when unmanaged.

Signed-off-by: Antonio Cardace <acardace@redhat.com>
2021-02-02 09:51:57 +01:00
Antonio Cardace
6ddfee3751 device: make 'nm_device_master_release_slaves' internal API
https://bugzilla.redhat.com/show_bug.cgi?id=1870691

Signed-off-by: Antonio Cardace <acardace@redhat.com>
2021-02-02 09:51:57 +01:00
Beniamino Galvani
3f4765f30e merge: branch 'bg/macsec-display-ckn'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/739
2021-02-01 18:05:41 +01:00
Beniamino Galvani
c42de1c5b6 supplicant: display the MACsec CKN as hex string
The CKN can contain non-ASCII or NULL bytes. Display the original hex
string from configuration instead.
2021-02-01 18:05:29 +01:00
Beniamino Galvani
18fe100926 supplicant: rename 'hidden' argument
Sometimes the option can't be displayed as is because it contains NULL
or non-ascii characters. Rename the 'hidden' argument of
nm_supplicant_config_add_option_with_type() to 'display_value' so that
callers can pass a preferred string representation of the value.
2021-02-01 18:05:29 +01:00
Beniamino Galvani
2757da7eac device: check ifindex before changing ethernet link settings
During the call to deactivate(), the device can already have lost the
ifindex. Add a check for that to prevent assertion:

 ((src/platform/nm-platform.c:3306)): assertion 'g_return_val_if_fail(ifindex > 0, FALSE)' failed

 0   g_logv (libglib-2.0.so.0 + 0x5bf67)
 1   g_log (libglib-2.0.so.0 + 0x5c223)
 2   _nm_g_return_if_fail_warning.lto_priv.0 (NetworkManager + 0x4c69f)
 3   nm_platform_ethtool_set_link_settings (NetworkManager + 0x183418)
 4   deactivate.lto_priv.1 (NetworkManager + 0x27dfd1)
 5   nm_device_cleanup (NetworkManager + 0x25b047)
 6   _set_state_full (NetworkManager + 0x24f4d8)
 7   nm_device_unrealize (NetworkManager + 0x259e63)
 8   _platform_link_cb_idle (NetworkManager + 0x27097f)
 9   g_idle_dispatch (libglib-2.0.so.0 + 0x5305b)
 10  g_main_context_dispatch (libglib-2.0.so.0 + 0x53f8f)
 11  g_main_context_iterate.constprop.0 (libglib-2.0.so.0 + 0xa74d8)
 12  g_main_loop_run (libglib-2.0.so.0 + 0x53673)
 13  main (NetworkManager + 0x4bdba)
 14  __libc_start_main (libc.so.6 + 0x27b75)
 15  _start (NetworkManager + 0x4c3ee)

https://bugzilla.redhat.com/show_bug.cgi?id=1923062
2021-02-01 15:29:55 +01:00
Thomas Haller
087a3b4955 libnm: fix NMVpnConnectionStateReason for glib-mkenums
The previous form was confusing glib-mkenums parser. Simplify
it.

Fixes: 5022e3b8ee ('libnm: revert coercing NMVpnConnectionStateReason to NMActiveConnectionStateReason')

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/646
2021-02-01 09:31:00 +01:00
Thomas Haller
484b699c78 tools/tests: add usage to "tools/run-nm-test.sh"
Also support specifying the test name after "--".
2021-01-29 08:43:11 +01:00
Thomas Haller
7e32c3efda gitlab-ci: generate new container images for tests
- the python-black version on Fedora 33 was updated, and this formats
  our python code differently. The black version that is used by our
  gitlab-ci is the authoritative version that should be used. Update
  it by regenerating the containers.

- especially Fedora:rawhide and Debian:sid often introduce changes that
  will cause a break of our build. Update the containers to test latest
  versions.
2021-01-28 14:50:39 +01:00
Thomas Haller
7869aacf61 gitlab-ci: skip valgrind on Debian/sid with glib2.0 (2.66.4-2)
See-also: https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1902#note_1018573
2021-01-28 14:50:32 +01:00
Thomas Haller
d446cde260 examples/python: some style update to avoid changes in black code formatting
Fedora 33's version of python-black is the authoritative version we
use for formatting -- note that formatting may look different depending
on the black version.

Recently, the package was updated to 20.8~b1-1.fc33, which treats
these lines different.

Work around that by adjusting the code so that both older and current
versions of python black behave the same.
2021-01-28 10:25:25 +01:00