Commit graph

31318 commits

Author SHA1 Message Date
Lubomir Rintel
133540763c libnm: test that Gir data matches actual exports
This verifies that what's in our public headers has version nodes, and
that they match Since: tags.

Not pretty (because python) but discovered a *lot* of issues.
2022-11-08 13:14:56 +01:00
Lubomir Rintel
e13eb9010c Makefile.am: tidy up the introspection conditional part
Use of conditionals in makefiles needs to be kept to a necessary minimum
otherwise they get out of hand quickly. There's no indentation to aid
reading and conditional chunks longer than a screen and nested ones are
almost impossible to comprehend.

The "if HAVE_INTROSPECTION" part does both.

Let's make it a little less horrible. There's generally no point in
making unused targets or variable assignment unless they collide with
pre-built stuff or have multiple variants.
2022-11-08 11:43:06 +01:00
Lubomir Rintel
4c49d67cc8 docs/api: fix ugly things in Makefile
Turns out automake doesn't like either that we add dependencies to a
target conditionally. Not sure why, but it's a tasteless thing to do
nevertheless:

  gtk-doc.make:174: warning: $(DOC_MAIN_SGML_FILE) was already defined in condition BUILD_DOCS, which is included in condition TRUE ...
  docs/api/Makefile.am:112:   'gtk-doc.make' included from here
  docs/api/Makefile.am:14: ... '$(DOC_MAIN_SGML_FILE)' previously defined here

In any case, the dependency is wrong in the first place -- the source
document doesn't depend on other source. The target (which is a stamp
file, since the xslt processor produces multiple files) does! Moreover,
there's a dependency of the stamp file on $(content_files) already, so
including GENERATED_FILES (like we already do) in content_files should
be sufficient.

While at that, deal with other not-so-nice things; don't extend "all"
target needlessly and don't define a target conditionally.
2022-11-08 11:43:06 +01:00
Lubomir Rintel
45d9f1c01c libnm: actually export a lot of routines that were supposed to be public
Add them to @libnm_1_40_4 as opposed to @libnm_1_42_0 because we now know
this is going to be backported to 1.40.4 first.
2022-11-08 11:43:00 +01:00
Lubomir Rintel
d78000d921 libnm: export nm_utils_ip_{address,rout}es_{from,to}_variant
These are present in a public header yet are not properly commented,
versioned or exported.

Export them now. Another option would be to move them to a private
header; but I suspect someone has intended them to be exported at some
point.

Add them to @libnm_1_40_4 as opposed to @libnm_1_42_0 because we now know
this is going to be backported to 1.40.4 first.
2022-11-08 11:41:47 +01:00
Lubomir Rintel
c0b2b5e3a8 libnm/connection: fix a handful of versioning tags
These are marked as being available sooner than they actually appear in
libnm.ver.
2022-11-08 11:40:18 +01:00
Lubomir Rintel
117a440cd9 libnm: fix a large amount of Since tags
Some comments are malformed, some are missing altogether.
2022-11-08 11:40:18 +01:00
Lubomir Rintel
1c6b0edb30 libnm: drop nm_vpn_plugin_old_set_{,ip6_}config()
Remove the functions from a public header. They were missing from
libnm.ver and thus never actually exported.

There's no point in salvaging them now as the whole NMVpnPluginOld has
been replaced NMVpnServicePlugin and new uses are discouraged.
2022-11-08 11:40:18 +01:00
Lubomir Rintel
ecb9a48040 libnm: remove nm_device_wpan_get_hw_address()
Remove the function from a public header. It was missing from libnm.ver
and thus never actually exported.

There's no point in salvaging it now as it nm_device_get_hw_address()
exists as a better option.
2022-11-08 11:40:18 +01:00
Lubomir Rintel
bd3239cf6c libnm: remove nm_device_6lowpan_get_hw_address()
Remove the function from a public header. It was missing from libnm.ver
and thus never actually exported.

There's no point in salvaging it now as it nm_device_get_hw_address()
exists as a better option.
2022-11-08 11:40:18 +01:00
Lubomir Rintel
c7f6a506ef libnm: move nm_setting_ip_config_get_dhcp_iaid() to @libnm_1_40_4 version node
We haven't done a release with this in @libnm_1_42_0 and we now know this
is going to be backported to 1.40.4 first.
2022-11-08 11:39:51 +01:00
Lubomir Rintel
a0373a72db client: add_and_activate*() allow NULL device
Fix up the doc comment so that the gir data gets that right.

