Commit Graph

31938 Commits

Author SHA1 Message Date
Etienne Champetier
fb03dbacd8 doc: fix route type name (unavailable -> unreachable)
Fixes: 1cc3d00cb7 ('libnm/doc: list route attributes in `man nm-settings-nmcli`')
2023-02-28 11:28:58 +01:00
Thomas Haller
93b94a6151 libnm: drop _NMConnectionForEachSecretFunc from public headers
It was always a private typedef. Not meant to be used.  This was left
over since commit e46d484fae ('libnm: hide NMSetting types from public
headers')
2023-02-27 14:01:09 +01:00
Thomas Haller
599fe234ea cloud-setup: use nm_strv_dup_packed() in nm_http_client_poll_get()
No need to do a deep clone. The strv array is not ever modified and we
pack it together in one memory allocation.
2023-02-27 14:01:04 +01:00
Beniamino Galvani
933e8ea11c device: fix copy/paste error in nm-device-ip-tunnel.c
Fixes: 351c562491 ('devices: support VTI tunnels')
2023-02-27 13:38:40 +01:00
NorwayFun
5f352df1c3 po: update Georgian (ka) translation
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1546
2023-02-27 08:13:55 +01:00
Thomas Haller
22c7fd33cc doc: fix documenting "carrier-wait-timeout" in NetworkManager-wait-online manual
Fixes: df94cb2116 ('man: add NetworkManager-wait-online.service.8 manual')
2023-02-24 11:50:40 +01:00
Thomas Haller
6dafe78088 platform: ensure ext-data is of expected type
We just lookup the link info by ifindex. There is no guarantee that that
ifindex is of the expected type, to have a suitable ext-data. Check for
that.

Fixes: a7d2cad67e ('platform/linux: add support for WPAN links')
2023-02-24 10:16:08 +01:00
Fernando Fernandez Mancera
61c0971748 merge: branch 'th/devcon-track-autoconnect'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1530
2023-02-23 10:01:40 +01:00
Fernando Fernandez Mancera
81fbe0634e utils: rename NM_SETTINGS_AUTO_CONNECT_* to NM_SETTINGS_AUTOCONNECT_* 2023-02-23 09:12:43 +01:00
Fernando Fernandez Mancera
b73b34c3ee policy: track autoconnect retries per Device x Connection
Autoconnect retries are not being tracked by connection anymore. Now it
is tracked per Device x Connection. In addition, autoconnect might be
blocked for the connection due to no secrets or user requested.

All the properties tracking the retries and blocked time were move to
DevConData and the functions to manipulate them aswell. In NMPolicy the
logic didn't change very much. Instead of looking into the connection
when the device failed activation it looks for DevConData.
2023-02-23 09:12:37 +01:00
Fernando Fernandez Mancera
10c38eabb9 utils: move autoconnect_blocked_reason_to_string to NetworkManagerUtils
As this is going to be used by multiple components, let's move it to
NetworkManagerUtils.[ch]
2023-02-22 22:38:03 +00:00
Thomas Haller
dc1cf48b86 core: add support for tracking Device times Profile in NMManager
This will be used next, to track the per-device, per-profile autoconnect
state.
2023-02-22 22:38:03 +00:00
Thomas Haller
20f791d8fe core: expose accessors to NMManager in NMSettings, NMSettingsConnection, NMDevice
We should avoid using the NM_MANAGER_GET singleton. Everybody already
has a manager instance. Expose it and allow to use it.
2023-02-22 22:38:03 +00:00
Fernando Fernandez Mancera
b5e347b313 client/tests: adjust expected output for new order of replace-local-rule
Now replace-local-rule is under routing-rules and therefore expected
output need to be adjusted in tests.
2023-02-22 22:20:41 +00:00
Fernando Fernandez Mancera
f46512c54f libnmc-setting: place replace-local-rule under routing-rules
This affects the order in which properties are listed in `nmcli
connection show`. The replace-local-rule property should be after the
routing-rule property.
2023-02-22 15:09:45 +01:00
Wen Liang
cefe4a7885 libnm: adjust symbol versioning of deprecating NMActiveConnection Master property
The symbol "nm_active_connection_get_controller" was backported to
1.42.1+. Since 1.44 is not yet released, move the symbol from
libnm_1_44 to libnm_1_42_2, like it is on 1.42.2 release. That way, we
don't need to duplicate the symbol while 1.44 being forward compatible
with 1.42.2.
2023-02-22 08:59:13 -05:00
Thomas Haller
da3c9e470e glib-aux/trivial: reword code comments about bad random fallback in "nm-random-utils.c" 2023-02-22 14:01:03 +01:00
Thomas Haller
d359a9a1e7 glib-aux: improve NM_FLAGS_{SET,UNSET,ASSIGN,ASSIGN_MASK}() macros
- add unused code which triggers a compiler check about compatible enum
  values.
2023-02-22 09:59:05 +01:00
Fernando Fernandez Mancera
28c27f3070 libnm: adjust symbol versioning for backporting replace-local-rule
NM 1.44 is not released yet and 1.42.2 will happen before 1.44.0, so we
can introduce the new API with version libnm_1_42_2 in both releases
without having duplicate symbols on 1.44.
2023-02-21 18:20:44 +01:00
Thomas Haller
a08214f60d wwan: workaround missing mm_modem_3gpp_set_initial_eps_bearer_settings() API
This was introduced only in MM 1.10. This breaks build on Centos7.

Fixes: c52999ee90 ('wwan: Set initial EPS bearer settings')
2023-02-21 18:04:23 +01:00
Fernando Fernandez Mancera
6595954f94 merge: branch 'ff/route_rule_0'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1542
2023-02-21 15:37:29 +01:00
Fernando Fernandez Mancera
d2ca44ffc6 all: add new "ipv[46].replace-local-rule" setting
This setting allows the user to remove the local route rule that is
autogenerated for both IPv4 and IPv6. By default, NetworkManager won't
touch the local route rule.
2023-02-21 15:36:38 +01:00
Fernando Fernandez Mancera
79611e4fcc platform: introduce function to globally track local route rule
The new function tracks local route rule in the GlobalTracker properly.
It also allow the developer to specify the untrack user tag.
2023-02-21 15:36:38 +01:00
Fabrice Fontaine
3a3ac89b53 meson.build: fix build failure with -Dmodem_manager=false
Fix the following build failure with -Dmodem_manager=false raised since
commit 03ba04d478 ('build: meson: add option to set the
mobile-broadband-provider-info database').

  ../output-1/build/network-manager-1.40.10/meson.build:1060:0: ERROR: Unknown variable "mobile_broadband_provider_info_database".

http://autobuild.buildroot.org/results/896879c8e8ce022556ee834216ced2f962ff279c

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>

Fixes: 03ba04d478 ('build: meson: add option to set the mobile-broadband-provider-info database')

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1544
2023-02-21 14:56:15 +01:00
Beniamino Galvani
34417ac3e6 merge: branch 'bg/hostname-skip-ipv6-tentative'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1536
2023-02-21 13:50:14 +01:00
Beniamino Galvani
4138be6a5a device: skip DNS resolution for tentative IPv6 addresses
A tentative IPv6 address can still fail DAD, so don't use it to
resolve the hostname via DNS. Furthermore, tentative addresses can't
be used to contact the nameserver and so the resolution will fail if
there is no other valid IPv6 address. Wait that the address becomes
non-tentative.
2023-02-21 13:46:55 +01:00
Beniamino Galvani
ac5325e96b nm-daemon-helper: log to stderr any error from getaddrinfo()
Print errors from getaddrinfo() to stderr so that they will be logged
by NM.
2023-02-21 13:46:55 +01:00
Beniamino Galvani
d65702803c core: print stderr from nm-daemon-helper
Currently the only way to return an error code from the daemon helper
is via the process exit code, but that is not enough to fully describe
an error from getaddrinfo(); in fact, the function returns a EAI_*
error code and when the value is EAI_SYSTEM, the error code is
returned in errno.

At the moment, any messages printed to stderr by the helper goes to NM
stderr; instead, we want to capture it and pass it through the logging
mechanism of NM, so that it can be filtered according to level and
domain.
2023-02-21 13:46:54 +01:00
Beniamino Galvani
7037aa66c6 device: improve logging for hostname-from-dns events
Improve logging:
 - log only when something changes
 - print the new resolver state, instead of the old one
 - rename state "in-progress" to "started"
 - log when the resolver state is reset due to DNS changes
2023-02-21 13:46:54 +01:00
Beniamino Galvani
961824d43b core: change buffer allocation size for the daemon helper
Use slightly more efficient sizes.
2023-02-21 13:46:54 +01:00
Thomas Haller
afbbfebfdb dhcp: merge branch 'th/dhcp-iaid'
https://bugzilla.redhat.com/show_bug.cgi?id=2169869

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1534
2023-02-21 09:29:44 +01:00
Thomas Haller
f36fabc0fa libnm/docs: improve documentation for ipv[46].dhcp-iaid setting 2023-02-21 09:20:51 +01:00
Thomas Haller
2fe4313b92 dhcp: log used DHCP IAID as hexstr
This is also the format that we will use to expose it in the lease
information. It's the format that dhclient uses.
2023-02-21 09:20:51 +01:00
Thomas Haller
07f1789725 dhcp: add the DHCPv6 IAID to the lease information
We already get the IAID from the dhclient environment. This is actually
rather useful, because dhclient plugin does not support setting the
value (that is, what we request in "config.v6.iaid" is not actually
used). Already previously, was the IAID for dhclient present in the
lease information. Now also normalize/verify it.

Expose the used IAID also with the internal (systemd) plugin. There we
explicitly set the IAID and know it.
2023-02-21 09:20:51 +01:00
Thomas Haller
5a05ba398b dhcp: add "static_key" argument to nm_dhcp_option_add_option() etc.
Our lease is tracked in a plain string dictionary. For dhclient plugin
and similar, the keys are received via the environment, they are thus
unlimited. For the internal plugins they are known at compile time and
static strings. We thus sometimes need to clone the string, and
sometimes not.

Unfortunately, we cannot ask the GHashTable whether it has a free
function for the key, so we need to explicitly tell it. Add a parameter
for that.
2023-02-21 09:13:09 +01:00
Thomas Haller
e5dc489197 libnm: accept ipv[46].dhcp-iaid as hexstr
dhclient exports the currently used IAID in the environment as
hex string. We expose this environment in our API, so this is also
the format that NetworkManager uses.

Accept setting the ipv[46].dhcp-iaid as hex string, so that the same
format is accepted on the profile.

While at it, also accept a hex number (0x) because it is also
convenient, and this change already introduces the precedent that the
IAID string is not unique/normalized.
2023-02-21 09:13:08 +01:00
Thomas Haller
4c18adbc74 base: add nm_dhcp_iaid_{from,to}_hexstr() helpers 2023-02-21 09:13:08 +01:00
Thomas Haller
69106d0aef core: reuse _nm_utils_iaid_verify() for parsing
There should be one function for parsing the string. Use it everywhere.

Also, because we will accept specifying the IAID as hex string so the
same parsing code should be used everywhere.
2023-02-21 09:12:59 +01:00
Beniamino Galvani
d403ac3d40 device: update address in nm_device_update_from_platform_link()
When a software device is deactivated, normally we schedule a idle
task to unrealize the device (delete_on_deactivate). However, if a new
activation is enqueued on the same device (and that implies that the
new profile is compatible with the device), then the idle task is not
scheduled and the device will normally transition to the different
states (disconnected, prepare, config, etc.).

For ovs-interfaces, we remove the db entry on disconnect and that
makes the link go away; however, we don't clear the hw_addr* fields of
the device struct.

When the new link appears, we try to set the new cloned MAC but the
stale hw_addr field indicates that it's already set. Avoid this
problem by updating the address as soon as the link appears.

https://bugzilla.redhat.com/show_bug.cgi?id=2168477
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1532
2023-02-20 17:35:35 +01:00
Thomas Haller
a1cdec7894 gsm: merge branch 'svenschwermer:initial-eps-bearer'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1331
2023-02-20 15:25:42 +01:00
Sven Schwermer
c52999ee90 wwan: Set initial EPS bearer settings
Signed-off-by: Sven Schwermer <sven.schwermer@disruptive-technologies.com>
2023-02-20 12:59:41 +01:00
Sven Schwermer
db3b112846 libnm: Add initial EPS parameters to gsm settings
The configure flag and APN for the initial EPS bearer are used when
bringing up cellular modem connections. These settings are only relevant
for LTE modems.

Signed-off-by: Sven Schwermer <sven.schwermer@disruptive-technologies.com>
2023-02-20 12:59:39 +01:00
Thomas Haller
49d6e1fe4b libnm: extract helper function to verify APN in "nm-setting-gsm.c" 2023-02-20 12:49:30 +01:00
Beniamino Galvani
a839395e30 dispatcher: fix constructing the IPv4 nameserver variable
Use the value of the address instead of its pointer.

Fixes: c68e148b02 ('core: extend NML3ConfigData:nameserver to track DNS as string')

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/1217
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1539
2023-02-20 09:36:30 +01:00
Wen Liang
33d6f4f3a2 dbus: merge branch 'wl/deprecate_dbus_master_prop'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/1205
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1514
2023-02-16 11:04:33 -05:00
Wen Liang
af677542b5 dbus: deprecate the NMActiveConnection Master property
To embrace the inclusive language, deprecate the NMActiveConnection
Master property and in favor of the NMActiveConnection Controller
property.
2023-02-16 11:04:14 -05:00
Wen Liang
b4e96ec067 nm-client: expose the method nml_dbus_property_o_notify() 2023-02-16 11:04:14 -05:00
Wen Liang
09e86a5e7c add _NM_DEPRECATED_INCLUSIVE_LANGUAGE_1_44 2023-02-16 11:04:14 -05:00
Ratchanan Srirattanamet
08a38ed619 wwan/ofono: fix a couple of logic errors in update_connection_list()
- Only consider preferred context of "internet" type. There can be
  multiple preferred contexts of multiple types, and we care about
  "internet" type only.
- Don't check for "internet+mms" type. It turns out that "internet+mms"
  isn't a thing in oFono, and is used to represent "internet" context
  with MMSC in the lomiri-system-setting's UI only.

Fixes: 9fc72bf75d ('wwan/ofono: create connections based on available contexts')
Bug-UBports: https://gitlab.com/ubports/development/core/packaging/network-manager/-/issues/3
2023-02-16 16:42:39 +01:00
Thomas Haller
c2bbc0e0c8 glib-aux: choose favorable reallocation sequence in nm_utils_fd_read()
Ensuring to have 1000 bytes available is not a good start.
Because, if we start with an empty buffer (allocated fewer
than 1000 bytes), on first call we will reserve 1000 bytes.
If we then just read one byte, on the next read we would again
try to reserve 1000 bytes, and already require a reallocation.

In this case it is better to reserve 488+1 or 1000+1 bytes.
2023-02-16 10:45:52 +01:00