Commit graph

32960 commits

Author SHA1 Message Date
Íñigo Huguet 03aaff8fc2 devlink: get and set eswitch inline-mode and encap-mode
The setter function allow to set to "preserve" to modify only some of
them.

(cherry picked from commit bf654ef39e)
2024-02-21 11:27:31 +01:00
Íñigo Huguet a8c4372d42 sriov: add eswitch-inline-mode and eswitch-encap-mode properties
Those are related to the eswitch mode and can be configured together.

(cherry picked from commit 8a88386e3a)
2024-02-21 11:27:30 +01:00
Íñigo Huguet dd7810c473 platform: destroy VFs before changing the eswitch mode
It is not safe to change the eswitch mode when there are VFs already
created: it often fails, or even worse, doesn't fail immediatelly but
there are later problems with the VFs.

What is supposed to be well tested in all drivers is to change the
eswitch mode with no VFs created, and then create the VFs, so let's set
num_vfs=0 before changing the eswitch mode.

As we want to change num_vfs asynchronously in a separate thread, we
need to do a multi-step process with callbacks each time that a step
finish (before it was just set num_vfs asynchronously and invoke the
callback when it's done).

This makes link_set_sriov_params_async to become even larger and more
complex than it already was. Refactor it to make it cleaner and easier
to follow, and hopefully less error prone, and implement that multi-step
process.

(cherry picked from commit 770340627b)
2024-02-21 11:27:29 +01:00
Íñigo Huguet 1ba2b77402 sriov: set the devlink's eswitch mode
Use the new property sriov.eswitch-mode to select between legacy SRIOV
and switchdev mode.

(cherry picked from commit 837549ea94)
2024-02-21 11:27:29 +01:00
Íñigo Huguet e9561456c9 sriov: add eswitch-mode property
Add property to allow changing the eswitch mode between legacy SRIOV and
switchdev. Allow also to set "preserve" to prevent NM from modifying the
eswitch mode.

(cherry picked from commit c61c87f8a6)
2024-02-21 11:27:29 +01:00
Íñigo Huguet 61788cf901 platform: netlink: add devlink support
Add support for Devlink, which is just another family of Generic Netlink
like nl80211. Implement get_eswitch_mode and set_eswitch_mode to allow
changing between legacy SRIOV and switchdev modes.

Devlink's purpose is to allow querying and configuring stuff related to
a piece of hardware but not to any of the usual Linux device classes.

For example, nowadays the Smart NICs normally allow to change the
eswitch mode per PF, because their hardware implements one eswitch per
PF, but future models might have a single eswitch for all the physical
and virtual ports of the NIC allowing more advanced bridge offloads.

Regarding the above example, for the moment we only support PCI network
devices with the "one eswitch per PF" model. The reason is that currently
NM only knows about netdevs so dealing with "devlink devices" that
doesn't map 1-1 with a netdev would require new mechanisms to understand
what they are and their relation with the netdevs that NM manage. We
will deal with that use cases when they arise and we have more
information about the right way to support them.

(cherry picked from commit f31d29bbb7)
2024-02-21 11:27:28 +01:00
Íñigo Huguet c31f31acbf nm-setting: implement direct_enum as GObject property of type int
(cherry picked from commit 260865b1ac)
2024-02-21 11:20:52 +01:00
Beniamino Galvani fe734c5c11 dhcp: remove l3cds when the lease expires
When the lease is lost, NM tries to get a new by restarting the DHCP
transaction. However, it doesn't delete the existing l3cds (one from
the DHCP client with flag ONLY_FOR_ACD, the other from
NMDevice). Therefore, the l3cfg still tracks the ACD state of the
address as "external-removed", and when NM gets the same address via
DHCP, ACD is considered as failed; as a consequence, NM sends a
DECLINE message to the server.

Moreover, the l3cd added by NMDevice for DHCP has a zero ACD timeout,
and so it's not possible to do ACD again on the same address.

