From 8bed2c9edc644287fa708d6837de6f601f4b5849 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Tue, 13 Dec 2022 12:25:04 +0100 Subject: [PATCH] core: add "VersionInfo" property on D-Bus and NMClient This exposes NM_VERSION as number (contrary to the "Version", which is a string). That is in particular useful, because the number can be compared with <> due to the encoding of the version. While at it, don't make it a single number. Expose an array of numbers, where the following numbers are a bitfield of capabilities. Note that before commit 3c67a1ec5e8e ('cli: remove version check against NM'), we used to parse the "Version" string to detect the version. As such, the information that "VersionInfo" exposes now, was already (somewhat) available, you just had to parse the string. The main benefit of "VersionInfo" is that it can expose capabilities (patched behavior) in in a lightweight bitfield. To include the numerical version there is just useful on top. Currently no additional capabilities are exposed. The idea is of course to have a place in the future, where we can expose additional capabilities. Adding a capability flag is most useful for behavior that we backport to older branches. Otherwise, we could just check the daemon version alone. But since we only add "VersionInfo" property only now, we cannot backport any capability further than this, because the "VersionInfo" property itself won't be backported. As such, this will only be useful in the future by having a place where we can add (and backport) capabilities. Note that there is some overlap with the existing "Capability" property and NMCapability enum. The difference is that adding a capability via "VersionInfo" is only one bit, and thus cheaper. Most importantly, having it cheaper means the downsides of adding a capability flag is significantly removed. In practice, we could live without capabilities for a long time, so they must be very cheap for them to be worth to add. Another difference might be, that we will want that the VersionInfo is about compile time defaults (e.g. a certain patch/behavior that is in or not), while NM_CAPABILITY_TEAM depends on whether the team plugin is loaded at runtime. --- .../org.freedesktop.NetworkManager.xml | 16 +++ src/core/nm-manager.c | 40 +++++++ src/core/nm-manager.h | 1 + src/libnm-client-impl/libnm.ver | 2 + src/libnm-client-impl/nm-client.c | 105 +++++++++++++++--- src/libnm-client-public/nm-client.h | 11 +- src/libnm-core-public/nm-dbus-interface.h | 14 +++ 7 files changed, 172 insertions(+), 17 deletions(-) diff --git a/introspection/org.freedesktop.NetworkManager.xml b/introspection/org.freedesktop.NetworkManager.xml index 161857062..c92c80174 100644 --- a/introspection/org.freedesktop.NetworkManager.xml +++ b/introspection/org.freedesktop.NetworkManager.xml @@ -456,6 +456,22 @@ --> + + +