Commit graph

30240 commits

Author SHA1 Message Date
Thomas Haller
b247b5b0b9
firewall: set firewall rules for WireGuard 2022-05-03 09:06:53 +02:00
Thomas Haller
c9326fbb92
firewall: add "topic" enum to NMFirewallConfig
We will use firewall config for different purposes. Currently we have
the "topic" to configure IPv4 sharing (NAT).
2022-05-03 08:20:12 +02:00
Thomas Haller
14ad50f710
firewall: rename parameter "shared"/"add" to "up"
Just makes more sense. In particular "shared" makes not much sense,
especially next, when we are going to add different modes.
2022-05-02 22:21:34 +02:00
Thomas Haller
e5d4194673
build/meson: avoid compiler warning generating "NM-1.0.gir"
In glib_dep we specify

  "-DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_40 -DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_40"

which is the dependency we use almost everywhere. With g-ir-scanner
this causes compiler warnings:

    [xxx] Generating NM-1.0.gir with a custom command
    /src/NetworkManager/build/tmp-introspectnas6f9u5/NM-1.0.c: In function ‘dump_object_type’:
    /src/NetworkManager/build/tmp-introspectnas6f9u5/NM-1.0.c:252:13: warning: Not available before 2.70
      252 |   if (G_TYPE_IS_FINAL (type))
          |             ^~~~~~~~~~~~~~~~~
    /src/NetworkManager/build/tmp-introspectnas6f9u5/NM-1.0.c: In function ‘dump_fundamental_type’:
    /src/NetworkManager/build/tmp-introspectnas6f9u5/NM-1.0.c:370:13: warning: Not available before 2.70
      370 |   if (G_TYPE_IS_FINAL (type))
          |             ^~~~~~~~~~~~~~~~~
    g-ir-scanner: link: gcc -o /src/NetworkManager/build/tmp-introspectnas6f9u5/NM-1.0 /src/NetworkManager/build/tmp-introspectnas6f9u5/NM-1.0.o -L. -Wl,-rpath,. -Wl,--no-as-needed -L/src/NetworkManager/build/src/libnm-client-impl -Wl,-rpath,/src/NetworkManager/build/src/libnm-client-impl -lnm -lgio-2.0 -lgobject-2.0 -lglib-2.0 -lgmodule-2.0 -ludev -lgirepository-1.0 -lgio-2.0 -lgobject-2.0 -Wl,--export-dynamic -lgmodule-2.0 -pthread -lglib-2.0 -lglib-2.0

Work around that.

Meson's gnome.generate_gir() is not very flexibly in allowing to
pass extra `--cflags-begin {} --cflags-end` parameters.
Hack around by adding a pseudo dependency that resets
these defines.

See-also: https://gitlab.gnome.org/GNOME/gobject-introspection/-/merge_requests/331
See-also: 1234e5583a ('build/autotools: avoid compiler warning generating "NM-1.0.gir"')
2022-05-02 22:05:06 +02:00
Thomas Haller
7fd6804e2a
tests/client: improve readme for how to get test-client.py regenerate the test data 2022-05-02 19:03:32 +02:00
Thomas Haller
3ce3ed4c92
examples: improve finding last checkpoint in "checkpoint.py"
This is a python example. We should do nice things, like
using max() for finding the maximum, instead of sorting.
2022-05-02 18:04:37 +02:00
Thomas Haller
6a04bcc59d
core: transfer ownership of strbuf data in _fw_nft_set()
In practice there is little difference.

Previously, "strbuf" would own the string until the end of the function,
when the "nm_auto_str_buf" cleanup attribute destroys it. In the
meantime, we would pass it on to _fw_nft_call_sync(), which in fact
won't access the string after returning.

Instead, we can just transfer ownership to the GBytes instance. That seems
more logical and safer than aliasing the buffer owned by NMStrBuf with
a g_bytes_new_static(). That way, we don't add a non-obvious restriction
on the lifetime of the string. The lifetime is now guarded by the GBytes
instance, which, could be referenced and kept alive longer.

