about summary refs log tree commit diff
path: root/clients/cli
diff options
context:
space:
mode:
Diffstat (limited to 'clients/cli')
-rw-r--r--clients/cli/connections.c43
-rw-r--r--clients/cli/devices.c2
-rw-r--r--clients/cli/general.c58
-rw-r--r--clients/cli/generate-docs-nm-settings-nmcli.xml4
-rw-r--r--clients/cli/generate-docs-nm-settings-nmcli.xml.in4
5 files changed, 71 insertions, 40 deletions
diff --git a/clients/cli/connections.c b/clients/cli/connections.c
index ee7b8fbb..fe4f8855 100644
--- a/clients/cli/connections.c
+++ b/clients/cli/connections.c
@@ -19,6 +19,7 @@
 #include "nm-vpn-helpers.h"
 #include "nm-meta-setting-access.h"
 #include "nm-secret-agent-simple.h"
+#include "nm-glib-aux/nm-dbus-aux.h"
 
 #include "utils.h"
 #include "common.h"
@@ -9184,28 +9185,42 @@ do_connection_monitor(const NMCCommand *cmd, NmCli *nmc, int argc, const char *c
 }
 
 static void
-do_connection_reload(const NMCCommand *cmd, NmCli *nmc, int argc, const char *const *argv)
+connection_reload_cb(GObject *source, GAsyncResult *result, gpointer user_data)
 {
-    gs_unref_variant GVariant *result = NULL;
-    gs_free_error GError *error       = NULL;
-
-    next_arg(nmc, &argc, &argv, NULL);
-    if (nmc->complete)
-        return;
+    NmCli *       nmc              = user_data;
+    gs_free_error GError *error    = NULL;
+    gs_unref_variant GVariant *ret = NULL;
 
-    result = nmc_dbus_call_sync(nmc,
-                                "/org/freedesktop/NetworkManager/Settings",
-                                "org.freedesktop.NetworkManager.Settings",
-                                "ReloadConnections",
-                                g_variant_new("()"),
-                                G_VARIANT_TYPE("(b)"),
-                                &error);
+    ret = nm_dbus_call_finish(result, &error);
     if (error) {
         g_string_printf(nmc->return_text,
                         _("Error: failed to reload connections: %s."),
                         nmc_error_get_simple_message(error));
         nmc->return_value = NMC_RESULT_ERROR_UNKNOWN;
     }
+
+    quit();
+}
+
+static void
+do_connection_reload(const NMCCommand *cmd, NmCli *nmc, int argc, const char *const *argv)
+{
+    next_arg(nmc, &argc, &argv, NULL);
+    if (nmc->complete)
+        return;
+
+    nmc->should_wait++;
+    nm_dbus_call(G_BUS_TYPE_SYSTEM,
+                 NM_DBUS_SERVICE,
+                 NM_DBUS_PATH_SETTINGS,
+                 NM_DBUS_INTERFACE_SETTINGS,
+                 "ReloadConnections",
+                 g_variant_new("()"),
+                 G_VARIANT_TYPE("(b)"),
+                 NULL,
+                 (nmc->timeout == -1 ? 90 : nmc->timeout) * 1000,
+                 connection_reload_cb,
+                 nmc);
 }
 
 static void
diff --git a/clients/cli/devices.c b/clients/cli/devices.c
index eea82653..5800fe76 100644
--- a/clients/cli/devices.c
+++ b/clients/cli/devices.c
@@ -4595,7 +4595,7 @@ print_wifi_connection(const NmcConfig *nmc_config, NMConnection *connection)
     const char *               psk      = NULL;
     const char *               type     = NULL;
     GBytes *                   ssid_bytes;
-    char *                     ssid;
+    gs_free char *             ssid = NULL;
     GString *                  string;
 
     s_wireless = nm_connection_get_setting_wireless(connection);
diff --git a/clients/cli/general.c b/clients/cli/general.c
index 1dae57e1..b1182709 100644
--- a/clients/cli/general.c
+++ b/clients/cli/general.c
@@ -10,6 +10,7 @@
 #include "nm-libnm-core-intern/nm-common-macros.h"
 
 #include "nm-client-utils.h"
+#include "nm-glib-aux/nm-dbus-aux.h"
 
 #include "polkit-agent.h"
 #include "utils.h"
@@ -344,7 +345,8 @@ usage_general_reload(void)
                  "                can be reloaded through 'nmcli connection reload' instead.\n"
                  "\n"
                  "  'dns-rc'      Update DNS configuration, which usually involves writing\n"
-                 "                /etc/resolv.conf anew.\n"
+                 "                /etc/resolv.conf anew. This is equivalent to sending the\n"
+                 "                SIGUSR1 signal to the NetworkManager process.\n"
                  "\n"
                  "  'dns-full'    Restart the DNS plugin. This is for example useful when\n"
                  "                using dnsmasq plugin, which uses additional configuration\n"
@@ -599,14 +601,30 @@ show_nm_permissions(NmCli *nmc)
 }
 
 static void
