summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2023-03-08 08:48:03 +0100
committerThomas Haller <thaller@redhat.com>2023-03-08 11:07:24 +0100
commit7db065c3a29a6799650fb3e923a7c0f5d13c0284 (patch)
tree826cc06834080c4fa72831f10f28d0739199d7e7
parent0ebfffb5ebff4d4b6fa83fa4596a920b8fb390a3 (diff)
downloadNetworkManager-th/fedora-wifi-mac-addr-rand.tar.gz
contrib/rpm: add "35-wifi-mac-addr.conf" to F39+th/fedora-wifi-mac-addr-rand
https://pagure.io/fedora-workstation/issue/350
-rw-r--r--contrib/fedora/rpm/35-wifi-mac-addr.conf23
-rw-r--r--contrib/fedora/rpm/NetworkManager.spec16
-rwxr-xr-xcontrib/fedora/rpm/build.sh2
3 files changed, 37 insertions, 4 deletions
diff --git a/contrib/fedora/rpm/35-wifi-mac-addr.conf b/contrib/fedora/rpm/35-wifi-mac-addr.conf
new file mode 100644
index 0000000000..8ff24da5be
--- /dev/null
+++ b/contrib/fedora/rpm/35-wifi-mac-addr.conf
@@ -0,0 +1,23 @@
+# This sets defaults to Wi-Fi profiles to set a stable MAC address.
+#
+# Do not modify this file. You can hide/overwrite this file by placing a
+# file to "/etc/NetworkManager/conf.d/35-wifi-mac-addr.conf". You can also
+# set the settings per-profile, so that these defaults are not used.
+#
+# For example, on some networks you could set
+#
+# $ nmcli connection modify "$PROFILE" connection.stable-id '${CONNECTION}/${BOOT}'
+#
+# or
+#
+# $ nmcli connection modify "$PROFILE" wifi.cloned-mac-address permanent
+#
+# See `man 5 nm-settings` for "wifi.cloned-mac-address" and "connection.stable-id".
+
+[connection.35-wifi-mac-addr]
+match-device=type:wifi
+wifi.cloned-mac-address=stable
+
+# The default stable-id already (of having it unset) already creates a unique
+# identity for each profile.
+#connection.stable-id=${CONNECTION}/${BOOT}
diff --git a/contrib/fedora/rpm/NetworkManager.spec b/contrib/fedora/rpm/NetworkManager.spec
index 983c755be9..6d4ba72e73 100644
--- a/contrib/fedora/rpm/NetworkManager.spec
+++ b/contrib/fedora/rpm/NetworkManager.spec
@@ -203,8 +203,9 @@ Source1: NetworkManager.conf
Source2: 00-server.conf
Source4: 20-connectivity-fedora.conf
Source5: 20-connectivity-redhat.conf
-Source6: 70-nm-connectivity.conf
-Source7: readme-ifcfg-rh.txt
+Source6: 35-wifi-mac-addr.conf
+Source7: 70-nm-connectivity.conf
+Source8: readme-ifcfg-rh.txt
#Patch1: 0001-some.patch
@@ -916,11 +917,15 @@ cp %{SOURCE4} %{buildroot}%{nmlibdir}/conf.d/
%if %{with connectivity_redhat}
cp %{SOURCE5} %{buildroot}%{nmlibdir}/conf.d/
mkdir -p %{buildroot}%{_sysctldir}
-cp %{SOURCE6} %{buildroot}%{_sysctldir}
+cp %{SOURCE7} %{buildroot}%{_sysctldir}
+%endif
+
+%if 0%{?fedora} >= 39
+cp %{SOURCE6} %{buildroot}%{nmlibdir}/conf.d/
%endif
%if 0%{?ifcfg_warning}
-cp %{SOURCE7} %{buildroot}%{_sysconfdir}/sysconfig/network-scripts
+cp %{SOURCE8} %{buildroot}%{_sysconfdir}/sysconfig/network-scripts
%endif
cp examples/dispatcher/10-ifcfg-rh-routes.sh %{buildroot}%{nmlibdir}/dispatcher.d/
@@ -1067,6 +1072,9 @@ fi
%dir %{_sysconfdir}/%{name}/dnsmasq-shared.d
%dir %{_sysconfdir}/%{name}/system-connections
%config(noreplace) %{_sysconfdir}/%{name}/NetworkManager.conf
+%if 0%{?fedora} >= 39
+%{nmlibdir}/conf.d/35-wifi-mac-addr.conf.conf
+%endif
%ghost %{_sysconfdir}/%{name}/VPN
%{_bindir}/nm-online
%{_libexecdir}/nm-dhcp-helper
diff --git a/contrib/fedora/rpm/build.sh b/contrib/fedora/rpm/build.sh
index 590929660a..2e412ab475 100755
--- a/contrib/fedora/rpm/build.sh
+++ b/contrib/fedora/rpm/build.sh
@@ -144,6 +144,7 @@ SOURCE_NETWORKMANAGER_CONF="$(abs_path "$SOURCE_NETWORKMANAGER_CONF" "$SCRIPTDIR
SOURCE_CONFIG_SERVER="$(abs_path "$SOURCE_CONFIG_SERVER" "$SCRIPTDIR/00-server.conf")" || die "invalid \$SOURCE_CONFIG_SERVER argument"
SOURCE_CONFIG_CONNECTIVITY_FEDORA="$(abs_path "$SOURCE_CONFIG_CONNECTIVITY_FEDORA" "$SCRIPTDIR/20-connectivity-fedora.conf")" || die "invalid \$SOURCE_CONFIG_CONNECTIVITY_FEDORA argument"
SOURCE_CONFIG_CONNECTIVITY_REDHAT="$(abs_path "$SOURCE_CONFIG_CONNECTIVITY_REDHAT" "$SCRIPTDIR/20-connectivity-redhat.conf")" || die "invalid \$SOURCE_CONFIG_CONNECTIVITY_REDHAT argument"
+SOURCE_CONFIG_WIFI_MAC_ADDR="$(abs_path "$SOURCE_CONFIG_WIFI_MAC_ADDR" "$SCRIPTDIR/35-wifi-mac-addr.conf")" || die "invalid \$SOURCE_CONFIG_WIFI_MAC_ADDR argument"
SOURCE_SYSCTL_RP_FILTER_REDHAT="$(abs_path "$SOURCE_SYSCTL_RP_FILTER_REDHAT" "$SCRIPTDIR/70-nm-connectivity.conf")" || die "invalid \$SOURCE_SYSCTL_RP_FILTER_REDHAT argument"
SOURCE_README_IFCFG_FILES="$(abs_path "$SOURCE_README_IFCFG_FILES" "$SCRIPTDIR/readme-ifcfg-rh.txt")" || die "invalid \$SOURCE_README_IFCFG_FILES argument"
@@ -200,6 +201,7 @@ cp "$SOURCE_NETWORKMANAGER_CONF" "$TEMP/SOURCES/NetworkManager.conf" || die "Cou
cp "$SOURCE_CONFIG_SERVER" "$TEMP/SOURCES/00-server.conf" || die "Could not copy source $SOURCE_CONFIG_SERVER to $TEMP/SOURCES"
cp "$SOURCE_CONFIG_CONNECTIVITY_FEDORA" "$TEMP/SOURCES/20-connectivity-fedora.conf" || die "Could not copy source $SOURCE_CONFIG_CONNECTIVITY_FEDORA to $TEMP/SOURCES"
cp "$SOURCE_CONFIG_CONNECTIVITY_REDHAT" "$TEMP/SOURCES/20-connectivity-redhat.conf" || die "Could not copy source $SOURCE_CONFIG_CONNECTIVITY_REDHAT to $TEMP/SOURCES"
+cp "$SOURCE_CONFIG_WIFI_MAC_ADDR" "$TEMP/SOURCES/35-wifi-mac-addr.conf" || die "Could not copy source $SOURCE_CONFIG_WIFI_MAC_ADDR to $TEMP/SOURCES"
cp "$SOURCE_SYSCTL_RP_FILTER_REDHAT" "$TEMP/SOURCES/70-nm-connectivity.conf" || die "Could not copy source $SOURCE_SYSCTL_RP_FILTER_REDHAT to $TEMP/SOURCES"
cp "$SOURCE_README_IFCFG_FILES" "$TEMP/SOURCES/readme-ifcfg-rh.txt" || die "Could not copy source $SOURCE_README_IFCFG_FILES to $TEMP/SOURCES"