summaryrefslogtreecommitdiff
path: root/libnm
Commit message (Collapse)AuthorAgeFilesLines
* build: move "libnm/" to "src/" and split itThomas Haller2021-02-24126-44222/+0
| | | | | | Like with "libnm-core/", split "libnm/" into different directories for the public headers, for the implementation and for the helper "aux" library.
* shared: move "nm-test-utils.h" to "src/libnm-glib-aux/"Thomas Haller2021-02-241-1/+1
| | | | | | | | | "nm-test-utils.h" is a header-only, helper library for our unit tests. It was somewhat unmotivated in "shared/nm-utils", because all tests use it, but it was not part of a "module". Move it to "src/libnm-glib-aux/". It fits there very well. They both have (only) a dependency on glib.
* build: move "shared/nm-std-aux" to "src/libnm-std-aux"Thomas Haller2021-02-242-2/+2
|
* build: move "shared/nm-{glib-aux,log-null,log-core}" to ↵Thomas Haller2021-02-2412-17/+17
| | | | "src/libnm-{glib-aux,log-null,log-core}"
* build: move "shared/nm-{base,udev-aux}" to "src/libnm-{base,udev-aux}"Thomas Haller2021-02-241-1/+1
|
* shared: rename "libnm-systemd-logging-stub.la" to "libnm-log-null.la"Thomas Haller2021-02-241-2/+2
| | | | | | | | This is really just a different implementation of "nm-glib-aux/nm-logging-fwd.h", that parallels libnm-log-core. It's also not only useful to shared/systemd, but also share/nm-platform, which also requires linking with a logging backend.
* all: change G_LOG_DOMAIN to "nm"th/libnm-core-splitThomas Haller2021-02-183-16/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | glib requires G_LOG_DOMAIN defined so that log messages are labeled to belong to NetworkManager or libnm. However, we don't actually want to use glib logging. Our library libnm MUST not log anything, because it spams the user's stdout/stderr. Instead, a library must report notable events via its API. Note that there is also LIBNM_CLIENT_DEBUG to explicitly enable debug logging, but that doesn't use glib logging either. Also, the daemon does not use glib logging instead it logs to syslog. When run with `--debug`. Hence, it's not useful for us to define different G_LOG_DOMAIN per library/application, because none of our libraries/applications should use glib logging. It also gets slightly confusing, because we have the static library like `src/libnm-core-impl`, which is both linked into `libnm` (the library) and `NetworkManager` (the daemon). Which logging domain should they use? Set the G_LOG_DOMAIN to "nm" everywhere. But no longer do it via `-D` arguments to the compiler. See-also: https://developer.gnome.org/glib/stable/glib-Message-Logging.html#G-LOG-DOMAIN:CAPS
* build: move "libnm-core/" to "src/" and split itThomas Haller2021-02-1823-32/+45
| | | | | | | | | | | | | | | | | | | | "libnm-core/" is rather complicated. It provides a static library that is linked into libnm.so and NetworkManager. It also contains public headers (like "nm-setting.h") which are part of public libnm API. Then we have helper libraries ("libnm-core/nm-libnm-core-*/") which only rely on public API of libnm-core, but are themself static libraries that can be used by anybody who uses libnm-core. And "libnm-core/nm-libnm-core-intern" is used by libnm-core itself. Move "libnm-core/" to "src/". But also split it in different directories so that they have a clearer purpose. The goal is to have a flat directory hierarchy. The "src/libnm-core*/" directories correspond to the different modules (static libraries and set of headers that we have). We have different kinds of such modules because of how we combine various code together. The directory layout now reflects this.
* libnm: add assertion in _dbus_handle_properties_changed()Thomas Haller2021-02-151-0/+1
| | | | (cherry picked from commit 3ceec9c6ac399b849fcabc52cf58e9001a6b8684)
* libnm: fix tracking object state in NMClient cacheThomas Haller2021-02-151-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | NMClient has a NMLDBusObject instance for each D-Bus object that it sees. This object can be in different states, like that we already saw it on D-Bus or that it is only referred to by another property. Due to a bug, we would wrongly not update the state and trigger an assertion. Reproduce with python-dbusmock (commit e89e28bf1bc0254a1eb71b71cf68ef7a97d11e5b) by running `pytest -v -s tests/test_networkmanager.py -k test_one_wifi_with_accesspoints`. With LIBNM_CLIENT_DEBUG we get: >>> libnm-dbus[96085]: <trace> [6464.06459] nmclient[c9bf1eaa1f4b6c99]: [/org/freedesktop/NetworkManager/Devices/mock_WiFi2]: properties-changed: properties changed for interface org.freedesktop.NetworkManager.Device { {'ActiveConnection': <objectpath '/org/freedesktop/NetworkManager/ActiveConnection/0'>} } libnm-dbus[96085]: <trace> [6464.06459] nmclient[c9bf1eaa1f4b6c99]: [/org/freedesktop/NetworkManager/Devices/mock_WiFi2]: properties-changed: set property org.freedesktop.NetworkManager.Device.ActiveConnection libnm-dbus[96085]: <trace> [6464.06459] nmclient[c9bf1eaa1f4b6c99]: [/org/freedesktop/NetworkManager/Devices/mock_WiFi2]: changed-type 0x01 linked libnm-dbus[96085]: <trace> [6464.06459] nmclient[c9bf1eaa1f4b6c99]: [/org/freedesktop/NetworkManager/Devices/mock_WiFi2]: changed-type 0x01 consumed >>> libnm-dbus[96085]: <trace> [6464.06459] nmclient[c9bf1eaa1f4b6c99]: [/org/freedesktop/NetworkManager/ActiveConnection/0]: set D-Bus object state watched-only libnm-dbus[96085]: <trace> [6464.06459] nmclient[c9bf1eaa1f4b6c99]: [/org/freedesktop/NetworkManager/Devices/mock_WiFi2]: changed-type 0x02 linked libnm-dbus[96085]: <trace> [6464.06459] nmclient[c9bf1eaa1f4b6c99]: [/org/freedesktop/NetworkManager]: changed-type 0x02 linked libnm-dbus[96085]: <trace> [6464.06459] nmclient[c9bf1eaa1f4b6c99]: [/org/freedesktop/NetworkManager/Devices/mock_WiFi2]: changed-type 0x02 consumed >>> libnm-dbus[96085]: <error> [6464.06459] nmclient[c9bf1eaa1f4b6c99]: [/org/freedesktop/NetworkManager/Devices/mock_WiFi2]: property ActiveConnection references /org/freedesktop/NetworkManager/ActiveConnection/0 but object is not present on D-Bus libnm-dbus[96085]: <trace> [6464.06459] nmclient[c9bf1eaa1f4b6c99]: [/org/freedesktop/NetworkManager]: changed-type 0x02 consumed libnm-dbus[96085]: <trace> [6464.06460] nmclient[c9bf1eaa1f4b6c99]: [/org/freedesktop/NetworkManager/Devices/mock_WiFi2]: properties-changed: properties changed for interface org.freedesktop.NetworkManager.Device { {'State': <uint32 100>} } libnm-dbus[96085]: <trace> [6464.06460] nmclient[c9bf1eaa1f4b6c99]: [/org/freedesktop/NetworkManager/Devices/mock_WiFi2]: properties-changed: set property org.freedesktop.NetworkManager.Device.State libnm-dbus[96085]: <trace> [6464.06460] nmclient[c9bf1eaa1f4b6c99]: [/org/freedesktop/NetworkManager/Devices/mock_WiFi2]: changed-type 0x01 linked libnm-dbus[96085]: <trace> [6464.06460] nmclient[c9bf1eaa1f4b6c99]: [/org/freedesktop/NetworkManager/Devices/mock_WiFi2]: changed-type 0x01 consumed libnm-dbus[96085]: <trace> [6464.06460] nmclient[c9bf1eaa1f4b6c99]: [/org/freedesktop/NetworkManager/Devices/mock_WiFi2]: changed-type 0x02 linked libnm-dbus[96085]: <trace> [6464.06460] nmclient[c9bf1eaa1f4b6c99]: [/org/freedesktop/NetworkManager]: changed-type 0x02 linked libnm-dbus[96085]: <trace> [6464.06461] nmclient[c9bf1eaa1f4b6c99]: [/org/freedesktop/NetworkManager/Devices/mock_WiFi2]: changed-type 0x02 consumed libnm-dbus[96085]: <trace> [6464.06461] nmclient[c9bf1eaa1f4b6c99]: [/org/freedesktop/NetworkManager]: changed-type 0x02 consumed libnm-dbus[96085]: <trace> [6464.06462] nmclient[c9bf1eaa1f4b6c99]: [/org/freedesktop/NetworkManager/Devices/mock_WiFi2]: properties-changed: properties changed for interface org.freedesktop.NetworkManager.Device { {'StateReason': <(uint32 100, uint32 0)>} } libnm-dbus[96085]: <trace> [6464.06462] nmclient[c9bf1eaa1f4b6c99]: [/org/freedesktop/NetworkManager/Devices/mock_WiFi2]: properties-changed: set property org.freedesktop.NetworkManager.Device.StateReason libnm-dbus[96085]: <trace> [6464.06462] nmclient[c9bf1eaa1f4b6c99]: [/org/freedesktop/NetworkManager/Devices/mock_WiFi2]: changed-type 0x01 linked libnm-dbus[96085]: <trace> [6464.06462] nmclient[c9bf1eaa1f4b6c99]: [/org/freedesktop/NetworkManager/Devices/mock_WiFi2]: changed-type 0x01 consumed libnm-dbus[96085]: <trace> [6464.06462] nmclient[c9bf1eaa1f4b6c99]: [/org/freedesktop/NetworkManager/Devices/mock_WiFi2]: changed-type 0x02 linked libnm-dbus[96085]: <trace> [6464.06462] nmclient[c9bf1eaa1f4b6c99]: [/org/freedesktop/NetworkManager]: changed-type 0x02 linked libnm-dbus[96085]: <trace> [6464.06462] nmclient[c9bf1eaa1f4b6c99]: [/org/freedesktop/NetworkManager/Devices/mock_WiFi2]: changed-type 0x02 consumed libnm-dbus[96085]: <trace> [6464.06462] nmclient[c9bf1eaa1f4b6c99]: [/org/freedesktop/NetworkManager]: changed-type 0x02 consumed >>> libnm-dbus[96085]: <trace> [6464.06465] nmclient[c9bf1eaa1f4b6c99]: [/org/freedesktop/NetworkManager/ActiveConnection/0]: interfaces-added: properties changed for interface org.freedesktop.NetworkManager.Connection.Active { {'Devices': <[objectpath '/org/freedesktop/NetworkManager/Devices/mock_WiFi2']>, 'Default6': <false>, 'Default': <true>, 'Type': <'802-11-wireless'>, 'Vpn': <false>, 'Connection': <objectpath '/org/freedesktop/NetworkManager/Settings/Mock_AP3'>, 'Master': <objectpath '/'>, 'SpecificObject': <objectpath '/org/freedesktop/NetworkManager/AccessPoint/Mock_AP3'>, 'Uuid': <'72757a57-8cb6-4052-a18f-4e2be4ba27d9'>, 'State': <uint32 2>, 'Id': <'AP_3'>} } >>> here we lack "set D-Bus object state on-dbus" libnm-dbus[96085]: <trace> [6464.06465] nmclient[c9bf1eaa1f4b6c99]: [/org/freedesktop/NetworkManager/ActiveConnection/0]: interfaces-added: set property org.freedesktop.NetworkManager.Connection.Active.Devices libnm-dbus[96085]: <trace> [6464.06465] nmclient[c9bf1eaa1f4b6c99]: [/org/freedesktop/NetworkManager/ActiveConnection/0]: interfaces-added: set property org.freedesktop.NetworkManager.Connection.Active.Default6 libnm-dbus[96085]: <trace> [6464.06465] nmclient[c9bf1eaa1f4b6c99]: [/org/freedesktop/NetworkManager/ActiveConnection/0]: interfaces-added: set property org.freedesktop.NetworkManager.Connection.Active.Default libnm-dbus[96085]: <trace> [6464.06465] nmclient[c9bf1eaa1f4b6c99]: [/org/freedesktop/NetworkManager/ActiveConnection/0]: interfaces-added: set property org.freedesktop.NetworkManager.Connection.Active.Type libnm-dbus[96085]: <trace> [6464.06465] nmclient[c9bf1eaa1f4b6c99]: [/org/freedesktop/NetworkManager/ActiveConnection/0]: interfaces-added: set property org.freedesktop.NetworkManager.Connection.Active.Vpn libnm-dbus[96085]: <trace> [6464.06465] nmclient[c9bf1eaa1f4b6c99]: [/org/freedesktop/NetworkManager/ActiveConnection/0]: interfaces-added: set property org.freedesktop.NetworkManager.Connection.Active.Connection libnm-dbus[96085]: <trace> [6464.06465] nmclient[c9bf1eaa1f4b6c99]: [/org/freedesktop/NetworkManager/ActiveConnection/0]: interfaces-added: set property org.freedesktop.NetworkManager.Connection.Active.Master libnm-dbus[96085]: <trace> [6464.06465] nmclient[c9bf1eaa1f4b6c99]: [/org/freedesktop/NetworkManager/ActiveConnection/0]: interfaces-added: set property org.freedesktop.NetworkManager.Connection.Active.SpecificObject libnm-dbus[96085]: <trace> [6464.06466] nmclient[c9bf1eaa1f4b6c99]: [/org/freedesktop/NetworkManager/ActiveConnection/0]: interfaces-added: set property org.freedesktop.NetworkManager.Connection.Active.Uuid libnm-dbus[96085]: <trace> [6464.06466] nmclient[c9bf1eaa1f4b6c99]: [/org/freedesktop/NetworkManager/ActiveConnection/0]: interfaces-added: set property org.freedesktop.NetworkManager.Connection.Active.State libnm-dbus[96085]: <trace> [6464.06466] nmclient[c9bf1eaa1f4b6c99]: [/org/freedesktop/NetworkManager/ActiveConnection/0]: interfaces-added: set property org.freedesktop.NetworkManager.Connection.Active.Id libnm-dbus[96085]: <trace> [6464.06466] nmclient[c9bf1eaa1f4b6c99]: [/org/freedesktop/NetworkManager/ActiveConnection/0]: changed-type 0x01 linked libnm-dbus[96085]: <trace> [6464.06466] nmclient[c9bf1eaa1f4b6c99]: [/org/freedesktop/NetworkManager/ActiveConnection/0]: changed-type 0x01 consumed Bail out! libnm:ERROR:libnm/nm-client.c:2863:_dbus_handle_obj_changed_dbus: assertion failed: (dbobj->obj_state >= NML_DBUS_OBJ_STATE_ON_DBUS) Backtrace: #3 0x00007f0bd11173bf in g_assertion_message_expr (domain=domain@entry=0x7f0bd1576018 "libnm", file=file@entry=0x7f0bd1576006 "libnm/nm-client.c", line=line@entry=2863, func=func@entry=0x7f0bd157f1b0 <__func__.170> "_dbus_handle_obj_changed_dbus", expr=expr@entry=0x7f0bd157cba0 "dbobj->obj_state >= NML_DBUS_OBJ_STATE_ON_DBUS") at ../glib/gtestutils.c:2963 #4 0x00007f0bd14959dd in _dbus_handle_obj_changed_dbus (self=self@entry=0x5612d4f5a130, log_context=<optimized out>) at libnm/nm-client.c:2863 #5 0x00007f0bd1495c29 in _dbus_handle_changes (self=self@entry=0x5612d4f5a130, log_context=<optimized out>, allow_init_start_check_complete=allow_init_start_check_complete@entry=1) at libnm/nm-client.c:2909 #6 0x00007f0bd1497e56 in _dbus_managed_objects_changed_cb (connection=<optimized out>, sender_name=<optimized out>, arg_object_path=<optimized out>, interface_name=<optimized out>, signal_name=<optimized out>, parameters=0x7f0bb800d720, user_data=0x5612d4f5a130) at libnm/nm-client.c:3172 #7 0x00007f0bd132a8df in emit_signal_instance_in_idle_cb (data=data@entry=0x7f0bb8003700) at ../gio/gdbusconnection.c:3789 #8 0x00007f0bd10f1b5b in g_idle_dispatch (source=source@entry=0x7f0bb8012260, callback=0x7f0bd132a860 <emit_signal_instance_in_idle_cb>, user_data=0x7f0bb8003700) at ../glib/gmain.c:5836 #9 0x00007f0bd10f2a9f in g_main_dispatch (context=0x5612d4f4b630) at ../glib/gmain.c:3325 #10 g_main_context_dispatch (context=0x5612d4f4b630) at ../glib/gmain.c:4043 #11 0x00007f0bd1144a98 in g_main_context_iterate.constprop.0 (context=0x5612d4f4b630, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at ../glib/gmain.c:4119 #12 0x00007f0bd10f2163 in g_main_loop_run (loop=0x5612d4f4b720) at ../glib/gmain.c:4317 #13 0x00005612d44b6543 in main (argc=7, argv=0x7fff4414f1d8) at clients/cli/nmcli.c:1036 https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=982613 https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/662 Fixes: ce0e898fb476 ('libnm: refactor caching of D-Bus objects in NMClient') (cherry picked from commit e1e9abdf041b4cc95fb1936b75ced7669f3d7867)
* libnm: avoid assertion failure in _dbus_handle_properties_changed() for ↵Thomas Haller2021-02-151-2/+6
| | | | | | logging no properties (cherry picked from commit 1f9622358a691aa97b72b3df118feac7970769c4)
* libnm: log PID in LIBNM_CLIENT_DEBUG debug loggingThomas Haller2021-02-151-2/+7
| | | | (cherry picked from commit 6da5fc59d860913a278f488f0873ce68f038de2b)
* libnm: merge libnm-keyfile into libnm-coreThomas Haller2021-02-091-3/+1
| | | | | | | | | | | | | | | | | Before there was a licensing conflict between the keyfile code (libnm-keyfile) and libnm. The latter would require LGPL-2.1+ while keyfile code was GPL-2.0+. Consequently we were linking libnm-keyfile into the daemon, but not in libnm.so. This conflict has been resolved and keyfile API is part of libnm.so. There is no more need to build a separate (intermediary) library. Merge them. This also makes sense because keyfile code needs access to private code from libnm-core. It is closely tied to libnm-core, so that building them separate makes no sense (anymore).
* all: add "libnm/nm-default-libnm.h" as replacement for "nm-default.h"Thomas Haller2021-02-0961-63/+86
|
* all: add "libnm/nm-default-client.h" as replacement for "nm-default.h"Thomas Haller2021-02-094-5/+26
|
* ethtool: add more offload features that kernel supportsThomas Haller2021-02-081-0/+7
| | | | | | | | | | | | | New features: - ethtool.feature-macsec-hw-offload - ethtool.feature-rx-gro-list - ethtool.feature-rx-udp-gro-forwarding - ethtool.feature-tls-hw-rx-offload - ethtool.feature-tx-gso-list - ethtool.feature-tx-tunnel-remcsum-segmentation https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/735
* build/meson: drop special timeout for libnm testThomas Haller2021-01-271-8/+12
| | | | | | | A timeout for tests should not be reached anyway. It's only a fail-safe for not running indefinitely (and for meson not killing the test too early). We don't need to run test-libnm with a shorter timeout.
* build/meson: cleanup "libnm/tests/meson.build"Thomas Haller2021-01-271-16/+15
|
* build: rename static "liblibnm" to "libnm-static"Thomas Haller2021-01-272-4/+4
| | | | | | | This is basically all of libnm as a static-library. The name liblibnm isn't great. Arguably, we do have quite a lot of libnmxyz, so finding a good name is hard. But libnm-static seems a better name. Rename.
* build/meson: cleanup "libnm/meson.build"Thomas Haller2021-01-271-36/+31
|
* build/meson: rename "libnm_utils_base" to "libnm_glib_aux"Thomas Haller2021-01-271-1/+1
| | | | It's the better name.
* libnm,shared: move nm-ethtool helper to "libnm-base"Thomas Haller2021-01-153-0/+102
| | | | | | | | | | | | | | We want to use this by "shared/nm-platform", which should have no dependency on "libnm-core". Move "libnm-core/nm-ethtool-utils.h" to "libnm/nm-ethtool-utils.h" so that it is only used by libnm. This file contains the defines for the option names. Also, symlink "libnm/nm-ethtool-utils.h" as "shared/nm-base/nm-ethtool-utils-base.h". We want to use the same defines also internally. Since they are both public API (must be in libnm) and should be in "shared/nm-base", this is the way.
* all: update deprecated SPDX license identifiersThomas Haller2021-01-05117-117/+117
| | | | | | | | | | | | | | | | These SPDX license identifiers are deprecated ([1]). Update them. [1] https://spdx.org/licenses/ sed \ -e '1 s%^/\* SPDX-License-Identifier: \(GPL-2.0\|LGPL-2.1\)+ \*/$%/* SPDX-License-Identifier: \1-or-later */%' \ -e '1,2 s%^\(--\|#\|//\) SPDX-License-Identifier: \(GPL-2.0\|LGPL-2.1\)+$%\1 SPDX-License-Identifier: \2-or-later%' \ -i \ $(git grep -l SPDX-License-Identifier -- \ ':(exclude)shared/c-*/' \ ':(exclude)shared/n-*/' \ ':(exclude)shared/systemd/src' \ ':(exclude)src/systemd/src')
* wifi: merge branch 'ac/wpa3eap_suiteb192'Antonio Cardace2020-12-221-1/+2
|\ | | | | | | https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/709
| * wifi: add WPA-EAP-SUITE-B-192 supportac/wpa3eap_suiteb192Antonio Cardace2020-12-221-1/+2
| | | | | | | | | | | | | | | | | | Add a new key management option to support WPA3 Enteprise wifi connection. Only supported with wpa_supplicant for the time being. Signed-off-by: Antonio Cardace <acardace@redhat.com>
* | libnm: allow opt-out of including system headers in <NetworkManager.h>Thomas Haller2020-12-221-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In public libnm headers we include some libc/linux headers, although libnm doesn't strictly need them. The <linux/*.h> headers conflict with some network headers provided by libc and they need to be included in the right order. As <NetworkManager.h> drags in some linux headers, this makes it unnecessarily complicated. It also feels ugly to include headers we don't need, only for the sake of convenience. Allow to opt out. Also, for internal build, don't do this. When building NetworkManager we need control about the headers and their order of inclusion.
* | all: explicit include <linux/if_{ether,infiniband,vlan}.h> as neededThomas Haller2020-12-225-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently libnm headers include <linux/if_{ether,infiniband,vlan}.h>. These are public headers, that means we drag in the linux header to all users of <NetworkManager.h>. Often the linux headers work badly together with certain headers from libc. Depending on the libc version, you have to order linux headers in the right order with respect to libc headers. We should do better about libnm headers. As a first step, assume that the linux headers don't get included by libnm, and explicitly include them where they are needed.
* | libnm: include "nm-core-enum-types.h" in libnm headers with quotesThomas Haller2020-12-221-1/+1
|/ | | | | | | | In C, includes with <> are for system headers, while "" prefers the current working directory (implementation defined). For libnm headers that include other libnm headers, we tend to use "" instead of <>. That makes sense to me. Be consistent about that.
* libnm: adjust nm_device_get_type_description for VethFernando Fernandez Mancera2020-12-141-1/+4
| | | | | | | | Veth interfaces should be shown as Ethernet from nm_device_get_type_description in order to provide backward compatibility. Signed-off-by: Fernando Fernandez Mancera <ffmancera@riseup.net>
* libnm: NMDeviceEthernet uses PRIO_20 instead of PRIO_30Fernando Fernandez Mancera2020-12-145-2/+14
| | | | | | | | | | As NMDeviceVeth has a NMDeviceEthernet as parent, it should use PRIO_20 in order to report NMDeviceVeth when configured and do not report NMDeviceEthernet. An unit test case has been added. Signed-off-by: Fernando Fernandez Mancera <ffmancera@riseup.net>
* libnm: add warning for bindings about broken functions for transferred GPtrArrayThomas Haller2020-12-092-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In commit 201c153e2599 ('libnm: fix GObject Introspection annotations for functions returning a GPtrArray') these annotations were changed to fix Vala bindings. However, bindings may treat the transfer annotation for GPtrArray differently, so depending on the binding we either get a leak or a double free. It's unclear how to fix that. For now, just add a warning to the documentation to avoid it. The following reproducer leads to a crash: #!/bin/python import gi gi.require_version("NM", "1.0") from gi.repository import NM def _pr(msg): NM.utils_print(0, msg + "\n") def process(nmc): for device in nmc.get_devices(): cons = device.filter_connections(nmc.get_connections()) _pr( "device %s (%s) has %s compatible connections" % (device.get_iface(), NM.Object.get_path(device), len(cons)) ) process(NM.Client.new()) See-also: https://gitlab.gnome.org/GNOME/gobject-introspection/-/issues/305
* libnm: fix re-entrancy of NMClient.dispose() for _init_release_all()Thomas Haller2020-12-081-2/+2
| | | | | | | | | | GObject's dispose() functions may be called multiple times to break reference cycles. As dispose() calls _init_release_all(), the object might already be partially destroyed. Fixes: ce0e898fb476 ('libnm: refactor caching of D-Bus objects in NMClient')
* libnm: add debug logging for creating/destroying NMObjectThomas Haller2020-12-071-0/+10
|
* veth: peer property is D-Bus object path not a stringFernando Fernandez Mancera2020-12-012-27/+22
| | | | Signed-off-by: Fernando Fernandez Mancera <ffmancera@riseup.net>
* veth: add support to configure veth interfacesFernando Fernandez Mancera2020-11-278-9/+187
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | NetworkManager is now able to configure veth interfaces throught the NMSettingVeth. Veth interfaces only have "peer" property. In order to support Veth interfaces in NetworkManager the design need to pass the following requirements: * Veth setting only has "peer" attribute. * Ethernet profiles must be applicable to Veth interfaces. * When creating a veth interface, the peer will be managed by NetworkManager but will not have a profile. * Veth connection can reapply only if the peer has not been modified. * In order to modify the veth peer, NetworkManager must deactivate the connection and create a new one with peer modified. In general, it should support the basis of veth interfaces but without breaking any existing feature or use case. The users that are using veth interfaces as ethernet should not notice anything changed unless they specified the veth peer setting. Creating a Veth interface in NetworkManager is useful even without the support for namespaces for some use cases, e.g "connecting one side of the veth to an OVS bridge and the other side to a Linux bridge" this is done when using OVN kubernetes [1][2]. In addition, it would provide persistent configuration and rollback support for Veth interfaces. [1] https://bugzilla.redhat.com/show_bug.cgi?id=1885605 [2] https://bugzilla.redhat.com/show_bug.cgi?id=1894139 Signed-off-by: Fernando Fernandez Mancera <ffmancera@riseup.net>
* ethernet: define NMDeviceEthernet on nm-libnm-utils.hFernando Fernandez Mancera2020-11-272-21/+36
| | | | | | | NMDeviceEthernet will be used to support Veth interfaces. Therefore, it needs to be defined on libnm/nm-libnm-utils.h Signed-off-by: Fernando Fernandez Mancera <ffmancera@riseup.net>
* libnm/tests: add unit test for more consistency check of NMObject type ↵Thomas Haller2020-11-181-14/+77
| | | | | | | | | | | information The type information of NMObject is entirely static. And there are certain conditions how this information should be. Add some more checks. We need priv_ptr_offset set if (and only if) we also have property_ao_info or property_o_info registered.
* utils: introduce new NML_DBUS_META_INTERFACE_PRIO_INSTANTIATE_20Fernando Fernandez Mancera2020-11-182-1/+3
| | | | | | | | | | | | | | | | This patch is replacing NML_DBUS_META_INTERFACE_PRIO_INSTANTIATE_LOW with NML_DBUS_META_INTERFACE_PRIO_INSTANTIATE_10 and NML_DBUS_META_INTERFACE_PRIO_INSTANTIATE_HIGH with NML_DBUS_META_INTERFACE_PRIO_INSTANTIATE_30. In addition it is introducing NML_DBUS_META_INTERFACE_PRIO_INSTANTIATE_20 which is a middle point between the existing priorities. This new priority is needed due to Veth support incoming. It will be used to prevent the creation a NMDeviceWired instance. Signed-off-by: Fernando Fernandez Mancera <ffmancera@riseup.net> [thaller@redhat.com: split original patch]
* libnm/trivial: rename enums NML_DBUS_META_INTERFACE_PRIO_INSTANTIATE_*Fernando Fernandez Mancera2020-11-1838-83/+83
| | | | | | | | | | | | | We will need more levels of priority. Change the naming to make room for that. sed 's/NML_DBUS_META_INTERFACE_PRIO_INSTANTIATE_LOW/NML_DBUS_META_INTERFACE_PRIO_INSTANTIATE_10/g' `git grep -l NML_DBUS_META_INTERFACE_PRIO_INSTANTIATE_ ` -i sed 's/NML_DBUS_META_INTERFACE_PRIO_INSTANTIATE_LOW/NML_DBUS_META_INTERFACE_PRIO_INSTANTIATE_10/g' `git grep -l NML_DBUS_META_INTERFACE_PRIO_INSTANTIATE_ ` -i ./contrib/scripts/nm-code-format-container.sh Signed-off-by: Fernando Fernandez Mancera <ffmancera@riseup.net> [thaller@redhat.com: split original patch]
* all: add hostname settingBeniamino Galvani2020-11-162-0/+6
| | | | | Add a new setting that contains properties related to how NM should get the hostname from the connection.
* shared: add c-list macros to iterate backwardsBeniamino Galvani2020-11-161-1/+1
|
* libnm: add NMSettingOvsExternalIDsThomas Haller2020-11-091-0/+7
|
* libnm: add nm_utils_print() functionThomas Haller2020-11-093-0/+45
| | | | | | | | | | | | | | | | libnm supports verbose debug logging by setting "LIBNM_CLIENT_DEBUG" environment variable. That mechanism uses g_printerr() (or g_print()). When testing an application it's useful to combine printf debugging with this debug logging. However, python's print() statement is additionally buffered and not in sync with the logging functions that libnm uses. As far as I see, g_print() and g_printerr() is not accessible via introspections/pygobject, probably because these are variadic functions. Add nm_utils_print() to libnm. This ensures to use the same logging mechanism as libnm.
* keyfile: expose keyfile handling in libnm as public APIThomas Haller2020-10-282-1/+14
|
* libnm: add "nm-keyfile.h" headerThomas Haller2020-10-282-0/+2
| | | | | Keyfile API will become part of public libnm API. Add "nm-keyfile.h" header for that.
* all/trivial: rename local variable for user_data for nm_utils_user_data_unpack()Thomas Haller2020-10-221-5/+5
| | | | | In almost all cases, the variable of this kind is named "user_data". Rename it for consistency.
* license: relicense "libnm/nm-types.h" under LGPL-2.1+Thomas Haller2020-10-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | >>> H0=a3e75f329446a93a61ca4c458a7657bd919f4fe6 commit_has_file() { git ls-tree -r "$1" | grep -q "\\s$2"\$ } print_commit_authors() { git --no-pager log --full-history --follow --no-merges --pretty='format:<%ae>' $H0 -- "$1" | sort | uniq } print_blame_authors() { local LAST_H if commit_has_file $H0 "$1"; then LAST_H=$H0 else LAST_H="$(git log --full-history --no-merges -n1 --pretty='format:%H' $H0 -- "$1")"^1 fi git blame --no-progress -C -C -C20 -M -M10 -e "$LAST_H" -- "$1" | sed 's/.*\(<[^>]\+@[^>]\+>\).*/\1/' | sort | uniq } print_grep() { git --no-pager log -p --full-history --follow $H0 -- "$1" | grep -i '[a-z0-9]@\|author\|copyright' | sort | uniq } prefix() { sed "s/^/>>>$1 /" } collect_all() { for F; do print_commit_authors "$F" | prefix 1 echo print_blame_authors "$F" | prefix 2 echo print_grep "$F" | prefix 3 done | sort | uniq | sed 's/@/(at)/' } collect_all \ libnm/nm-types.h \ libnm-glib/nm-types.h \ ; <<< >>>1 <bberg(at)redhat.com> >>>1 <bgalvani(at)redhat.com> >>>1 <danw(at)gnome.org> >>>1 <danw(at)redhat.com> >>>1 <dcbw(at)redhat.com> >>>1 <jarteaga(at)jbeta.is> >>>1 <jklimes(at)redhat.com> >>>1 <lkundrak(at)v3.sk> >>>1 <thaller(at)redhat.com> >>>2 <bgalvani(at)redhat.com> >>>2 <clarkbw(at)cvs.gnome.org> >>>2 <danw(at)redhat.com> >>>2 <dcbw(at)redhat.com> >>>2 <jarteaga(at)jbeta.is> >>>2 <lkundrak(at)v3.sk> >>>2 <pgrzegorczyk(at)gmail.com> >>>2 <tambet(at)gmail.com> >>>2 <thaller(at)redhat.com> >>>3 [...] Red Hat, Inc. Everybody in this list agreed to relicensing according to RELICENSE.md.
* all: unify comment style for SPDX-License-Identifier tagThomas Haller2020-09-29113-113/+113
| | | | | | | | | | Our coding style recommends C style comments (/* */) instead of C++ (//). Also, systemd (which we partly fork) uses C style comments for the SPDX-License-Identifier. Unify the style. $ sed -i '1 s#// SPDX-License-Identifier: \([^ ]\+\)$#/* SPDX-License-Identifier: \1 */#' -- $(git ls-files -- '*.[hc]' '*.[hc]pp')
* format: replace tabs for indentation in code commentsac/clang-formatThomas Haller2020-09-2846-1879/+1879
| | | | | | | | | | | | sed -i \ -e 's/^'$'\t'' \*/ */g' \ -e 's/^'$'\t\t'' \*/ */g' \ -e 's/^'$'\t\t\t'' \*/ */g' \ -e 's/^'$'\t\t\t\t'' \*/ */g' \ -e 's/^'$'\t\t\t\t\t'' \*/ */g' \ -e 's/^'$'\t\t\t\t\t\t'' \*/ */g' \ -e 's/^'$'\t\t\t\t\t\t\t'' \*/ */g' \ $(git ls-files -- '*.[hc]')
* all: reformat all with new clang-format styleAntonio Cardace2020-09-28112-23932/+24665
| | | | | | | | | | | | Run: ./contrib/scripts/nm-code-format.sh -i ./contrib/scripts/nm-code-format.sh -i Yes, it needs to run twice because the first run doesn't yet produce the final result. Signed-off-by: Antonio Cardace <acardace@redhat.com>