Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 13 additions & 11 deletions libpod/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -1459,18 +1459,20 @@ func (c *Container) NetworkMode() string {
// If there is none, it's host networking.
// If there is one and it has a path, it's "ns:".
foundNetNS := false
for _, ns := range ctrSpec.Linux.Namespaces {
if ns.Type == spec.NetworkNamespace {
foundNetNS = true
if ns.Path != "" {
networkMode = fmt.Sprintf("ns:%s", ns.Path)
} else {
// We're making a network ns, but not
// configuring with Slirp or CNI. That
// means it's --net=none
networkMode = "none"
if ctrSpec.Linux != nil {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

how is --network none vs --network host handled on freebsd spec? In general this change would make it that you display host even when created with network none or network ns:/somepath (though I guess this does not work at all)

Copy link
Copy Markdown
Contributor Author

@dfr dfr Mar 18, 2026

Choose a reason for hiding this comment

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

Right now, --network=none is broken - it behaves the same as --network=host.

With the FreeBSD OCI runtime extension, it is possible to represent --network=none by creating a private vnet for the jail which is not bridged to any network. I have a work-in-progress which adds support for the new FreeBSD OCI runtime bits but its currently blocked waiting for opencontainers/runtime-tools#801 which adds support in the runtime-tools library.

for _, ns := range ctrSpec.Linux.Namespaces {
if ns.Type == spec.NetworkNamespace {
foundNetNS = true
if ns.Path != "" {
networkMode = fmt.Sprintf("ns:%s", ns.Path)
} else {
// We're making a network ns, but not
// configuring with Slirp or CNI. That
// means it's --net=none
networkMode = "none"
}
break
}
break
}
}
if !foundNetNS {
Expand Down