Commit graph

27920 commits

Author SHA1 Message Date
Thomas Haller
ca43239beb
logging: merge branch 'th/platform-sysctl-logging-mt'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/772
2021-03-09 09:37:57 +01:00
Thomas Haller
3c0ae1b5da
platform: make global logging cache for NMPlatform's sysctl values thread-safe
We have a cache for sysctl values, so that we can log changes and
previous values.

When resetting the log level, we prune that cache, which is done by
_nm_logging_clear_platform_logging_cache(). That function is called
by nm_logging_setup(), which is guaranteed to only happen on the main
thread.

NMPlatform in general is not thread safe (meaning, that the same NMPlatform
instance cannot be used by multiple threads at the same time). There is however
a reasonable aim that you could use different NMPlatform instances on their
own threads.

That currently doesn't work, mainly due to nm-logging which always must
be done from the main thread -- unless we would set NM_THREAD_SAFE_ON_MAIN_THREAD
in all of NMPlatform (which would be too expensive for something we
don't actually need). That means also the sysctl getter must only be
called on the main thread an all was good already.

Still, we could have NMPlatform usable from multiple thread by setting
NM_THREAD_SAFE_ON_MAIN_THREAD. As we are almost there to have the code
thread-safe, make accessing the sysctl value cache thread-safe (even if
we currently don't actually access it from multiple thread).
2021-03-08 22:29:01 +01:00
Thomas Haller
8dbfbce9f6
platform: add NM_LINUX_PLATFORM_FROM_PRIVATE() helper function 2021-03-08 22:29:01 +01:00
Thomas Haller
597ad6aa8a
logging: use NMStrBuf in _domains_to_string() 2021-03-08 22:29:01 +01:00
Thomas Haller
29e93b1738
logging: prefer stack buffer for logging message 2021-03-08 22:29:01 +01:00
Thomas Haller
45ba49f322
shared: add nm_vsprintf_buf_or_alloc() macro 2021-03-08 22:29:00 +01:00
Thomas Haller
098ac7dbc0
shared: fix behavior of NM_G_MUTEX_LOCKED()
The idea of NM_G_MUTEX_LOCKED() macro is not only to register a mutex
for unlocking (via nm_auto_unlock_g_mutex) but also to lock it at
the same time.

That is a useful helper macro. If you have to lock the mutex yourself,
it makes usage less convenient. At which point you don't need the macro
anymore and you should instead take full control and lock/unlock yourself.

Fix the macro and change behavior. The macro was not used so far, so
it's not a problem.

Fixes: dd33b3a14e ('shared: add nm_auto_unlock_g_mutex and NM_G_MUTEX_LOCKED() helper macros')
2021-03-08 22:29:00 +01:00
Thomas Haller
a5829ea6d1
libnm: comment about wrong out parameter of nm_wireguard_peer_get_allowed_ip() 2021-03-08 22:24:12 +01:00
Beniamino Galvani
8df3ef5063 initrd: apply the MTU from bond= argument to the bond connection
Currently the MTU specified in:

 bond=<bondname>[:<bondslaves>:[:<options>[:<mtu>]]]

gets applied to the bond ports. Instead it should be applied to the
bond itself.

Fixes: ecc074b2f8 ('initrd: add command line parser')

https://bugzilla.redhat.com/show_bug.cgi?id=1932502
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/767
2021-03-08 10:31:51 +01:00
Thomas Haller
7ad2b8f20a
platform: merge branch 'th/platform-move'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/769
2021-03-05 11:29:09 +01:00
Thomas Haller
604b1d0331
platform: move more platform code to src/libnm-platform/ 2021-03-05 11:27:16 +01:00
Thomas Haller
06c03f3e8d
platform: drop unnecessary #include from platform code (2) 2021-03-05 11:27:16 +01:00
Thomas Haller
3b6e57961d
platform: move "platform/{wifi,wpan}/" to "src/libnm-platform/" 2021-03-05 11:27:15 +01:00
Thomas Haller
f435454615
platform: move "linux/nl802154.h" to "src/linux-headers/" 2021-03-05 11:27:15 +01:00
Thomas Haller
a0662c05a3
platform: drop unnecessary #include from platform code 2021-03-05 11:27:15 +01:00
Thomas Haller
901a7ecbdd
core: move NMPObjectType to "libnm-platform/nmp-base.h" 2021-03-05 11:27:15 +01:00
Thomas Haller
d3585243c3
core: move creating singleton instance out of "nm-platform.c"
In core, NMPlatform is (also) a singleton instance. As we will move platform code
to libnm-platform, this singleton part makes no sense there. Move the code
to NetworkManagerUtils.c.
2021-03-05 11:27:15 +01: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
398b509931
base: move "libnm-core-intern/nm-core-types-internal.h" to libnm-base
"libnm-platform" has no dependency on libnm-core. To have the symbols
accessible, move them to libnm-base.
2021-03-05 11:27:02 +01:00
Thomas Haller
40fc7bd39a
base: move bridge defines to libnm-base/nm-base.h 2021-03-05 11:09:15 +01:00
Thomas Haller
8755538e04
glib-aux: move nm_utils_route_type{2str,_by_name}() to libnm-glib-aux 2021-03-05 11:09:15 +01:00
Thomas Haller
af0cfc559b
glib-aux: move nm_utils_ptrarray_find_first() helper to libnm-glib-aux 2021-03-05 11:09: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
2ab87642f6
glib-aux: move NMLinkType to "libnm-glib-aux/nm-shared-utils.h"
It is a bit odd to do this, because usually libnm-glib-aux is not
about network related stuff. But that is not true entirely, because
it also contains NMIPAddr and other related helper funcitons.

NMLinkType is only a plain enum, there is no logic beyond it.
As such, I think it's acceptable to move it here.

There reason to do this, is that I want to move NMUtilsIPv6IfaceId and
nm_utils_get_ipv6_interface_identifier() out of src/core/, and since
that API is also trival helpers without complex state, it fits to
libnm-glib-aux. As such, we will need also NMLinkType there.
2021-03-05 11:09:14 +01:00
Thomas Haller
2b6baccff8
core: use _NM_UTILS_HWADDR_LEN_MAX instead of NM_UTILS_HWADDR_LEN_MAX 2021-03-05 11:09:14 +01:00
Thomas Haller
e691657da0
core: use _NMVlanFlags instead of NMVlanFlags 2021-03-05 11:09:14 +01:00
Thomas Haller
82e2a694d7
core: use _NM80211Mode instead of NM80211Mode 2021-03-05 11:09:13 +01:00
Thomas Haller
a5865cef1a
core: use _NMDeviceWifiCapabilities instead of NMDeviceWifiCapabilities 2021-03-05 11:09:13 +01:00
Thomas Haller
d2abd70932
core: use _NMSettingWirelessWakeOnWLan instead of NMSettingWirelessWakeOnWLan 2021-03-05 11:09:13 +01:00
Thomas Haller
8a3df8419a
libnm-base: add internal _NMVlanFlags type 2021-03-05 11:09:13 +01:00
Thomas Haller
ad91e92b25
libnm-base: add internal _NM80211Mode type 2021-03-05 11:09:13 +01:00
Thomas Haller
367be3585f
libnm-base: add internal _NMDeviceWifiCapabilities type 2021-03-05 11:09:13 +01:00
Thomas Haller
096ee5ed6e
libnm-base: add internal _NMSettingWirelessWakeOnWLan type
NMSettingWirelessWakeOnWLan is public API of libnm/libnm-core
in "src/libnm-core-public/"

We want that libnm-platform is independet of libnm-core to keep
the dependencies smaller and code better separated. Hence we
cannot use that enum there.

Duplicate NMSettingWirelessWakeOnWLan as _NMSettingWirelessWakeOnWLan
in libnm-base.
2021-03-05 11:09:13 +01:00
Thomas Haller
c61d869646
platform: avoid nm_utils_hwaddr_ntoa() in "nm-platform.c" 2021-03-05 11:09:13 +01:00
Thomas Haller
5c790db8b6
glib-aux: move ssid utils from "libnm-core-impl" to "libnm-glib-aux"
The purpose is of course to be able to use it outside of the internal
API from libnm-core-intern.
2021-03-05 11:09:12 +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
9c32ba1910
glib-aux: add _nm_utils_hwaddr_ntoa_maybe_a() helper macro 2021-03-05 11:09:09 +01:00
Jonathan Lebon
1c0932a6e6
core/dns: emit CONFIG_CHANGED signal even if caching
With systemd-resolved, NetworkManager considers `/etc/resolv.conf`
unmanaged. This breaks hostname lookups in a subtle way: when a new
connection comes online, NM will initiate the hostname lookup *before*
propagating DNS updates to systemd-resolved, which of course will cause
the request to fail. And because NM doesn't update `/etc/resolv.conf`,
it doesn't emit a `CONFIG_CHANGED` signal which would've restarted the
lookup.

Fix this by emitting a signal also when using a caching DNS plugin.

https://bugzilla.redhat.com/show_bug.cgi?id=1933863

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/770
2021-03-04 17:21:46 +01:00
zsien
29ba46b722
wifi: fix SpecificObject of ActiveConnection not updated after WiFi roaming
The SpecificObject property of ActiveConnection should be updated after WiFi roaming.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/768
2021-03-04 17:01:18 +01:00
Thomas Haller
fc142c24ee
core/tests: fix unit tests after changing syslog idenfier
Fixes: 62727b62e0 ('logging: fix syslog identifier for NetworkManager')
2021-03-03 12:34:00 +01:00
Thomas Haller
62727b62e0
logging: fix syslog identifier for NetworkManager
We no longer define G_LOG_DOMAIN differently for the libraries and
applications. Instead, the use now all "nm".

However, that also changes the syslog identifier for NetworkManager
core. That is undesirable. Change it back to "NetworkManager".

Fixes: 341b6e0704 ('all: change G_LOG_DOMAIN to "nm"')
2021-03-03 11:15:16 +01:00
Thomas Haller
afd55358a4
contrib/scripts: fix "nm-copr-build.sh" script to use new nm-git-bundle 2021-03-03 11:00:06 +01:00
Thomas Haller
2d7bd768b0
man: fix spelling error in man NetworkManager.conf 2021-03-03 09:55:29 +01:00