NetworkManager/src
Thomas Haller a764061807 keep-alive: check GetNameOwner lazy and only when we rely on the information
Upside:

  - it may avoid a D-Bus call altogether.

  - currently there is no API to bind/unbind an existing NMActiveConnection,
    it can only be bound initially with AddAndActivate2.
    That makes sense when the calling applicatiion only wants to keep the
    profile active for as long as it lives. It never intends to extend the
    lifetime beyond that. In such a case, it is expected that eventually
    we need to be sure whether the D-Bus client is still alive, as we
    make a decision based on that. In that case, we eventually will call
    GetNameOwner and nothing is saved.
    A future feature could add D-Bus API to bind/unbind existing active
    connections after creation. That would allow an application to
    activate profiles and -- if anything goes wrong -- to be sure
    that the profile gets deactivted. Only in the success case, it
    would unbind the lifetime in a last step and terminate. Un such
    a case, binding to a D-Bus client is more of a fail-safe mechanism
    and commonly not expected to come into action.
    This is an interesting feature, because ActivateConnection D-Bus call
    may take a long time, while perfroming interactive polkit authentication.
    That means, `nmcli connection up $PROFILE` can fail with timeout before
    the active connection path is even created, but afterwards the profile may
    still succeed to activate. That seems wrong. nmcli could avoid that,
    by binding the active connection to itself, and when nmcli exits
    with failure, it would make sure that the active connection gets
    disconnected as well.

Downside:

  - the code is slightly more complicated(?).

  - if the D-Bus name is indeed gone (but the NMKeepAlive is still alive
    for other reasons), we will not unregister the D-Bus signal, because we
    never learn that it's gone. It's not a leak, but an unnecessary
    signal subscription.

  - during nm_keep_alive_set_dbus_client_watch() we don't notice right
    away that the D-Bus client is already gone. That is unavoidable as
    we confirm the state asynchronously.
    If the NMKeepAlive is kept alive for other reasons but only later
    depends on presence of the D-Bus client, then in the non-lazy approach
    we would have noticed already that the client is gone, and would disconnect
    right away. With the lazy approach, this takes another async D-Bus call to
    notice.
