Compare commits
10 Commits
d34619f2aa
...
9d449d33a9
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9d449d33a9 | ||
|
|
af13dd6511 | ||
|
|
af20b16929 | ||
|
|
a7e8b80531 | ||
|
|
11cb3f9ec0 | ||
|
|
2d8bca87fc | ||
|
|
bc8002dd02 | ||
|
|
08466e716a | ||
|
|
09ac7c388c | ||
|
|
a9b54444d9 |
61
backport-fix-nm-release-NM-client-after-a-timeout.patch
Normal file
61
backport-fix-nm-release-NM-client-after-a-timeout.patch
Normal file
@ -0,0 +1,61 @@
|
||||
From eb76e2a80a43481da7a54ff784edf1c76651db96 Mon Sep 17 00:00:00 2001
|
||||
From: Eric Garver <eric@garver.life>
|
||||
Date: Wed, 22 Nov 2023 12:10:09 -0500
|
||||
Subject: [PATCH] fix(nm): release NM client after a timeout
|
||||
|
||||
Conflict: NA
|
||||
Reference: https://github.com/firewalld/firewalld/commit/eb76e2a80a43481da7a54ff784edf1c76651db96
|
||||
|
||||
libnm will accumulate a bunch of data, e.g. routes, that is irrelevant
|
||||
to firewalld. To avoid unbound growth in memory we can destroy the
|
||||
client and reinitialize it when we query NM.
|
||||
|
||||
Fixes: #1232
|
||||
---
|
||||
src/firewall/core/fw_nm.py | 20 ++++++++++++++++++++
|
||||
1 file changed, 20 insertions(+)
|
||||
|
||||
diff --git a/src/firewall/core/fw_nm.py b/src/firewall/core/fw_nm.py
|
||||
index 0e38dd4..c1f8e1d 100644
|
||||
--- a/src/firewall/core/fw_nm.py
|
||||
+++ b/src/firewall/core/fw_nm.py
|
||||
@@ -39,6 +39,7 @@ else:
|
||||
except (ImportError, ValueError, GLib.Error):
|
||||
_nm_imported = False
|
||||
_nm_client = None
|
||||
+_nm_client_timeout = None
|
||||
|
||||
from firewall import errors
|
||||
from firewall.errors import FirewallError
|
||||
@@ -61,9 +62,28 @@ def nm_get_client():
|
||||
"""Returns the NM client object or None if the import of NM failed
|
||||
@return NM.Client instance if import was successful, None otherwise
|
||||
"""
|
||||
+
|
||||
+ def _release():
|
||||
+ """
|
||||
+ Release the client to avoid excess memory usage when libnm pushes
|
||||
+ irrelevant (to firewalld) updates.
|
||||
+ """
|
||||
+ global _nm_client
|
||||
+ global _nm_client_timeout
|
||||
+ _nm_client = None
|
||||
+ _nm_client_timeout = None
|
||||
+
|
||||
global _nm_client
|
||||
+ global _nm_client_timeout
|
||||
+
|
||||
if not _nm_client:
|
||||
_nm_client = NM.Client.new(None)
|
||||
+ else:
|
||||
+ # refresh timer
|
||||
+ GLib.source_remove(_nm_client_timeout)
|
||||
+
|
||||
+ _nm_client_timeout = GLib.timeout_add_seconds(5, _release)
|
||||
+
|
||||
return _nm_client
|
||||
|
||||
def nm_get_zone_of_connection(connection):
|
||||
--
|
||||
2.33.0
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
Name: firewalld
|
||||
Version: 1.2.6
|
||||
Release: 3
|
||||
Release: 7
|
||||
Summary: A firewall daemon with D-Bus interface providing a dynamic firewall
|
||||
License: GPLv2+
|
||||
URL: http://www.firewalld.org
|
||||
@ -12,17 +12,15 @@ Patch2: add-Restart-on-failure-on-firewalld.service.patch
|
||||
Patch3: 0001-fix-config-Specify-the-translation-encoding-format-a.patch
|
||||
Patch4: backport-chore-nftables-add-delete-table-helper.patch
|
||||
Patch5: backport-fix-nftables-always-flush-main-table-on-start.patch
|
||||
Patch6: 0002-fix-service-update-highest-port-number-for-ceph.patch
|
||||
Patch6: backport-fix-service-update-highest-port-number-for-ceph.patch
|
||||
Patch7: backport-fix-nm-release-NM-client-after-a-timeout.patch
|
||||
|
||||
BuildArch: noarch
|
||||
BuildRequires: autoconf automake desktop-file-utils gettext intltool glib2 glib2-devel systemd-units docbook-style-xsl
|
||||
BuildRequires: libxslt iptables ebtables ipset python3-devel
|
||||
|
||||
|
||||
Requires: iptables ebtables ipset systemd
|
||||
%if %{?openEuler:1}0
|
||||
Requires: hicolor-icon-theme python3-gobject NetworkManager-libnm dbus-x11 gtk3
|
||||
%endif
|
||||
Requires: iptables iptables-nft ipset systemd
|
||||
Requires: python3-firewall = %{version}-%{release}
|
||||
Suggests: iptables-nft
|
||||
|
||||
@ -39,8 +37,8 @@ Obsoletes: firewalld-config-cloud <= 0.3.15
|
||||
Obsoletes: firewalld-config-server <= 0.3.15
|
||||
Obsoletes: firewalld-config-workstation <= 0.3.15
|
||||
|
||||
Provides: firewalld-filesystem = %{version}-%{release} firewall-config = %{version}-%{release}
|
||||
Obsoletes: firewalld-filesystem < %{version}-%{release} firewall-config < %{version}-%{release}
|
||||
Provides: firewalld-filesystem = %{version}-%{release}
|
||||
Obsoletes: firewalld-filesystem < %{version}-%{release}
|
||||
|
||||
%description
|
||||
firewalld is a firewall service daemon that provides a dynamic customizable
|
||||
@ -70,6 +68,18 @@ Summary: Firewalld testsuite
|
||||
%description -n firewalld-test
|
||||
This package provides the firewalld testsuite.
|
||||
|
||||
%if %{?openEuler:1}0
|
||||
%package -n firewall-config
|
||||
Summary: Firewall GUI configuration application
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
Requires: python3-firewall = %{version}-%{release}
|
||||
Requires: hicolor-icon-theme python3-gobject NetworkManager-libnm dbus-x11 gtk3
|
||||
Recommends: polkit
|
||||
|
||||
%description -n firewall-config
|
||||
GUI configuration interface for firewalld.
|
||||
%endif
|
||||
|
||||
|
||||
%prep
|
||||
%autosetup -n %{name}-%{version} -p1
|
||||
@ -115,6 +125,11 @@ dd if=/dev/zero of=$RPM_BUILD_ROOT/%{_datadir}/firewalld/firewalld-tmp-mmap bs=4
|
||||
|
||||
%postun
|
||||
%systemd_postun_with_restart firewalld.service
|
||||
if [ $1 -eq 0 ]; then
|
||||
if [ -L %{_sysconfdir}/firewalld/firewalld.conf ] && [ ! -e %{_sysconfdir}/firewalld/firewalld.conf ]; then
|
||||
rm -f %{_sysconfdir}/firewalld/firewalld.conf
|
||||
fi
|
||||
fi
|
||||
|
||||
%posttrans
|
||||
# If we don't yet have a symlink or existing file for firewalld.conf,
|
||||
@ -149,13 +164,11 @@ if [ ! -e %{_datadir}/polkit-1/actions/org.fedoraproject.FirewallD1.policy ]; th
|
||||
esac
|
||||
fi
|
||||
|
||||
sed -i "s/CleanupModulesOnExit=no/CleanupModulesOnExit=yes/g" %{_sysconfdir}/firewalld/firewalld.conf
|
||||
|
||||
%files -f %{name}.lang
|
||||
%doc COPYING README.md
|
||||
%{_sbindir}/firewalld
|
||||
%if %{?openEuler:1}0
|
||||
%{_bindir}/firewall-config
|
||||
%endif
|
||||
%{_bindir}/firewall-cmd
|
||||
%{_bindir}/firewall-offline-cmd
|
||||
%{_datadir}/bash-completion/completions/firewall-cmd
|
||||
@ -180,9 +193,7 @@ fi
|
||||
%{_datadir}/polkit-1/actions/org.fedoraproject.FirewallD1.server.policy.choice
|
||||
%ghost %{_datadir}/polkit-1/actions/org.fedoraproject.FirewallD1.policy
|
||||
%{_sysconfdir}/modprobe.d/firewalld-sysctls.conf
|
||||
%if %{!?openEuler:1}0
|
||||
%attr (0700,root,root) %{_datadir}/firewalld/firewalld-tmp-mmap
|
||||
%endif
|
||||
%config(noreplace) %{_sysconfdir}/logrotate.d/firewalld
|
||||
%{_rpmconfigdir}/macros.d/macros.firewalld
|
||||
|
||||
@ -195,20 +206,15 @@ fi
|
||||
%exclude %{_mandir}/man1/firewall-applet*.1*
|
||||
|
||||
%if %{?openEuler:1}0
|
||||
%files -n firewall-config
|
||||
%{_bindir}/firewall-config
|
||||
%defattr(0644,root,root)
|
||||
%attr (0700,root,root) %{_datadir}/firewalld/firewalld-tmp-mmap
|
||||
%{_datadir}/firewalld/*
|
||||
%{_datadir}/applications/firewall-config.desktop
|
||||
%{_datadir}/metainfo/firewall-config.appdata.xml
|
||||
%{_datadir}/icons/hicolor/*/apps/firewall-config*.*
|
||||
%{_datadir}/glib-2.0/schemas/org.fedoraproject.FirewallConfig.gschema.xml
|
||||
%else
|
||||
%exclude %{_bindir}/firewall-config
|
||||
%exclude %{_datadir}/firewalld/*
|
||||
%exclude %{_datadir}/applications/firewall-config.desktop
|
||||
%exclude %{_datadir}/metainfo/firewall-config.appdata.xml
|
||||
%exclude %{_datadir}/icons/hicolor/*/apps/firewall-config*.*
|
||||
%exclude %{_datadir}/glib-2.0/schemas/org.fedoraproject.FirewallConfig.gschema.xml
|
||||
%exclude %{_datadir}/firewalld/firewalld-tmp-mmap
|
||||
%endif
|
||||
%exclude %{_datadir}/firewalld/testsuite/*
|
||||
|
||||
@ -221,6 +227,15 @@ fi
|
||||
%defattr(-,root,root)
|
||||
%{python3_sitelib}/firewall/*
|
||||
|
||||
%if %{!?openEuler:1}0
|
||||
%exclude %{_bindir}/firewall-config
|
||||
%exclude %{_datadir}/firewalld/*
|
||||
%exclude %{_datadir}/applications/firewall-config.desktop
|
||||
%exclude %{_datadir}/metainfo/firewall-config.appdata.xml
|
||||
%exclude %{_datadir}/icons/hicolor/*/apps/firewall-config*.*
|
||||
%exclude %{_datadir}/glib-2.0/schemas/org.fedoraproject.FirewallConfig.gschema.xml
|
||||
%endif
|
||||
|
||||
%files -n firewalld-test
|
||||
%dir %{_datadir}/firewalld/testsuite
|
||||
%{_datadir}/firewalld/testsuite/README.md
|
||||
@ -234,7 +249,33 @@ fi
|
||||
%{_datadir}/firewalld/testsuite/python/firewalld_test.py
|
||||
|
||||
%changelog
|
||||
* Thu Apr 29 2024 baiguo <baiguo@kylinos.cn> - 1.2.6-3
|
||||
* Wed Aug 28 2024 zhouyihang <zhouyihang3@h-partners.com> - 1.2.6-7
|
||||
- Type:bugfix
|
||||
- CVE:NA
|
||||
- SUG:NA
|
||||
- DESC:fix broken symbolic link after package remove
|
||||
|
||||
* Thu Jul 11 2024 zhouyihang <zhouyihang3@h-partners.com> - 1.2.6-6
|
||||
- Type:requirement
|
||||
- ID:NA
|
||||
- SUG:NA
|
||||
- DESC:split GUI part from firewalld to firewall-config
|
||||
|
||||
* Fri Jul 05 2024 zhouyihang <zhouyihang3@h-partners.com> - 1.2.6-5
|
||||
- Type:bugfix
|
||||
- ID:NA
|
||||
- SUG:NA
|
||||
- DESC:fix unintentinally exclude file
|
||||
|
||||
* Fri Jul 05 2024 zhouyihang <zhouyihang3@h-partners.com> - 1.2.6-4
|
||||
- Type:bugfix
|
||||
- ID:NA
|
||||
- SUG:NA
|
||||
- DESC:Firewall startup is to set CleanupModuleOnxit=yes to unload related ko when stopping firewalld service
|
||||
To reduce unnecessary loading of ebtables-related kernel modules
|
||||
fix(nm): release NM client after a timeout
|
||||
|
||||
* Mon Apr 29 2024 baiguo <baiguo@kylinos.cn> - 1.2.6-3
|
||||
- Type:requirement
|
||||
- ID:NA
|
||||
- SUG:NA
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user