summary refs log tree commit diff
path: root/clients
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2021-08-16 09:51:46 +0200
committerMichael Biebl <biebl@debian.org>2021-08-16 09:51:46 +0200
commitbfe522304da217296e2a61040f58e35ec5d6f3f2 (patch)
tree6c4296644fa59cbfe51d9e8aafebddace5ac6b6f /clients
parent3a56bce6c0ea7ba0fe269520547740783b342e0d (diff)
New upstream version 1.30.6 upstream/1.30.6
Diffstat (limited to 'clients')
-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
-rw-r--r--clients/common/nm-meta-setting-desc.c2
-rw-r--r--clients/common/nm-secret-agent-simple.c2
-rw-r--r--clients/common/settings-docs.h4
-rw-r--r--clients/common/settings-docs.h.in4
-rw-r--r--clients/tui/newt/meson.build1
-rw-r--r--clients/tui/newt/nmt-newt-button.c3
11 files changed, 80 insertions, 47 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"
diff --git a/clients/common/nm-meta-setting-desc.c b/clients/common/nm-meta-setting-desc.c
index b6e3d671..744def63 100644
--- a/clients/common/nm-meta-setting-desc.c
+++ b/clients/common/nm-meta-setting-desc.c
@@ -864,7 +864,7 @@ _get_fcn_gobject_impl(const NMMetaPropertyInfo *property_info,
              * signal them differently. */
             cstr = g_value_get_string(&val);
             nm_assert((!!is_default) == (cstr == NULL));
-            RETURN_STR_EMPTYUNSET(get_type, is_default, NULL);
+            RETURN_STR_EMPTYUNSET(get_type, is_default, cstr);
         }
     }
 