2018-11-20 10:22:27 +01:00
..
devices device: ignore "carrier-wait" when device is already activated 2018-11-15 15:36:49 +01:00
dhcp dhcp: drop unused variable 2018-11-19 17:49:25 +01:00
dns all: cleanup GChecksum handling 2018-11-13 18:30:03 +01:00
dnsmasq all: don't use gchar/gshort/gint/glong but C types 2018-07-11 12:02:06 +02:00
initrd initrd: use keyfile util for creating filename 2018-10-23 10:37:33 +02:00
ndisc build: avoid header conflict for <linux/if.h> and <net/if.h> with "nm-platform.h" 2018-11-12 16:02:35 +01:00
platform build: avoid header conflict for <linux/if.h> and <net/if.h> with "nm-platform.h" 2018-11-12 16:02:35 +01:00
ppp ppp: check ppp status against correct type 2018-10-22 10:53:16 +02:00
settings settings/ifupdown: fix block_name typo in initialize() 2018-10-23 22:58:44 +02:00
supplicant all: cleanup GChecksum handling 2018-11-13 18:30:03 +01:00
systemd systemd: fix crash by unrefing event sources before re-adding them 2018-11-15 14:06:59 +01:00
tests all: add "${MAC}" substituion for "connection.stable-id" 2018-11-13 19:09:34 +01:00
vpn vpn: disconnect signal handlers from proxy in NMVpnConnection::dispose() 2018-09-14 15:24:31 +02:00
main-utils.c all: don't use gchar/gshort/gint/glong but C types 2018-07-11 12:02:06 +02:00
main-utils.h
main.c dbus: don't even bother connecting in configure-and-quit mode 2018-09-18 17:40:47 +02:00
meson.build core: Introduce helper class to track connection keep alive 2018-11-17 12:15:40 +01:00
NetworkManagerUtils.c device: add "dhcp-plugin" match spec for device 2018-11-01 11:17:12 +01:00
NetworkManagerUtils.h device: add "dhcp-plugin" match spec for device 2018-11-01 11:17:12 +01:00
nm-act-request.c shared: drop duplicate c-list.h header 2018-04-18 15:22:14 +02:00
nm-act-request.h core: specify an activation reason for active connections 2018-04-08 09:40:14 +02:00
nm-active-connection.c keep-alive: various style fixes 2018-11-17 12:50:58 +01:00
nm-active-connection.h core: Add option to AddAndActivateConnection2 to bind the lifetime 2018-11-17 12:15:40 +01:00
nm-audit-manager.c all: remove consecutive empty lines 2018-04-30 16:24:52 +02:00
nm-audit-manager.h checkpoint: allow resetting the rollback timeout via D-Bus 2018-04-04 14:02:13 +02:00
nm-auth-manager.c auth-manager: use the correct function to deallocate a GError 2018-05-02 14:55:01 +02:00
nm-auth-manager.h auth-manager: add helper function nm_auth_call_result_eval() 2018-04-13 09:09:46 +02:00
nm-auth-subject.c all: don't use gchar/gshort/gint/glong but C types 2018-07-11 12:02:06 +02:00
nm-auth-subject.h all: remove consecutive empty lines 2018-04-30 16:24:52 +02:00
nm-auth-utils.c docs: misc. typos pt2 2018-09-17 11:26:13 +02:00
nm-auth-utils.h core: add nm_auth_is_subject_in_acl_set_error() helper 2018-04-18 07:55:15 +02:00
nm-checkpoint-manager.c settings: use delegation instead of inheritance for NMSettingsConnection and NMConnection 2018-08-28 22:27:55 +02:00
nm-checkpoint-manager.h checkpoint: allow resetting the rollback timeout via D-Bus 2018-04-04 14:02:13 +02:00
nm-checkpoint.c settings: use delegation instead of inheritance for NMSettingsConnection and NMConnection 2018-08-28 22:27:55 +02:00
nm-checkpoint.h checkpoint: allow resetting the rollback timeout via D-Bus 2018-04-04 14:02:13 +02:00
nm-config-data.c device: add "dhcp-plugin" match spec for device 2018-11-01 11:17:12 +01:00
nm-config-data.h device: add "dhcp-plugin" match spec for device 2018-11-01 11:17:12 +01:00
nm-config.c all: remove \n endings from log calls 2018-10-12 14:34:58 +02:00
nm-config.h config: add --configure-and-quit=initrd mode 2018-09-18 17:40:47 +02:00
nm-connectivity.c connectivity: fix crash when the uri gets cleared from configuration 2018-10-01 09:46:14 +02:00
nm-connectivity.h connectivity: allow limiting the connectivity check to a specified AF 2018-09-24 15:17:02 +02:00
nm-core-utils.c all: add "${MAC}" substituion for "connection.stable-id" 2018-11-13 19:09:34 +01:00
nm-core-utils.h all: add "${MAC}" substituion for "connection.stable-id" 2018-11-13 19:09:34 +01:00
nm-dbus-manager.c dbus: don't even bother connecting in configure-and-quit mode 2018-09-18 17:40:47 +02:00
nm-dbus-manager.h settings: use delegation instead of inheritance for NMSettingsConnection and NMConnection 2018-08-28 22:27:55 +02:00
nm-dbus-object.c core/dbus: stop NMDBusManager and reject future method calls 2018-04-24 10:25:26 +02:00
nm-dbus-object.h core/dbus: stop NMDBusManager and reject future method calls 2018-04-24 10:25:26 +02:00
nm-dbus-utils.c core: don't explicitly set D-Bus path properties to "/" 2018-04-18 07:55:15 +02:00
nm-dbus-utils.h core/dbus: stop NMDBusManager and reject future method calls 2018-04-24 10:25:26 +02:00
nm-dcb.c all: don't use gchar/gshort/gint/glong but C types 2018-07-11 12:02:06 +02:00
nm-dcb.h
nm-dhcp4-config.c core: sort DHCP options that are exported on D-Bus 2018-04-23 15:43:39 +02:00
nm-dhcp4-config.h
nm-dhcp6-config.c core: sort DHCP options that are exported on D-Bus 2018-04-23 15:43:39 +02:00
nm-dhcp6-config.h
nm-dispatcher.c all: use the elvis operator wherever possible 2018-05-10 14:36:58 +02:00
nm-dispatcher.h all: remove consecutive empty lines 2018-04-30 16:24:52 +02:00
nm-firewall-manager.c all: use the elvis operator wherever possible 2018-05-10 14:36:58 +02:00
nm-firewall-manager.h firewall: merge "started" signal and "available" property 2017-04-21 09:09:01 +02:00
nm-hostname-manager.c hostname: drop define IFCFG_DIR which is only used once 2018-07-17 17:46:01 +02:00
nm-hostname-manager.h hostname: cache hostname-manager's hostname property 2017-05-12 17:29:33 +02:00
nm-iface-helper.c config: add --configure-and-quit=initrd mode 2018-09-18 17:40:47 +02:00
nm-ip4-config.c all: cleanup GChecksum handling 2018-11-13 18:30:03 +01:00
nm-ip4-config.h ip-config: add @intersect_routes argument to intersect functions 2018-09-26 11:49:37 +02:00
nm-ip6-config.c all: cleanup GChecksum handling 2018-11-13 18:30:03 +01:00
nm-ip6-config.h ip-config: add @intersect_routes argument to intersect functions 2018-09-26 11:49:37 +02:00
nm-keep-alive.c keep-alive: check GetNameOwner lazy and only when we rely on the information 2018-11-20 10:22:27 +01:00
nm-keep-alive.h keep-alive: drop unused error argument 2018-11-17 12:43:25 +01:00
nm-logging.c logging: make nm-logging.c independent of other core components 2018-10-18 12:16:55 +02:00
nm-logging.h logging: make nm-logging.c independent of other core components 2018-10-18 12:16:55 +02:00
nm-manager.c all: rename "bind" option for AddAndActivateConnection2 to "bind-activation" 2018-11-19 13:04:59 +01:00
nm-manager.h core: extend nm_manager_get_activatable_connections() for autoconnect and multi-connect 2018-08-08 11:24:29 +02:00
nm-netns.c all: get rid of a handful of unused-but-set variables 2017-12-18 13:29:32 +01:00
nm-netns.h core: rework handling of default-routes and drop NMDefaultRouteManager 2017-09-08 11:11:21 +02:00
nm-pacrunner-manager.c docs: misc. typos pt2 2018-09-17 11:26:13 +02:00
nm-pacrunner-manager.h proxy: introduce call-id for clearing pacmanager configuration 2017-04-23 18:12:09 +02:00
nm-policy.c policy: don't check for valid error in active_connection_keep_alive_changed() 2018-11-17 13:38:15 +01:00
nm-policy.h policy: track best active connections rather than best devices 2018-07-09 14:56:59 +02:00
nm-proxy-config.c
nm-proxy-config.h
nm-rfkill-manager.c all: don't use gchar/gshort/gint/glong but C types 2018-07-11 12:02:06 +02:00
nm-rfkill-manager.h
nm-session-monitor.c all: avoid g_memdup() 2018-09-07 11:24:17 +02:00
nm-session-monitor.h
nm-sleep-monitor.c all: don't use gchar/gshort/gint/glong but C types 2018-07-11 12:02:06 +02:00
nm-sleep-monitor.h
nm-test-utils-core.h build: avoid header conflict for <linux/if.h> and <net/if.h> with "nm-platform.h" 2018-11-12 16:02:35 +01:00
nm-types.h core: Introduce helper class to track connection keep alive 2018-11-17 12:15:40 +01:00
org.freedesktop.NetworkManager.conf all: replace "it's" with "its" where needed 2018-04-18 14:14:07 +02:00