Commit graph

32930 commits

Author SHA1 Message Date
Fernando Fernandez Mancera
cbf8723273 merge: branch 'ff/conscious_language_autoconnect_slaves'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1844

(cherry picked from commit 0607340922)
2024-02-02 12:52:20 +01:00
Fernando Fernandez Mancera
b0b068e103 all: use the new NMSettingConnection autoconnect-ports property
(cherry picked from commit 8a08a74abf)
2024-02-02 12:52:20 +01:00
Fernando Fernandez Mancera
513eda352e connection: deprecate NMSettingConnection autoconnect-slaves property
To embrace inclusive language, deprecate the NMSettingConnection
autoconnect-slaves property and introduce autoconnect-ports property.

(cherry picked from commit 194455660d)
2024-02-02 12:52:20 +01:00
Fernando Fernandez Mancera
37972c9fe2 setting: add property_type field to _nm_setting_property_define_direct_enum
In order to make _nm_setting_property_define_direct_enum more flexible,
this patch is introducing property_type argument to it. When set to NULL
it will set property_type to nm_sett_info_propert_type_direct_enum.

(cherry picked from commit b90dd247be)
2024-02-02 12:52:20 +01:00
Fernando Fernandez Mancera
13281fbd20 internal: add direct_is_aliased_field flag to NMSettInfoProperty
(cherry picked from commit 2921fe7aac)
2024-02-02 12:52:20 +01:00
Fernando Fernandez Mancera
e1e612a60b tests: drop unit tests related to from_dbus/to_dbus function
Defining the wrong from_dbus/to_dbus functions is something not
probable. The unit test is just getting in the way of those who knows
what they do and force contributors to change the same thing in multiple
places.

(cherry picked from commit 2f1b599fe3)
2024-02-02 12:52:20 +01:00
Stanislas FAYE
ee21ca8743 release: bump version to 1.45.90 (1.46-rc1) 2024-01-25 01:16:53 +01:00
Wen Liang
792bf3cdd1 libnm: merge branch 'empty_addr_with_route'
https://issues.redhat.com/browse/RHEL-5098
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1832
2024-01-24 09:24:00 -05:00
Wen Liang
0e7bda8ad8 libnm: allow configuring static route when address is empty
OpenShift MetalLB team requests to configure additional routes
whenever the nodes does not have a configured IP address or route for
the subnet in which MetalLB issues addresses.

Note in linux network stack, it does not matter what interface you add
the address on a node (for example, loopback), the kernel is always
processing arp-requests and sending arp-replies to any of them, this
behavior is considered correct and, moreover, it is widely used in the a
dynamic environment as Kubernetes.

https://issues.redhat.com/browse/RHEL-5098
https://gitlab.freedesktop.org/NetworkManager/NetworkManager-ci/-/merge_requests/1587
2024-01-24 09:15:39 -05:00
Wen Liang
cf28660b6a core: check the dhcp enabled flag in l3cfg
The decision to configure or not configure routes without addresses only
related to what method is configured - DHCP and non-DHCP cases. For DHCP
case, the deamon waits until addresses appear first before configuring
the static routes to preserve the behavior mentioned in
https://bugzilla.redhat.com/show_bug.cgi?id=2102212, otherwise, the
daemon can configure the routes immediately for non-DHCP case.
2024-01-24 09:15:39 -05:00
Wen Liang
00c7e4855e l3cfg: add dhcp_enabled_4 and dhcp_enabled_6 properties to NML3ConfigData 2024-01-24 09:15:34 -05:00
Luna Jernberg
7825f53c7c
po: update Swedish (sv) translation
Update Swedish translation for the first time in a while.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1839
2024-01-23 13:51:01 +01:00
Thomas Haller
821710bbaa
libnm: merge branch 'th/setting-no-empty-str-props'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1827
2024-01-23 11:16:04 +01:00
Thomas Haller
955f113f46
libnm/docs: update comment about "apn.gsm" and empty string 2024-01-23 09:43:28 +01:00
Thomas Haller
f766ec0a16
libnm: drop some unnecessary direct_string_allow_empty
"nm_setting_hsr_get_port1" is new API and verify() already enforces that
the strings are not empty. The flag is redundant.

Also drop it from a few other places, where it's redundant.
2024-01-23 09:43:27 +01:00
Thomas Haller
8062d04cd4
libnm: don't set .direct_string_allow_empty for _nm_setting_property_define_direct_mac_address()
Most properties don't accept empty strings and reject them during
verify().