Remove those l3cds when the lease expires, so that any ACD state is
cleared and DHCP can perform ACD again.

Fixes: 240ec7f891 ('dhcp: implement ACD (address collision detection) for DHCPv4')

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1853
(cherry picked from commit a80fef9f37)
2024-02-20 09:31:21 +01:00
Íñigo Huguet 8776409483 release: bump version to 1.45.91 (1.46-rc2) (development) 2024-02-09 15:41:49 +01:00
Íñigo Huguet b6a135729a NEWS: add missing new features in 1.46
(cherry picked from commit a9fde8d965)
2024-02-09 13:08:21 +01:00
Jan Vaclav 08b1a08ef8 libnm-core: fix mac comparison in _remove_mac_blacklist_item_by_value
The comparison checking for MAC address equality had previously been flipped around.

Fixes: b084ad7f2b ('libnm-core: canonicalize hardware addresses in settings')
(cherry picked from commit 641e717797)
2024-02-09 12:56:20 +01:00
Jan Vaclav 96d3739a54 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')
(cherry picked from commit 7502787959)
2024-02-09 12:55:39 +01:00
Thomas Haller 0904bab5e2 glib-aux: fix atomic pattern in nm_ref_string_unref()
It's simply not valid to read the ref-count without an atomic.
The compiler might optimize out the assignment to "r" and read the
_ref_count field multiple times. Thereby, we might at first appear
to be larger than > 1, and later pass 1 to compare-and-exchange.

We need an atomic get here.

Fixes: 19d4027824 ('refstr: inline nm_ref_string_{ref,unref}()')

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1847
(cherry picked from commit 5f7a027f59)
2024-02-09 12:54:37 +01:00
Thomas Haller 40a77de88e std-aux: workaround usage of _Pragma() inside nm_assert()
Older gcc versions don't like this. The _Pragam() itself is to workaround a
-Wnonnull-compare warning with gcc 14.

After all, we use compiler warning extensively. They are our linters and have
necessarily false positives. To make them usable across a wide range of
compilers, is a constant effort.

Here is another one.

The error:

  ./src/libnm-std-aux/nm-std-aux.h: In function ‘nm_utils_addr_family_other’:
  ./src/libnm-std-aux/nm-std-aux.h:230:36: error: expected expression before ‘#pragma’
    230 | #define NM_PRAGMA_DIAGNOSTICS_PUSH _Pragma("GCC diagnostic push")
        |                                    ^~~~~~~
  ./src/libnm-std-aux/nm-std-aux.h:232:5: note: in expansion of macro ‘NM_PRAGMA_DIAGNOSTICS_PUSH’
    232 |     NM_PRAGMA_DIAGNOSTICS_PUSH _Pragma(_NM_PRAGMA_WARNING_DO(warning))
        |     ^~~~~~~~~~~~~~~~~~~~~~~~~~
  ./src/libnm-std-aux/nm-std-aux.h:291:9: note: in expansion of macro ‘NM_PRAGMA_WARNING_DISABLE’
    291 |         NM_PRAGMA_WARNING_DISABLE("-Wnonnull-compare");                \
        |         ^~~~~~~~~~~~~~~~~~~~~~~~~
  ./src/libnm-std-aux/nm-std-aux.h:953:9: note: in expansion of macro ‘nm_assert’
    953 |         nm_assert(true || NM_UNIQ_T(xx, uniq) == (x));                    \
        |         ^~~~~~~~~
  ./src/libnm-std-aux/nm-std-aux.h:961:27: note: in expansion of macro ‘_NM_IN_SET’
    961 | #define NM_IN_SET(x, ...) _NM_IN_SET(NM_UNIQ, ||, typeof(x), x, __VA_ARGS__)
        |                           ^~~~~~~~~~
  ./src/libnm-std-aux/nm-std-aux.h:1493:15: note: in expansion of macro ‘NM_IN_SET’
   1493 |     nm_assert(NM_IN_SET((addr_family), NM_AF_INET, NM_AF_INET6))
        |               ^~~~~~~~~
  ./src/libnm-std-aux/nm-std-aux.h:1502:9: note: in expansion of macro ‘nm_assert_addr_family’
   1502 |         nm_assert_addr_family(NM_UNIQ_T(_addr_family, uniq));    \
        |         ^~~~~~~~~~~~~~~~~~~~~
  ./src/libnm-std-aux/nm-std-aux.h:1510:33: note: in expansion of macro ‘_NM_IS_IPv4’
   1510 | #define NM_IS_IPv4(addr_family) _NM_IS_IPv4(NM_UNIQ, addr_family)
        |                                 ^~~~~~~~~~~
  ./src/libnm-std-aux/nm-std-aux.h:1515:12: note: in expansion of macro ‘NM_IS_IPv4’
   1515 |     return NM_IS_IPv4(addr_family) ? NM_AF_INET6 : NM_AF_INET;
        |            ^~~~~~~~~~