There is also no runtime/memory overhead in doing this.
2022-05-02 16:43:42 +02:00
Adrian Freihofer
04ce34d8dc version: add 1.40 macros 2022-05-01 14:12:20 +02:00
Thomas Haller
e766ca4e7c
contrib: improve nm-in-container.d scripts
Get `ip netns exec` to work. Now we can start stuff in their
own namespace, which is much cleaner.
2022-04-28 19:33:14 +02:00
Thomas Haller
bf058554bd
platform: reorder fields to pack structs in "nm-platform.h" 2022-04-28 16:45:02 +02:00
Thomas Haller
f1f8ae5a83
libnm: drop NM_DEPRECATED_IN_1_2/NM_AVAILABLE_IN_1_2 macros from structs in libnm headers
On rhel-8.7, we are going to no longer use the pre-generated docs, but
instead generate them on build time with "gtk-doc-1.28-4.el8".

That version of gtk-doc has problems with these deprecated/available
macros on the structs, so it will generate:

  /usr/share/gtk-doc/html/libnm/libnm-nm-vpn-service-plugin.html
  /usr/share/gtk-doc/html/libnm/libnm-nm-vpn-plugin-old.html

instead of

  /usr/share/gtk-doc/html/libnm/NMVpnServicePlugin.html
  /usr/share/gtk-doc/html/libnm/NMVpnPluginOld.html

Newer gtk-doc versions don't have this problem.

But as we usually don't use these macros on typedefs (only on functions), and as
1.2 is very old already, it seems simpler to just drop this (instead of
fixing gtk-doc).

See-also: https://bugzilla.redhat.com/show_bug.cgi?id=1995915
2022-04-28 16:39:42 +02:00
Thomas Haller
0ddc664526
trivial: fix code format 2022-04-28 13:39:23 +02:00
Fernando Fernandez Mancera
bf5927b978 l3cfg: drop NM_L3_CFG_COMMIT_TYPE_ASSUME and assume_config_once
ASSUME is causing more troubles than benefits it provides. This patch is
dropping NM_L3_CFG_COMMIT_TYPE_ASSUME and assume_config_once. NM3LCfg
will commit as if the sys-iface-state is MANAGED.

This patch is part of the effort to remove ASSUME from NetworkManager.
After ASSUME is dropped when starting NetworkManager it will take full
control of the interface, re-configuring it. The interface will be
managed from the start instead of assumed and then managed.

This will solve the situations where an interface is half-up and then a
restart happens. When NetworkManager is back it won't add the missing
addresses (which is what assume does) so the interface will fail during
the activation and will require a full activation.

https://bugzilla.redhat.com/show_bug.cgi?id=2050216
https://bugzilla.redhat.com/show_bug.cgi?id=2077605
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1196
2022-04-28 10:48:56 +02:00
Thomas Haller
c3b7ec5b42
platform: merge branch 'th/ipv6-address-order-rh2073032'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1185
2022-04-27 16:03:25 +02:00
Thomas Haller
3d6b6aa317
core: change the priority order in static "ipv6.addresses"
The order of addresses matters. For "ipv4.addresses", the list
contains the primary address first. For "ipv6.addresses", the
order was reverted. This was also documented behavior.

The previous patch just changed behavior with respect to relative order
of static IPv6 addresses and autoconf6/DHCPv6. As we seem in the mood
for changing behavior, here is another one.

Now the addresses are interpreted in an order consistent with IPv4 and
how one might expect: preferred addresses first.
2022-04-27 15:50:55 +02:00
Thomas Haller
4a548423b9
core: change order/priority of static IPv6 addresses relative to autoconf6/DHCPv6
The order of addresses can matter for source address selection.
This is described in RFC 6724 section 5, but if the rules don't
determine a clear winner, the order matters.

