From 260ceff28ab9e7fa37b2da1ae2d7774d4e6530cb Mon Sep 17 00:00:00 2001 From: Andrew Zaborowski Date: Thu, 8 Apr 2021 00:02:05 +0200 Subject: iwd: Add warning comment to autogenerated IWD files --- src/core/devices/wifi/nm-wifi-utils.c | 10 ++++++++++ 1 file changed, 10 insertions(+) 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); -- cgit v1.2.1