diff --git a/clients/common/nm-secret-agent-simple.c b/clients/common/nm-secret-agent-simple.c
index 18574325..35c3ed3d 100644
--- a/clients/common/nm-secret-agent-simple.c
+++ b/clients/common/nm-secret-agent-simple.c
@@ -867,7 +867,7 @@ request_secrets_from_ui(RequestData *request)
     if (nm_connection_is_type(request->connection, NM_SETTING_WIRELESS_SETTING_NAME)) {
         NMSettingWireless *s_wireless;
         GBytes *           ssid;
-        char *             ssid_utf8;
+        gs_free char *     ssid_utf8 = NULL;
 
         s_wireless = nm_connection_get_setting_wireless(request->connection);
         ssid       = nm_setting_wireless_get_ssid(s_wireless);
diff --git a/clients/common/settings-docs.h b/clients/common/settings-docs.h
index 2c275a99..7c3ff25f 100644
--- a/clients/common/settings-docs.h
+++ b/clients/common/settings-docs.h
@@ -342,8 +342,8 @@
 #define DESCRIBE_DOC_NM_SETTING_SRIOV_AUTOPROBE_DRIVERS N_("Whether to autoprobe virtual functions by a compatible driver. If set to NM_TERNARY_TRUE (1), the kernel will try to bind VFs to a compatible driver and if this succeeds a new network interface will be instantiated for each VF. If set to NM_TERNARY_FALSE (0), VFs will not be claimed and no network interfaces will be created for them. When set to NM_TERNARY_DEFAULT (-1), the global default is used; in case the global default is unspecified it is assumed to be NM_TERNARY_TRUE (1).")
 #define DESCRIBE_DOC_NM_SETTING_SRIOV_TOTAL_VFS N_("The total number of virtual functions to create. Note that when the sriov setting is present NetworkManager enforces the number of virtual functions on the interface (also when it is zero) during activation and resets it upon deactivation. To prevent any changes to SR-IOV parameters don't add a sriov setting to the connection.")
 #define DESCRIBE_DOC_NM_SETTING_SRIOV_VFS N_("Array of virtual function descriptors. Each VF descriptor is a dictionary mapping attribute names to GVariant values. The 'index' entry is mandatory for each VF. When represented as string a VF is in the form: \"INDEX [ATTR=VALUE[ ATTR=VALUE]...]\". for example: \"2 mac=00:11:22:33:44:55 spoof-check=true\". Multiple VFs can be specified using a comma as separator. Currently, the following attributes are supported: mac, spoof-check, trust, min-tx-rate, max-tx-rate, vlans. The \"vlans\" attribute is represented as a semicolon-separated list of VLAN descriptors, where each descriptor has the form \"ID[.PRIORITY[.PROTO]]\". PROTO can be either 'q' for 802.1Q (the default) or 'ad' for 802.1ad.")
-#define DESCRIBE_DOC_NM_SETTING_TC_CONFIG_QDISCS N_("Array of TC queueing disciplines.")
-#define DESCRIBE_DOC_NM_SETTING_TC_CONFIG_TFILTERS N_("Array of TC traffic filters.")
+#define DESCRIBE_DOC_NM_SETTING_TC_CONFIG_QDISCS N_("Array of TC queueing disciplines. When the \"tc\" 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 \"net.core.default_qdisc\" sysctl. If the \"tc\" setting is not present, NetworkManager doesn't touch the qdiscs present on the interface.")
+#define DESCRIBE_DOC_NM_SETTING_TC_CONFIG_TFILTERS N_("Array of TC traffic filters. When the \"tc\" setting is present, filters from this property are applied upon activation. If the property is empty, NetworkManager removes all the filters. If the \"tc\" setting is not present, NetworkManager doesn't touch the filters present on the interface.")
 #define DESCRIBE_DOC_NM_SETTING_TEAM_CONFIG N_("The JSON configuration for the team network interface.  The property should contain raw JSON configuration data suitable for teamd, because the value is passed directly to teamd. If not specified, the default configuration is used.  See man teamd.conf for the format details.")
 #define DESCRIBE_DOC_NM_SETTING_TEAM_LINK_WATCHERS N_("Link watchers configuration for the connection: each link watcher is defined by a dictionary, whose keys depend upon the selected link watcher. Available link watchers are 'ethtool', 'nsna_ping' and 'arp_ping' and it is specified in the dictionary with the key 'name'. Available keys are:   ethtool: 'delay-up', 'delay-down', 'init-wait'; nsna_ping: 'init-wait', 'interval', 'missed-max', 'target-host'; arp_ping: all the ones in nsna_ping and 'source-host', 'validate-active', 'validate-inactive', 'send-always'. See teamd.conf man for more details.")
 #define DESCRIBE_DOC_NM_SETTING_TEAM_MCAST_REJOIN_COUNT N_("Corresponds to the teamd mcast_rejoin.count.")
diff --git a/clients/common/settings-docs.h.in b/clients/common/settings-docs.h.in
index 2c275a99..7c3ff25f 100644
--- a/clients/common/settings-docs.h.in
+++ b/clients/common/settings-docs.h.in
@@ -342,8 +342,8 @@
 #define DESCRIBE_DOC_NM_SETTING_SRIOV_AUTOPROBE_DRIVERS N_("Whether to autoprobe virtual functions by a compatible driver. If set to NM_TERNARY_TRUE (1), the kernel will try to bind VFs to a compatible driver and if this succeeds a new network interface will be instantiated for each VF. If set to NM_TERNARY_FALSE (0), VFs will not be claimed and no network interfaces will be created for them. When set to NM_TERNARY_DEFAULT (-1), the global default is used; in case the global default is unspecified it is assumed to be NM_TERNARY_TRUE (1).")
 #define DESCRIBE_DOC_NM_SETTING_SRIOV_TOTAL_VFS N_("The total number of virtual functions to create. Note that when the sriov setting is present NetworkManager enforces the number of virtual functions on the interface (also when it is zero) during activation and resets it upon deactivation. To prevent any changes to SR-IOV parameters don't add a sriov setting to the connection.")
 #define DESCRIBE_DOC_NM_SETTING_SRIOV_VFS N_("Array of virtual function descriptors. Each VF descriptor is a dictionary mapping attribute names to GVariant values. The 'index' entry is mandatory for each VF. When represented as string a VF is in the form: \"INDEX [ATTR=VALUE[ ATTR=VALUE]...]\". for example: \"2 mac=00:11:22:33:44:55 spoof-check=true\". Multiple VFs can be specified using a comma as separator. Currently, the following attributes are supported: mac, spoof-check, trust, min-tx-rate, max-tx-rate, vlans. The \"vlans\" attribute is represented as a semicolon-separated list of VLAN descriptors, where each descriptor has the form \"ID[.PRIORITY[.PROTO]]\". PROTO can be either 'q' for 802.1Q (the default) or 'ad' for 802.1ad.")
-#define DESCRIBE_DOC_NM_SETTING_TC_CONFIG_QDISCS N_("Array of TC queueing disciplines.")
-#define DESCRIBE_DOC_NM_SETTING_TC_CONFIG_TFILTERS N_("Array of TC traffic filters.")
+#define DESCRIBE_DOC_NM_SETTING_TC_CONFIG_QDISCS N_("Array of TC queueing disciplines. When the \"tc\" 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 \"net.core.default_qdisc\" sysctl. If the \"tc\" setting is not present, NetworkManager doesn't touch the qdiscs present on the interface.")
+#define DESCRIBE_DOC_NM_SETTING_TC_CONFIG_TFILTERS N_("Array of TC traffic filters. When the \"tc\" setting is present, filters from this property are applied upon activation. If the property is empty, NetworkManager removes all the filters. If the \"tc\" setting is not present, NetworkManager doesn't touch the filters present on the interface.")
 #define DESCRIBE_DOC_NM_SETTING_TEAM_CONFIG N_("The JSON configuration for the team network interface.  The property should contain raw JSON configuration data suitable for teamd, because the value is passed directly to teamd. If not specified, the default configuration is used.  See man teamd.conf for the format details.")
 #define DESCRIBE_DOC_NM_SETTING_TEAM_LINK_WATCHERS N_("Link watchers configuration for the connection: each link watcher is defined by a dictionary, whose keys depend upon the selected link watcher. Available link watchers are 'ethtool', 'nsna_ping' and 'arp_ping' and it is specified in the dictionary with the key 'name'. Available keys are:   ethtool: 'delay-up', 'delay-down', 'init-wait'; nsna_ping: 'init-wait', 'interval', 'missed-max', 'target-host'; arp_ping: all the ones in nsna_ping and 'source-host', 'validate-active', 'validate-inactive', 'send-always'. See teamd.conf man for more details.")
 #define DESCRIBE_DOC_NM_SETTING_TEAM_MCAST_REJOIN_COUNT N_("Corresponds to the teamd mcast_rejoin.count.")
diff --git a/clients/tui/newt/meson.build b/clients/tui/newt/meson.build
index 0c89c0f6..cbe9d554 100644
--- a/clients/tui/newt/meson.build
+++ b/clients/tui/newt/meson.build
@@ -26,6 +26,7 @@ libnmt_newt = static_library(
   ),
   dependencies: [
     libnm_nm_default_dep,
+    libnm_dep,
     newt_dep,
   ],
   c_args: [
diff --git a/clients/tui/newt/nmt-newt-button.c b/clients/tui/newt/nmt-newt-button.c
index 1a30a63d..1fc89b76 100644
--- a/clients/tui/newt/nmt-newt-button.c
+++ b/clients/tui/newt/nmt-newt-button.c
@@ -108,7 +108,8 @@ nmt_newt_button_build_component(NmtNewtComponent *component, gboolean sensitive)
 {
     NmtNewtButtonPrivate *priv = NMT_NEWT_BUTTON_GET_PRIVATE(component);
     newtComponent         co;
-    char *                label = NULL, *label_lc;
+    gs_free char *        label = NULL;
+    char *                label_lc;
 
     if (sensitive) {
         label_lc = nmt_newt_locale_from_utf8(priv->label);