Change the relative order of IPv6 addresses. Previously, we would prefer
autoconf6, over DHCPv6, over manual addresses. Now that got reverted
to make more sense and be consistent with IPv4.
Also, if we had multiple autoconf6 addresses (received at different
moments in time), then previously a newly received address would be
added with highest priority. Now, the older address will be preferred
and that order will be enforced (this can be a problem, see (*) below).

For IPv4, it's all simple and sensible. When we add addresses in kernel
via netlink, the first address (of a subnet) becomes the primary.
Note that we only control the order of addresses of the same subnet.
The addresses in ipv4.addresses" are sorted with primary address first.
In the same way is the order for addresses in NML3ConfigData and for
@known_addresses in nm_platform_ip_address_sync(), all primary-first.
Also, manual addresses are sorted with higher priority compared to DHCPv4
addresses (at least since NetworkManager 1.36). That means the way how we
merge NML3ConfigData makes sense (nm_l3_config_data_merge()) because we first
merge the static configuration, then the DHCPv4 configuration, where we just
append the lower priority DHCPv4 addresses.

For IPv6, the address priority is messed up. On netlink/kernel, the last added
address becomes the preferred one (we thus need to add them in the order of
lowest priority first). Consequently and historically, the IPv6 addresses in
@known_addresses parameter to nm_platform_ip_address_sync() were
lowest priority first. And so they were tracked in NML3ConfigData
and in the profile ("ipv6.addresses"). That is confusing.
Also, we usually want to merge NML3ConfigData with different priorities
(e.g. static configuration from the profile before autoconf6/DHCPv6),
as we do with IPv4. However, since internally IPv6 addresses are tracked in
reverse order, it means later NML3ConfigData would be appended and get effectively
a higher priority. That means, autoconf6 addresses were preferred over DHCPv6 and
over manual "ipv6.addresses", respectively. That seems undesirable and inconsistent
with IPv4. Change that. This is a change in behavior.

Note that changing the order of addresses means to remove and re-add
them in the right (inverse) order, with lease important first. This
means, when we add a new address with lower priority, we need to remove
all higher priority addresses temporarily, before readding them. That
is a problem(*).

Note that in the profile, "ipv6.addresses" is still tracked in reverse
order. This did not change, but might change later.
2022-04-27 15:50:50 +02:00
Thomas Haller
6804c2ba04
device: set MTU after attaching bond port
When attaching a bond port, kernel will reset the MTU of the port ([1],
[2]). Configuring a different MTU on the port seems not a sensible
thing for the user to do.

Still, before commit e67ddd826f ('device: commit MTU during stage2')
we would first attach the bond port before setting the MTU. That
changed, and now the MTU set by kernel wins.

Btw, this change in behavior happens because we attach the port in
stage3 (ip-config), which seems an ugly thing to do.

Anyway, fix this by setting the MTU after attaching the ports, but still
in stage3.

