Commit graph

18 commits

Author SHA1 Message Date
Thomas Haller
49e85bee0e
core/tests: add nmtst_utils_host_id_{push,pop}() helpers to stub the host-id
The host-id gets read from /var/lib/NetworkManager/secret_key, and cached in
a global variable. Other parts of the code can get the host ID using a
singleton function.

For testing, we need to inject a different host-id. Add two push/pop
functions for that.

Unlike nm_utils_host_id_get(), these functions are not thread-safe (nor
is it possible to make them thread-safe in a reasonable manner).
2021-09-08 18:33:43 +02:00
Thomas Haller
5a4124f738
core: refactor nm_utils_ipv6_addr_set_stable_privacy() to not fail
It's great to have functions that cannot fail, because it allows to
skip any error handling.

_set_stable_privacy() as it was could not fail, so the only reason why
nm_utils_ipv6_addr_set_stable_privacy() could fail is because the DAD
counter exhausted.

Also, it will be useful to have a function that does not do the counter
check, where the caller wants to handle that differently.

Rename some functions, and make the core nm_utils_ipv6_addr_set_stable_privacy()
not failable.
2021-08-31 16:49:46 +02:00
Beniamino Galvani
604c611cd0 core: add nm_utils_connection_match_spec_list()
Add function nm_utils_connection_match_spec_list() to check whether a
connection matches a spec list. Also document the supported syntax in
the man page.
2021-07-27 17:43:45 +02:00
Thomas Haller
4e109bacab
clang-format: use "IndentPPDirectives:None" instead of "BeforeHash"
Subjectively, I think this looks better.
2021-07-09 08:49:06 +02:00
Beniamino Galvani
00126e57b4 core: add infrastructure for spawning a helper process
(cherry picked from commit 6ac21ba916)
2021-06-11 21:59:11 +02:00
Thomas Haller
9113a672cf
platform: move nm_utils_modprobe() to libnm-platform 2021-03-05 11:27:15 +01:00
Thomas Haller
7b18e15481
platform: move nm_utils_lifetime_*() to libnm-platform 2021-03-05 11:27:15 +01:00
Thomas Haller
690105c616
platform: move nm_utils_new_{vlan,infiniband}_name() to libnm-platform 2021-03-05 11:27:15 +01:00
Thomas Haller
2d9a9d0ded
core: move NM_PLATFORM_LIFETIME_PERMANENT to libnm-platform/nmp-base.h 2021-03-05 11:27:15 +01:00
Thomas Haller
a016f24353
glib-aux: move NMIcmpv6RouterPref to libnm-glib-aux 2021-03-05 11:09:15 +01:00
Thomas Haller
3c733cc32e
glib-aux: move nm_utils_sysctl_ip_conf_*() helpers 2021-03-05 11:09:14 +01:00
Thomas Haller
2ce9cf3e20
glib-aux: move nm_utils_ip4_address_is_{zeronet,link_local}() 2021-03-05 11:09:14 +01:00
Thomas Haller
57735e1e8e
glib-aux: move nm_utils_ip[46]_address_*() helpers 2021-03-05 11:09:14 +01:00
Thomas Haller
ec22551ce9
glib-aux: move NMUtilsIPv6IfaceId struct to libnm-glib-aux 2021-03-05 11:09:14 +01:00
Thomas Haller
b3f5113503
glib-aux: move nm_utils_exp10() from core to libnm-glib-aux 2021-03-05 11:09:12 +01:00
Thomas Haller
9dc84b32b0
build: move "shared/nm-{glib-aux,log-null,log-core}" to "src/libnm-{glib-aux,log-null,log-core}" 2021-02-24 12:48:20 +01:00
Thomas Haller
60800b33b4
all: drop unnecessary cast of g_object_new()
Our cast macros (like NM_AUTH_SUBJECT()) are plain C pointer casts,
unless when building with more asserts enabled.

Still, they are unnecessary and even their ability to check the type
(with more asserts) is not needed, because we must trust glib's
g_object_new() to return reasonable objects. That is a basic
requirement, that we don't need to assert against.

Also, in the majority of cases we don't do this either.
2021-02-08 17:02:09 +01:00
Thomas Haller
ac1a9e03e4
all: move "src/" directory to "src/core/"
Currently "src/" mostly contains the source code of the daemon.
I say mostly, because that is not true, there are also the device,
settings, wwan, ppp plugins, the initrd generator, the pppd and dhcp
helper, and probably more.

Also we have source code under libnm-core/, libnm/, clients/, and
shared/ directories. That is all confusing.

We should have one "src" directory, that contains subdirectories. Those
subdirectories should contain individual parts (libraries or
applications), that possibly have dependencies on other subdirectories.
There should be a flat hierarchy of directories under src/, which
contains individual modules.

As the name "src/" is already taken, that prevents any sensible
restructuring of the code.

As a first step, move "src/" to "src/core/". This gives space to
reorganize the code better by moving individual components into "src/".

For inspiration, look at systemd's "src/" directory.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/743
2021-02-04 09:45:55 +01:00
Renamed from src/nm-core-utils.h (Browse further)