Sync spec file with upstream

Related: RHEL-2404
This commit is contained in:
Íñigo Huguet 2023-10-04 15:19:02 +02:00
parent 9b7c1a53e2
commit 2025f8936f
2 changed files with 103 additions and 3 deletions

View File

@ -155,12 +155,18 @@
%global split_ifcfg_rh 0
%endif
%if 0%{?fedora} >= 36 || 0%{?rhel} >= 9
%if (0%{?fedora} >= 36 && 0%{?fedora} < 39) || 0%{?rhel} >= 9
%global ifcfg_warning 1
%else
%global ifcfg_warning 0
%endif
%if 0%{?fedora} >= 39
%global ifcfg_migrate 1
%else
%global ifcfg_migrate 0
%endif
%if 0%{?fedora}
# Although eBPF would be available on Fedora's kernel, it seems
# we often get SELinux denials (rh#1651654). But even aside them,
@ -185,7 +191,7 @@ Epoch: %{epoch_version}
Version: %{rpm_version}
Release: %{release_version}%{?snap}%{?dist}
Group: System Environment/Base
License: GPLv2+ and LGPLv2+
License: GPL-2.0-or-later AND LGPL-2.1-or-later
URL: https://networkmanager.dev/
Source: https://download.gnome.org/sources/NetworkManager/%{real_version_major}/%{name}-%{real_version}.tar.xz
@ -195,6 +201,7 @@ Source4: 20-connectivity-fedora.conf
Source5: 20-connectivity-redhat.conf
Source6: 70-nm-connectivity.conf
Source7: readme-ifcfg-rh.txt
Source8: readme-ifcfg-rh-migrated.txt
# RHEL downstream patches that change behavior from upstream.
# These are not bugfixes, hence they are also relevant after
@ -739,6 +746,9 @@ Preferably use nmcli instead.
-Ddist_version=%{version}-%{release} \
%if %{?config_plugins_default_ifcfg_rh}
-Dconfig_plugins_default=ifcfg-rh \
%endif
%if %{?ifcfg_migrate}
-Dconfig_migrate_ifcfg_rh_default=true \
%endif
-Dresolvconf=no \
-Dnetconfig=no \
@ -884,6 +894,9 @@ autoreconf --install --force
--with-dist-version=%{version}-%{release} \
%if %{?config_plugins_default_ifcfg_rh}
--with-config-plugins-default=ifcfg-rh \
%endif
%if %{?ifcfg_migrate}
--with-config-migrate-ifcfg-rh-default=yes \
%endif
--with-resolvconf=no \
--with-netconfig=no \
@ -918,6 +931,9 @@ cp %{SOURCE6} %{buildroot}%{_sysctldir}
%if 0%{?ifcfg_warning}
cp %{SOURCE7} %{buildroot}%{_sysconfdir}/sysconfig/network-scripts
%endif
%if 0%{?ifcfg_migrate}
cp %{SOURCE8} %{buildroot}%{_sysconfdir}/sysconfig/network-scripts/readme-ifcfg-rh.txt
%endif
cp examples/dispatcher/10-ifcfg-rh-routes.sh %{buildroot}%{nmlibdir}/dispatcher.d/
ln -s ../no-wait.d/10-ifcfg-rh-routes.sh %{buildroot}%{nmlibdir}/dispatcher.d/pre-up.d/
@ -1109,7 +1125,7 @@ fi
%{_unitdir}/nm-priv-helper.service
%dir %{_datadir}/doc/NetworkManager/examples
%{_datadir}/doc/NetworkManager/examples/server.conf
%if 0%{?ifcfg_warning}
%if 0%{?ifcfg_warning} || 0%{?ifcfg_migrate}
%{_sysconfdir}/sysconfig/network-scripts/readme-ifcfg-rh.txt
%endif
%doc NEWS AUTHORS README.md CONTRIBUTING.md

View File

@ -0,0 +1,84 @@
NetworkManager was built to automatically migrate connection profiles in
this directory to equivalent ones in keyfile format in directory
/etc/NetworkManager/system-connections.
You can check whether the migration is enabled via:
$ NetworkManager --print-config | grep migrate-ifcfg-rh
In case it is enabled, all files in this directory are migrated at startup.
To inspect where your connection files are currently stored use:
$ nmcli -f name,uuid,filename connection
Background
==========
The ifcfg format is deprecated and will be removed in future releases. For
more information see:
https://lists.freedesktop.org/archives/networkmanager/2023-May/000103.html
Connection profiles in keyfile format have many benefits. For example, this
format is INI file-based and can easily be parsed and generated.
Each section in NetworkManager keyfiles corresponds to a NetworkManager
setting name as described in the nm-settings(5) and nm-settings-keyfile(5)
man pages. Each key-value pair in a section is one of the properties listed
in the settings specification of the man page.
How to keep using ifcfg
=======================
If you want to keep using connection profiles in ifcfg format, you need to:
- disable the automatic migration to keyfile by setting
"migrate-ifcfg-rh=false" in the [main] section of NetworkManager
configuration;
- optionally, set "plugins=ifcfg-rh" in the [main] section of
NetworkManager configuration so that new profiles are created in ifcfg
format.
At this point, you can migrate all your files back via
nmcli connection migrate --plugin ifcfg-rh
Or, if you prefer to migrate only specific connections:
nmcli connection migrate --plugin ifcfg-rh <profile_name|UUID>
Note that some connection types are not supported by the ifcfg plugin.
Interface renaming
==================
Connection profiles stored in ifcfg-rh format support the renaming of
interfaces via udev. This is done via a helper tool
/usr/lib/udev/rename_device that is invoked by udev to parse the files
in /etc/sysconfig/network-scripts; when the HWADDR and DEVICE
variables are set, the interface that matches the MAC address in
HWADDR is renamed to the name specified in DEVICE.
Connections in keyfile format don't provide the same integration with
udev. The renaming of interfaces must be configured directly in udev,
for example by creating a file:
/etc/systemd/network/70-rename.link
with content:
[Match]
MACAddress=00:11:22:33:44:56
[Link]
Name=ethernet1
Alternatively, a udev rule can also be used, such as:
/etc/udev/rules.d/70-interface-names.rules
with content:
SUBSYSTEM=="net",ACTION=="add",ATTR{address}=="00:11:22:33:44:56",ATTR{type}=="1",NAME="ethernet1"