It is probably not sensible for the user to configure a different MTU.
Still, if the user requested it by configuration, we should apply it.
Note that NetworkManager has some logic to constrain the MTU based on
the parent/child and controller/port. In many regards however, NetworkManager
does not fully understand or enforce the correct MTU and relies on the
user to configure it correctly. After all, if the user misconfigures the
MTU, the setup will have problems anyway (and in many cases neither
kernel nor NetworkManager could know that the configuration is wrong).

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/net/bonding/bond_main.c?h=v5.17#n3603
[2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/net/bonding/bond_main.c?h=v5.17#n4372

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

Fixes: e67ddd826f ('device: commit MTU during stage2')

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1199
2022-04-27 12:53:18 +02:00
Thomas Haller
7fcfc5ccb3
all: hardcode HOST_NAME_MAX to 64
On glibc, HOST_NAME_MAX is defined as 64. Also, Linux'
sethostname() enforces that limit (__NEW_UTS_LEN). Also,
`man gethostname` comments that HOST_NAME_MAX on Linux is
64.

However, when building against musl, HOST_NAME_MAX is defined as 255.
That seems wrong. We use this limit to validate the hostname, and that
should not depend on the libc or on the compilation.

Hardcode the value to 64.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1197
2022-04-26 17:54:56 +02:00
Yuri Chornoivan
da7dbc0304
po: update Ukrainian (uk) translation
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1198
2022-04-26 08:29:11 +02:00
Thomas Haller
26a0307b8f
clients/tests: declare encoding of utf-8 python source "test-client.py"
The source file now contains UTF-8 (non ASCII) characters. Python2
doesn't like that:

  "./src/tests/client/test-client.sh" "." "." "/usr/bin/python"
    File "/builddir/build/BUILD/NetworkManager-1.39.2/src/tests/client/test-client.py", line 1730
  SyntaxError: Non-ASCII character '\xe2' in file /builddir/build/BUILD/NetworkManager-1.39.2/src/tests/client/test-client.py on line 1730, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details
2022-04-21 12:01:20 +02:00
Lubomir Rintel
a8284b1d3b configure.ac: fix a syntax error
Fixes this error:

  checking whether more special flags are required for pthreads... no
  checking for PTHREAD_PRIO_INHERIT... yes
  ./configure: line 30294: ,as_fn_error: command not found
  checking for a Python interpreter with version >= 3... python
  checking for python... /usr/bin/python

Fixes: 3affccf29b ('tests: fix undefined references to pthread')
2022-04-21 09:57:48 +02:00
Thomas Haller
b3359126ba
glib-aux/tests: fix test for nm_hostname_is_valid() for different HOST_NAME_MAX
nm_hostname_is_valid() determines the valid length based on
HOST_NAME_MAX, which is defined differently for glibc and musl.

Fixes: 9ff1f66680 ('glib-aux: add nm_hostname_is_valid() helper from systemd')
2022-04-20 19:01:54 +02:00
Thomas Haller
47a46344c7
release: bump version to 1.39.2 (development) 2022-04-20 17:48:34 +02:00
Thomas Haller
c041b02744
clients/tests: rename function Util.ReplaceTextUsingRegex to Util.ReplaceTextRegex
Seems to be the better name.
2022-04-20 15:47:57 +02:00
Thomas Haller
e35eceb9e3
clients/tests: add code comment and extend pattern in test_offline() 2022-04-20 15:47:01 +02:00
Thomas Haller
6aef83a556
clients/tests: workaround unexpected output for offline test
This test calls "nmcli g" with a bogus D-Bus bus address. We expect
a failure on stderr.

On alpine:latest, the error however looks slightly different:
  b'size: 258\nlocation: src/tests/client/test-client.py:test_offline()/1\ncmd: $NMCLI g\nlang: C\nreturncode: 1\nstderr: 136 bytes\n>>>\nError: Could not create NMClient object: Key/Value pair 0, *invalid*, in address element *very:invalid* does not contain an equal sign.\n\n<<<\n'
On ubuntu:16.04 and debian:9 we got:
  b"size: 258\nlocation: src/tests/client/test-client.py:test_offline()/1\ncmd: $NMCLI g\nlang: C\nreturncode: 1\nstderr: 136 bytes\n>>>\nError: Could not create NMClient object: Key/Value pair 0, 'invalid', in address element 'very:invalid' does not contain an equal sign.\n\n<<<\n"
On fedora and most recent systemd we got:
  b'size: 258\nlocation: src/tests/client/test-client.py:test_offline()/1\ncmd: $NMCLI g\nlang: C\nreturncode: 1\nstderr: 136 bytes\n>>>\nError: Could not create NMClient object: Key/Value pair 0, ?invalid?, in address element ?very:invalid? does not contain an equal sign.\n\n<<<\n'

This depends on the glib version (whether to print `%s', '%s', or “%s”).
Also, as we run the application with lang=C, so that libc (I think)
replaces Unicode with an ASCII character. Here musl and glibc behave
differently.

Workaround by replace the unexpected text.
2022-04-20 15:34:38 +02:00
Thomas Haller
e27152f315
clients/tests: merge branch 'th/clients-test-replace-text-rework'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1195
2022-04-20 12:29:52 +02:00
Thomas Haller
2140da73a4
clients/tests: add code comment for how to get Polish translations on Fedora 2022-04-20 12:29:45 +02:00
Thomas Haller
7986ea8c1a
clients/tests: rework Util.replace_text() to uniformly accept a callable
Let the replace_arr parameter of Util.replace_text() only contain
callables, and don't special case the argument. Previously, we
either expected a regex or a 2-tuple, and the code would check
each explicitly.

Aside that the tuples are hard to follow, it also makes
Util.replace_text() strongly tied to those types. By instead accepting
and arbitrary function, each element can implement its own replacement.

Also, make text that was replaced by regex atomic. Meaning, if we
first match (and replace) a certain part of the text with the regex,
then the replacement cannot be split again. This is done by returning
a 1-tuple from the replace function.
2022-04-20 12:29:45 +02:00
Thomas Haller
4930cdd3c8
all/systemd: merge branch 'th/replace-systemd-utils-1'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1191
2022-04-20 12:15:34 +02:00
Thomas Haller
747d7dcfe3
systemd: drop "nm-sd-utils-core.h" and nm_sd_utils_id128_get_machine()
This was only for unit testing, to check whether our reader
for "/etc/machine-id" agrees with systemd's.

That unit test was anyway flawed, because it actually accesses
the machine-id on the test system.

Anyway. Drop this. Most likely our parser is good enough, and
if we get a bug report with a defect, we can unit test against
that.
2022-04-20 12:07:04 +02:00
Thomas Haller
e6f0c866d9
systemd: drop unused nm_sd_hostname_is_valid() 2022-04-20 12:07:04 +02:00
Thomas Haller
c4f5111920
all: use nm_hostname_is_valid() instead of systemd code 2022-04-20 12:07:04 +02:00
Thomas Haller
9ff1f66680
glib-aux: add nm_hostname_is_valid() helper from systemd 2022-04-20 12:07:04 +02:00
Thomas Haller
202d9c36c3
systemd: drop systemd path helpers from "nm-sd-utils-shared.h" adapter header
They are now unused, and replaced by nm_path*() utils in glib-aux (which
are forks of the systemd code).
2022-04-20 12:07:03 +02:00
Thomas Haller
f4c7b5b7b7
all: avoid using systemd path utils 2022-04-20 12:07:03 +02:00
Thomas Haller
b5f3d88e6f
glib-aux: add path-utils from systemd
We use these functions, currently from our systemd fork. One day we want
to stop importing systemd code, so we need them ourselves.

Copy them, and adjust for NM style.
2022-04-20 12:07:03 +02:00
Thomas Haller
82cac62fe2
systemd: drop nm_sd_utils_unbase64{char,mem}() wrappers
They are unused now.
2022-04-20 12:07:03 +02:00
Thomas Haller
cdc3e3fa95
libnm: use own nm_unbase64mem_full() instead of systemd's in nm_utils_base64secret_decode() 2022-04-20 12:07:03 +02:00
Thomas Haller
bb0ba779f6
keyfile: use nm_unbase64char() instead of systemd code in _write_setting_wireguard() 2022-04-20 12:06:59 +02:00
Thomas Haller
04fc191922
glib-aux: refactor nm_unbase64mem_full()
Make the code more nm-like.
2022-04-20 12:05:17 +02:00
Thomas Haller
3571292d97
glib-aux: treat '=' as special character in nm_unbase64char()
This will be useful.
2022-04-20 12:05:17 +02:00
Thomas Haller
e3240781b1
glib-aux: use switch in nm_unbase64char()
This seams easier to read. And as we have a unit test that covers all
possible 256 input values, it's easy to refactor and ensure the code
still works.
2022-04-20 12:05:17 +02:00
Thomas Haller
63dcc5680b
glib-aux/tests: add unbase64mem test
This is copied and adjusted from "src/core/tests/test-systemd.c",
where it currently tests the systemd implementation.
2022-04-20 12:05:16 +02:00
Thomas Haller
0aa7d59557
glib-aux: add nm_unbase64{char,mem,mem_full}() helpers
These are taken from systemd code. We want to stop using systemd code,
so we can eventually drop it.
2022-04-20 12:05:16 +02:00
Thomas Haller
c95fd646bc
settings: merge branch 'th/settings-startup-complete-crash'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1192
2022-04-20 11:53:51 +02:00
Thomas Haller
b2a4d706f8
settings: use GSource instead of numeric ID in NMSettings
I find it better style to use GSource pointers for tracking pending
sources.
2022-04-20 11:53:14 +02:00
Thomas Haller
9046975a81
settings: fix assertion failure in NMSettings' _startup_complete_check()
This probably has no bad effects when building without more-asserts.

  #0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at pthread_kill.c:44
  #1  0x00007f7ead0564a3 in __pthread_kill_internal (signo=6, threadid=<optimized out>) at pthread_kill.c:78
  #2  0x00007f7ead009d06 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
  #3  0x00007f7eacfdc7d3 in __GI_abort () at abort.c:79
  #4  0x00007f7ead1fed4c in g_assertion_message (domain=<optimized out>, file=<optimized out>, line=<optimized out>, func=<optimized out>, message=<optimized out>) at ../glib/gtestutils.c:3065
  #5  0x00007f7ead25f98f in g_assertion_message_expr (domain=0x560964f8b7e9 "nm", file=0x560964f83da8 "src/core/settings/nm-settings.c", line=640, func=0x56096504a390 <__func__.44.lto_priv.1> "_startup_complete_check", expr=<optimized out>) at ../glib/gtestutils.c:3091
  #6  0x0000560964ed710e in _startup_complete_check (self=0x560966d1d030, now_msec=<optimized out>) at src/core/settings/nm-settings.c:640
  #7  0x0000560964ed7d9b in _startup_complete_notify_connection (self=0x560966d1d030, sett_conn=<optimized out>, forget=<optimized out>) at src/core/settings/nm-settings.c:704
  #8  0x0000560964edd070 in _connection_changed_delete (self=0x560966d1d030, storage=<optimized out>, sett_conn=0x560966cedbc0, allow_add_to_no_auto_default=<optimized out>) at src/core/settings/nm-settings.c:1244
  #9  0x0000560964edd948 in _connection_changed_process_one (update_reason=(NM_SETTINGS_CONNECTION_UPDATE_REASON_IGNORE_PERSIST_FAILURE | NM_SETTINGS_CONNECTION_UPDATE_REASON_CLEAR_SYSTEM_SECRETS | NM_SETTINGS_CONNECTION_UPDATE_REASON_UPDATE_NON_SECRET | unknown: 0x5400), override_sett_flags=0, sett_mask=NM_SETTINGS_CONNECTION_INT_FLAGS_NONE, sett_flags=1725440360, allow_add_to_no_auto_default=0, sett_conn_entry=0x560966d1d030, self=<optimized out>) at src/core/settings/nm-settings.c:1294
  #10 _connection_changed_process_all_dirty (self=<optimized out>, allow_add_to_no_auto_default=<optimized out>, sett_flags=<optimized out>, sett_mask=<optimized out>, override_sett_flags=<optimized out>, update_reason=<optimized out>) at src/core/settings/nm-settings.c:1335
  #11 0x0000560964eeb8ec in nm_settings_delete_connection (allow_add_to_no_auto_default=648659760, sett_conn=<optimized out>, self=0x560966d1d030) at src/core/settings/nm-settings.c:2457
  #12 nm_settings_connection_delete (self=<optimized out>, allow_add_to_no_auto_default=648659760) at src/core/settings/nm-settings-connection.c:637
  #13 0x0000560964eebebd in delete_auth_cb (self=0x560966cedbc0, context=0x7f7e9c0170a0, subject=0x560966cc5ed0, error=0x0, data=<optimized out>) at src/core/settings/nm-settings-connection.c:1877
  #14 0x0000560964ec9778 in pk_auth_cb (auth_manager=<optimized out>, auth_call_id=<optimized out>, is_authorized=1, is_challenge=<optimized out>, auth_error=<optimized out>, user_data=0x560966e16980) at src/core/settings/nm-settings-connection.c:1262
  #15 0x0000560964db9a28 in _call_id_invoke_callback (error=0x0, is_challenge=0, is_authorized=1, call_id=0x560966ddeb00) at src/core/nm-auth-manager.c:180
  #16 _call_on_idle (user_data=user_data@entry=0x560966ddeb00) at src/core/nm-auth-manager.c:284
  #17 0x00007f7ead23111b in g_idle_dispatch (source=0x560966e50190, callback=0x560964db9900 <_call_on_idle>, user_data=0x560966ddeb00) at ../glib/gmain.c:5848
  #18 0x00007f7ead234d4f in g_main_dispatch (context=0x560966cd1e20) at ../glib/gmain.c:3337
  #19 g_main_context_dispatch (context=0x560966cd1e20) at ../glib/gmain.c:4055
  #20 0x00007f7ead289608 in g_main_context_iterate.constprop.0 (context=0x560966cd1e20, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at ../glib/gmain.c:4131
  #21 0x00007f7ead234463 in g_main_loop_run (loop=0x560966caf010) at ../glib/gmain.c:4329
  #22 0x0000560964cb7515 in main (argc=<optimized out>, argv=<optimized out>) at src/core/main.c:509

Fixes: 3df662f534 ('settings: rework wait-device-timeout handling and consider device compatibility')
2022-04-20 11:53:13 +02:00
Thomas Haller
a3038d4f5a
clients/tests: fix regular expression match in Util.replace_text()
Seems the previous code did not work properly:
With python36-3.6.8-38.module+el8.5.0+12207+5c5719bc.x86_6 on rhel-8.6:

  Traceback (most recent call last):
    File "/root/nm-build/NetworkManager/src/tests/client/test-client.py", line 1157, in f
      func(self)
    File "/root/nm-build/NetworkManager/src/tests/client/test-client.py", line 1724, in test_offline
      replace_stdout=replace_uuids,
    File "/root/nm-build/NetworkManager/src/tests/client/test-client.py", line 797, in call_nmcli
      frame,
    File "/root/nm-build/NetworkManager/src/tests/client/test-client.py", line 997, in _call_nmcli
      self.async_start(wait_all=sync_barrier)
    File "/root/nm-build/NetworkManager/src/tests/client/test-client.py", line 1032, in async_start
      async_job.wait_and_complete()
    File "/root/nm-build/NetworkManager/src/tests/client/test-client.py", line 670, in wait_and_complete
      self._complete_cb(self, return_code, stdout, stderr)
    File "/root/nm-build/NetworkManager/src/tests/client/test-client.py", line 919, in complete_cb
      stdout = Util.replace_text(stdout, replace_stdout)
    File "/root/nm-build/NetworkManager/src/tests/client/test-client.py", line 362, in replace_text
      if Util.is_regex_pattern(v_search):
    File "/root/nm-build/NetworkManager/src/tests/client/test-client.py", line 208, in is_regex_pattern
      t = re.Pattern
  AttributeError: module 're' has no attribute 'Pattern'

On this python version, re.compile() give an object of type
_sre.SRE_Pattern.

  # python -c 'import re; print(type(re.compile("a")))'
  <class '_sre.SRE_Pattern'>

Fixes: beebde9e56 ('client/test: allow matching and replacing regex-es in nmcli output')
2022-04-20 11:01:15 +02:00
Lubomir Rintel
e95482dfd0 merge: branch 'lr/nmcli-offline'
https://bugzilla.redhat.com/show_bug.cgi?id=1361145
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1183
2022-04-19 14:51:50 +02:00