All _nm_setting_property_define_direct_mac_address() call
nm_utils_hwaddr_valid() on the string, which rejects empty strings.

Clear the .direct_string_allow_empty flag for those. The usage of the
flag is misleading.
2024-01-23 09:43:27 +01:00
Thomas Haller
d8e51faee7
libnm: add direct_string_allow_empty meta data for NMSetting property
Most string properties should not accept empty strings. Add a generic
way to reject them during verify.

Add a new flag NMSettInfoProperty.direct_string_allow_empty.

Note that properties must opt-in to allow empty values. Since all
existing properties didn't have this check (but hopefully re-implemented
it in verify()), all existing properties get this flag set to TRUE.

The main point here it that new properties get the strict check by
default.

We should also review existing uses of direct_string_allow_empty,
whether the flag can be cleared. This can be done if verify() already
enforces a non-empty string, or if we accept to break behavior by
tightening up the check.
2024-01-23 09:43:26 +01:00
Thomas Haller
e6abcb4d67
libnm: add generic code for verifying properties in NMSetting
Current verifications happens by implementing NMSetting's verify().
Add code for a second step of validation, that can operate based on the
known type.

The use case will be to reject empty strings.
2024-01-23 09:43:26 +01:00
Thomas Haller
b025bd92d9
libnm/tests: use nmtst_assert_setting_verifies() in test_setting_gsm_apn_bad_chars() test
This shows the GError in case of failure, which is useful for debugging
the test.
2024-01-23 09:43:26 +01:00
Thomas Haller
81bfce7c47
glib-aux: convert nmtst_assert_setting_verifies() to a macro
The macro has the advantage, that it preserves the file and line number
from the caller.
2024-01-23 09:43:25 +01:00
Fernando Fernandez Mancera
9360ed9a7a merge: branch 'ff/conscious_language_port_type'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1837
2024-01-23 08:27:52 +01:00
Fernando Fernandez Mancera
027b259602 all: use the new NMSettingConnection port-type property 2024-01-23 08:21:16 +01:00
Fernando Fernandez Mancera
1e3bb7f320 connection: drop the usage of nm_setting_connection_is_slave_type()
As the function is deperecated, drop the usage of it. In addition
replace the !g_strcmp0() usage for nm_streq0().
2024-01-23 08:21:16 +01:00
Fernando Fernandez Mancera
411e7573a4 connection: deprecate the NMSettingConnection slave-type property
To embrace inclusive language, deprecate the NMSettingConnection
slave-type property and introduce port-type property.

Signed-off-by: Fernando Fernandez Mancera <ffmancera@riseup.net>
2024-01-23 08:21:07 +01:00
Stanislas Faye
fbfb82da8c merge: branch 'sf/change-tar-archive-format-to-pax'
build: Change the tar format for generating tarballs to posix format (pax)

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1836
2024-01-19 08:31:09 +00:00
Stanislas FAYE
e0b5725e4c build: Change the tar format for generating tarballs to posix format (pax)
The `ustar` format that is used to generate NM tarballs only supports
a 21-bit uid/gid causing the `make dist` command (or similar commands involving
tar archive creation) fails for users with high UIDs. This commit
changes the tar format from `ustar` to `pax` format which does not have such
limitation and is aligned with future plan to switch to meson
build system (which already uses the `pax` format).
2024-01-19 08:30:57 +00:00
Íñigo Huguet
4f90b3e036 merge: branch 'ih/nmtui_esc'
nmtui: fix deletion confirmation with ESC key press

Closes #1460

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1835
2024-01-19 06:56:13 +00:00
Íñigo Huguet
8f5a4f957f nmtui: fix deletion confirmation with ESC key press
When deleting a profile, the confirmation dialog shows "Cancel" and
"Delete" buttons. ESC key should do nothing, but in some distributions
like Debian and Ubuntu newt has a downstream patch that enables it (see
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=584098).

In that case, when pressing ESC the return value of the dialog is not
"Cancel" (1) or "Delete" (2), but the "otherwise" value (0). Fix it by
not checking if "Cancel" is pressed. Instead, check if "Delete" was
pressed, and continue deleting only in that case.

Also, fix the doc comment that incorrectly says that the dialog returns
0/1 for the buttons, it is 1/2.
2024-01-18 10:16:45 +01:00
Fernando Fernandez Mancera
b9f7b1a17b utils: drop both "master" and "controller" from the dictionary
If a generated connection matches a connection that uses interface name
as controller, we need to drop the existing value from the settings to
avoid conflicts. Therefore, both of them need to be dropped; controller
and master.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1833

