Skip to content

netfilter: preserve legacy iptables and conntrack across checkpoints - #17027

Open
hky1999 wants to merge 2 commits into
google:masterfrom
hky1999:upstream/dind-netfilter-20261105
Open

hky1999 wants to merge 2 commits into
google:masterfrom
hky1999:upstream/dind-netfilter-20261105

Conversation

@hky1999

@hky1999 hky1999 commented Nov 5, 2026 •

Copy link
Copy Markdown

Series #17025, PR 2/3, stacked on #17026. Related: #16670, #4595.

Preserve legacy iptables rules and conntrack together so restored Docker networking retains filtering and NAT state. Restore matcher/target state, rebind stack-dependent references, rehash original/reply tuples, and retain saved tables during destination configuration. This contributes AKernel's independently developed downstream implementation.

Two minimal dataplane regressions accompany this commit:

  • FilterDropAndRemovalAcrossSave: UDP passes initially, is dropped after installing INPUT DROP, remains blocked after restore, and passes after rule removal.
  • EstablishedDNATMappingAcrossSaveWithoutMatchingRule: establish a bidirectional IPv4 UDP address/port mapping, replace its matching rule with a nonmatching rule, then save. The original sockets must work after restore, while a fresh tuple must not inherit the mapping. Replaying rules cannot reconstruct the original flow and hide missing conntrack state.

Validation at ee441833bcd6eed16ae63daf31a53a4024f3ee2c on frozen master deb6b3ea1355ea9798c043cf33bc02804e86ed53: both cases pass native Linux and netfilter-prefix systrap ordinary/save/save-resume, without skips. On the topology-only prefix, both reach restore and fail the post-restore dataplane checks. These tests do not require #16666. The complete release builds; source lint and changed-source C++ lint pass. The baseline full-lint limitation is recorded in #17025.

Run with CAP_NET_ADMIN, CAP_SYS_ADMIN and CAP_NET_RAW; both cases must execute without skips:

bazel test -c opt \
  //test/syscalls:iptables_test_native \
  //test/syscalls:iptables_test_runsc_systrap_save \
  //test/syscalls:iptables_test_runsc_systrap_save_resume \
  --test_env='GTEST_FILTER=IPTablesCheckpointTest.*' \
  --test_output=all --nocache_test_results

Scope: legacy iptables. Existing TCP NAT, broader SNAT/target coverage, expiry, restore-time readiness, failure cleanup and performance remain to be qualified in #17025. The combined DinD TCP fixture applies #16666 separately.

Compatibility: COMPATIBILITY:NEW-APP-CONFIG — runtime-programmed legacy networking with sandbox C/R.

@google-cla

google-cla Bot commented Nov 5, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

hky1999 and others added 2 commits November 12, 2026 14:30
…store

Keep in-memory bridge, veth and child loopback NICs in the existing
preservedNICs registry. Preserve child network stacks and quiesce every
namespace during save. Restore topology in all namespaces, start endpoint
recovery in all of them, then wait for global TCP dependencies.

Recreate veth queues, save bridge FDB entries and retain the NIC ID high
watermark. Host-backed interfaces and their external routes continue to
come from destination network configuration.

Register nested clone/unshare namespaces with the kernel root while
retaining the creating task's user namespace. Cover both operations
with and without CLONE_NEWUSER, including link administration in the
new namespace.

Add a cooperative-save syscall regression for a bridge/veth path to a
namespace retained by descriptors after its creating thread exits. Check
original sockets, interface identity and subsequent NIC allocation.

Co-authored-by: Tianyu Zhou <lufeihaizei2008@gmail.com>
Assisted-by: Codex
Suggested-by: Tamir Duberstein <tamird@gmail.com>
…oints

Save the rule graph and tracked connections together. Restore current
matcher wrappers and TCP state handlers, redraw hash seeds from the
stack's secure RNG, and rehash both directions before processing packets.
Retain the completed connection-finalization state after deserialization.

Stop the conntrack reaper during serialization, invalidate stale queued
callbacks, release source locks on resume, and restart restored workers
only after clocks and endpoint recovery are ready. Leave nftables state
outside this change.

Add native-controlled cooperative-save syscall regressions for UDP DROP
enforcement and an existing UDP DNAT address/port mapping after its
matching rule is replaced. Check that new tuples do not reuse that mapping.

Co-authored-by: Tianyu Zhou <lufeihaizei2008@gmail.com>
Assisted-by: Codex
@hky1999
hky1999 force-pushed the upstream/dind-netfilter-20261105 branch from bbd5ec4 to ee44183 Compare November 12, 2026 07:22
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

Successfully merging this pull request may close these issues.

1 participant