summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Zaborowski <andrew.zaborowski@intel.com>2021-04-08 00:02:05 +0200
committerThomas Haller <thaller@redhat.com>2021-04-19 18:11:11 +0200
commit260ceff28ab9e7fa37b2da1ae2d7774d4e6530cb (patch)
tree5e1c055764713549799168916c470a8d5a37f0b6
parent60dcb83b584a8bc4451d5c3cd45cc03f7a49f966 (diff)
downloadNetworkManager-260ceff28ab9e7fa37b2da1ae2d7774d4e6530cb.tar.gz
iwd: Add warning comment to autogenerated IWD files
-rw-r--r--src/core/devices/wifi/nm-wifi-utils.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/core/devices/wifi/nm-wifi-utils.c b/src/core/devices/wifi/nm-wifi-utils.c
index 8576c8dff7..5536aa4f08 100644
--- a/src/core/devices/wifi/nm-wifi-utils.c
+++ b/src/core/devices/wifi/nm-wifi-utils.c
@@ -14,6 +14,7 @@
#include "nm-utils.h"
#include "libnm-core-intern/nm-core-internal.h"
#include "libnm-core-aux-intern/nm-common-macros.h"
+#include "libnm-base/nm-config-base.h"
static gboolean
verify_no_wep(NMSettingWirelessSecurity *s_wsec, const char *tag, GError **error)
@@ -1683,6 +1684,7 @@ nm_wifi_utils_connection_to_iwd_config(NMConnection *connection,
gsize ssid_len;
NMIwdNetworkSecurity security;
const char * cloned_mac_addr;
+ gs_free char * comment = NULL;
nm_auto_unref_keyfile GKeyFile *file = NULL;
if (!s_conn || !s_wifi
@@ -1725,6 +1727,14 @@ nm_wifi_utils_connection_to_iwd_config(NMConnection *connection,
file = g_key_file_new();
+ comment = g_strdup_printf(" Auto-generated from NetworkManager connection \"%s\"\n"
+ " Changes to that connection overwrite this file when "
+ "enabled by NM's [%s].%s value",
+ nm_setting_connection_get_id(s_conn),
+ NM_CONFIG_KEYFILE_GROUP_MAIN,
+ NM_CONFIG_KEYFILE_KEY_MAIN_IWD_CONFIG_PATH);
+ g_key_file_set_comment(file, NULL, NULL, comment, NULL);
+
if (!nm_setting_connection_get_autoconnect(s_conn))
g_key_file_set_boolean(file, "Settings", "AutoConnect", FALSE);