Fixes: 90d0ae0faf ('libnm: implement nm_client_activate_connection()/nm_client_add_and_activate_connection*() by using GDBusConnection directly')
2022-11-07 15:58:29 +01:00
Thomas Haller
ab6ecbb808
build: merge branch 'th/build-cleanup-compiler-warnings'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1445
2022-11-07 08:50:23 +01:00
Thomas Haller
abbacb1085
build: enable warnings "-Wint-conversion" and "-Wold-style-definition"
See https://lwn.net/Articles/913505/ .
2022-11-07 08:50:07 +01:00
Thomas Haller
4d2cb2d32b
build/autotools: add compiler warnings that we have in meson
Synchronize the compiler warnings for meson and autotools.
2022-11-07 08:50:07 +01:00
Thomas Haller
f3682588b2
build/meson: sort compiler flags in "meson.build"
Also remove duplicates.
2022-11-07 08:50:07 +01:00
Thomas Haller
c884d4d347
nm-setting: fix static assertions for NM_SETTING_PARAM_* flags and numeric values
- the static assertions were wrong, there was a "," instead of "==".

- the numeric values were wrong, as shown by the static assertions.

- move the code comment to the implementation. This does not seem
  relevant for the library user and should not be in the public header.

Fixes: 08e845f651 ('nm-setting: mangle public constant to make g-ir-scanner happy')
2022-11-07 08:36:10 +01:00
Lubomir Rintel
08e845f651 nm-setting: mangle public constant to make g-ir-scanner happy
Some versions of g-ir-scanner's C parser silently coerce unrecognized
symbols into zeroes [1]. Let's avoid that so that we don't end up with
wrong constants in our Gir data.

