libn/d/overlay: test encryption firewall rulesets

Add coverage for the firewall rules which mark VXLAN datagrams for
encryption. Each test joins a fresh network namespace and programs the
rules into the kernel, so the rulesets are asserted as the kernel renders
them rather than as the driver constructs them.

Two orderings are load-bearing for the correctness of the rules, and
neither was pinned by anything but a comment:

 - In iptables mode the rule which strips the encryption mark from
   socket-associated datagrams has to be evaluated after every rule which
   sets that mark, so that it neutralizes the unrestricted rules left
   behind by daemons predating the mark-spoofing fix. Reverting
   programMangleMarkSpoofProtection() to insert its rule at the head of
   the chain rather than appending it fails
   TestMangleMarkSpoofProtectionOrdering.

 - In nftables mode the socket-exists predicate and the statement which
   clears the mark have to precede the mark-setting statement in the
   enc-out chain. The rendered ruleset is asserted against golden files.

The remaining cases cover replacing a legacy rule with the restricted
one, the install and removal lifecycle for two VNIs, and the selection of
ip6tables when the Swarm data plane is IPv6.

Signed-off-by: Cory Snider <csnider@mirantis.com>
Assisted-By: Claude Opus 5
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit fda66a3bc0e742b1f82a6750f6f2f56c6b6adb53)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
4 files changed
tree: 636cd89f56eff1acd43b9a64adcfb54b61dceda5
  1. .devcontainer/
  2. .github/
  3. api/
  4. client/
  5. cmd/
  6. contrib/
  7. daemon/
  8. dockerversion/
  9. docs/
  10. errdefs/
  11. extpoints/
  12. hack/
  13. integration/
  14. integration-cli/
  15. internal/
  16. man/
  17. pkg/
  18. project/
  19. releases/
  20. vendor/
  21. .codecov.yml
  22. .dockerignore
  23. .gitattributes
  24. .gitignore
  25. .golangci.yml
  26. .mailmap
  27. AGENTS.md
  28. AUTHORS
  29. CONTRIBUTING.md
  30. docker-bake.hcl
  31. Dockerfile
  32. Dockerfile.simple
  33. Dockerfile.windows
  34. go.mod
  35. go.sum
  36. LICENSE
  37. MAINTAINERS
  38. Makefile
  39. NOTICE
  40. otelcol-ci-config.yml
  41. README.md
  42. ROADMAP.md
  43. SECURITY.md
  44. TESTING.md
README.md

The Moby Project

PkgGoDev GitHub License OpenSSF Scorecard OpenSSF Best Practices

Moby Project logo

Moby is an open-source project created by Docker to enable and accelerate software containerization.

It provides a “Lego set” of toolkit components, the framework for assembling them into custom container-based systems, and a place for all container enthusiasts and professionals to experiment and exchange ideas. Components include container build tools, a container registry, orchestration tools, a runtime and more, and these can be used as building blocks in conjunction with other tools and projects.

Principles

Moby is an open project guided by strong principles, aiming to be modular, flexible and without too strong an opinion on user experience. It is open to the community to help set its direction.

  • Modular: the project includes lots of components that have well-defined functions and APIs that work together.
  • Batteries included but swappable: Moby includes enough components to build fully featured container systems, but its modular architecture ensures that most of the components can be swapped by different implementations.
  • Usable security: Moby provides secure defaults without compromising usability.
  • Developer focused: The APIs are intended to be functional and useful to build powerful tools. They are not necessarily intended as end user tools but as components aimed at developers. Documentation and UX is aimed at developers not end users.

Audience

The Moby Project is intended for engineers, integrators and enthusiasts looking to modify, hack, fix, experiment, invent and build systems based on containers. It is not for people looking for a commercially supported system, but for people who want to work and learn with open source code.

Relationship with Docker

The components and tools in the Moby Project are initially the open source components that Docker and the community have built for the Docker Project. New projects can be added if they fit with the community goals. Docker is committed to using Moby as the upstream for the Docker Product. However, other projects are also encouraged to use Moby as an upstream, and to reuse the components in diverse ways, and all these uses will be treated in the same way. External maintainers and contributors are welcomed.

The Moby project is not intended as a location for support or feature requests for Docker products, but as a place for contributors to work on open source code, fix bugs, and make the code more useful. The releases are supported by the maintainers, community and users, on a best efforts basis only. For customers who want enterprise or commercial support, Docker Desktop and Mirantis Container Runtime are the appropriate products for these use cases.

Go modules

[!IMPORTANT] Starting with Docker v29 (released November 2025), the Go module github.com/docker/docker is deprecated and won't be updated.

The supported public Go modules are:

ModuleDescription
github.com/moby/moby/clientGo client for the Docker Engine API
github.com/moby/moby/apiAPI types shared between client and server

The root module github.com/moby/moby/v2 is the codebase for building container engines based on Moby (such as Docker Engine). It produces binaries only - it is not intended to be imported as a Go library and has no API stability guarantees.

Release tags

Docker Engine releases are tagged with a docker- prefix (e.g. docker-v29.0.0 for Docker Engine 29.0.0).

These tags are only used to build the Docker Engine binary from the root module - they must not be consumed via go get.

The client and api modules are versioned independently with their own tags (e.g. client/v1.x.x, api/v1.x.x).

Migrating from github.com/docker/docker

Replace the old import paths:

- import "github.com/docker/docker/client"
+ import "github.com/moby/moby/client"

- import "github.com/docker/docker/api/types"
+ import "github.com/moby/moby/api/types"

Note that v29 includes many breaking API changes (option structs, renamed methods, moved types). See the v29.0.0 release notes for the full list of Go SDK changes.


Legal

Brought to you courtesy of our legal counsel. For more context, please see the NOTICE document in this repo.

Use and transfer of Moby may be subject to certain restrictions by the United States and other governments.

It is your responsibility to ensure that your use and/or transfer does not violate applicable laws.

For more information, please see https://www.bis.doc.gov

Licensing

Moby is licensed under the Apache License, Version 2.0. See LICENSE for the full license text.