Skip to content

ns: remove obsolete conntrack module loading, simplify, and remove logging - #49

Merged
thaJeztah merged 2 commits into
moby:mainfrom
thaJeztah:cleanup_ns
Oct 15, 2026
Merged

thaJeztah merged 2 commits into
moby:mainfrom
thaJeztah:cleanup_ns

Conversation

@thaJeztah

Copy link
Copy Markdown
Member

ns: remove obsolete conntrack module loading

The modprobe logic was inherited from libnetwork, where it was added
for conntrack support in moby/libnetwork@ac1e2ea.

IPVS does not use this functionality, and loading kernel modules is
not necessary for detecting supported netlink families.

Remove the module loading and retain socket-based capability detection
for NETLINK_XFRM and NETLINK_NETFILTER. Also remove the associated
warnings for unavailable optional features.

ns: simplify initialization and remove logging

Replace the manually managed sync.Once and global handles with
sync.OnceValue to ensure initialization only happens once, including
when Init is called directly.

Preserve initialization errors internally so SetNamespace can return
them, while keeping the existing exported API unchanged.

Avoid using partially initialized handles, clean up on failure, and
remove the logrus dependency from the package.

The modprobe logic was inherited from libnetwork, where it was added
for conntrack support in [moby/libnetwork@ac1e2ea].

IPVS does not use this functionality, and loading kernel modules is
not necessary for detecting supported netlink families.

Remove the module loading and retain socket-based capability detection
for NETLINK_XFRM and NETLINK_NETFILTER. Also remove the associated
warnings for unavailable optional features.

[moby/libnetwork@ac1e2ea]: moby/libnetwork@ac1e2ea

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>

This comment was marked as resolved.

Replace the manually managed sync.Once and global handles with
sync.OnceValue to ensure initialization only happens once, including
when Init is called directly.

Preserve initialization errors internally so SetNamespace can return
them, while keeping the existing exported API unchanged.

Avoid using partially initialized handles, clean up on failure, and
remove the logrus dependency from the package.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

The focused changes correctly remove unused module loading while improving initialization error handling and cleanup.

0 open findings

1 resolved since last review

🧠 Review effort: Balanced

@thaJeztah
thaJeztah requested review from robmry and vvoland October 14, 2026 11:02
@thaJeztah

Copy link
Copy Markdown
Member Author

FWIW; planning to deprecate this package as a whole; I couldn't find any importers beyond this module itself, and that was only as part of tests; removing that in the other PR;

@thaJeztah
thaJeztah merged commit 42b4839 into moby:main Oct 15, 2026
5 checks passed
@thaJeztah
thaJeztah deleted the cleanup_ns branch October 15, 2026 20:52
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.

3 participants