[1] https://gitlab.gnome.org/GNOME/gobject-introspection/-/merge_requests/366

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1446
2022-11-07 08:23:57 +01:00
Thomas Haller
e7b1fd9dbc
std-aux: add code comment to NM_BOOLEAN_EXPR() 2022-11-04 09:27:37 +01:00
Beniamino Galvani
8bd72d5f2e std-aux: fix NM_LIKELY()/NM_UNLIKELY() macros
Fix this compile error when "defined(__GNUC__) && (__GNUC__ > 2) &&
defined(__OPTIMIZE__)" doesn't match:

  In file included from ../src/libnm-std-aux/nm-default-std.h:102,
                   from ../src/libnm-std-aux/nm-std-utils.c:3:
  ../src/libnm-std-aux/nm-std-aux.h: In function ‘NM_ALIGN_TO’:
  ../src/libnm-std-aux/nm-std-aux.h:160:6: error: expected expression before ‘{’ token
    160 |     ({                                 \
        |      ^
  ../src/libnm-std-aux/nm-std-aux.h:169:31: note: in expansion of macro ‘_NM_BOOLEAN_EXPR_IMPL’
    169 | #define NM_BOOLEAN_EXPR(expr) _NM_BOOLEAN_EXPR_IMPL(NM_UNIQ, expr)
        |                               ^~~~~~~~~~~~~~~~~~~~~
  ../src/libnm-std-aux/nm-std-aux.h:175:27: note: in expansion of macro ‘NM_BOOLEAN_EXPR’
    175 | #define NM_LIKELY(expr)   NM_BOOLEAN_EXPR(expr)
        |                           ^~~~~~~~~~~~~~~
  ../src/libnm-std-aux/nm-std-aux.h:238:19: note: in expansion of macro ‘NM_LIKELY’
    238 |         } else if NM_LIKELY (cond) {                                  \
        |                   ^~~~~~~~~
  ../src/libnm-std-aux/nm-std-aux.h:449:5: note: in expansion of macro ‘nm_assert’
    449 |     nm_assert(nm_utils_is_power_of_two(ali));
        |     ^~~~~~~~~

The NM_LIKELY()/NM_UNLIKELY() macros should be alwas called enclosed
in parentheses like in:

 if (NM_LIKELY(i == 1)) ...

and should be expanded with only a single pair of parentheses so that
expressions like (i = 1) generate a compiler warning.

Fixes: 030d68aef7 ('shared: add nm_assert() to "nm-std-aux.h"')
2022-11-04 09:12:04 +01:00
Lubomir Rintel
941e8b70f8 libnm: export nm_setting_ip_config_get_dhcp_iaid
The export was left out when the symbol was added; apparently by
accident.

Let's also bump the documented version of when is the symbol supposed to
be available, because it actually wasn't.

Fixes: 56a1a5426a ('all: add ipvX.dhcp-iaid properties')

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1447
2022-11-03 15:34:08 +01:00
Thomas Haller
dc26e65928
tests: add tests for generating stable UUIDs for keyfile/initrd
Fixes: 7ee0da3eaf ('build: don't "update-po" during make dist')
2022-11-03 09:23:57 +01:00
Thomas Haller
545edb7093
all: fix generating UUIDs for string
https://github.com/coreos/fedora-coreos-tracker/issues/1325

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/1130

Fixes: b5e7e48bc1 ('glib-aux: add and use nm_uuid_generate_from_strings_old()')
2022-11-03 09:23:52 +01:00
Thomas Haller
311c97a83e
release: bump version to 1.41.4 (development) 2022-11-02 18:13:08 +01:00
Thomas Haller
28ab535617
initrd/tests: add unit test for autoconnect-priority setting
Fixes: 98575bd513 ('initrd: generate initrd generator profiles with autoconnect-priority -100')
2022-11-02 13:43:06 +01:00
Thomas Haller
f25a6aad93
all: update references to our mailing list
The mailing list migrated from GNOME (networkmanager-list@gnome.org)
to freedesktop (networkmanager@list.freedesktop.org).

See also https://mail.gnome.org/archives/networkmanager-list/2022-November/msg00000.html.
2022-11-02 12:58:57 +01:00
Thomas Haller
1d767bb1cd
gitignore: ignore "po/.Makefile.patched" file
Fixes: 7ee0da3eaf ('build: don't "update-po" during make dist')
2022-10-31 09:20:53 +01:00
Thomas Haller
c51e0b1f6d
build: merge branch 'th/gen-metadata-nm-settings-libnm-core'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1441
2022-10-31 09:15:23 +01:00
Thomas Haller
d699f76855
libnm: generate "gen-metadata-nm-settings-libnm-core.xml" with meta data
libnm-core-impl has lots of internal meta data about the properties.
In particular, which properties exist (their names), and their D-Bus
type.

We should use this information for our manual pages. For example,
currently `man nm-settings-dbus` has nonsense like: "Value Type: array
of string", when it should be reall "as".

In a first step, generate an XML with that meta data for later use.
2022-10-31 09:11:30 +01:00
Thomas Haller
1bfe908c2e
nmcli: rename "generate-docs-nm-settings-nmcli" to "gen-metadata-nm-settings-nmcli"
This is the better name, becuse this is not in particular about "docs".
It's about generating an XML with the information from the settings
meta data for nmcli.

We will do something similar with the libnm-core meta data.
2022-10-31 09:11:30 +01:00
Thomas Haller
139f4b4b2e
build: pass both filenames to "tools/check-compare-generated.sh" script
It just feels nicer to be explicit about the filenames and
not rely on a specific naming.

Also, in meson we can directly pass the target as argument, which
expands to the filename but also adds a dependency.
2022-10-31 09:11:30 +01:00
Thomas Haller
489f65bf9c
build/meson fix "gen-metadata-nm-settings-nmcli.xml.in" without enable_docs
Fixes: ab8fdb73e6 ('build: commit pre-generated "generate-docs-nm-settings-nmcli.xml" to git')
2022-10-31 09:11:30 +01:00
Thomas Haller
0ffe391f82
std-aux: fix build error due to __assert_fail() missing with NDEBUG
<assert.h> only defines __assert_fail() if NDEBUG is not on.
Fix that.

Fixes: 8e3299498d ('std-aux,glib-aux: rework nm_assert() implementations')
2022-10-29 21:43:33 +02:00
Thomas Haller
a13fa05754
libnm: merge branch 'th/libnm-fix-compare-dns'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1442
2022-10-28 17:55:42 +02:00
Thomas Haller
e72b1f49b3
libnm: minor refactoring on property_to_dbus() and add comment
Add a comment. Also, restructure the check so that it is (hopefully)
easier to read.
2022-10-28 17:54:16 +02:00
Thomas Haller
991a20b4b2
libnm: fix comparing "ipv[46].dns" properties
nm_setting_diff() ends up calling the compare_fcn() hook. Previously,
the hook for "dns" was _nm_setting_property_compare_fcn_default()
and the hook for "dns-data" was _nm_setting_property_compare_fcn_ignore().

That's wrong. _nm_setting_property_compare_fcn_default() converts
the property to D-Bus and compares the GVariant. However, "dns" has
to_dbus_only_in_manager_process set, so it wouldn't

Fixes: 63eaf168d1 ('libnm: add "dns-data" replacement for "ipv[46].dns" properties on D-Bus')
2022-10-28 17:54:15 +02:00
Thomas Haller
0f0468b208
libnm: fix _nm_setting_property_compare_fcn_default() for "to_dbus_only_in_manager_process"
property_to_dbus() gets called for two reasons. Once from
_nm_setting_to_dbus(). In that case, we want to honor
to_dbus_only_in_manager_process().

It gets also called from _nm_setting_property_compare_fcn_default(),
with ignore_flags set. In that case, we don't want to ignore the property
as the hook really wants to compare them.

Fixes: c8392018ca ('libnm: refactor to-dbus on the client skipping to serialize legacy properties')
2022-10-28 17:54:15 +02:00
Thomas Haller
6414b016a7
libnm/tests: test comparing "ipv[46].dns" properties 2022-10-28 17:54:15 +02:00
Thomas Haller
64b1b2f453
libnm/tests: use g_assert_cmpint() in ensure_diffs() test
Just gives a better failure message. These checks fail often, when new
code gets added.
2022-10-28 17:54:14 +02:00
Thomas Haller
b2d1d14772
build/autotools: adjust hack for gettext() for other Makefile versions
On rhel-8.7, we use a different gettext version, so the Makefile
looks different. Adjust patch the source.

Fixes: 7ee0da3eaf ('build: don't "update-po" during make dist')
2022-10-28 12:23:04 +02:00
Thomas Haller
0622ed7051
cli: cleanup connecting state change signal
It seems really ugly, to pass a callback function of wrong
signature. Granted, it probably works due to the C calling
convention, but it seems odd.

Use callbacks of the proper type instead. Then we also don'
need g_signal_connect_swapped().

While at it, rename. "connected_state_cb()" seems a bad name.
2022-10-28 08:52:08 +02:00
Thomas Haller
4fa20ce710
platform/tests: don't use translations in test tool
Otherwise, this file would need to be included in POTFILES.in.
This is unnecessary.

Fixes: 06cf1f5e2d ('platform/tests: extend monitor tool to dump the state of NMPlatform')
2022-10-27 15:18:54 +02:00
Thomas Haller
3a8decd9cf
hostname: rename nm_hostname_manager_write_hostname() to set_static_hostname() 2022-10-27 15:18:54 +02:00
Thomas Haller
37ab511ed4
glib-aux: add nm_dbus_connection_call_get() helper 2022-10-27 13:46:17 +02:00
Thomas Haller
1b60c1ecba
dns: merge branch 'th/dot-sni'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/528

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1434
2022-10-27 09:17:03 +02:00
Thomas Haller
3970489219
NEWS: update 2022-10-27 09:15:26 +02:00
Thomas Haller
bdb124852f
libnm: unify IPv4/IPv6 forms of DNS to GVariant helper 2022-10-27 09:11:40 +02:00
Thomas Haller
d5be1c706e
dns/resolved: set DoT server name (SNI) in systemd-resolved
Unfortunately, for this we require SetLinkDNSEx() API from v246.
That adds extra complexity.

If the configuration contains no server name, we continue using
SetLinkDNS(). Otherwise, at first we try using SetLinkDNSEx().
We will notice if that method is unsupported, reconfigure with
SetLinkDNS(), and set a flag to not try that again.
2022-10-27 09:11:38 +02:00
Thomas Haller
ba33942734
dns/resolved: cleanup detection of supported API in "nm-dns-systemd-resolved.c"
- rename the "has_" variables to have the same name as the API that they
  check.
- do an if-else-if for checking the operation when detecting support.

This just feels nicer. No strong reasons.
2022-10-27 09:11:35 +02:00
Thomas Haller
c68e148b02
core: extend NML3ConfigData:nameserver to track DNS as string
The DNS name can now also contain the DoT server name. It's not longer a
binary IP address only.

Extend NML3ConfigData to account for that. To track the additional
data, use the string representation. The alternative to have a separate
type that contains the parsed information would be cumbersome too.
2022-10-27 09:11:33 +02:00