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

feat: build host iptables with nftables support #1106

Merged
merged 1 commit into from
Dec 6, 2024

Conversation

smira
Copy link
Member

@smira smira commented Dec 6, 2024

Build iptables with nftables support, and force to use nft version.

See siderolabs/talos#9883

Build iptables with nftables support, and force to use
nft version.

See siderolabs/talos#9883

Signed-off-by: Andrey Smirnov <[email protected]>
@@ -30,6 +33,19 @@ steps:
install:
- |
make install DESTDIR=/rootfs
- |
# fix up symlinks which point to legacy version to point to nft version
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this necessary? How other distros build this? Maybe patching the Makefile would be better?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Our goal is not to have a generic solution which would work in any case. Talos enforces use of nftables (vs. legacy). Kubernetes does a wrapper which picks up iptables version by detecting existing rules in either of the backends. We know we do nft, so no reason to overcomplicate, and point default binaries to nft one.

The host iptables should be used by CNI plugins, and they don't seem to be smart enough to figure out which version to use based on anything.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and iptables Makefile is not configurable on that - it always does iptables -> xtables-legacy-multi.

This script should work even if the default is changed though.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/ # nsenter -t 1 -m /sbin/iptables -v
iptables v1.8.11 (nf_tables): no command specified
Try `iptables -h' or 'iptables --help' for more information.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is what a result looks like:

drwxr-xr-x 0/0               0 2019-06-02 01:34 sbin/
lrwxrwxrwx 0/0               0 2019-06-02 01:34 sbin/arptables -> xtables-nft-multi
lrwxrwxrwx 0/0               0 2019-06-02 01:34 sbin/arptables-nft -> xtables-nft-multi
lrwxrwxrwx 0/0               0 2019-06-02 01:34 sbin/arptables-nft-restore -> xtables-nft-multi
lrwxrwxrwx 0/0               0 2019-06-02 01:34 sbin/arptables-nft-save -> xtables-nft-multi
lrwxrwxrwx 0/0               0 2019-06-02 01:34 sbin/arptables-restore -> xtables-nft-multi
lrwxrwxrwx 0/0               0 2019-06-02 01:34 sbin/arptables-save -> xtables-nft-multi
lrwxrwxrwx 0/0               0 2019-06-02 01:34 sbin/arptables-translate -> xtables-nft-multi
lrwxrwxrwx 0/0               0 2019-06-02 01:34 sbin/ebtables -> xtables-nft-multi
lrwxrwxrwx 0/0               0 2019-06-02 01:34 sbin/ebtables-nft -> xtables-nft-multi
lrwxrwxrwx 0/0               0 2019-06-02 01:34 sbin/ebtables-nft-restore -> xtables-nft-multi
lrwxrwxrwx 0/0               0 2019-06-02 01:34 sbin/ebtables-nft-save -> xtables-nft-multi
lrwxrwxrwx 0/0               0 2019-06-02 01:34 sbin/ebtables-restore -> xtables-nft-multi
lrwxrwxrwx 0/0               0 2019-06-02 01:34 sbin/ebtables-save -> xtables-nft-multi
lrwxrwxrwx 0/0               0 2019-06-02 01:34 sbin/ebtables-translate -> xtables-nft-multi
lrwxrwxrwx 0/0               0 2019-06-02 01:34 sbin/ip6tables -> xtables-nft-multi
lrwxrwxrwx 0/0               0 2019-06-02 01:34 sbin/ip6tables-apply -> iptables-apply
lrwxrwxrwx 0/0               0 2019-06-02 01:34 sbin/ip6tables-legacy -> xtables-legacy-multi
lrwxrwxrwx 0/0               0 2019-06-02 01:34 sbin/ip6tables-legacy-restore -> xtables-legacy-multi
lrwxrwxrwx 0/0               0 2019-06-02 01:34 sbin/ip6tables-legacy-save -> xtables-legacy-multi
lrwxrwxrwx 0/0               0 2019-06-02 01:34 sbin/ip6tables-nft -> xtables-nft-multi
lrwxrwxrwx 0/0               0 2019-06-02 01:34 sbin/ip6tables-nft-restore -> xtables-nft-multi
lrwxrwxrwx 0/0               0 2019-06-02 01:34 sbin/ip6tables-nft-save -> xtables-nft-multi
lrwxrwxrwx 0/0               0 2019-06-02 01:34 sbin/ip6tables-restore -> xtables-nft-multi
lrwxrwxrwx 0/0               0 2019-06-02 01:34 sbin/ip6tables-restore-translate -> xtables-nft-multi
lrwxrwxrwx 0/0               0 2019-06-02 01:34 sbin/ip6tables-save -> xtables-nft-multi
lrwxrwxrwx 0/0               0 2019-06-02 01:34 sbin/ip6tables-translate -> xtables-nft-multi
lrwxrwxrwx 0/0               0 2019-06-02 01:34 sbin/iptables -> xtables-nft-multi
-rwxr-xr-x 0/0            7052 2019-06-02 01:34 sbin/iptables-apply
lrwxrwxrwx 0/0               0 2019-06-02 01:34 sbin/iptables-legacy -> xtables-legacy-multi
lrwxrwxrwx 0/0               0 2019-06-02 01:34 sbin/iptables-legacy-restore -> xtables-legacy-multi
lrwxrwxrwx 0/0               0 2019-06-02 01:34 sbin/iptables-legacy-save -> xtables-legacy-multi
lrwxrwxrwx 0/0               0 2019-06-02 01:34 sbin/iptables-nft -> xtables-nft-multi
lrwxrwxrwx 0/0               0 2019-06-02 01:34 sbin/iptables-nft-restore -> xtables-nft-multi
lrwxrwxrwx 0/0               0 2019-06-02 01:34 sbin/iptables-nft-save -> xtables-nft-multi
lrwxrwxrwx 0/0               0 2019-06-02 01:34 sbin/iptables-restore -> xtables-nft-multi
lrwxrwxrwx 0/0               0 2019-06-02 01:34 sbin/iptables-restore-translate -> xtables-nft-multi
lrwxrwxrwx 0/0               0 2019-06-02 01:34 sbin/iptables-save -> xtables-nft-multi
lrwxrwxrwx 0/0               0 2019-06-02 01:34 sbin/iptables-translate -> xtables-nft-multi
-rwxr-xr-x 0/0           79632 2019-06-02 01:34 sbin/xtables-legacy-multi
lrwxrwxrwx 0/0               0 2019-06-02 01:34 sbin/xtables-monitor -> xtables-nft-multi
-rwxr-xr-x 0/0          197856 2019-06-02 01:34 sbin/xtables-nft-multi

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so it basically changes "default" symlinks like iptables but iptables-legacy still points to legacy version

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should probably drop iptables-legacy completely, for 1.10 with cgroups v1 (including kernel support).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, perhaps if no client complains. Should we add this to deprecation maybe?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We never even documented that it exists, it should only be used by CNI plugins, and we want them to use nftables always.

@smira
Copy link
Member Author

smira commented Dec 6, 2024

/m

@talos-bot talos-bot merged commit 9cf35be into siderolabs:main Dec 6, 2024
14 checks passed
smira added a commit to smira/talos that referenced this pull request Dec 6, 2024
These are used by CNI plugins.

Fixes siderolabs#9883

See siderolabs/pkgs#1106

Signed-off-by: Andrey Smirnov <[email protected]>
smira added a commit to smira/talos that referenced this pull request Dec 6, 2024
These are used by CNI plugins.

Fixes siderolabs#9883

See siderolabs/pkgs#1106

Signed-off-by: Andrey Smirnov <[email protected]>
smira added a commit to smira/talos that referenced this pull request Dec 9, 2024
These are used by CNI plugins.

Fixes siderolabs#9883

See siderolabs/pkgs#1106

Signed-off-by: Andrey Smirnov <[email protected]>
(cherry picked from commit 07220fe)
@smira smira mentioned this pull request Dec 11, 2024
smira added a commit to smira/talos that referenced this pull request Dec 12, 2024
These are used by CNI plugins.

Fixes siderolabs#9883

See siderolabs/pkgs#1106

Signed-off-by: Andrey Smirnov <[email protected]>
(cherry picked from commit 07220fe)
smira added a commit to smira/talos that referenced this pull request Dec 12, 2024
These are used by CNI plugins.

Fixes siderolabs#9883

See siderolabs/pkgs#1106

Signed-off-by: Andrey Smirnov <[email protected]>
(cherry picked from commit 07220fe)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Backported
Status: Backported
Development

Successfully merging this pull request may close these issues.

4 participants