summaryrefslogtreecommitdiff
path: root/src/nm-manager.c
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2019-07-09 15:22:01 +0200
committerThomas Haller <thaller@redhat.com>2019-07-25 15:26:49 +0200
commit22c8721f35ec111335be0acc36bb0cc7b89bf97d (patch)
tree87f4576ae17008edd4d09594444f37ef0e41dc07 /src/nm-manager.c
parent0aa323fb2887fc4b5decfb5360d7384bf774e6db (diff)
downloadNetworkManager-22c8721f35ec111335be0acc36bb0cc7b89bf97d.tar.gz
core,libnm: add AddConnection2() D-Bus API to block autoconnect from the start
It should be possible to add a profile with autoconnect blocked form the start. Update2() has a %NM_SETTINGS_UPDATE2_FLAG_BLOCK_AUTOCONNECT flag to block autoconnect, and so we need something similar when adding a connection. As the existing AddConnection() and AddConnectionUnsaved() API is not extensible, add AddConnection2() that has flags and room for additional arguments. Then add and implement the new flag %NM_SETTINGS_ADD_CONNECTION2_FLAG_BLOCK_AUTOCONNECT for AddConnection2(). Note that libnm's nm_client_add_connection2() API can completely replace the existing nm_client_add_connection_async() call. In particular, it will automatically prefer to call the D-Bus methods AddConnection() and AddConnectionUnsaved(), in order to work with server versions older than 1.20. The purpose of this is that when upgrading the package, the running NetworkManager might still be older than the installed libnm. Anyway, so since nm_client_add_connection2_finish() also has a result output, the caller needs to decide whether he cares about that result. Hence it has an argument ignore_out_result, which allows to fallback to the old API. One might argue that a caller who doesn't care about the output results while still wanting to be backward compatible, should itself choose to call nm_client_add_connection_async() or nm_client_add_connection2(). But instead, it's more convenient if the new function can fully replace the old one, so that the caller does not need to switch which start/finish method to call. https://bugzilla.redhat.com/show_bug.cgi?id=1677068
Diffstat (limited to 'src/nm-manager.c')
-rw-r--r--src/nm-manager.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/nm-manager.c b/src/nm-manager.c
index 93bfb14720..4f114e4d13 100644
--- a/src/nm-manager.c
+++ b/src/nm-manager.c
@@ -2674,6 +2674,7 @@ get_existing_connection (NMManager *self,
if (!nm_settings_add_connection (priv->settings,
connection,
NM_SETTINGS_CONNECTION_PERSIST_MODE_IN_MEMORY_ONLY,
+ NM_SETTINGS_CONNECTION_ADD_REASON_NONE,
NM_SETTINGS_CONNECTION_INT_FLAGS_VOLATILE
| NM_SETTINGS_CONNECTION_INT_FLAGS_NM_GENERATED,
&added,
@@ -5419,6 +5420,7 @@ _add_and_activate_auth_done (NMManager *self,
nm_settings_add_connection_dbus (priv->settings,
connection,
persist_mode,
+ NM_SETTINGS_CONNECTION_ADD_REASON_NONE,
( is_volatile
? NM_SETTINGS_CONNECTION_INT_FLAGS_VOLATILE
: NM_SETTINGS_CONNECTION_INT_FLAGS_NONE),