Commit Graph

32561 Commits

Author SHA1 Message Date
Beniamino Galvani
fc13215826 ovs: implement asynchronous detach_port()
Make detach_port() return only after ovsdb reports that the operation
finished.
2023-04-04 08:21:22 +02:00
Beniamino Galvani
07dc237e5c device: wait port detach before leaving the DEACTIVATING state
The device shouldn't change state from DEACTIVATING to DISCONNECTED
until its detached from its controller; otherwise, the port detach
that is in progress can conflict with the following activation.
2023-04-04 08:21:22 +02:00
Beniamino Galvani
82d0fa2a87 device: make detach_port() method asynchronous
This changes the signature of detach_port() to be asynchronous,
similarly to attach_port(). The implementation can return TRUE/FALSE
on immediate completion.

Current implementations return immediately and so there is no change
in behavior for now.
2023-04-04 08:21:22 +02:00
Thomas Haller
de8104c71c device: fix assertion condition in _dev_ipdhcpx_start()
src/core/devices/nm-device.c: In function '_dev_ipdhcpx_start':
  src/core/devices/nm-device.c:10672:13: error: logical 'or' of collectively exhaustive tests is always true [-Werror=logical-op]
               nm_assert(pd_hint_length > 0 || pd_hint_length <= 128);
               ^
  src/core/devices/nm-device.c:10672:13: error: logical 'or' of collectively exhaustive tests is always true [-Werror=logical-op]
  src/core/devices/nm-device.c:10672:13: error: logical 'or' of collectively exhaustive tests is always true [-Werror=logical-op]

Fixes: e2b9019ac0 ('dhcp: support prefix delegation hint')
2023-04-04 08:19:20 +02:00
Beniamino Galvani
3127810158 merge: branch 'bg/dhcp6-pd-hint'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1581
2023-04-03 16:05:27 +02:00
Beniamino Galvani
fa997be216 dhcp: export the prefix delegation
Export the IA_PD option so that it is available via D-Bus and in the
lease file in /run.
2023-04-03 16:04:55 +02:00
Beniamino Galvani
e2b9019ac0 dhcp: support prefix delegation hint
Support the prefix delegation hint in the DHCP client.

dhclient only supports a prefix length, emit a warning if the user set
a non-zero prefix.
2023-04-03 16:04:55 +02:00
Beniamino Galvani
f9c1d06e64 libnm,nmcli: add ipv6.dhcp-pd-hint property
Add a new property to specify a hint for DHCPv6 prefix delegation.
2023-04-03 16:04:55 +02:00
Thomas Haller
af078a7d54 core: merge branch 'th/dameon-helper-cleanup'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1588
2023-04-03 10:29:54 +02:00
Thomas Haller
f58a69656a core: error out in nm_utils_kill_child_{sync,async}() if first waitpid() gives ECHILD
It is wrong trying to send the signal still. Just error out.

