summaryrefslogtreecommitdiff
path: root/Makefile.am
Commit message (Collapse)AuthorAgeFilesLines
* nm-online: fix build of nm-online for missing libcsiphash.laThomas Haller2020-05-021-0/+1
| | | | Fixes: e468b48ab7b8 ('nm-online: allow configuring timeout via NM_ONLINE_TIMEOUT environment')
* nm-online: allow configuring timeout via NM_ONLINE_TIMEOUT environmentThomas Haller2020-04-301-2/+5
| | | | | | https://bugzilla.redhat.com/show_bug.cgi?id=1828458 https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/484
* build: remove subshells and fix invalid test syntaxGilles Dartiguelongue2020-04-201-1/+1
| | | | | | Signed-off-by: Gilles Dartiguelongue <eva@gentoo.org> https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/472
* cli: cleanup NMCCommand and declarations of func implementationsThomas Haller2020-04-101-2/+0
| | | | | | | | | | | | | | - move the main func declarations to nmcli.h and give them a common prefix "nmc_command_func_" prefix. - remove some of the header files that are now empty. In fact, these headers did not really declare some well separated module. While we probably should structure the code in nmcli better with better layering, it was not and still is not. Having these dummy headers don't mean that the code is well structured and they serve little purpose. - move the static NMCommand lists variables into the function scope where they are used.
* systemd: merge branch systemd into masterThomas Haller2020-04-081-0/+2
|\
* | shared: add NMStrBuf utilThomas Haller2020-04-031-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Our own implementation of a string buffer like GString. Advantages (in decreasing relevance): - Since we are in control, we can easily let it nm_explicit_bzero() the memory. The regular GString API cannot be used in such a case. While nm_explicit_bzero() may or may not be of questionable benefit, the problem is that if the underlying API counteracts the aim of clearing memory, it gets impossible. As API like NMStrBuf supports it, clearing memory is a easy as enable the right flag. This would for example be useful for example when we read passwords from a file or file descriptor (e.g. try_spawn_vpn_auth_helper()). - We have API like nmp_object_to_string (const NMPObject *obj, NMPObjectToStringMode to_string_mode, char *buf, gsize buf_size); which accept a fixed size output buffer. This has the problem of how choosing the right sized buffer. With NMStrBuf such API could be instead nmp_object_to_string (const NMPObject *obj, NMPObjectToStringMode to_string_mode, NMStrBuf *buf); which can automatically grow (using heap allocation). It would be easy to extend NMStrBuf to use a fixed buffer or limiting the maximum string length. The point is, that the to-string API wouldn't have to change. Depending on the NMStrBuf passed in, you can fill an unbounded heap allocated string, a heap allocated string up to a fixed length, or a static string of fixed length. NMStrBuf currently only implements the unbounded heap allocate string case, but it would be simple to extend. Note that we already have API like nm_utils_strbuf_*() to fill a buffer of fixed size. GString is not useable for that (efficiently), hence this API exists. NMStrBuf could be easily extended to replace this API without usability or performance penalty. So, while this adds one new API, it could replace other APIs. - GString always requires a heap allocation for the container. In by far most of the cases where we use GString, we use it to simply construct a string dynamically. There is zero use for this overhead. If one really needs a heap allocated buffer, NMStrBuf can easily embedded in a malloc'ed memory and boxed that way. - GString API supports inserting and removing range. We almost never make use of that. We only require append-only, which is simple to implement. - GString needs to NUL terminate the buffer on every append. It has unnecessary overhead for allowing a usage of where intermediate buffer contents are valid strings too. That is not the case with NMStrBuf: the API requires the user to call nm_str_buf_get_str() or nm_str_buf_finalize(). In most cases, you would only access the string once at the end, and not while constructing it. - GString always grows the buffer size by doubling it. I don't think that is optimal. I don't think there is one optimal approach for how to grow the buffer, it depends on the usage patterns. However, trying to make an optimal choice here makes a difference. QT also thinks so, and I adopted their approach in nm_utils_get_next_realloc_size().
* | build: link nm-dispatcher with libnm-glib-aux.laThomas Haller2020-03-251-0/+3
| | | | | | | | | | | | | | | | Our glib based code should also include our static utility library libnm-glib-aux. This is our basic utility library that we want to have around everywhere. Since we link statically, the linker will weed out the unused stuff at compile time. So, there is no overhead, except for the things that we actually use.
* | systemd: merge branch systemd into masterThomas Haller2020-03-231-0/+2
|\ \ | |/
* | core: add common base class NMDhcpConfig for NMDhcp[46]Config and merge themThomas Haller2020-02-211-2/+0
| | | | | | | | | | | | | | | | | | | | The advantage is that the API is now the same for IPv4 and IPv6: it's all nm_dhcp_config_*() and we can (easier) treat the address family generically. We still need two distinct GObject types, mainly because of the glue code for exposing the object on D-Bus as NMDBusObject. Of course, that could be solved differently, but as it is, it's quite nice.
* | core: rename "nm-dhcp4-config.[ch]" to "nm-dhcp-config.[hc]" before mergeThomas Haller2020-02-211-2/+2
| | | | | | | | | | NMDhcp4Config and NMDhcp6Config will get a common base type NMDhcpConfig and be merged. In preparation, rename the file.
* | build/autotools: fix passing AM_CFLAGS when building libnm-coreThomas Haller2020-02-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With `./configure --enable-more-asserts`, we add extra -W flags to AM_CFLAGS. This variable is only used, if the per-library override libnm_core_libnm_core_la_CFLAGS is unspecified ([1]). Usually we avoid this problem be never specifying library_CFLAGS, but placing all our per-library flags to library_CPPFLAGS. While that is a bit of a hack and misuse of CPPFLAGS, it works well (enough). This was broken recently. The effect was, that libnm-core was not build with AM_CFLAGS flags. Fix it. [1] https://www.gnu.org/software/automake/manual/html_node/Flag-Variables-Ordering.html Fixes: d2d6a6869755 ('build: use -fcommon when building libnm-core')
* | build: remove duplicate definition in MakefileBeniamino Galvani2020-02-031-2/+0
| | | | | | | | | | | | | | Fix the following warning: Makefile.am:3671: warning: $(src_devices_wifi_libnm_device_plugin_wifi_la_OBJECTS) was already defined in condition TRUE, which includes condition WITH_WIFI ... Makefile.am:1075: ... '$(src_devices_wifi_libnm_device_plugin_wifi_la_OBJECTS)' previously defined here
* | build: use -fcommon when building libnm-coreBeniamino Galvani2020-02-031-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Building with GCC 10 gives the following error: multiple definition of_nm_jansson_json_object_iter_key'; libnm/.libs/liblibnm.a(libnm_core_la-nm-json.o):/builddir/build/BUILD/NetworkManager-1.23.1/libnm-core/nm-json.c:24: first defined here /usr/bin/ld: libnm/.libs/liblibnm.a(libnm_core_la-nm-team-utils.o):/usr/include/jansson.h:202: multiple definition of _nm_jansson_json_object_iter'; This happens because GCC 10 defaults to -fno-common and so multiple definitions of the same global variable are not merged together. _nm_jansson_json_* symbols are defined in nm-json.c as void pointers and, due to the following macros in nm-json.h: #define json_object_iter_next (*_nm_jansson_json_object_iter_next) ... the function declaration in jansson.h: void *json_object_iter_next(json_t *object, void *iter); becomes a global variable as well: void *(*_nm_jansson_json_object_iter_next)(json_t *object, void *iter); So, the symbol is present in nm-json.o and all other object files that include nm-json.h, and -fcommon is required. Without it, it would be necessary to define the symbols only in one place (for example, nm-json.c), but then static inline functions from the jannson.h header would still refer to the original (missing) jansson functions. For the moment, just use -fcommon.
* | build: fix linking of "src/devices/wifi/tests/test-devices-wifi"Thomas Haller2020-01-151-1/+2
| | | | | | | | | | | | On ppc64le, the linking fails due to unresolved symbols. Fixes: 7d8da6c9c150 ('build: build intermediate library with core wifi for device-plugin and tests')
* | core,libnm: add VRF supportBeniamino Galvani2020-01-141-0/+8
| | | | | | | | | | | | | | | | Add VRF support to the daemon. When the device we are activating is a VRF or a VRF's slave, put routes in the table specified by the VRF connection. Also, introduce a VRF device type in libnm.
* | libnm-core,cli: add VRF settingBeniamino Galvani2020-01-141-0/+2
| | | | | | | | | | Add new VRF setting and connection types to libnm-core and support them in nmcli.
* | build: build intermediate library with core wifi for device-plugin and testsThomas Haller2020-01-081-9/+25
| | | | | | | | | | | | Don't build the same sources multiple times. The test code should statically link against the tested code, just like the device plugin that uses the code in production.
* | libnm/keyfile: build keyfile code as separate GPL licensed internal libraryThomas Haller2020-01-071-4/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Keyfile support was initially added under GPL-2.0+ license as part of core. It was moved to "libnm-core" in commit 59eb5312a5d6 ('keyfile: merge branch 'th/libnm-keyfile-bgo744699''). "libnm-core" is statically linked with by core and "libnm". In the former case under terms of GPL-2.0+ (good) and in the latter case under terms of LGPL-2.1+ (bad). In fact, to this day, "libnm" doesn't actually use the code. The linker will probably remove all the GPL-2.0+ symbols when compiled with gc-sections or LTO. Still, linking them together in the first place makes "libnm" only available under GPL code (despite the code not actually being used). Instead, move the GPL code to a separate static library "shared/nm-keyfile/libnm-keyfile.la" and only link it to the part that actually uses the code (and which is GPL licensed too). This fixes the license violation. Eventually, it would be very useful to be able to expose keyfile handling via "libnm". However that is not straight forward due to the licensing conflict. https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/381
* | clients: polkit-agent: implement polkit agent without using libpolkitAntonio Cardace2019-12-241-8/+2
| |
* | shared: move nm-dbus-auth-subject to shared/nm-libnm-core-internAntonio Cardace2019-12-241-2/+2
| | | | | | | | | | | | | | | | Move it to shared as it's useful for clients as well. Move and rename nm_dbus_manager_new_auth_subject_from_context() and nm_dbus_manager_new_auth_subject_from_message() in nm-dbus-manager.c as they're needed there.
* | systemd: merge branch systemd into masterThomas Haller2019-12-161-1/+3
|\ \ | |/
* | cli: use nmc_client_new_async() instead of nm_client_new_async()Thomas Haller2019-12-101-0/+1
| | | | | | | | | | This will allow us to set construct parameters to the instance, like NM_CLIENT_INSTANCE_FLAGS.
* | nm-online: use nmc_client_new_async() instead of nm_client_new_async()Thomas Haller2019-12-101-0/+1
| | | | | | | | | | This will allow us to set construct parameters to the instance, like NM_CLIENT_INSTANCE_FLAGS.
* | cloud-setup: reuse nmc_client_new_waitsync() to create NMClient instanceThomas Haller2019-12-101-0/+1
| |
* | tui: create NMClient instance via async initThomas Haller2019-12-101-0/+1
| | | | | | | | | | | | | | | | Using sync init (nm_client_new()) has an overhead as it requires an internal GMainContext to ensure preserving the order of D-Bus messages. Let's avoid that by using the async init. Note that the difference here is that we will iterate the caller's GMainContext while creating the instance. But that is no problem for nmtui at that point.
* | shared: add "shared/nm-libnm-aux" static libraryThomas Haller2019-12-101-0/+37
| | | | | | | | | | | | | | | | | | | | | | | | We have "shared/nm-libnm-core-aux", which is shared code that can be used by anybody (including libnm-core, src, libnm and clients). We have "clients/common", which are helper function for clients. But that implies that the code is inside "clients". I think it would be useful to have auxiliary code that extends libnm, but is not only usable by code in "clients". In other words, "shared/nm-libnm-aux" is a better place than "clients/common", and I think most of the functionality form "clients/common" should move there.
* | shared: move "shared/nm-utils/tests/test-shared-general" to ↵Thomas Haller2019-12-101-5/+5
| | | | | | | | | | | | | | | | "shared/nm-glib-aux/tests" "shared/nm-utils" got long renamed and split into separate parts. The remaining tests are really to test nm-std-aux and nm-glib-aux (no libnm dependencies). Move the tests to the appropriate place.
* | settings/ifcfg: add support for KEY_MGMT=OWEDavid Bauer2019-12-051-0/+1
| |
* | cloud-setup: add tool for automatic IP configuration in cloudThomas Haller2019-11-281-0/+81
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a tool for automatically configuring networking in a cloud environment. Currently it only supports IPv4 on EC2, but it's intended for extending to other cloud providers (Azure). See [1] and [2] for how to configure secondary IP addresses on EC2. This is what the tool currently aims to do (but in the future it might do more). [1] https://aws.amazon.com/premiumsupport/knowledge-center/ec2-ubuntu-secondary-network-interface/ It is inspired by SuSE's cloud-netconfig ([1], [2]) and ec2-net-utils package on Amazon Linux ([3], [4]). [1] https://www.suse.com/c/multi-nic-cloud-netconfig-ec2-azure/ [2] https://github.com/SUSE-Enceladus/cloud-netconfig [3] https://github.com/aws/ec2-net-utils [4] https://github.com/lorengordon/ec2-net-utils.git It is also intended to work without configuration. The main point is that you boot an image with NetworkManager and nm-cloud-setup enabled, and it just works.
* | shared/logging: add "nm-logging-base.h"Thomas Haller2019-11-281-0/+2
| | | | | | | | | | | | We have "nm-logging-fwd.h", which (as the name implies) is header-only. Add instead a "nm-logging-base.c", which also contains implementation for logging functions that are not only useful under "src/nm-logging.c"
* | libnm: refactor caching of D-Bus objects in NMClientThomas Haller2019-11-251-8/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | No longer use GDBusObjectMangaerClient and gdbus-codegen generated classes for the NMClient cache. Instead, use GDBusConnection directly and a custom implementation (NMLDBusObject) for caching D-Bus' ObjectManager data. CHANGES ------- - This is a complete rework. I think the previous implementation was difficult to understand. There were unfixed bugs and nobody understood the code well enough to fix them. Maybe somebody out there understood the code, but I certainly did not. At least nobody provided patches to fix those issues. I do believe that this implementation is more straightforward and easier to understand. It removes a lot of layers of code. Whether this claim of simplicity is true, each reader must decide for himself/herself. Note that it is still fairly complex. - There was a lingering performance issue with large number of D-Bus objects. The patch tries hard that the implementation scales well. Of course, when we cache N objects that have N-to-M references to other, we still are fundamentally O(N*M) for runtime and memory consumption (with M being the number of references between objects). But each part should behave efficiently and well. - Play well with GMainContext. libnm code (NMClient) is generally not thread safe. However, it should work to use multiple instances in parallel, as long as each access to a NMClient is through the caller's GMainContext. This follows glib's style and effectively allows to use NMClient in a multi threaded scenario. This implies to stick to a main context upon construction and ensure that callbacks are only invoked when iterating that context. Also, NMClient itself shall never iterate the caller's context. This also means, libnm must never use g_idle_add() or g_timeout_add(), as those enqueue sources in the g_main_context_default() context. - Get ordering of messages right. All events are consistently enqueued in a GMainContext and processed strictly in order. For example, previously "nm-object.c" tried to combine signals and emit them on an idle handler. That is wrong, signals must be emitted in the right order and when they happen. Note that when using GInitable's synchronous initialization to initialize the NMClient instance, NMClient internally still operates fully asynchronously. In that case NMClient has an internal main context. - NMClient takes over most of the functionality. When using D-Bus' ObjectManager interface, one needs to handle basically the entire state of the D-Bus interface. That cannot be separated well into distinct parts, and even if you try, you just end up having closely related code in different source files. Spreading related code does not make it easier to understand, on the contrary. That means, NMClient is inherently complex as it contains most of the logic. I think that is not avoidable, but it's not as bad as it sounds. - NMClient processes D-Bus messages and state changes in separate steps. First NMClient unpacks the message (e.g. _dbus_handle_properties_changed()) and keeps track of the changed data. Then we update the GObject instances (_dbus_handle_obj_changed_dbus()) without emitting any signals yet. Finally, we emit all signals and notifications that were collected (_dbus_handle_changes_commit()). Note that for example during the initial GetManagedObjects() reply, NMClient receive a large amount of state at once. But we first apply all the changes to our GObject instances before emitting any signals. The result is that signals are always emitted in a moment when the cache is consistent. The unavoidable downside is that when you receive a property changed signal, possibly many other properties changed already and more signals are about to be emitted. - NMDeviceWifi no longer modifies the content of the cache from client side during poke_wireless_devices_with_rf_status(). The content of the cache should be determined by D-Bus alone and follow what NetworkManager service exposes. Local modifications should be avoided. - This aims to bring no API/ABI change, though it does of course bring various subtle changes in behavior. Those should be all for the better, but the goal is not to break any existing clients. This does change internal (albeit externally visible) API, like dropping NM_OBJECT_DBUS_OBJECT_MANAGER property and NMObject no longer implementing GInitableIface and GAsyncInitableIface. - Some uses of gdbus-codegen classes remain in NMVpnPluginOld, NMVpnServicePlugin and NMSecretAgentOld. These are independent of NMClient/NMObject and should be reworked separately. - While we no longer use generated classes from gdbus-codegen, we don't need more glue code than before. Also before we constructed NMPropertiesInfo and a had large amount of code to propagate properties from NMDBus* to NMObject. That got completely reworked, but did not fundamentally change. You still need about the same effort to create the NMLDBusMetaIface. Not using generated bindings did not make anything worse (which tells about the usefulness of generated code, at least in the way it was used). - NMLDBusMetaIface and other meta data is static and immutable. This avoids copying them around. Also, macros like NML_DBUS_META_PROPERTY_INIT_U() have compile time checks to ensure the property types matches. It's pretty hard to misuse them because it won't compile. - The meta data now explicitly encodes the expected D-Bus types and makes sure never to accept wrong data. That would only matter when the server (accidentally or intentionally) exposes unexpected types on D-Bus. I don't think that was previously ensured in all cases. For example, demarshal_generic() only cared about the GObject property type, it didn't know the expected D-Bus type. - Previously GDBusObjectManager would sometimes emit warnings (g_log()). Those probably indicated real bugs. In any case, it prevented us from running CI with G_DEBUG=fatal-warnings, because there would be just too many unrelated crashes. Now we log debug messages that can be enabled with "LIBNM_CLIENT_DEBUG=trace". Some of these messages can also be turned into g_warning()/g_critical() by setting LIBNM_CLIENT_DEBUG=warning,error. Together with G_DEBUG=fatal-warnings, this turns them into assertions. Note that such "assertion failures" might also happen because of a server bug (or change). Thus these are not common assertions that indicate a bug in libnm and are thus not armed unless explicitly requested. In our CI we should now always run with LIBNM_CLIENT_DEBUG=warning,error and G_DEBUG=fatal-warnings and to catch bugs. Note that currently NetworkManager has bugs in this regard, so enabling this will result in assertion failures. That should be fixed first. - Note that this changes the order in which we emit "notify:devices" and "device-added" signals. I think it makes the most sense to emit first "device-removed", then "notify:devices", and finally "device-added" signals. This changes behavior for commit 52ae28f6e5bf ('libnm: queue added/removed signals and suppress uninitialized notifications'), but I don't think that users should actually rely on the order. Still, the new order makes the most sense to me. - In NetworkManager, profiles can be invisible to the user by setting "connection.permissions". Such profiles would be hidden by NMClient's nm_client_get_connections() and their "connection-added"/"connection-removed" signals. Note that NMActiveConnection's nm_active_connection_get_connection() and NMDevice's nm_device_get_available_connections() still exposes such hidden NMRemoteConnection instances. This behavior was preserved. NUMBERS ------- I compared 3 versions of libnm. [1] 962297f9085d, current tip of nm-1-20 branch [2] 4fad8c7c642e, current master, immediate parent of this patch [3] this patch All tests were done on Fedora 31, x86_64, gcc 9.2.1-1.fc31. The libraries were build with $ ./contrib/fedora/rpm/build_clean.sh -g -w test -W debug Note that RPM build already stripped the library. --- N1) File size of libnm.so.0.1.0 in bytes. There currently seems to be a issue on Fedora 31 generating wrong ELF notes. Usually, libnm is smaller but in these tests it had large (and bogus) ELF notes. Anyway, the point is to show the relative sizes, so it doesn't matter). [1] 4075552 (102.7%) [2] 3969624 (100.0%) [3] 3705208 ( 93.3%) --- N2) `size /usr/lib64/libnm.so.0.1.0`: text data bss dec hex filename [1] 1314569 (102.0%) 69980 ( 94.8%) 10632 ( 80.4%) 1395181 (101.4%) 1549ed /usr/lib64/libnm.so.0.1.0 [2] 1288410 (100.0%) 73796 (100.0%) 13224 (100.0%) 1375430 (100.0%) 14fcc6 /usr/lib64/libnm.so.0.1.0 [3] 1229066 ( 95.4%) 65248 ( 88.4%) 13400 (101.3%) 1307714 ( 95.1%) 13f442 /usr/lib64/libnm.so.0.1.0 --- N3) Performance test with test-client.py. With checkout of [2], run ``` prepare_checkout() { rm -rf /tmp/nm-test && \ git checkout -B test 4fad8c7c642e && \ git clean -fdx && \ ./autogen.sh --prefix=/tmp/nm-test && \ make -j 5 install && \ make -j 5 check-local-clients-tests-test-client } prepare_test() { NM_TEST_REGENERATE=1 NM_TEST_CLIENT_BUILDDIR="/data/src/NetworkManager" NM_TEST_CLIENT_NMCLI_PATH=/usr/bin/nmcli python3 ./clients/tests/test-client.py -v } do_test() { for i in {1..10}; do NM_TEST_CLIENT_BUILDDIR="/data/src/NetworkManager" NM_TEST_CLIENT_NMCLI_PATH=/usr/bin/nmcli python3 ./clients/tests/test-client.py -v || return -1 done echo "done!" } prepare_checkout prepare_test time do_test ``` [1] real 2m14.497s (101.3%) user 5m26.651s (100.3%) sys 1m40.453s (101.4%) [2] real 2m12.800s (100.0%) user 5m25.619s (100.0%) sys 1m39.065s (100.0%) [3] real 1m54.915s ( 86.5%) user 4m18.585s ( 79.4%) sys 1m32.066s ( 92.9%) --- N4) Performance. Run NetworkManager from build [2] and setup a large number of profiles (551 profiles and 515 devices, mostly unrealized). This setup is already at the edge of what NetworkManager currently can handle. Of course, that is a different issue. Here we just check how long plain `nmcli` takes on the system. ``` do_cleanup() { for UUID in $(nmcli -g NAME,UUID connection show | sed -n 's/^xx-c-.*:\([^:]\+\)$/\1/p'); do nmcli connection delete uuid "$UUID" done for DEVICE in $(nmcli -g DEVICE device status | grep '^xx-i-'); do nmcli device delete "$DEVICE" done } do_setup() { do_cleanup for i in {1..30}; do nmcli connection add type bond autoconnect no con-name xx-c-bond-$i ifname xx-i-bond-$i ipv4.method disabled ipv6.method ignore for j in $(seq $i 30); do nmcli connection add type vlan autoconnect no con-name xx-c-vlan-$i-$j vlan.id $j ifname xx-i-vlan-$i-$j vlan.parent xx-i-bond-$i ipv4.method disabled ipv6.method ignore done done systemctl restart NetworkManager.service sleep 5 } do_test() { perf stat -r 50 -B nmcli 1>/dev/null } do_test ``` [1] Performance counter stats for 'nmcli' (50 runs): 456.33 msec task-clock:u # 1.093 CPUs utilized ( +- 0.44% ) 0 context-switches:u # 0.000 K/sec 0 cpu-migrations:u # 0.000 K/sec 5,900 page-faults:u # 0.013 M/sec ( +- 0.02% ) 1,408,675,453 cycles:u # 3.087 GHz ( +- 0.48% ) 1,594,741,060 instructions:u # 1.13 insn per cycle ( +- 0.02% ) 368,744,018 branches:u # 808.061 M/sec ( +- 0.02% ) 4,566,058 branch-misses:u # 1.24% of all branches ( +- 0.76% ) 0.41761 +- 0.00282 seconds time elapsed ( +- 0.68% ) [2] Performance counter stats for 'nmcli' (50 runs): 477.99 msec task-clock:u # 1.088 CPUs utilized ( +- 0.36% ) 0 context-switches:u # 0.000 K/sec 0 cpu-migrations:u # 0.000 K/sec 5,948 page-faults:u # 0.012 M/sec ( +- 0.03% ) 1,471,133,482 cycles:u # 3.078 GHz ( +- 0.36% ) 1,655,275,369 instructions:u # 1.13 insn per cycle ( +- 0.02% ) 382,595,152 branches:u # 800.433 M/sec ( +- 0.02% ) 4,746,070 branch-misses:u # 1.24% of all branches ( +- 0.49% ) 0.43923 +- 0.00242 seconds time elapsed ( +- 0.55% ) [3] Performance counter stats for 'nmcli' (50 runs): 352.36 msec task-clock:u # 1.027 CPUs utilized ( +- 0.32% ) 0 context-switches:u # 0.000 K/sec 0 cpu-migrations:u # 0.000 K/sec 4,790 page-faults:u # 0.014 M/sec ( +- 0.26% ) 1,092,341,186 cycles:u # 3.100 GHz ( +- 0.26% ) 1,209,045,283 instructions:u # 1.11 insn per cycle ( +- 0.02% ) 281,708,462 branches:u # 799.499 M/sec ( +- 0.01% ) 3,101,031 branch-misses:u # 1.10% of all branches ( +- 0.61% ) 0.34296 +- 0.00120 seconds time elapsed ( +- 0.35% ) --- N5) same setup as N4), but run `PAGER= /bin/time -v nmcli`: [1] Command being timed: "nmcli" User time (seconds): 0.42 System time (seconds): 0.04 Percent of CPU this job got: 107% Elapsed (wall clock) time (h:mm:ss or m:ss): 0:00.43 Average shared text size (kbytes): 0 Average unshared data size (kbytes): 0 Average stack size (kbytes): 0 Average total size (kbytes): 0 Maximum resident set size (kbytes): 34456 Average resident set size (kbytes): 0 Major (requiring I/O) page faults: 0 Minor (reclaiming a frame) page faults: 6128 Voluntary context switches: 1298 Involuntary context switches: 1106 Swaps: 0 File system inputs: 0 File system outputs: 0 Socket messages sent: 0 Socket messages received: 0 Signals delivered: 0 Page size (bytes): 4096 Exit status: 0 [2] Command being timed: "nmcli" User time (seconds): 0.44 System time (seconds): 0.04 Percent of CPU this job got: 108% Elapsed (wall clock) time (h:mm:ss or m:ss): 0:00.44 Average shared text size (kbytes): 0 Average unshared data size (kbytes): 0 Average stack size (kbytes): 0 Average total size (kbytes): 0 Maximum resident set size (kbytes): 34452 Average resident set size (kbytes): 0 Major (requiring I/O) page faults: 0 Minor (reclaiming a frame) page faults: 6169 Voluntary context switches: 1849 Involuntary context switches: 142 Swaps: 0 File system inputs: 0 File system outputs: 0 Socket messages sent: 0 Socket messages received: 0 Signals delivered: 0 Page size (bytes): 4096 Exit status: 0 [3] Command being timed: "nmcli" User time (seconds): 0.32 System time (seconds): 0.02 Percent of CPU this job got: 102% Elapsed (wall clock) time (h:mm:ss or m:ss): 0:00.34 Average shared text size (kbytes): 0 Average unshared data size (kbytes): 0 Average stack size (kbytes): 0 Average total size (kbytes): 0 Maximum resident set size (kbytes): 29196 Average resident set size (kbytes): 0 Major (requiring I/O) page faults: 0 Minor (reclaiming a frame) page faults: 5059 Voluntary context switches: 919 Involuntary context switches: 685 Swaps: 0 File system inputs: 0 File system outputs: 0 Socket messages sent: 0 Socket messages received: 0 Signals delivered: 0 Page size (bytes): 4096 Exit status: 0 --- N6) same setup as N4), but run `nmcli monitor` and look at `ps aux` for the RSS size. USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND [1] me 1492900 21.0 0.2 461348 33248 pts/10 Sl+ 15:02 0:00 nmcli monitor [2] me 1490721 5.0 0.2 461496 33548 pts/10 Sl+ 15:00 0:00 nmcli monitor [3] me 1495801 16.5 0.1 459476 28692 pts/10 Sl+ 15:04 0:00 nmcli monitor
* | build: create base directories for install-data-hook firstThomas Haller2019-11-221-9/+15
| | | | | | | | | | | | | | | | The dependencies of make are exectured in the order as they appear. We probably should start by creating the directories, before invoking other install hooks. Currently there is no difference, because none of the other hooks depend on the base directories. Still split it to a special target.
* | build: cleanup Makefile.am by moving "data_edit" firstThomas Haller2019-11-221-26/+32
|/ | | | | | | | | $(data_edit) will be used later at an earlier place in the makefile (to edit "clients/cloud-setup/nm-cloud-setup.service", which will be handled earlier). Move it. Also minor cleanups, like allowing to incrementally build systemdsystemunit_DATA variable.
* systemd: merge branch systemd into masterThomas Haller2019-11-201-5/+7
|\
* | build: link "nm-enum-types.c" with the base "liblibnm" instead of "libnm"Thomas Haller2019-10-181-5/+6
| | | | | | | | This way the symbols are also available to the unit tests.
* | cli: add "nmcli d wifi show"lr/nmcli-d-wifi-showLubomir Rintel2019-10-181-0/+4
| | | | | | | | | | | | A quick overview of the currently connected Wi-Fi network, including credentials. Comes handy if someone wants to connect more devices to their Hotspot or the same network as they are connected to.
* | meson: Remove devices tests' meson build filesIñigo Martínez2019-10-011-3/+1
| | | | | | | | | | | | | | | | The devices tests' meson build files include only the build of a single executable file and its execution as a test unit. This has been moved to the devices' main meson build files so this files can be removed.
* | meson: Add missing "nm-bt-test" helper programIñigo Martínez2019-10-011-1/+3
| | | | | | | | | | | | | | | | In 878d4963e a new `nm-bt-test` helper program was added. However, although `autotools` build steps were included, meson build steps were not. This add meson's build steps.
* | build: avoid target redefinitionBeniamino Galvani2019-09-241-2/+0
| | | | | | | | | | | | | | Makefile.am:3462: warning: $(src_devices_bluetooth_libnm_device_plugin_bluetooth_la_OBJECTS) was already defined in condition TRUE, which includes condition WITH_MODEM_MANAGER_1 ... Makefile.am:960: ... '$(src_devices_bluetooth_libnm_device_plugin_bluetooth_la_OBJECTS)' previously defined here Fixes: 878d4963ed7e ('bluetooth/tests: add "nm-bt-test helper" program for manual testing of bluetooth code')
* | bluetooth: refactor BlueZ handling and let NMBluezManager cache ↵Thomas Haller2019-09-231-4/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ObjectManager data This is a complete refactoring of the bluetooth code. Now that BlueZ 4 support was dropped, the separation of NMBluezManager and NMBluez5Manager makes no sense. They should be merged. At that point, notice that BlueZ 5's D-Bus API is fully centered around D-Bus's ObjectManager interface. Using that interface, we basically only call GetManagedObjects() once and register to InterfacesAdded, InterfacesRemoved and PropertiesChanged signals. There is no need to fetch individual properties ever. Note how NMBluezDevice used to query the D-Bus properties itself by creating a GDBusProxy. This is redundant, because when using the ObjectManager interfaces, we have all information already. Instead, let NMBluezManager basically become the client-side cache of all of BlueZ's ObjectManager interface. NMBluezDevice was mostly concerned about caching the D-Bus interface's state, tracking suitable profiles (pan_connection), and moderate between bluez and NMDeviceBt. These tasks don't get simpler by moving them to a seprate file. Let them also be handled by NMBluezManager. I mean, just look how it was previously: NMBluez5Manager registers to ObjectManager interface and sees a device appearing. It creates a NMBluezDevice object and registers to its "initialized" and "notify:usable" signal. In the meantime, NMBluezDevice fetches the relevant information from D-Bus (although it was already present in the data provided by the ObjectManager) and eventually emits these usable and initialized signals. Then, NMBlue5Manager emits a "bdaddr-added" signal, for which NMBluezManager creates the NMDeviceBt instance. NMBluezManager, NMBluez5Manager and NMBluezDevice are strongly cooperating to the point that it is simpler to merge them. This is not mere refactoring. This patch aims to make everything asynchronously and always cancellable. Also, it aims to fix races and inconsistencies of the state. - Registering to a NAP server now waits for the response and delays activation of the NMDeviceBridge accordingly. - For NAP connections we now watch the bnep0 interface in platform, and tear down the device when it goes away. Bluez doesn't send us a notification on D-Bus in that case. - Rework establishing a DUN connection. It no longer uses blocking connect() and does not block until rfcomm device appears. It's all async now. It also watches the rfcomm file descriptor for POLLERR/POLLHUP to notice disconnect. - drop nm_device_factory_emit_component_added() and instead let NMDeviceBt directly register to the WWan factory's "added" signal.
* | bluetooth/tests: add "nm-bt-test helper" program for manual testing of ↵Thomas Haller2019-09-221-13/+51
| | | | | | | | | | | | | | bluetooth code Just add a stub implementation and let it build. More will be added later.
* | shared: add NMRefStringThomas Haller2019-09-211-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I'd like to refactor libnm's caching. Note that cached D-Bus objects have repeated strings all over the place. For example every object will have a set of D-Bus interfaces (strings) and properties (strings) and an object path (which is referenced by other objects). We can save a lot of redundant strings by deduplicating/interning them. Also, by interning them, we can compare them using pointer equality. Add a NMRefString implementation for this. Maybe an alternative name would be NMInternedString or NMDedupString, because this string gets always interned. There is no way to create a NMRefString that is not interned. Still, NMRefString name sounds better. It is ref-counted after all. Notes: - glib has GQuark and g_intern_string(). However, such strings cannot be unrefered and are leaked indefinitely. It is thus unsuited for anything but a fixed set of well-known strings. - glib 2.58 adds GRefString, but we cannot use that because we currently still use glib 2.40. There are some differences: - GRefString is just a typedef to char. That means, the glib API exposes GRefString like regular character strings. NMRefString intentionally does that not. This makes it slightly less convenient to pass it to API that expects "const char *". But it makes it clear to the reader, that an instance is in fact a NMRefString, which means it indicates that the string is interned and can be referenced without additional copy. - GRefString can be optionally interned. That means you can only use pointer equality for comparing values if you know that the GRefString was created with g_ref_string_new_intern(). So, GRefString looks like a "const char *" pointer and even if you know it's a GRefString, you might not know whether it is interned. NMRefString is always interned, and you can always compare it using pointer equality. - In the past I already proposed a different implementation for a ref-string. That made different choices. For example NMRefString then was a typedef to "const char *", it did not support interning but deduplication (without a global cache), ref/unref was not thread safe (but then there was no global cache so that two threads could still use the API independently). The point is, there are various choices to make. GRefString, the previous NMRefString implementation and the one here, all have pros and cons. I think for the purpose where I intend NMRefString (dedup and efficient comparison), it is a preferable implementation. Ah, and of course NMRefString is an immutable string, which is a nice property.
* | meson: fix build_clean.sh -w meson -w testFrancesco Giudici2019-09-131-0/+1
| | | | | | | | Fixes: 6e5385a4ebba ('wwan/tests: test service-providers.xml parser')
* | build: make test-service-providers depend on nm-core-enum-types.hLubomir Rintel2019-09-111-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | Fixes build: In file included from ../src/devices/wwan/nm-service-providers.c:10: In file included from ../shared/nm-default.h:279: ../libnm-core/nm-core-types.h:14:10: fatal error: 'nm-core-enum-types.h' file not found #include "nm-core-enum-types.h" ^ 1 error generated. make[2]: *** [src/devices/wwan/src_devices_wwan_tests_test_service_providers-nm-service-providers.o] Error 1
* | wwan/tests: test service-providers.xml parserLubomir Rintel2019-09-111-1/+25
| | | | | | | | Just a handful of unit tests.
* | wwan: add service-providers.xml parserLubomir Rintel2019-09-111-1/+4
| | | | | | | | This allows up to look up a default APN if the user doesn't pick one.
* | initrd: fix dt testLubomir Rintel2019-09-101-0/+19
| |
* | COPYING: make sure we ship the relevant license textsLubomir Rintel2019-09-101-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | This adds LGPL and GFDL texts from the GNU web site and updates the GPL one: COPYING: https://www.gnu.org/licenses/old-licenses/gpl-2.0.txt COPYING.LGPL: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt COPYING.GFDL: https://www.gnu.org/licenses/old-licenses/fdl-1.1.txt The update to the GPL text is purely cosmetic. However, shipping the exact same file as GNU publishes may help distros that deduplicate the license texts or hardlink duplicates.
* | initrd: add devicetree supportLubomir Rintel2019-09-101-0/+22
| | | | | | | | | | | | | | | | | | | | | | | | This adds capability to hand over the network configuration from OpenFirmware (and potentially other boot loaders with openfirmware support such as U-Boot) to NetworkManager. It's done analogously to ACPI/iBFT. In fact, the same ip=ibft command line option is used, adding a more general ip=fw alias. This probably deserves some documentation, but I'm not adding any at this time. https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/257
* | build: use regexp in gtkdoc --ignore-decorators optionBeniamino Galvani2019-09-061-1/+0
| | | | | | | | | | | | | | gtkdoc-scan supports regular expressions in the --ignore-decorators command-line option. Since it is easier to use a regexp than grepping macros from a source file, revert the ugly solution from commit 2d941dc95a1d ('build: fix errors when building with gtk-doc 1.32').