Commit Graph

32934 Commits

Author SHA1 Message Date
Jan Vaclav
95f7c8e128 contrib/fedora: add --meson option to build_clean
This allows the script user to complete the entire build only using meson instead of autotools.
2024-01-29 13:21:16 +00:00
Jan Vaclav
7502787959 build: include meson-dist-data script in dist generated by autotools
The script had not been previously included in the distribution tarball
due to an oversight.

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

Fixes: 1c41066a40 ('build: include documentation in meson dist')
2024-01-29 13:16:19 +00:00
Fernando Fernandez Mancera
e9e456d9ad doc: regenerate docs for "connection.mdns"
As the documentation for "connection.mdns" was modified, we need to
regenerate the docs.
2024-01-29 12:08:32 +01:00
Thomas Haller
0ce996ba18 doc: merge branch 'th/doc-mdns'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/1467

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1841
2024-01-29 09:52:04 +01:00
Thomas Haller
1128bceab9 doc: clarify limitation of parsing values in "NetworkManager.conf"
This really should be fixed, because it's a non-obvious limitation.
Anyway, document it for now.
2024-01-29 09:50:37 +01:00
Thomas Haller
fa503e402d doc: clarify default for "connection.mdns" in manual
The default in systemd-resolved is nowadays "yes". In any case, since
the setting is configurable systemd-resolved, don't describe it in the
manual page.

Instead, clarify the behavior and try to improve the documentation.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/1467
2024-01-29 09:50:29 +01:00
Beniamino Galvani
f1761c0184 merge: branch 'bg/vpn-ipv6-route-prefsrc'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1834
2024-01-29 08:58:41 +01:00
Beniamino Galvani
c415eaca76 vpn: accept pref-src for IPv6 routes returned by plugins
As done for IPv4 in commit 3b145a33b7 ('vpn-connections: allow the
plugin to specify route preferred src'), allow VPN plugins to return a
preferred source address for routes. Still accept the old format.
2024-01-29 08:54:08 +01:00
Beniamino Galvani
23f45d0e18 vpn: simplify routes parsing code
Split the IPv4 and IPv6 cases to make the following commit simpler.
2024-01-29 08:54:07 +01:00
Stanislas FAYE
c3acd38645 release: bump version to 1.47.0 (development) 2024-01-25 01:27:55 +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