diff --git a/configure.ac b/configure.ac
index e43781d80f..d007559849 100644
--- a/configure.ac
+++ b/configure.ac
@@ -172,10 +172,9 @@ AC_SUBST(nmrundir, '${runstatedir}'/$PACKAGE, [NetworkManager runtime state dire
AC_CHECK_FUNCS([__secure_getenv secure_getenv])
# Alternative configuration plugins
-AC_ARG_ENABLE(ifcfg-rh, AS_HELP_STRING([--enable-ifcfg-rh], [enable ifcfg-rh configuration plugin (Fedora/RHEL)]))
+AC_ARG_ENABLE(ifcfg-rh, AS_HELP_STRING([--enable-ifcfg-rh], [enable ifcfg-rh configuration plugin (Fedora/RHEL) (deprecated)]))
AC_ARG_ENABLE(ifupdown, AS_HELP_STRING([--enable-ifupdown], [enable ifupdown configuration plugin (Debian/Ubuntu)]))
# Default alternative plugins by distribution
-AS_IF([test -z "$enable_ifcfg_rh" -a -d /etc/sysconfig/network-scripts], enable_ifcfg_rh=yes)
AS_IF([test -z "$enable_ifupdown" -a -f /etc/debian_version], enable_ifupdown=yes)
# Otherwise, plugins default to "no"
AS_IF([test -z "$enable_ifcfg_rh"], enable_ifcfg_rh=no)
diff --git a/man/NetworkManager.conf.xml b/man/NetworkManager.conf.xml
index 43644b5f71..8ac982d5fc 100644
--- a/man/NetworkManager.conf.xml
+++ b/man/NetworkManager.conf.xml
@@ -1646,9 +1646,9 @@ enable=nm-version-min:1.3,nm-version-min:1.2.6,nm-version-min:1.0.16
ifcfg-rh
- This plugin is used on the Fedora and Red Hat Enterprise
- Linux distributions to read and write configuration from
- the standard
+ This plugin is now deprecated; it can be used on the
+ Fedora and Red Hat Enterprise Linux distributions to read
+ and write configuration from the standard
/etc/sysconfig/network-scripts/ifcfg-*
files. It currently supports reading Ethernet, Wi-Fi,
InfiniBand, VLAN, Bond, Bridge, and Team connections.
diff --git a/man/nm-settings-ifcfg-rh.xsl b/man/nm-settings-ifcfg-rh.xsl
index 8f054f9b73..b389b7e913 100644
--- a/man/nm-settings-ifcfg-rh.xsl
+++ b/man/nm-settings-ifcfg-rh.xsl
@@ -334,7 +334,7 @@ DEVICETYPE=TeamPort
-
+
setting
diff --git a/meson.build b/meson.build
index b234e867cd..e6a21af561 100644
--- a/meson.build
+++ b/meson.build
@@ -289,11 +289,6 @@ glib_dep = declare_dependency(
)
enable_ifcfg_rh = get_option('ifcfg_rh')
-if enable_ifcfg_rh == 'auto'
- enable_ifcfg_rh = (run_command('test', '-e', '/etc/sysconfig/network-scripts').returncode() == 0)
-else
- enable_ifcfg_rh = (enable_ifcfg_rh != 'false')
-endif
enable_ifupdown = get_option('ifupdown')
if enable_ifupdown == 'auto'
diff --git a/meson_options.txt b/meson_options.txt
index d49faf3463..4956afe924 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -45,7 +45,7 @@ option('ebpf', type: 'combo', choices: ['auto', 'true', 'false'], description: '
# configuration plugins
option('config_plugins_default', type: 'string', value: '', description: 'Default configuration option for main.plugins setting, used as fallback if the configuration option is unset')
-option('ifcfg_rh', type: 'combo', choices: ['auto', 'true', 'false'], value: 'auto', description: 'enable ifcfg-rh configuration plugin (Fedora/RHEL)')
+option('ifcfg_rh', type: 'boolean', value: false, description: 'enable ifcfg-rh configuration plugin (Fedora/RHEL) (deprecated)')
option('ifupdown', type: 'combo', choices:['auto', 'true', 'false'], value: 'auto', description: 'enable ifupdown configuration plugin (Debian/Ubuntu)')
# handlers for resolv.conf
diff --git a/src/core/settings/plugins/ifcfg-rh/nms-ifcfg-rh-plugin.c b/src/core/settings/plugins/ifcfg-rh/nms-ifcfg-rh-plugin.c
index eb0d733df7..f68a4e0e03 100644
--- a/src/core/settings/plugins/ifcfg-rh/nms-ifcfg-rh-plugin.c
+++ b/src/core/settings/plugins/ifcfg-rh/nms-ifcfg-rh-plugin.c
@@ -53,6 +53,7 @@ typedef struct {
GHashTable *unmanaged_specs;
GHashTable *unrecognized_specs;
+ gboolean warned;
} NMSIfcfgRHPluginPrivate;
struct _NMSIfcfgRHPlugin {
@@ -177,6 +178,8 @@ nm_assert_self(NMSIfcfgRHPlugin *self, gboolean unhandled_specs_consistent)
static NMSIfcfgRHStorage *
_load_file(NMSIfcfgRHPlugin *self, const char *filename, GError **error)
{
+ NMSIfcfgRHPluginPrivate *priv = NMS_IFCFG_RH_PLUGIN_GET_PRIVATE(self);
+ NMSIfcfgRHStorage *ret = NULL;
gs_unref_object NMConnection *connection = NULL;
gs_free_error GError *load_error = NULL;
gs_free char *unhandled_spec = NULL;
@@ -224,16 +227,23 @@ _load_file(NMSIfcfgRHPlugin *self, const char *filename, GError **error)
nm_assert_not_reached();
return NULL;
}
- return nms_ifcfg_rh_storage_new_unhandled(self,
+
+ ret = nms_ifcfg_rh_storage_new_unhandled(self, filename, unmanaged_spec, unrecognized_spec);
+ } else {
+ ret = nms_ifcfg_rh_storage_new_connection(self,
filename,
- unmanaged_spec,
- unrecognized_spec);
+ g_steal_pointer(&connection),
+ &st.st_mtim);
}
- return nms_ifcfg_rh_storage_new_connection(self,
- filename,
- g_steal_pointer(&connection),
- &st.st_mtim);
+ if (!priv->warned) {
+ nm_log_info(_NMLOG_DOMAIN,
+ "Warning: the ifcfg-rh plugin is deprecated, please migrate connections "
+ "to the keyfile format using \"nmcli connection migrate\".");
+ priv->warned = TRUE;
+ }
+
+ return ret;
}
static void
diff --git a/src/core/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c b/src/core/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c
index 855ad58e7a..08deaf5abd 100644
--- a/src/core/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c
+++ b/src/core/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c
@@ -61,6 +61,24 @@
/*****************************************************************************/
+static void
+set_error_unsupported(GError **error,
+ NMConnection *connection,
+ const char *name,
+ gboolean is_setting)
+{
+ g_set_error(error,
+ NM_SETTINGS_ERROR,
+ NM_SETTINGS_ERROR_NOT_SUPPORTED_BY_PLUGIN,
+ "The ifcfg-rh plugin doesn't support %s '%s'. If you are modifying an existing "
+ "connection profile saved in ifcfg-rh format, please migrate the connection to "
+ "keyfile using 'nmcli connection migrate %s' or via the Update2() D-Bus API "
+ "and try again.",
+ is_setting ? "setting" : "property",
+ name,
+ nm_connection_get_uuid(connection));
+};
+
static void
save_secret_flags(shvarFile *ifcfg, const char *key, NMSettingSecretFlags flags)
{
@@ -3488,6 +3506,11 @@ do_write_construct(NMConnection *connection,
write_sriov_setting(connection, ifcfg);
write_tc_setting(connection, ifcfg);
+ if (_nm_connection_get_setting(connection, NM_TYPE_SETTING_LINK)) {
+ set_error_unsupported(error, connection, "link", TRUE);
+ return FALSE;
+ }
+
route_path_is_svformat = utils_has_route_file_new_syntax(route_path);
has_complex_routes_v4 = utils_has_complex_routes(ifcfg_name, AF_INET);
diff --git a/src/libnm-client-public/NetworkManager.h b/src/libnm-client-public/NetworkManager.h
index cb5c319f77..61adee29d2 100644
--- a/src/libnm-client-public/NetworkManager.h
+++ b/src/libnm-client-public/NetworkManager.h
@@ -51,11 +51,10 @@
#include "nm-setting-match.h"
#include "nm-setting-olpc-mesh.h"
#include "nm-setting-ovs-bridge.h"
-#include "nm-setting-ovs-interface.h"
#include "nm-setting-ovs-dpdk.h"
+#include "nm-setting-ovs-interface.h"
#include "nm-setting-ovs-patch.h"
#include "nm-setting-ovs-port.h"
-#include "nm-setting-wifi-p2p.h"
#include "nm-setting-ppp.h"
#include "nm-setting-pppoe.h"
#include "nm-setting-proxy.h"
@@ -71,6 +70,7 @@
#include "nm-setting-vpn.h"
#include "nm-setting-vrf.h"
#include "nm-setting-vxlan.h"
+#include "nm-setting-wifi-p2p.h"
#include "nm-setting-wimax.h"
#include "nm-setting-wired.h"
#include "nm-setting-wireguard.h"
diff --git a/src/libnm-core-public/nm-errors.h b/src/libnm-core-public/nm-errors.h
index a4d69c31ac..11ce25f15e 100644
--- a/src/libnm-core-public/nm-errors.h
+++ b/src/libnm-core-public/nm-errors.h
@@ -253,6 +253,9 @@ GQuark nm_secret_agent_error_quark(void);
* @NM_SETTINGS_ERROR_VERSION_ID_MISMATCH: The profile's VersionId mismatched
* and the update is rejected. See the "version-id" argument to Update2()
* method. Since 1.44.
+ * @NM_SETTINGS_ERROR_NOT_SUPPORTED_BY_PLUGIN: the requested operation is not
+ * supported by the settings plugin currently in use for the specified object.
+ * Since: 1.44.
*
* Errors related to the settings/persistent configuration interface of
* NetworkManager.
@@ -262,15 +265,16 @@ GQuark nm_secret_agent_error_quark(void);
* D-Bus errors in that namespace.
*/
typedef enum {
- NM_SETTINGS_ERROR_FAILED = 0, /*< nick=Failed >*/
- NM_SETTINGS_ERROR_PERMISSION_DENIED, /*< nick=PermissionDenied >*/
- NM_SETTINGS_ERROR_NOT_SUPPORTED, /*< nick=NotSupported >*/
- NM_SETTINGS_ERROR_INVALID_CONNECTION, /*< nick=InvalidConnection >*/
- NM_SETTINGS_ERROR_READ_ONLY_CONNECTION, /*< nick=ReadOnlyConnection >*/
- NM_SETTINGS_ERROR_UUID_EXISTS, /*< nick=UuidExists >*/
- NM_SETTINGS_ERROR_INVALID_HOSTNAME, /*< nick=InvalidHostname >*/
- NM_SETTINGS_ERROR_INVALID_ARGUMENTS, /*< nick=InvalidArguments >*/
- NM_SETTINGS_ERROR_VERSION_ID_MISMATCH, /*< nick=VersionIdMismatch >*/
+ NM_SETTINGS_ERROR_FAILED = 0, /*< nick=Failed >*/
+ NM_SETTINGS_ERROR_PERMISSION_DENIED, /*< nick=PermissionDenied >*/
+ NM_SETTINGS_ERROR_NOT_SUPPORTED, /*< nick=NotSupported >*/
+ NM_SETTINGS_ERROR_INVALID_CONNECTION, /*< nick=InvalidConnection >*/
+ NM_SETTINGS_ERROR_READ_ONLY_CONNECTION, /*< nick=ReadOnlyConnection >*/
+ NM_SETTINGS_ERROR_UUID_EXISTS, /*< nick=UuidExists >*/
+ NM_SETTINGS_ERROR_INVALID_HOSTNAME, /*< nick=InvalidHostname >*/
+ NM_SETTINGS_ERROR_INVALID_ARGUMENTS, /*< nick=InvalidArguments >*/
+ NM_SETTINGS_ERROR_VERSION_ID_MISMATCH, /*< nick=VersionIdMismatch >*/
+ NM_SETTINGS_ERROR_NOT_SUPPORTED_BY_PLUGIN, /*< nick=NotSupportedByPlugin >*/
} NMSettingsError;
GQuark nm_settings_error_quark(void);