mirror of
https://github.com/containers/podman.git
synced 2025-05-20 08:36:23 +08:00

This replaces the NetworkJail string field with a struct pointer named NetNS. This does not try to emulate the complete NetNS interface but does help to re-use code that just refers to c.state.NetNS. [NO NEW TESTS NEEDED] Signed-off-by: Doug Rabson <dfr@rabson.org>
26 lines
621 B
Go
26 lines
621 B
Go
//go:build freebsd
|
|
// +build freebsd
|
|
|
|
package libpod
|
|
|
|
// replaceNetNS handle network namespace transitions after updating a
|
|
// container's state.
|
|
func replaceNetNS(netNSPath string, ctr *Container, newState *ContainerState) error {
|
|
if netNSPath != "" {
|
|
// On FreeBSD, we just record the network jail's name in our state.
|
|
newState.NetNS = &jailNetNS{Name: netNSPath}
|
|
} else {
|
|
newState.NetNS = nil
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// getNetNSPath retrieves the netns path to be stored in the database
|
|
func getNetNSPath(ctr *Container) string {
|
|
if ctr.state.NetNS != nil {
|
|
return ctr.state.NetNS.Name
|
|
} else {
|
|
return ""
|
|
}
|
|
}
|