+reload_cb(GObject *source, GAsyncResult *result, gpointer user_data)
+{
+    NmCli *       nmc              = user_data;
+    gs_free_error GError *error    = NULL;
+    gs_unref_variant GVariant *ret = NULL;
+
+    ret = nm_dbus_call_finish(result, &error);
+    if (error) {
+        g_string_printf(nmc->return_text,
+                        _("Error: failed to reload: %s"),
+                        nmc_error_get_simple_message(error));
+        nmc->return_value = NMC_RESULT_ERROR_UNKNOWN;
+    }
+
+    quit();
+}
+
+static void
 do_general_reload(const NMCCommand *cmd, NmCli *nmc, int argc, const char *const *argv)
 {
-    gs_unref_variant GVariant *result = NULL;
-    gs_free_error GError *error       = NULL;
-    gs_free const char ** values      = NULL;
-    gs_free char *        err_token   = NULL;
-    gs_free char *        joined      = NULL;
-    int                   flags       = 0;
+    gs_free const char **values    = NULL;
+    gs_free char *       err_token = NULL;
+    gs_free char *       joined    = NULL;
+    int                  flags     = 0;
 
     next_arg(nmc, &argc, &argv, NULL);
 
@@ -649,20 +667,18 @@ do_general_reload(const NMCCommand *cmd, NmCli *nmc, int argc, const char *const
         return;
     }
 
-    result = nmc_dbus_call_sync(nmc,
-                                "/org/freedesktop/NetworkManager",
-                                "org.freedesktop.NetworkManager",
-                                "Reload",
-                                g_variant_new("(u)", flags),
-                                G_VARIANT_TYPE("()"),
-                                &error);
-
-    if (error) {
-        g_string_printf(nmc->return_text,
-                        _("Error: failed to reload: %s"),
-                        nmc_error_get_simple_message(error));
-        nmc->return_value = NMC_RESULT_ERROR_UNKNOWN;
-    }
+    nmc->should_wait++;
+    nm_dbus_call(G_BUS_TYPE_SYSTEM,
+                 NM_DBUS_SERVICE,
+                 NM_DBUS_PATH,
+                 NM_DBUS_INTERFACE,
+                 "Reload",
+                 g_variant_new("(u)", flags),
+                 G_VARIANT_TYPE("()"),
+                 NULL,
+                 (nmc->timeout == -1 ? 90 : nmc->timeout) * 1000,
+                 reload_cb,
+                 nmc);
 }
 
 static void
diff --git a/clients/cli/generate-docs-nm-settings-nmcli.xml b/clients/cli/generate-docs-nm-settings-nmcli.xml
index 1044ae0d..0a75a0e6 100644
--- a/clients/cli/generate-docs-nm-settings-nmcli.xml
+++ b/clients/cli/generate-docs-nm-settings-nmcli.xml
@@ -914,9 +914,9 @@
     </setting>
     <setting name="tc" >
         <property name="qdiscs"
-                  description="Array of TC queueing disciplines." />
+                  description="Array of TC queueing disciplines. When the &quot;tc&quot; setting is present, qdiscs from this property are applied upon activation. If the property is empty, all qdiscs are removed and the device will only have the default qdisc assigned by kernel according to the &quot;net.core.default_qdisc&quot; sysctl. If the &quot;tc&quot; setting is not present, NetworkManager doesn&apos;t touch the qdiscs present on the interface." />
         <property name="tfilters"
-                  description="Array of TC traffic filters." />
+                  description="Array of TC traffic filters. When the &quot;tc&quot; setting is present, filters from this property are applied upon activation. If the property is empty, NetworkManager removes all the filters. If the &quot;tc&quot; setting is not present, NetworkManager doesn&apos;t touch the filters present on the interface." />
     </setting>
     <setting name="team" >
         <property name="config"
diff --git a/clients/cli/generate-docs-nm-settings-nmcli.xml.in b/clients/cli/generate-docs-nm-settings-nmcli.xml.in
index 1044ae0d..0a75a0e6 100644
--- a/clients/cli/generate-docs-nm-settings-nmcli.xml.in
+++ b/clients/cli/generate-docs-nm-settings-nmcli.xml.in
@@ -914,9 +914,9 @@
     </setting>
     <setting name="tc" >
         <property name="qdiscs"
-                  description="Array of TC queueing disciplines." />
+                  description="Array of TC queueing disciplines. When the &quot;tc&quot; setting is present, qdiscs from this property are applied upon activation. If the property is empty, all qdiscs are removed and the device will only have the default qdisc assigned by kernel according to the &quot;net.core.default_qdisc&quot; sysctl. If the &quot;tc&quot; setting is not present, NetworkManager doesn&apos;t touch the qdiscs present on the interface." />
         <property name="tfilters"
-                  description="Array of TC traffic filters." />
+                  description="Array of TC traffic filters. When the &quot;tc&quot; setting is present, filters from this property are applied upon activation. If the property is empty, NetworkManager removes all the filters. If the &quot;tc&quot; setting is not present, NetworkManager doesn&apos;t touch the filters present on the interface." />
     </setting>
     <setting name="team" >
         <property name="config"