Note that ECHILD indicates that the process is either not a child
or was already reaped. In both cases, that is a bug of the caller
who must keep accurate track of the child's process ID.
2023-04-03 10:27:43 +02:00
Thomas Haller
a65e80e8b6 core: pre-allocate exact buffer size for output in nm_utils_spawn_helper()
It's easy enough to know how many bytes are needed. Just allocate the
right size (+1, because NMStrBuf really likes to reserve that extra byte
for the trailing NUL, even if it's not needed in this case).
2023-04-03 10:27:43 +02:00
Thomas Haller
346196792c core/trivial: add code comment about using GChildWatchSource 2023-04-03 10:27:43 +02:00
Thomas Haller
597e127bcb core: use nm_g_child_watch_source_new() in nm_utils_spawn_helper() 2023-04-03 10:27:43 +02:00
Thomas Haller
a52d620549 core: assert that nm_utils_spawn_helper() is used with default context 2023-04-03 10:27:43 +02:00
Thomas Haller
3411f42418 core: store main context in variable in nm_utils_spawn_helper()
There is no change in behavior, because the GTask's context
is of course g_main_context_get_thread_default(). Still, not point
in making that unclear.
2023-04-03 10:27:43 +02:00
Thomas Haller
f9c409d34c core: qualify logging lines related to helper with "nm-daemon-helper"
Seems to be the better name, because that is also the name of the
executable.
2023-04-03 10:27:43 +02:00
Thomas Haller
f74109e4b0 core: rename nmlog defines in "nm-core-utils.c"
Those are related to _NMLOG2() macro. Rename.
2023-04-03 10:27:43 +02:00
Thomas Haller
b5875ec79e core: use nm_clear_fd() helper in nm_utils_spawn_helper() 2023-04-03 10:27:43 +02:00
Yuri Chornoivan
a26c79e495 po: update Ukrainian (uk) translation
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1592
2023-04-03 09:40:41 +02:00
Thomas Haller
8d6349156b libnm/tests: avoid uninitialized variable warning in _invalid_option_write_handler()
src/libnm-core-impl/tests/test-keyfile.c: In function '_invalid_option_write_handler':
  src/libnm-core-impl/tests/test-keyfile.c:917:9: error: 'message' may be used uninitialized [-Werror=maybe-uninitialized]
    917 |         g_assert(message && strstr(message, "ethtool.bogus"));
        |         ^
  src/libnm-core-impl/tests/test-keyfile.c:905:29: note: 'message' was declared here
    905 |     const char             *message;
        |                             ^
  lto1: all warnings being treated as errors
2023-03-31 18:15:50 +02:00
Thomas Haller
17601acd3d clients/tests: merge branch 'th/test-client-fixes'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1591
2023-03-31 17:43:11 +02:00
Thomas Haller
342ee618c7 client/tests: don't do dup2() dance to pass file descriptor to "tools/test-cloud-meta-mock.py"
"preexec_fn" is not great, because it is not generally safe in multi
threaded code (and we don't know whether the test didn't start other
threads already, like a GDBus worker thread). Well, it probably is safe,
if you only call async signal safe code, but it's not clear what os.dup2()
does under the hood.

Just avoid that. We can pass on the FD directly.
2023-03-30 15:36:16 +02:00
Thomas Haller
d533072962 client/tests: close process stdin in test-python.py to avoid warning about leak
test_ec2 (__main__.TestNmCloudSetup.test_ec2) ... /usr/lib64/python3.11/unittest/case.py:579: ResourceWarning: unclosed file <_io.BufferedWriter name=5>
    if method() is not None:
  ResourceWarning: Enable tracemalloc to get the object allocation traceback
  ok

Fixes: d89d42bf23 ('tests/client: test nm-cloud-setup')
2023-03-30 15:35:22 +02:00
Thomas Haller
a9558231cf client/tests: drop unnecessary socket.set_inheritable() call from "test-client.py"
This seems unnecessary, because we spawn the child process via subprocess.Popen and
set "pass_fds". That already ensures to pass on the FD.

Worse, socket.set_inheritable() is only added in Python 3.4, that means the
test is gonna break for Python 3.2 and 3.3. Just avoid that by not using the
unnecessary function. For the same reason, drop "inheritable=True" from
os.dup2(). "inheritable=True" is already the default, but only exists
since Python 3.4.

Fixes: d89d42bf23 ('tests/client: test nm-cloud-setup')
2023-03-30 15:06:54 +02:00
Thomas Haller
15c25e91f5 client/tests: skip cloud-setup test for older python
The test uses subprocess.Popen()'s "pass_fd" argument. That is only
available since Python 3.2. Possibly it could be solved differently, but
that is not implemented. Instead, skip the test.

Also, socket.socket.set_inheritable() is Python 3.4. But presumably
we don't need it.

Fixes: d89d42bf23 ('tests/client: test nm-cloud-setup')
2023-03-30 14:56:14 +02:00
Thomas Haller
9ed802b0c2 wwan/ofono: merge branch 'peat-psuwit:for-upstream/combined-context-mms-proxy-route'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1584
2023-03-30 08:41:46 +02:00
Ratchanan Srirattanamet
bb226d4ed1 wwan/ofono: account for port in the Proxy property 2023-03-30 08:41:35 +02:00
Ratchanan Srirattanamet
264fed4778 wwan/ofono: correct MMS proxy property lookup
The property name under `Settings` dict is just `Proxy`, unlike the one
outside which is `MessageProxy`. See [1].

[1] https://kernel.googlesource.com/pub/scm/network/ofono/ofono/+/refs/heads/master/doc/connman-api.txt#253

Fixes: a6e81af87f ('wwan: add support for using oFono as a modem manager')
2023-03-30 08:41:35 +02:00
Thomas Haller
c4aa969a43 platform: merge branch 'lr/nl-retry'
https://bugzilla.redhat.com/show_bug.cgi?id=2169512

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1537
2023-03-30 08:24:07 +02:00
Thomas Haller
5eb584f84b platform: explicitly compare seq_result number against WAIT_FOR_NL_RESPONSE_RESULT_UNKNOWN
We have other places like

  nm_assert(!out_seq_result || *out_seq_result == WAIT_FOR_NL_RESPONSE_RESULT_UNKNOWN);

where we explicitly compare against WAIT_FOR_NL_RESPONSE_RESULT_UNKNOWN.
Do that here too.
2023-03-29 15:27:51 +02:00
Lubomir Rintel
da9745b961 platform: always retry when netlink drops messages
Netlink is capable of dropping not only outbout messages, but also the
requests. We should always try to recover from those.
2023-03-29 15:27:51 +02:00
Lubomir Rintel
0a549bfad2 platform: increase log level for some failures
These are not expected to happen. While probably harmless, we should notice
when they do.
2023-03-29 11:49:59 +02:00
Lubomir Rintel
090ff4ae95 platform: limit retry count on link change
This is a nice safeguard, also consistent with ip_route_get().
2023-03-29 11:49:59 +02:00
Lubomir Rintel
fee7832bde platform: increase netlink resync retry count
With a small buffer (of 4K) and many links (100 ethernet adapters), I've
seen up to ~15 retries of link change until things settled.

Let's increase this. Still a »bulharská konštanta« but possibly safer and
more broadly useful (so we can cap the link change retry count too).
2023-03-29 11:49:58 +02:00
Lubomir Rintel
e45b27a937 platform: create a define for retry count when netlink drops data
We're going to use it elsewhere.
2023-03-29 11:49:58 +02:00
Lubomir Rintel
ef6d8cf1a8 platform: assert the seq_status is known to be unknown on sending a nl message
This guards against accidental use of a stale result.
2023-03-29 11:49:58 +02:00
Lubomir Rintel
1e74b755ee platform: reset seq_result on retrying link change
Shouldn't make a difference at this point. It's nevertheless a good
practice to guard against accidental use of a stale result.
2023-03-29 11:49:58 +02:00
Thomas Haller
e3eaccd722 libnm,doc: merge branch 'th/gtkdoc-annotations-cleanup'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1587
2023-03-29 11:46:48 +02:00
Thomas Haller
9135189078 doc: reorder gtkdoc annotations for consistency 2023-03-29 11:46:48 +02:00
Thomas Haller
6043910bff doc: use "Returns:" annotation instead of deprecated aliases 2023-03-29 11:46:48 +02:00
Thomas Haller
98dd4180ec all: various fixes to gtk-doc annotations
- drop annotations from "@error" which has defaults.

- ensure all annotations are on the same line. That's useful
  when searching for an annotation, to find the line that specifies
  the argument name.

- convert a few plain docs into gtkdoc annotations.
2023-03-29 11:46:48 +02:00
Thomas Haller
1ed3854402 checkpatch: discourage deprecated "(allow-none)" annotation 2023-03-29 11:46:48 +02:00
Beniamino Galvani
37de834575 merge: branch 'bg/rh2174353'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1589
https://bugzilla.redhat.com/show_bug.cgi?id=2174353
2023-03-29 11:24:25 +02:00
Beniamino Galvani
b3e5504972 core: don't block a connection that was removed
Don't try to block a device/connection pair when the connection was
removed. Doing so would create a new devcon entry associated with the
connection that is being deleted.

Fixes: b73b34c3ee ('policy: track autoconnect retries per Device x Connection')
2023-03-29 11:19:35 +02:00
Beniamino Galvani
6d6bd92510 core: also deactivate ACs that are not authorized yet
If we are deactivating active-connections for a specific
settings-connection, also consider active-connections that are waiting
for authorization. Otherwise, when the connection is deleted, a
active-connection might still reference it.
2023-03-29 10:28:37 +02:00
Beniamino Galvani
e6b3a6a2b6 core: move deactivation of active connections to the manager
It's needed for the next commit.
2023-03-29 10:28:26 +02:00
Fernando Fernandez Mancera
9d4bbf78f0 dns: add support to no-aaaa option
Users can set `no-aaaa` DNS option to suppress AAAA queries made by the
stub resolver, including AAAA lookups triggered by NSS-based interfaces
such as getaddrinfo. Only DNS lookups are affected.
2023-03-28 12:53:58 +02:00
Fernando Fernandez Mancera
2b0870ed28 bonding: fix verification of ns_ip6_target and arp_validate options
When arp_validate is set it requires ns_ip6_target or arp_ip_target
options to be set.

Fixes: c6487c240c ('bonding: add support to ns_ip6_target option')
2023-03-28 12:50:27 +02:00
Beniamino Galvani
afd1a7b9a6 merge: branch 'bg/hotspot-fixes'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1578
2023-03-28 10:02:23 +02:00
Beniamino Galvani
231128d28d nmcli: increase strength of generated hotspot passwords
The password currently generated has ~48 bits of entropy; increase the
length from 8 to 12 to get ~70 bits. While at it, exclude characters
that look similar and might be entered wrongly by users.
2023-03-28 09:58:29 +02:00