summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
| * glib-aux: use _nm_deprecated() macro in "nm-glib.h"Thomas Haller2021-06-281-3/+2
| |
| * glib-aux/trivial: add code comment to nm_g_source_destroy_and_unref() about ↵Thomas Haller2021-06-281-0/+13
| | | | | | | | | | | | | | | | g_source_destroy() I think this is non-obvious API, and should be pointed out. As we don't really have a good place for this comment, the place is a bit unmotivated. Still, add a comment.
| * glib-aux/trivial: fix spelling error in code commentThomas Haller2021-06-281-3/+3
| |
| * std-aux: add _nm_deprecated() macroThomas Haller2021-06-281-0/+1
|/
* ifcfg-rh: merge branch 'th/ifcfg-fix-empty-ethtool'Thomas Haller2021-06-288-13/+186
|\ | | | | | | https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/905
| * ifcfg-rh: fix persisting all-default NMSettingEthtool settingsThomas Haller2021-06-253-1/+10
| | | | | | | | | | | | | | | | | | | | | | | | We somehow need to encode an NMSettingEthtool instance that has all options unset. Previously, that would result in no "$ETHTOOL_OPTS" variable and thus the reader would loose a previously existing setting. Hack it by writing a bogus ETHTOOL_OPTS="-A $IFACE" line.
| * ifcfg-rh/tests: add unit test for persisting NMSettingEthtoolThomas Haller2021-06-257-1/+150
| | | | | | | | | | | | In particular the case with an all-default NMSettingEthtool is currently broken. The test is checking the wrong behavior, which will be fixed next.
| * ifcfg-rh/tests: unlink test file in _writer_new_connection_reread() if not ↵Thomas Haller2021-06-251-1/+3
| | | | | | | | requested
| * ifcfg-rh/tests: evalute environment for $NMTST_IFCFG_RH_UPDATE_EXPECTED only ↵Thomas Haller2021-06-251-11/+24
|/ | | | | | | | once It just seems ugly to call g_getenv() repeatedly. Environment variables must not change (in a multi-threaded program after other threads start), so determine the mode once and cache it.
* ifcfg: always write ethernet.s390-options even without subchannelsThomas Haller2021-06-251-1/+1
| | | | | | | | | | | | | | | | | For the umpteenth time: it is not ifcfg-rh writers decision to decide what are valid configurations and only persist settings based on some other settings. If s390-options would only be allowed together with subchannels, then this is alone nm_connection_verify()'s task to ensure. Reproduce with $ nmcli connection add type ethernet autoconnect no con-name zz ethernet.s390-options bridge_role=primary Related: https://bugzilla.redhat.com/show_bug.cgi?id=1935842 Fixes: 16bccfd672e7 ('core: handle s390 options more cleanly')
* supplicant: suppress warning log for P2PDevice.Cancel()Thomas Haller2021-06-241-29/+67
| | | | | | | | | | | | A failure to cancel something is not worth a warning. It probably just means that no operation was in progress. In my logs I always see a warning: CODE_FILE=src/core/supplicant/nm-supplicant-interface.c CODE_LINE=391 MESSAGE=<warn> [1624517233.8822] sup-iface[a22b181a321ffd9b,9,wlan0]: call-p2p-cancel: failed with P2P cancel failed Downgrade this to trace level.
* gitlab-ci: bump tag for cached container imagesThomas Haller2021-06-232-6/+6
| | | | | This results in a rebuild of the containers, which is a good idea as we didn't do that for a while.
* cli/wireguard: merge branch 'mcatanzaro/wg-import-dns-priority'Thomas Haller2021-06-232-5/+5
|\ | | | | | | https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/901
| * NEWS: updateThomas Haller2021-06-231-0/+5
| |
| * libnmc-base: don't set DNS priority when importing Wireguard connectionsMichael Catanzaro2021-06-231-5/+0
|/ | | | | | | | | | | | | | | | | | | | | | | | | This is actually trying *too* hard to prevent DNS leaks, breaking normal expected use of split DNS. Let systemd-resolved handle sending our DNS queries to the right place instead. It's true that NetworkManager is trying to emulate the behavior of wg-quick here, and wg-quick uses 'resolvconf -x' to attempt to set "exclusive" DNS. But with systemd-resolved this is implemented by setting a ~. routing domain for the Wireguard interface. That is a *really* big hammer already, since Domain=~. overrides +DefaultRoute, ensuring most DNS queries can only go to other interfaces with Domain=~. NetworkManager follows systemd-resolved's recommended convention by only applying Domain=~. to other "privacy VPNs" since 1.26.6. Setting DNS priority only prevents *domain-specific* "leaks", which are almost always desired. For example, it prevents using both the Wireguard VPN and a corporate VPN at the same time. Note that all of the justification behind !688 applies here as well. See-also: https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/688 https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/585 https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/901
* wifi/p2p: merge branch 'benzea/p2p-assigned-addr'Thomas Haller2021-06-233-3/+96
|\ | | | | | | https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/899
| * wifi/p2p: Use address assigned by GO when availableBenjamin Berg2021-06-231-3/+33
| | | | | | | | | | | | When we are a client in the group we may be assigned an address by the group owner. Use this address if it is available, but only if we are in AUTO configuration mode.
| * supplicant: Store assigned addr for P2P group joinsBenjamin Berg2021-06-232-0/+63
|/ | | | | | A P2P Group Owner may assign an IP address and netmask to us. Store this address so that it can be retrieved later during the IP configuration stage.
* build,doc: merge branch 'liangwen12year:wl/docbook_xml'Thomas Haller2021-06-234-8/+423
|\ | | | | | | https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/870
| * Docs:improve manual page about qdiscs and tfiltersWen Liang2021-06-231-0/+379
| | | | | | | | Signed-off-by: Wen Liang <liangwen12year@gmail.com>
| * Support new attribute tag `description-docbook`Wen Liang2021-06-233-8/+44
|/ | | | | | | | `description-docbook` is the alternative tag to `description`, the difference is that `description-docbook` expects docbook XML but not plaintext. Signed-off-by: Wen Liang <liangwen12year@gmail.com>
* trivial: fix code formattingThomas Haller2021-06-231-2/+2
| | | | Fixes: ac090edd87bc ('libnm: add type enum for handling gprop differences in to_dbus_fcn')
* libnm: add NM_OBJECT_CLIENT propertyThomas Haller2021-06-232-2/+30
| | | | | | | | | | | | | | | | We have nm_object_get_client() property that returns a reference to the NMClient instance. This is actually useful, because if the function returns %NULL, it means that the object was removed from the cache. On the other hand, the user cannot subscribe to notifications when this happens. Well, there are otherwise pointless signals like NM_CLIENT_DEVICE_REMOVED, which we wouldn't need if we had a general mechanism for NMObject instances. Add a GObject property "client", which is just that mechanism. https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/902
* tools: merge branch 'fm/suppress-duplicate-line-in-stub'Thomas Haller2021-06-231-6/+2
|\ | | | | | | https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/891
| * tools: correct NetworkManager top object set_state functionFrederic Martinsons2021-06-231-2/+2
| | | | | | | | Signed-off-by: Frederic Martinsons <frederic.martinsons@sigfox.com>
| * tools: suppress duplicate state change in deactivation step of active connectionFrederic Martinsons2021-06-231-4/+0
|/ | | | Signed-off-by: Frederic Martinsons <frederic.martinsons@sigfox.com>
* systemd: merge branch systemd into mainThomas Haller2021-06-2324-140/+225
|\ | | | | | | https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/897
| * systemd: update code from upstream (2021-06-17)Thomas Haller2021-06-1724-140/+223
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a direct dump from systemd git. ====== SYSTEMD_DIR=../systemd COMMIT=17f8a7e9727a87ab8aad460a39907e329f694977 ( cd "$SYSTEMD_DIR" git checkout "$COMMIT" git reset --hard git clean -fdx ) git ls-files -z :/src/libnm-systemd-core/src/ \ :/src/libnm-systemd-shared/src/ \ :/src/libnm-std-aux/unaligned.h | \ xargs -0 rm -f nm_copy_sd_shared() { mkdir -p "./src/libnm-systemd-shared/$(dirname "$1")" cp "$SYSTEMD_DIR/$1" "./src/libnm-systemd-shared/$1" } nm_copy_sd_core() { mkdir -p "./src/libnm-systemd-core/$(dirname "$1")" cp "$SYSTEMD_DIR/$1" "./src/libnm-systemd-core/$1" } nm_copy_sd_stdaux() { mkdir -p "./src/libnm-std-aux/" cp "$SYSTEMD_DIR/$1" "./src/libnm-std-aux/${1##*/}" } nm_copy_sd_core "src/libsystemd-network/arp-util.c" nm_copy_sd_core "src/libsystemd-network/arp-util.h" nm_copy_sd_core "src/libsystemd-network/dhcp-identifier.c" nm_copy_sd_core "src/libsystemd-network/dhcp-identifier.h" nm_copy_sd_core "src/libsystemd-network/dhcp-internal.h" nm_copy_sd_core "src/libsystemd-network/dhcp-lease-internal.h" nm_copy_sd_core "src/libsystemd-network/dhcp-network.c" nm_copy_sd_core "src/libsystemd-network/dhcp-option.c" nm_copy_sd_core "src/libsystemd-network/dhcp-packet.c" nm_copy_sd_core "src/libsystemd-network/dhcp-protocol.h" nm_copy_sd_core "src/libsystemd-network/dhcp6-internal.h" nm_copy_sd_core "src/libsystemd-network/dhcp6-lease-internal.h" nm_copy_sd_core "src/libsystemd-network/dhcp6-network.c" nm_copy_sd_core "src/libsystemd-network/dhcp6-option.c" nm_copy_sd_core "src/libsystemd-network/dhcp6-protocol.h" nm_copy_sd_core "src/libsystemd-network/lldp-internal.h" nm_copy_sd_core "src/libsystemd-network/lldp-neighbor.c" nm_copy_sd_core "src/libsystemd-network/lldp-neighbor.h" nm_copy_sd_core "src/libsystemd-network/lldp-network.c" nm_copy_sd_core "src/libsystemd-network/lldp-network.h" nm_copy_sd_core "src/libsystemd-network/network-common.c" nm_copy_sd_core "src/libsystemd-network/network-common.h" nm_copy_sd_core "src/libsystemd-network/network-internal.c" nm_copy_sd_core "src/libsystemd-network/network-internal.h" nm_copy_sd_core "src/libsystemd-network/sd-dhcp-client.c" nm_copy_sd_core "src/libsystemd-network/sd-dhcp-lease.c" nm_copy_sd_core "src/libsystemd-network/sd-dhcp6-client.c" nm_copy_sd_core "src/libsystemd-network/sd-dhcp6-lease.c" nm_copy_sd_core "src/libsystemd-network/sd-ipv4acd.c" nm_copy_sd_core "src/libsystemd-network/sd-ipv4ll.c" nm_copy_sd_core "src/libsystemd-network/sd-lldp.c" nm_copy_sd_core "src/libsystemd/sd-event/event-source.h" nm_copy_sd_core "src/libsystemd/sd-event/event-util.c" nm_copy_sd_core "src/libsystemd/sd-event/event-util.h" nm_copy_sd_core "src/libsystemd/sd-event/sd-event.c" nm_copy_sd_core "src/libsystemd/sd-id128/id128-util.c" nm_copy_sd_core "src/libsystemd/sd-id128/id128-util.h" nm_copy_sd_core "src/libsystemd/sd-id128/sd-id128.c" nm_copy_sd_core "src/systemd/_sd-common.h" nm_copy_sd_core "src/systemd/sd-dhcp-client.h" nm_copy_sd_core "src/systemd/sd-dhcp-lease.h" nm_copy_sd_core "src/systemd/sd-dhcp-option.h" nm_copy_sd_core "src/systemd/sd-dhcp6-client.h" nm_copy_sd_core "src/systemd/sd-dhcp6-lease.h" nm_copy_sd_core "src/systemd/sd-dhcp6-option.h" nm_copy_sd_core "src/systemd/sd-event.h" nm_copy_sd_core "src/systemd/sd-id128.h" nm_copy_sd_core "src/systemd/sd-ipv4acd.h" nm_copy_sd_core "src/systemd/sd-ipv4ll.h" nm_copy_sd_core "src/systemd/sd-lldp.h" nm_copy_sd_core "src/systemd/sd-ndisc.h" nm_copy_sd_shared "src/basic/alloc-util.c" nm_copy_sd_shared "src/basic/alloc-util.h" nm_copy_sd_shared "src/basic/async.h" nm_copy_sd_shared "src/basic/cgroup-util.h" nm_copy_sd_shared "src/basic/dns-def.h" nm_copy_sd_shared "src/basic/env-file.c" nm_copy_sd_shared "src/basic/env-file.h" nm_copy_sd_shared "src/basic/env-util.c" nm_copy_sd_shared "src/basic/env-util.h" nm_copy_sd_shared "src/basic/errno-util.h" nm_copy_sd_shared "src/basic/escape.c" nm_copy_sd_shared "src/basic/escape.h" nm_copy_sd_shared "src/basic/ether-addr-util.c" nm_copy_sd_shared "src/basic/ether-addr-util.h" nm_copy_sd_shared "src/basic/extract-word.c" nm_copy_sd_shared "src/basic/extract-word.h" nm_copy_sd_shared "src/basic/fd-util.c" nm_copy_sd_shared "src/basic/fd-util.h" nm_copy_sd_shared "src/basic/fileio.c" nm_copy_sd_shared "src/basic/fileio.h" nm_copy_sd_shared "src/basic/format-util.c" nm_copy_sd_shared "src/basic/format-util.h" nm_copy_sd_shared "src/basic/fs-util.c" nm_copy_sd_shared "src/basic/fs-util.h" nm_copy_sd_shared "src/basic/hash-funcs.c" nm_copy_sd_shared "src/basic/hash-funcs.h" nm_copy_sd_shared "src/basic/hashmap.c" nm_copy_sd_shared "src/basic/hashmap.h" nm_copy_sd_shared "src/basic/hexdecoct.c" nm_copy_sd_shared "src/basic/hexdecoct.h" nm_copy_sd_shared "src/basic/hostname-util.c" nm_copy_sd_shared "src/basic/hostname-util.h" nm_copy_sd_shared "src/basic/in-addr-util.c" nm_copy_sd_shared "src/basic/in-addr-util.h" nm_copy_sd_shared "src/basic/io-util.c" nm_copy_sd_shared "src/basic/io-util.h" nm_copy_sd_shared "src/basic/list.h" nm_copy_sd_shared "src/basic/log.h" nm_copy_sd_shared "src/basic/macro.h" nm_copy_sd_shared "src/basic/memory-util.c" nm_copy_sd_shared "src/basic/memory-util.h" nm_copy_sd_shared "src/basic/mempool.c" nm_copy_sd_shared "src/basic/mempool.h" nm_copy_sd_shared "src/basic/missing_fcntl.h" nm_copy_sd_shared "src/basic/missing_random.h" nm_copy_sd_shared "src/basic/missing_socket.h" nm_copy_sd_shared "src/basic/missing_stat.h" nm_copy_sd_shared "src/basic/missing_syscall.h" nm_copy_sd_shared "src/basic/missing_type.h" nm_copy_sd_shared "src/basic/ordered-set.c" nm_copy_sd_shared "src/basic/ordered-set.h" nm_copy_sd_shared "src/basic/parse-util.c" nm_copy_sd_shared "src/basic/parse-util.h" nm_copy_sd_shared "src/basic/path-util.c" nm_copy_sd_shared "src/basic/path-util.h" nm_copy_sd_shared "src/basic/prioq.c" nm_copy_sd_shared "src/basic/prioq.h" nm_copy_sd_shared "src/basic/process-util.c" nm_copy_sd_shared "src/basic/process-util.h" nm_copy_sd_shared "src/basic/random-util.c" nm_copy_sd_shared "src/basic/random-util.h" nm_copy_sd_shared "src/basic/ratelimit.c" nm_copy_sd_shared "src/basic/ratelimit.h" nm_copy_sd_shared "src/basic/set.h" nm_copy_sd_shared "src/basic/signal-util.c" nm_copy_sd_shared "src/basic/signal-util.h" nm_copy_sd_shared "src/basic/siphash24.h" nm_copy_sd_shared "src/basic/socket-util.c" nm_copy_sd_shared "src/basic/socket-util.h" nm_copy_sd_shared "src/basic/sort-util.h" nm_copy_sd_shared "src/basic/sparse-endian.h" nm_copy_sd_shared "src/basic/stat-util.c" nm_copy_sd_shared "src/basic/stat-util.h" nm_copy_sd_shared "src/basic/stdio-util.h" nm_copy_sd_shared "src/basic/string-table.c" nm_copy_sd_shared "src/basic/string-table.h" nm_copy_sd_shared "src/basic/string-util.c" nm_copy_sd_shared "src/basic/string-util.h" nm_copy_sd_shared "src/basic/strv.c" nm_copy_sd_shared "src/basic/strv.h" nm_copy_sd_shared "src/basic/strxcpyx.c" nm_copy_sd_shared "src/basic/strxcpyx.h" nm_copy_sd_shared "src/basic/time-util.c" nm_copy_sd_shared "src/basic/time-util.h" nm_copy_sd_shared "src/basic/tmpfile-util.c" nm_copy_sd_shared "src/basic/tmpfile-util.h" nm_copy_sd_shared "src/basic/umask-util.h" nm_copy_sd_shared "src/basic/user-util.h" nm_copy_sd_shared "src/basic/utf8.c" nm_copy_sd_shared "src/basic/utf8.h" nm_copy_sd_shared "src/basic/util.c" nm_copy_sd_shared "src/basic/util.h" nm_copy_sd_shared "src/fundamental/macro-fundamental.h" nm_copy_sd_shared "src/fundamental/string-util-fundamental.c" nm_copy_sd_shared "src/fundamental/string-util-fundamental.h" nm_copy_sd_shared "src/fundamental/type.h" nm_copy_sd_shared "src/shared/dns-domain.c" nm_copy_sd_shared "src/shared/dns-domain.h" nm_copy_sd_shared "src/shared/log-link.h" nm_copy_sd_shared "src/shared/web-util.c" nm_copy_sd_shared "src/shared/web-util.h" nm_copy_sd_stdaux "src/basic/unaligned.h"
* | dhcp: merge branch 'th/dhcp-factory-cleanup'Thomas Haller2021-06-238-56/+44
|\ \ | | | | | | | | | https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/896
| * | dhcp/trivial: rename "NMDhcpClientFactory.experimental" to ↵Thomas Haller2021-06-234-4/+6
| | | | | | | | | | | | | | | | | | "NMDhcpClientFactory.undocumented" It's not experimental. It's not officially documented. Rename.
| * | dhcp: refactor GType handling for NMDhcpClientFactoryThomas Haller2021-06-237-47/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In NetworkManager.conf, we can only configure one "[main].dhcp=" for both address families. Consequently, NMDhcpClientFactory represents also both address families. However, most plugins don't support IPv4 and IPv6 together. Thus, if a plugin does not support an address family, we fallback to the implementation of the "internal" plugin. Slightly rework the code how that is done. Instead of having a "get_type()" and "get_type_per_addr_family()" callback, have an IPv4 and IPv6 getter.
| * | dhcp: minor cleanup of DHCP plugin factoryThomas Haller2021-06-232-5/+6
|/ /
* | glib-aux: merge branch 'th/fix-hash-combine-bool'Thomas Haller2021-06-234-17/+38
|\ \ | | | | | | | | | https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/903
| * | glib-aux: rework NM_HASH_COMBINE_BOOLS() macro to avoid expression statementThomas Haller2021-06-232-12/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | clang 3.4.2-9.el7 dislikes expressions in the form int v; struct { typeof(({ v; })) _field; } x; error: statement expression not allowed at file scope typeof( ({ v; }) ) _field; ^ That is, if the argument to typeof() is an expression statement. But this is what nm_hash_update_val(&h, ..., NM_HASH_COMBINE_BOOLS(...)) expands to. Rework NM_HASH_COMBINE_BOOLS() to avoid the expression statement. We still have the static assertion for the size of the return type. We no longer have the _nm_hash_combine_bools_type typedef. It really wasn't needed, and the current variant is always safe without it. Fixes: 23adeed24463 ('glib-aux: use NM_VA_ARGS_FOREACH() to implement NM_HASH_COMBINE_BOOLS()')
| * | std-aux: rework NM_STATIC_ASSERT_EXPR() macroThomas Haller2021-06-232-5/+30
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Replace NM_STATIC_ASSERT_EXPR() by NM_STATIC_ASSERT_EXPR_1() and NM_STATIC_ASSERT_EXPR_VOID(). NM_STATIC_ASSERT_EXPR_VOID() can be used as an expression that returns void (that is, a simple statement). On the other hand, NM_STATIC_ASSERT_EXPR_1() itself retuns a compile time constant of int value 1. The latter is useful, because we can use the 1 to combine static assertions in expressions that are themself compile time constants, like #define STATIC_CHECK_AND_GET(cond, value) \ (NM_STATIC_ASSERT_EXPR_1(cond) ? (value) : (value)) This is itself a compile time constant if value is a compile time constant. Also, it does the compile time check that "cond" is true.
* | libnm: merge branch 'th/setting-to-dbus-fcn'Thomas Haller2021-06-2336-802/+1260
|\ \ | | | | | | | | | https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/900
| * | libnm: use _nm_setting_property_define_string() for string NMSetting propertiesThomas Haller2021-06-238-178/+214
| | |
| * | libnm: use _nm_setting_property_define_boolean() for boolean NMSetting ↵Thomas Haller2021-06-2317-293/+410
| | | | | | | | | | | | properties
| * | libnm: use new including_default flag and boolean getter for ↵Thomas Haller2021-06-231-22/+8
| | | | | | | | | | | | "ethernet.auto-negotiate" property
| * | libnm: add flag to control whether to_dbus_fcn() should handle default valuesThomas Haller2021-06-233-2/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Usually, properties that are set to their default are not serialized on D-Bus. That is, to_dbus_fcn() returns NULL. In some cases, we explicitly want to always serialize the property. For example, if we changed behavior and the libnm default value changed. Then we want that the message on D-Bus is always clear about the used value and not rely on the default value on the receiving side.
| * | libnm: extend to_dbus_fcn() property type for efficiently converting string ↵Thomas Haller2021-06-235-6/+102
| | | | | | | | | | | | property
| * | libnm: extend to_dbus_fcn() property type for efficiently converting boolean ↵Thomas Haller2021-06-235-7/+108
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | property Most of our NMSetting properties are based around GObject properties, and thus the tooling to convert a NMSetting to/from GVariant consists of getting/setting a GValue. We can do better. For most of such properties we also define a C getter function, which we can call with less overhead. All we need is to hook the C getter with the property meta data. As example, implement it for "connection.autoconnect". The immediate goal of this is to reduce the overhead of to_dbus. But note that also for comparison of two properties, there is the default implementation which is used by the majority of properties. This implementation converts the properties first to GVariant (via to_dbus_fcn) and then compares the variants. What this commit also does, is to hook up the property meta data with the C-getters. This is one step towards also more efficiently compare properties using the naive C getters. Likewise, the keyfile writer use g_object_get_property(). It also could do better.
| * | libnm: move gprop_to_dbus_fcn hook to NMSettInfoPropertyThomas Haller2021-06-238-29/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For each property we have meta data in form of NMSettInfoProperty. Each meta data also has a NMSettInfoProperty.property_type (NMSettInfoPropertType). The property type is supposed to define common behaviors for properties, while the property meta data has individual properties. The idea is that several properties can share the same property-type, and that per-property meta data is part of NMSettInfoProperty. The distinction is not very strong, but note that all remaining uses of NMSettInfoPropertType.gprop_to_dbus_fcn were part of a property type that was only used for one single property. That lack of reusability hints to a wrong use. Move gprop_to_dbus_fcn to the property meta data as a new field NMSettInfoProperty.to_dbus_data. Note that NMSettInfoPropertType.gprop_from_dbus_fcn still suffers from the same problem. But the from-dbus side is not yet addressed.
| * | libnm: change "nm_sett_info_propert_type_mac_address" to use gprop_type for ↵Thomas Haller2021-06-234-10/+11
| | | | | | | | | | | | to_dbus_fcn()
| * | libnm: change "nm_sett_info_propert_type_strdict" to use gprop_type for ↵Thomas Haller2021-06-234-8/+10
| | | | | | | | | | | | to_dbus_fcn()
| * | libnm: change "nm_sett_info_propert_type_dcb_au" to use gprop_type for ↵Thomas Haller2021-06-234-12/+15
| | | | | | | | | | | | to_dbus_fcn()
| * | libnm: add type enum for handling gprop differences in to_dbus_fcnThomas Haller2021-06-233-32/+60
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For GBytes, GEnum, GFlags and others, we need special converters from the default GObject properties to GVariant. Previously, those were implemented by providing a special gprop_to_dbus_fcn hook. But gprop_to_dbus_fcn should move from NMSettInfoPropertType to NMSettInfoProperty, because it's usually a per-property meta data, and not a per-property-type meta data. The difference is whether the meta data can be shared between different properties (of the same "type). In these cases, this extra information is indeed part of the type. We want to have a generic NM_SETT_INFO_PROPERT_TYPE_GPROP() property (using _nm_setting_property_to_dbus_fcn_gprop()), but then we would like to distinguish between special cases. So this was fine. However, I find the approach of providing a gprop_to_dbus_fcn in this case cumbersome. It makes it harder to understand what happens. Instead, introduce a new "gprop_type" for the different types that _nm_setting_property_to_dbus_fcn_gprop() can handle. This new "gprop_type" is extra data of the property type, so introduce a new field "typdata_to_dbus".
| * | libnm: add and use NM_SETT_INFO_PROPERT_TYPE_*_INIT() macrosThomas Haller2021-06-235-93/+88
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The advantage is that we use similar macros for initializing the static structs like const NMSettInfoPropertType nm_sett_info_propert_type_cloned_mac_address; and the ad-hoc locations that use NM_SETT_INFO_PROPERT_TYPE(). The former exist for property types that are used more than once. The latter exist for convenience, where a property type is implemented at only one place. Also, there are few direct references to _nm_setting_property_to_dbus_fcn_gprop(). all users use NM_SETT_INFO_PROPERT_TYPE_GPROP() or NM_SETT_INFO_PROPERT_TYPE_GPROP_INIT().
| * | libnm: add and use NM_SETT_INFO_PROPERT_TYPE_DBUS() macroThomas Haller2021-06-2312-67/+74
| | |
| * | libnm: let all property types implement to_dbus_fcn() handlerThomas Haller2021-06-2311-66/+100
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If a property can be converted to D-Bus, then always set the to_dbus_fcn() handler. The only caller of to_dbus_fcn() is property_to_dbus(), so this means that property_to_dbus() has no more default implementation and always delegates to to_dbus_fcn(). The code is easier to understand if all properties implement to_dbus_fcn() the same way. Also, there is supposed to be a split between NMSettInfoProperty (info about the property) and NMSettInfoPropertType (the type). The idea is that each property (obviously) requires its distinct NMSettInfoProperty, but they can share a common type implementation. With NMSettInfoPropertType.gprop_to_dbus_fcn that is often violated because many properties that implement NMSettInfoPropertType.gprop_to_dbus_fcn require a special type implementation. As such, gprop_to_dbus_fcn should be part of the property info and not the property type. The first step towards that is unifying all properties to use to_dbus_fcn().