Fixes: 62c1745f62 ('std-aux: suppress "-Wnonnull-compare" warning in nm_assert()')
(cherry picked from commit e4b154e1b0)
2024-02-09 12:53:54 +01:00
Thomas Haller 926351d031 device: fix _prop_get_ipv4_dhcp_dscp() to return value
Fixes: 3cf6a805ba ('device: support the DHCP DSCP property')
(cherry picked from commit 3e8fc01afb)
2024-02-09 12:53:23 +01:00
Gris Ge f990f9b4e4 bridge: skip VLAN filtering resetting in reapply if no vlan change changed
When doing reapply on linux bridge interface, NetworkManager will reset
the VLAN filtering and default PVID which cause PVID been readded to all
bridge ports regardless they are managed by NetworkManager.

This is because Linux kernel will re-add PVID to bridge port upon the
changes of bridge default-pvid value.

To fix the issue, this patch introduce netlink parsing code for
`vlan_filtering` and `default_pvid` of NMPlatformLnkBridge, and use that
to compare desired VLAN filtering settings, skip the reset of VLAN
filter if `default_pvid` and `vlan_filtering` are unchanged.

Signed-off-by: Gris Ge <fge@redhat.com>
(cherry picked from commit 02c34d538c)
2024-02-09 10:03:39 +01:00
Beniamino Galvani 7bf464736f merge: branch 'th/gcc-14-fixes'
Fix compiler warnings with gcc-14 (mostly "-Wnonnull-compare")

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

(cherry picked from commit 2dbc4d16e6)
2024-02-07 09:43:44 +01:00
Thomas Haller aeaba8a2a1 libnm: avoid "-Wnonnull-compare warnings with "static" array declarator
With a static array, we indicate that the argument must not be NULL.
Gcc-14.0.1-0.2.fc40 now warns against that:

    CC       src/libnm-base/libnm_base_la-nm-base.lo
  In file included from ../src/libnm-std-aux/nm-default-std.h:102,
                   from ../src/libnm-glib-aux/nm-default-glib.h:11,
                   from ../src/libnm-glib-aux/nm-default-glib-i18n-lib.h:13,
                   from ../src/libnm-base/nm-base.c:3:
  ../src/libnm-base/nm-base.c: In function 'nm_net_devname_infiniband':
  ../src/libnm-std-aux/nm-std-aux.h:191:12: error: 'nonnull' argument 'name' compared to NULL [-Werror=nonnull-compare]
    191 |         if (expr)                      \
        |            ^
  ../src/libnm-std-aux/nm-std-aux.h:202:27: note: in expansion of macro '_NM_BOOLEAN_EXPR_IMPL'
    202 |                           _NM_BOOLEAN_EXPR_IMPL(NM_UNIQ, expr))
        |                           ^~~~~~~~~~~~~~~~~~~~~
  ../src/libnm-glib-aux/nm-macros-internal.h:1693:31: note: in expansion of macro 'NM_BOOLEAN_EXPR'
   1693 | #define _G_BOOLEAN_EXPR(expr) NM_BOOLEAN_EXPR(expr)
        |                               ^~~~~~~~~~~~~~~
  /usr/include/glib-2.0/glib/gmacros.h:1244:43: note: in expansion of macro '_G_BOOLEAN_EXPR'
   1244 | #define G_LIKELY(expr) (__builtin_expect (_G_BOOLEAN_EXPR(expr), 1))
        |                                           ^~~~~~~~~~~~~~~
  /usr/include/glib-2.0/glib/gmessages.h:656:9: note: in expansion of macro 'G_LIKELY'
    656 |     if (G_LIKELY (expr)) \
        |         ^~~~~~~~
  ../src/libnm-base/nm-base.c:57:5: note: in expansion of macro 'g_return_val_if_fail'
     57 |     g_return_val_if_fail(name, NULL);
        |     ^~~~~~~~~~~~~~~~~~~~

  ../src/libnm-core-impl/nm-setting-wireguard.c: In function '_nm_wireguard_peer_set_public_key_bin':
  ../src/libnm-core-impl/nm-setting-wireguard.c:316:8: error: 'nonnull' argument 'public_key' compared to NULL [-Werror=nonnull-compare]
    316 |     if (!public_key)
        |        ^