Fixes: 3e4a2ebb3c ('all: use the new NMSettingConnection Controller property')

Signed-off-by: Fernando Fernandez Mancera <ffmancera@riseup.net>
2024-01-17 18:41:42 +01:00
Íñigo Huguet
876e8a4da1 merge: branch 'jv/meson-dist-docs'
build: include documentation in meson dist

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1811
2024-01-17 12:40:04 +00:00
Jan Vaclav
1c41066a40 build: include documentation in meson dist
Previously, the tarball generated by `meson dist` did not contain the
autogenerated documentation due to the way meson works (packaging the
latest revision control commit). This introduces a dist script which
builds & copies the generated documentation into the distribution
tarball.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1811
2024-01-17 12:39:46 +00:00
Thomas Haller
d37431e2db
core: merge branch 'th/dbus-annotate-deprecated'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1829
2024-01-17 11:12:51 +01:00
Thomas Haller
2fe8ec25b9
core: mark deprecated D-Bus API as deprecated in Introspect()
Mark the methods/properties deprecated in the D-Bus API (via
org.freedesktop.DBus.Introspectable.Introspect(), [1]).

It affects those properties that are documented as deprecated in
introspection XML.

  $ busctl -j call \
        org.freedesktop.NetworkManager \
        /org/freedesktop/NetworkManager \
        org.freedesktop.DBus.Introspectable \
        Introspect | \
    jq '.data[0]' -r | \
    grep -5 Deprecated

[1] https://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces-introspectable
2024-01-16 09:28:18 +01:00
Thomas Haller
da743663c3
dbus: add helper macros for GDBusAnnotationInfo 2024-01-16 09:28:17 +01:00
Thomas Haller
dff7ed3e76
introspection: use common format for DEPREACTED properties in introspection
All other forms of deprecations use a "DEPRECATED:" tag. Adjust the
documentation in the introspection for IP4Config/IP6Config.
2024-01-16 09:28:17 +01:00
Thomas Haller
6fb4af7300
cloud-setup: more sandboxing in service file
Note that some of those sandboxing options may require relatively
recent systemd. In that case, to run against older systemd, you
will need to patch the service file. I don't think there is
a way around that, and limiting outselves to only the oldest supported
option is harmful for users who run recent systemd.

See-also: https://fedoraproject.org/wiki/Changes/SystemdSecurityHardening
2024-01-16 08:59:07 +01:00
Beniamino Galvani
b4340fd9a2 merge: branch 'bg/ipv4-dad-enable-by-default'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1826
2024-01-15 17:09:41 +01:00
Beniamino Galvani
fd914be8d7 device: upgrade ACD failure message to warning level
A IPv4 conflict detected during the probe is a serious problem, as it
prevents the address from being configured. As such, is should be
displayed at warning level.

A conflict detected after the address is already configured
(addr_info->state == NM_L3_ACD_ADDR_STATE_CONFLICT) is less important
because NM will try to defend the address and will keep using it.
2024-01-15 17:07:09 +01:00
Beniamino Galvani
790e4231f4 core,libnm: change default value for ipv4.dad-timeout from 0 to 200ms
A duplicate address is a serious issue which leads to non-working
setups or problems hard to debug. Enable IPv4 duplicate address
detection (aka ACD, RFC 5227) by default to detect such problems.

While the RFC recommends a timeout of 9 seconds, a comment in n-acd
sources says:

  A 9s timeout for successful link setups is not acceptable today.
  Hence, we will just go forward and ignore the proposed values. On
  both wired and wireless local links round-trip latencies of below
  3ms are common.  We require the caller to set a timeout multiplier,
  where 1 corresponds to a total probe time between 0.5 ms and 1.0
  ms. On modern networks a multiplier of about 100 should be a
  reasonable default. To comply with the RFC select a multiplier of
  9000.

Set a default timeout of 200ms, which is the double of the value
suggested in n-acd sources. 200ms sounds quick enough, and gives at
least ~100ms to other hosts to reply.

See also the Fedora change proposal:

