hm2_eth: add nftables firewall backend#4111
Conversation
259d203 to
8772107
Compare
|
As always, while looking trough the code, I found some things that where not subject to your change. Thanks for fixing. |
|
From your side, it is ready? So I will do some testing later today. It will take some time, many options to test... Three firewall variants / vs. root/nonroot so 6 combinations. |
|
Yes, ready, I cannot test, waiting on feedback, probably will pick this up tomorrow, addressing test results ;-) |
|
So, i tested all combinations: suid / setcap vs. auto iptables installed / auto iptables not installed / nft / iptables Below the tables when linuxcnc is running to verify. Looks good to me but I don't know this well enought to properly verify it. Rules iptables: sudo ip6tables -S Rules nft: |
|
Can someone also, please, cleanup the cppcheck mess caused by the hm2_eth.c changes? |
|
Is this accurate? |
|
This was introduced here: @grandixximo If @NTULINUX version does not work, I would just pass the arguments as a single string and split by spaces. @BsAtHome Recurring issue. It probably would make sense to maintain a list of wontfixnow files in cppcheck.sh / shellcheck.sh and fail the CI if any other files have issues. So no new issues are introduced in any other files than in this list. |
No, we have to be more careful when changing stuff. Ignoring files or difficult issues sets a precedent that "it is ok to be sloppy". No, it is not and things need to get fixed (the proper way). That is also how we were able to add -Werror to the CI build. We just need some continuous stability here too and then we'll enforce it in CI. With respect to shellcheck,... almost there. Still pondering some options. But my attention is already spread thin by doing all the review work in the necessary docs build reorg and fixes (while working on hal getter/setter and pondering other issues too). |
Of course, this list should be as small as possible and disappear soon. I just discovered that cppcheck is now passing normally (except the new issue introduced). So we could fail the CI if cppcheck fails. I can look into this. Right now the CI always passes on cppcheck / shellcheck issues which is even worse, so new issues get introduced when you are not checking this CI stage manually. |
8772107 to
9339f6e
Compare
|
Fixed the cppcheck varFuncNullUB findings too: the IPT/IP6T/NFT sentinel is now |
|
Thanks for fixing cppckeck. Hmm, while looking at this: I don't have time to test this right now, but this compiles. It could be simplified with the matching define. |
9339f6e to
0543c7a
Compare
Good call, done. |
|
Nice! And now you also can not anymore pass an 1 instead of an "1" to the macos. Before, that probably would have generated a segfault / ub. Now the compiler should catch it. |
Follow-up to #3964. That PR added automatic interface isolation via iptables; @NTULINUX noted nftables-only systems have no iptables binary at all, so the auto-skip just leaves them unprotected.
This adds an nft backend alongside the existing one.
What changed
firewall=auto|iptables|nft|nonemodule parameter.no_iptables=1kept as a deprecated alias forfirewall=none.auto(default) prefers iptables when usable, preserving current behavior, and falls back to nft. Pure-nftables systems get isolation out of the box.table inet hm2_ethwith anoutput-hook chain. Because the table is dedicated, flush and delete never touch the user's other rules. Theinetfamily handles IPv4 and IPv6 in one chain.Tested
Configured
--with-realtime=uspaceand built; hm2_eth compiles and links clean. Not hardware-tested, I do not have a Mesa ethernet card. The iptables path is unchanged, so existing setups see no difference.cc @NTULINUX, @hdiethelm