Convert these checks to an nm_assert() to suppress the warning.

(cherry picked from commit 7a031eef5d)
2024-02-07 09:43:43 +01:00
Thomas Haller 3fb0f9f8a7 std-aux: suppress "-Wnonnull-compare" warning in nm_assert()
When we use a "static" array declarator to a function, we understand
and tell the compiler that the argument must not be NULL.

But now gcc-14.0.1-0.2.fc40 starts warning about NULL checks for
such arguments.

  static void foo(char args[static 10]) {
      nm_assert(args);
      sprintf(args, "hi");
  }

Granted, the compiler is right, and we know that this condition is not
supposed to be violated. A logical thing would be just to drop the
assertion.

Instead, suppress "-Wnonnull-compare" warnings inside a nm_assert(). An
nm_assert() is more than a run time check, it's an additional
self-documenting code of the invariants.

It's fine to assert for something that is true. Actually, all the
conditions that we assert against, hold. The compiler telling us that
the condition that we assert against is valid, is not useful.

(cherry picked from commit 62c1745f62)
2024-02-07 09:43:43 +01:00
Thomas Haller a5f75625e2 std-aux: move NM_PRAGMA_WARNING_DISABLE() macro from libnm-glib-aux to libnm-std-aux
Will be used by nm_assert().

(cherry picked from commit c0338526f3)
2024-02-07 09:43:43 +01:00
Thomas Haller 9fd5a78eb9 std-aux: add NM_STRINGIFY() macro
(cherry picked from commit 025d6898fe)
2024-02-07 09:43:43 +01:00
Thomas Haller 157c2ffeee libnm: use flexible array member in NMUtilsStrStrDictKey
Otherwise, gcc-14.0.1-0.2.fc40 warns:

  ../src/libnm-core-impl/nm-utils.c: In function _nm_utils_strstrdictkey_create:
  ../src/libnm-core-impl/nm-utils.c:5076:16: error: allocation of insufficient size '1' for type 'NMUtilsStrStrDictKey' {aka 'struct _NMUtilsStrStrDictKey'} with size '2' [-Werror=alloc-size]
   5076 |         return g_malloc0(1);
        |                ^~~~~~~~~~~~

(cherry picked from commit 63ab0d926d)
2024-02-07 09:43:43 +01:00
Thomas Haller eaa3a4e396 libnm: avoid "-Walloc-size" warning in nm_team_link_watcher_new_ethtool()
gcc-14.0.1-0.2.fc40 warns:

    CC       src/libnm-core-impl/libnm_core_impl_la-nm-setting-team.lo
  ../src/libnm-core-impl/nm-setting-team.c: In function nm_team_link_watcher_new_ethtool:
  ../src/libnm-core-impl/nm-setting-team.c:127:13: error: allocation of insufficient size 16 for type NMTeamLinkWatcher with size 48 [-Werror=alloc-size]
    127 |     watcher = g_malloc(nm_offsetofend(NMTeamLinkWatcher, ethtool));
        |             ^

