Skip to content

When the dbus restarts frequently, nftables backend adds rules repeatedly. #1006

Open

Description

@kircherlike

What happened:
When the dbus restarts frequently, nftables backend adds rules repeatedly.
set FirewallBackend to nftables,set FlushAllOnReload to yes
firewalld adds the same nftables rule repeatedly.

What you expected to happen:
The nftables rule is added only once for firewalld.

How to reproduce it (as minimally and precisely as possible):

nft list ruleset | grep mangle_PRE_policy_allow-host-ipv6_post | wc -l
OUTPUT: 2
for i in {1..20};do
        systemctl restart dbus
        sleep 2
done
nft list ruleset | grep mangle_PRE_policy_allow-host-ipv6_post | wc -l
OUTPUT: 13

Anything else we need to know?:
If the backend of firewalld is changed to iptables, iptables rules will not be added repeatedly.

I think the reason for this is that the iptables backend uses iptables-restore to reload all rules at startup, while the nftables backend uses the add interface of python-nftables to add rules at startup. When firewalld is stop, the delete interface of python-nftables is used to delete rules.

The correct method is to delete and then add at startup.

Environment:

  • Firewalld Version (if Fedora based dnf info firewalld or commit hash if developing from git git log -n1 --format=format:"%H"):
    firewalld-1.0.2
  • Firewalld Backend (cat /etc/firewalld/firewalld.conf | grep FirewallBackend):
    nftables、iptables
  • OS (e.g: cat /etc/os-release):
    linux
  • Others:

Activity

  1. jon7259 commented on Sep 11, 2023

    @jon7259

    @TorontoMedia “When the dbus restarts frequently, nftables backend adds rules repeatedly”,This issue doesn't seem to be solved even if I use dbus-python1.3.2 version( latest version)

  2. jon7259 commented on Sep 11, 2023

    @jon7259

    @erig0 Hi,This problem still exists. Do we declare that when firewalld is running, do not restart dbus.service.
    Looking forward to your reply.

  3. erig0 commented on Sep 11, 2023

    @erig0
    Collaborator

    Hrm. I wonder if this was fixed as a side effect of 6a155ea. Can anyone retest on the latest code from the main branch?

  4. added
    retest
    on Sep 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    retest

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions