summaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
authoropenshift-ci[bot] <75433959+openshift-ci[bot]@users.noreply.github.com>2022-07-07 11:55:30 +0000
committerGitHub <noreply@github.com>2022-07-07 11:55:30 +0000
commit48c892324899553415f1a9746c680263898d0ca0 (patch)
tree3e170269ac3427d88f3ba56d943bb09beca03f23 /pkg
parentf3533a312fb4b2f0eb88e9d53fb31d1580b182a6 (diff)
parentee05bc031882cd47cf402f55e1bfefbe83ecb3c0 (diff)
downloadpodman-48c892324899553415f1a9746c680263898d0ca0.tar.gz
podman-48c892324899553415f1a9746c680263898d0ca0.tar.bz2
podman-48c892324899553415f1a9746c680263898d0ca0.zip
Merge pull request #14673 from idleroamer/fix-network-inspect-main
Fix network inspect compat API discrepancy
Diffstat (limited to 'pkg')
-rw-r--r--pkg/api/handlers/compat/containers.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/pkg/api/handlers/compat/containers.go b/pkg/api/handlers/compat/containers.go
index 38fe0196a..ae063dc9f 100644
--- a/pkg/api/handlers/compat/containers.go
+++ b/pkg/api/handlers/compat/containers.go
@@ -397,6 +397,15 @@ func LibpodToContainer(l *libpod.Container, sz bool) (*handlers.Container, error
}, nil
}
+func convertSecondaryIPPrefixLen(input *define.InspectNetworkSettings, output *types.NetworkSettings) {
+ for index, ip := range input.SecondaryIPAddresses {
+ output.SecondaryIPAddresses[index].PrefixLen = ip.PrefixLength
+ }
+ for index, ip := range input.SecondaryIPv6Addresses {
+ output.SecondaryIPv6Addresses[index].PrefixLen = ip.PrefixLength
+ }
+}
+
func LibpodToContainerJSON(l *libpod.Container, sz bool) (*types.ContainerJSON, error) {
_, imageName := l.Image()
inspect, err := l.Inspect(sz)
@@ -587,6 +596,9 @@ func LibpodToContainerJSON(l *libpod.Container, sz bool) (*types.ContainerJSON,
if err := json.Unmarshal(n, &networkSettings); err != nil {
return nil, err
}
+
+ convertSecondaryIPPrefixLen(inspect.NetworkSettings, &networkSettings)
+
// do not report null instead use an empty map
if networkSettings.Networks == nil {
networkSettings.Networks = map[string]*network.EndpointSettings{}