Skip to contentSkip to conversation

How to test the kernel netfilter logic?

DISCUSSION Konstantin Khorenko 2 participants 5 messages May 25, 2020 – May 26, 2020 netfilter

lore
Share & tools
lore
#0 lore raw

Hello,

are there any tests for netfilter kernel logic?

i've taken a look at iptables and nftables repo, there are a lot of tests, but all of them (if i see correctly) are about loading/unloading rules, chains, etc,
but not actually checking that those rules work properly.

i mean i did not find tests which configure some rules, then send traffic and check if the traffic is changed by the rule in the expected way.

i understand that this is not userspace's work to process the traffic, so i'd expect the tests somehow are bound to the kernel, but did not find netfilter tests in kernel git repo as well.

Can you please help me?

Thank you in advance!

--
Best regards,

Konstantin Khorenko,
Virtuozzo Linux Kernel Team

#1 lore raw

Hi Konstantin,

Quoted 1 line · On Mon, 25 May 2020 11:37:57 +0300 Konstantin Khorenko…

but did not find netfilter tests in kernel git repo as well.

Have a look at tools/testing/selftests/netfilter/, some of the tests there actually send traffic and check the outcome.

Signature · 1 line
Stefano
#2 lore raw
Quoted 9 lines · Stefano Brivio

Hi Konstantin,

Quoted 1 line · On Mon, 25 May 2020 11:37:57 +0300 Konstantin Khorenko…

but did not find netfilter tests in kernel git repo as well.

Have a look at tools/testing/selftests/netfilter/, some of the tests there actually send traffic and check the outcome.

Hi Stefano,

thank you very much for the answer!

Yes, you are right, i know about that place, i just thought it's just for "smoke" testing:
"iptables" and "nftables" repos have many more testcases (for add/del rules), so i thought there is some additional place with similar very detailed tests for kernel part.

If not, well, it's great we have a least those! :)

Have a nice day!

--
Best regards,

Konstantin Khorenko,
Virtuozzo Linux Kernel Team

#3 lore raw
Quoted 11 lines · On Mon, 25 May 2020 17:00:24 +0300 Konstantin Khorenko…
Quoted 9 lines · Stefano Brivio

Hi Konstantin,

Quoted 1 line · On Mon, 25 May 2020 11:37:57 +0300 Konstantin Khorenko…

but did not find netfilter tests in kernel git repo as well.

Have a look at tools/testing/selftests/netfilter/, some of the tests there actually send traffic and check the outcome.

Quoted 6 lines

Hi Stefano,

thank you very much for the answer!

Yes, you are right, i know about that place, i just thought it's just for "smoke" testing:

Well, I'd say it's a bit more than that, some tests there cover specific functionalities rather extensively. Still:

Quoted 3 lines

"iptables" and "nftables" repos have many more testcases (for add/del rules), so i thought there is some additional place with similar very detailed tests for kernel part.

...I'm not aware of any (except for ipset cases that actually test both sides with packets, see http://git.netfilter.org/ipset/tree/tests).

Sure, I think it would be great to have something with actual traffic at the same level of detail as nft tests, though.

Signature · 1 line
Stefano
#4 lore raw
Quoted 5 lines · Stefano Brivio
Quoted 2 lines

Yes, you are right, i know about that place, i just thought it's just for "smoke" testing:

Well, I'd say it's a bit more than that, some tests there cover specific functionalities rather extensively.

Yes, i take it back, taking more closer look reveals those tests are quite big in size and perform deep testing.
Not for all functionality surely, but still - very good! :)

Thank you once again!

--
Best regards,

Konstantin Khorenko