Repository navigation
virtio-linux, microvm-rootfs: add nftables socket support and nft to the guest - #798
Conversation
…the guest The guest minimald loads its host-address classifier table (inet minimal_class) inside the microVM, from the same ruleset text the native installer renders. Its `socket cgroupv2 level N` matches need NFT_SOCKET, which has no default and so stays off after olddefconfig, and the rootfs ships no nft binary. virtio-linux: want NFT_SOCKET, and assert NF_SOCKET_IPV4, NF_SOCKET_IPV6, SOCK_CGROUP_DATA and NFT_REJECT_INET, which follow from it and from symbols already on. The rest of the table's dependencies (nf_tables core, ct, nat, limit, log, reject) are already in the want list. microvm-rootfs: pin nftables-1.1.6-r1 and its missing closure (gmp, jansson, libnftnl) from Alpine v3.24 main; libmnl and readline are already pinned. build.sh asserts /usr/sbin/nft lands in the image.
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: gominimal/pkgs/.coderabbit.yaml Review profile: CHILL Plan: Essentials Run ID: 📒 Files selected for processing (3)
Included review availability: This review used your included allowance. 0 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 2 reviews per hour. 📝 WalkthroughWalkthroughThe guest rootfs build adds nftables and its shared-library dependencies, and checks for ChangesGuest nftables support
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~10 minutes Change: Feature Suggested reviewers: Merge Risk: ⚪ Minimal · up to No actionable merge-blocking issue is established. The guest-level classifier check remains useful validation when the build is available. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
…mirrored to gs://) The four new apks were pinned but never uploaded, so the build 404'd on nftables-1.1.6-r1. All eight (4 apks x 2 arches) are now under gs://minimal-staging-archives/alpine/v3.24/main/, byte-identical to the pins. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
What
packages/virtio-linux/build.sh: the guest kernel gains the nftablessocketexpression.NFT_SOCKETjoins thewantlist.NF_SOCKET_IPV4,NF_SOCKET_IPV6,SOCK_CGROUP_DATAandNFT_REJECT_INETare added beside it as asserts. They follow fromNFT_SOCKETand from symbols already on. The rest of the ruleset's dependency set is already in thewantlist and asserted, so it is not repeated:NF_TABLES,NF_TABLES_INET/IPV4/IPV6,NFT_CT,NF_CONNTRACK,NFT_NAT,NF_NAT,NFT_LIMIT,NFT_LOG,NF_LOG_SYSLOGandNFT_REJECT/IPV4/IPV6.packages/microvm-rootfs/build.ncl: the rootfs shipsnftand its libraries, so the in-VM classifier can load rules.nftablesgoes in the guest-tools group and its three missing libraries go in the shared-library closure, each alphabetical within its group.libmnl-1.0.5-r2andreadline-8.3.3-r1are already pinned, and musl and/bin/shcome from the minirootfs.packages/microvm-rootfs/build.sh:usr/sbin/nftjoins the staged-rootfs assert, which carries one entry per root package.Why
The box-networking guest egress classifier needs
nftin the guest. minimal is moving its host-address classifier table (inet minimal_class) into the microVM guest (gominimal/minimal#1812). The guest loads the same ruleset text the native installer renders. That table matchessocket cgroupv2 level N "<path>", which needsNFT_SOCKET. Its tristate has no default, soolddefconfigleaves it off, and the kernel ships no modules. The rootfs has nonftbinary.NFT_REDIRis not needed: the table usesdnat, notredirect.Alpine apks (v3.24
main, same version on both arches)aarch64) sha256x86_64) sha256gmp-6.3.0-r44dab6e86b850fe1b5bc0cf2fac17efa4d7f648bea44f3d9019694cc1e1cb12b785323ef5bce8ff234736dc2d6592ea37aebdc6348a531e27430bdfe38364d256jansson-2.15.0-r0a13822f5ca1772cced4bb7d3d178ec5dee770d8accba5b4816b2ddc413e6f0557681b41486e1f2b2efce11875c839533464ae8857d30fc49130f0039c6585fdblibnftnl-1.3.1-r08b31395671e910c294d7f0e29d3ac3c7efe9d89264db255f39aa9944dd4b6cac2f4cf35959fde00fdba0dd35ef12a6739739b504e8319c97e30bd4834f98d924nftables-1.1.6-r1e350dc0ae7667486f925a6719add6df562055799baf0e402077ef2b11839ac9eedca96e6160479bd734bb6cdb8412f84f689c6a771fdec75ce2c1c18f3e7cf42Prerequisite: mirror the apks before CI can pass
Important
Not done by this PR (needs bucket access). The build cannot pass until it is.
The rootfs fetches from the staging mirror, not dl-cdn (see the
build.nclheader). These eight objects must be copied there before themicrovm-rootfsbuild can fetch them. Each source is the same path onhttps://dl-cdn.alpinelinux.org/alpine/v3.24/main/<arch>/:Verification
dl-cdn.alpinelinux.org/alpine/v3.24/main/{aarch64,x86_64}/. Its sha256 matches the value pinned inbuild.ncl.nftables.PKGINFOdepends onso:libgmp.so.10,so:libjansson.so.4,so:libmnl.so.0,so:libnftnl.so.11,so:libreadline.so.8, musl and/bin/sh.libnftnldepends onlibmnland musl, andgmpandjanssondepend only on musl. The closure is complete with these four added.nftablespayload carriesusr/sbin/nftandusr/lib/libnftables.so.1. Its only install script is.post-upgrade, which migrates old rules-file locations and is moot for a fresh tar overlay.bash -nandshellcheckare clean on bothbuild.shfiles.virtio-linuxpost-olddefconfigassert and themicrovm-rootfsstaged-path assert are the checks, and the CI builds run them. The end-to-end check isnft -c -fof the ruleset in gominimal/minimal#1812, run inside a guest booted from this kernel and rootfs. It runs on the minimal side oncelocked_commitmoves here.Summary by CodeRabbit