https://fedoraproject.org/wiki/Changes/Enable_IPv4_Address_Conflict_Detection
2024-01-15 17:07:09 +01:00
Stanislas FAYE
1730ceda70
release: bump version to 1.45.10 (development) 2024-01-15 16:02:07 +01:00
Fernando Fernandez Mancera
8340f819c4 merge: branch 'ff/conscious_language_connection_master'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1809
2024-01-11 14:06:18 +01:00
Fernando Fernandez Mancera
3e4a2ebb3c all: use the new NMSettingConnection Controller property 2024-01-11 00:19:14 +01:00
Fernando Fernandez Mancera
00bc10b8c0 connection: deprecate the NMSettingConnection Master property
To embrace inclusive language, deprecate the NMSettingConnection Master
property and introduce Controller property.
2024-01-11 00:19:14 +01:00
Thomas Haller
71b535e932
glib-aux,libnm: merge branch 'th/gvariant-cmp'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1819
2024-01-04 10:04:19 +01:00
Thomas Haller
03b9a255d2
libnm: remove unused "nm-property-compare.c"
"nm-property-compare.c" only contains nm_property_compare(), which is
broken.

It tries to compare string dictionaries as equal regardless of the
order of elements. It gets it wrong, for dictionaries with duplicate
keys. Which means, it can only be used with trusted variants that are
known to not contain duplicates. Which is quite a non-starter.

Also, the idea of a compare function for GVariant that ignores the order
of dictionary elements seems wrong. Even if for a certain application
the order does not matter, it still depends what the upper layer makes
of duplicate keys (will they bail out, or take the first/last occurrence
of a duplicate key?). nm_property_compare() doesn't have the knowledge
how upper layer handles it, and it's not obvious what's the right
choice. For example, if you use g_variant_lookup(), the first occurrence
is preferred. If you iterate over the children, possibly later
occurrences overwrite earlier ones.

It's ill defined, and maybe shouldn't be done. What should instead
happen, is that upper layers normalize (sort, uniquify) the keys, so
that we can do a full comparison. For that we have nm_g_variant_cmp().

Drop the now unused code. The core of the function still exists as
nm_g_variant_cmp().
2024-01-04 10:03:00 +01:00
Thomas Haller
9db8cdb64d
glib-aux: add nm_g_variant_cmp()
There is g_variant_equal(), which can handle all variant types (however
that is not a compare function).

There is g_variant_compare(), which is a compare function but only works for
basic types.

Add nm_g_variant_cmp() which works with all variant types.

This is based on nm_property_compare(), with some differences:

- nm_property_compare() tries (wrongly) to accept string dictionaries in
  any order. That functionality seems wrong, and nm_g_variant_cmp()
  doesn't do that.

- nm_property_compare() does possibly not support all variant types.
  This can be a problem, if we call the function on untrusted data
  (and it can be hard to validate first, whether the function can
  be called with a particular variant). Instead, nm_g_variant_cmp()
  should work with all variants.

The unit tests are copied from "src/libnm-core-impl/tests/test-compare.c"
with some adjustments (because nm_property_compare() is not the same as
nm_g_variant_cmp()).

Note that the code is actually unused. It was written as replacement for
nm_property_compare(), but turns out not to be used there. For now,
leave it, because it might still be useful to have in the toolbox and it
exists (including tests).
2024-01-04 09:59:59 +01:00
Thomas Haller
e415e4fc18
libnm: fix _nm_setting_property_compare_fcn_default() to use nm_g_variant_equal()
nm_property_compare() makes a misguided attempt to compare dictionaries
regardless of their order.

However, if variants contain duplicate keys, then the implementation
is wrong and cannot handle it correctly.

Regardless of that. While in some sense the order of dictionary keys is
irrelevant, this is not the right place to perform such normalization.
If the order of things doesn't matter, then NMSetting must normalize the
property (e.g. by sorting the keys). At that point, the GVariant shall
be compared fully.
2024-01-04 09:59:54 +01:00
Fernando Fernandez Mancera
0e893593a9 hsr: drop supervision-address from HSR setting
The supervision address is read-only. It is constructed by kernel and
only the last byte can be modified by setting the multicast-spec as
documented indeed.

As 1.46 was not released yet, we still can drop the whole API for this
setting property. We are keeping the NMDeviceHsr property as it is a
nice to have for reading it.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1823

Fixes: 5426bdf4a1 ('HSR: add support to HSR/PRP interface')
2023-12-19 13:54:21 +01:00
Íñigo Huguet
9613b99ea8 merge: branch 'main'
Update Russian translation

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1808
2023-12-19 09:23:59 +00:00
Aleksandr Melman
c3bfa95977 Update ru.po 2023-12-18 19:07:41 +00:00