mirror of
https://github.com/containers/podman.git
synced 2025-07-03 09:17:15 +08:00
libpod: fix a crash in 'kube generate' on FreeBSD
For containers using host networking, 'kube generate' crashed in (*Container).HostNetwork which dereferenced config.Spec.Linux without checking if its non-nil, which is the case for FreeBSD containers. [NO NEW TESTS NEEDED] Signed-off-by: Doug Rabson <dfr@rabson.org>
This commit is contained in:
@ -1210,11 +1210,13 @@ func (c *Container) HostNetwork() bool {
|
||||
if c.config.CreateNetNS || c.config.NetNsCtr != "" {
|
||||
return false
|
||||
}
|
||||
if c.config.Spec.Linux != nil {
|
||||
for _, ns := range c.config.Spec.Linux.Namespaces {
|
||||
if ns.Type == spec.NetworkNamespace {
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user