(cherry picked from commit 5715feebe7)
2024-02-07 09:43:43 +01:00
Beniamino Galvani b7fa330ac5 dhcp: merge branch 'bg/dhcp-dscp'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1824

(cherry picked from commit 9c67bf9ab6)
2024-02-06 17:02:32 +01:00
Beniamino Galvani a840e64945 n-dhcp4: change the default DSCP value to 0
Section 4.9 of RFC 4594 specifies that DHCP should use the standard
(CS0 = 0) service class. Section 3.2 says that class CS6 is for
"transmitting packets between network devices (routers) that require
control (routing) information to be exchanged between nodes", listing
"OSPF, BGP, ISIS, RIP" as examples of such traffic. Furthermore, it
says that:

      User traffic is not allowed to use this service class.  By user
      traffic, we mean packet flows that originate from user-controlled
      end points that are connected to the network.

Indeed, we got reports of some Cisco switches dropping DHCP packets
because of the CS6 marking.

For these reasons, change the default value to the recommended one,
CS0.

(cherry picked from commit d8b33e2a97)
2024-02-06 17:02:31 +01:00
Beniamino Galvani 60958b8381 initrd: add support for rd.net.dhcp.dscp property
Add a new kernel command line option, so that the DSCP value can by
changed even in early boot.

(cherry picked from commit d920b48a5f)
2024-02-06 17:02:31 +01:00
Beniamino Galvani aed4dd0927 device: support the DHCP DSCP property
(cherry picked from commit 3cf6a805ba)
2024-02-06 17:02:30 +01:00
Beniamino Galvani e12e5a2ad4 libnm,nmcli: add ipvx.dhcp-dscp property
Currently the internal DHCP client sets traffic class "CS6" in the DS
field of the IP header for outgoing packets.

dhclient sets the field according to the definition of TOS (RFC 1349),
which was was deprecated in 1998 by RFC 2474 in favor of DSCP.

Introduce a new property IPvX.dhcp-dscp (currently valid only for
IPv4) to specify a custom DSCP value for DHCP backends that support it
(currently, only the internal one).

Define the default value to CS0, because:

 - section 4.9 of RFC 4594 specifies that DHCP should use the standard
   (CS0 = 0) service class;

 - section 3.2 says that class CS6 is for "transmitting packets
   between network devices (routers) that require control (routing)
   information to be exchanged between nodes", listing "OSPF, BGP,
   ISIS, RIP" as examples of such traffic. Furthermore, it says that:

     User traffic is not allowed to use this service class.  By user
     traffic, we mean packet flows that originate from user-controlled
     end points that are connected to the network.

- we got reports of some Cisco switches dropping DHCP packets because
  of the CS6 marking.

(cherry picked from commit fcd907e062)
2024-02-06 17:02:30 +01:00
Beniamino Galvani a179bcc117 n-dhcp4: support setting the DSCP value
The client currently always sets the DSCP value in the DS field
(formerly known as "TOS") to CS6. Some network equipment drops packets
with such DSCP value; provide a way to change it.

(cherry picked from commit 2f543f1154)
2024-02-06 17:02:30 +01:00
Javier Sánchez Parra 854f7275de nmtui: fix WireGuard peer editor empty fields
Previously, input fields for peer attributes such as 'Public Key' were
not pre-populated with the existing settings of the peer. This was due
to the WireGuard peer editor class not setting its peer property during
object construction, as the necessary flag was absent. This commit
addresses and fixes this issue.

Closes #1443

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1851
(cherry picked from commit 7e7d3a7981)
2024-02-02 12:53:22 +01:00
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