Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider adding support for choosing which nftables table(s) to insert rules into #1732

Open
gedia opened this issue Oct 5, 2023 · 2 comments

Comments

@gedia
Copy link

gedia commented Oct 5, 2023

Hello,

I'm glad to see nft support was recently added to rtpengine. This is a minor feature request to add configuration which allows choosing which tables the rules will be injected into. nft is a bit non-intuitive when multiple tables of type filter are using the same hook, and explicitly setting this could simplify things and prevent unintended behaviours.

Currently rtpe would create rules similar to the following:

table ip filter {
        chain rtpengine {
                meta l4proto udp counter packets 0 bytes 0 # RTPENGINE id:0
        }

        chain INPUT {
                type filter hook input priority filter; policy accept;
                meta l4proto udp counter packets 0 bytes 0 jump rtpengine
        }
}
table ip6 filter {
        chain rtpengine {
                meta l4proto udp counter packets 0 bytes 0
        }

        chain INPUT {
                type filter hook input priority filter; policy accept;
                meta l4proto udp counter packets 0 bytes 0 jump rtpengine
        }
}

It would be great if this behaviour depended on a configuration setting such as:

--nftables-tables=ip,ip6

So that if one chose to use --nftables-tables=inet, the following configuration would be created instead:

table inet filter {

        chain rtpengine {
                meta l4proto udp counter packets 0 bytes 0
        }

        chain input {
                type filter hook input priority filter; policy accept;
                meta l4proto udp counter packets 0 bytes 0 jump rtpengine
        }
}

Note that these nft snippets are used for demonstration purposes and are not actually produced by the rtpengine process. Thanks!

@amessina
Copy link

amessina commented Oct 5, 2023

Similarly, it would be helpful to have proto UDP and the port range be configurable. In the case where no base chain is set, it seems everything will need to touch xt_RTPENGINE before popping back to the remainder of the chains and rules.

nftables-chain = rtpengine
nftables-base-chain =
XT target RTPENGINE not found
table ip filter {
        chain rtpengine {
                type filter hook input priority filter; policy accept;
                # RTPENGINE id:0 counter packets 150400 bytes 33882564
        }
}
table ip6 filter {
        chain rtpengine {
                type filter hook input priority filter; policy accept;
                counter packets 5996916 bytes 9456735819
        }
}
table inet firewalld {
...
...

This nft list ruleset 2>&1 | less output is what's currently on my system.

@rfuchs
Copy link
Member

rfuchs commented Oct 18, 2023

I'm glad to see nft support was recently added to rtpengine. This is a minor feature request to add configuration which allows choosing which tables the rules will be injected into. nft is a bit non-intuitive when multiple tables of type filter are using the same hook, and explicitly setting this could simplify things and prevent unintended behaviours.

That will probably have to wait until the kernel module itself is migrated to nftables as I don't think it's possible to link xtables modules into the inet table

sipwise-jenkins pushed a commit that referenced this issue Oct 23, 2023
If we're not using a separate base chain, create the target rule with
the UDP filter in place, same as the "immediate" rule in the case with a
base chain.

Reported in #1732

Change-Id: I0e67a88f5f51e21ba9537c87e2955f910dd6ec2c
sipwise-jenkins pushed a commit that referenced this issue Dec 13, 2023
If we're not using a separate base chain, create the target rule with
the UDP filter in place, same as the "immediate" rule in the case with a
base chain.

Reported in #1732

Change-Id: I0e67a88f5f51e21ba9537c87e2955f910dd6ec2c
sipwise-jenkins pushed a commit that referenced this issue Dec 13, 2023
If we're not using a separate base chain, create the target rule with
the UDP filter in place, same as the "immediate" rule in the case with a
base chain.

Reported in #1732

Change-Id: I0e67a88f5f51e21ba9537c87e2955f910dd6ec2c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants