diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2022-05-03 16:37:54 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-03 16:37:54 -0400 |
commit | 3210a3f4257d19744abd4ae2302018b16edb2507 (patch) | |
tree | 97f6f9e2c4bfd41191971c5658484012ce1b4826 /cmd/rootlessport/main.go | |
parent | 3af1396f269463aa7640e9cf1dcc84a413d99ee0 (diff) | |
parent | 3ab8fa679c57a653f7ea012f79fa453ae8133108 (diff) | |
download | podman-3210a3f4257d19744abd4ae2302018b16edb2507.tar.gz podman-3210a3f4257d19744abd4ae2302018b16edb2507.tar.bz2 podman-3210a3f4257d19744abd4ae2302018b16edb2507.zip |
Merge pull request #14100 from mheon/incremental_backports
[v4.1] Incremental backports
Diffstat (limited to 'cmd/rootlessport/main.go')
-rw-r--r-- | cmd/rootlessport/main.go | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/cmd/rootlessport/main.go b/cmd/rootlessport/main.go index e9ab8b076..5bd35a985 100644 --- a/cmd/rootlessport/main.go +++ b/cmd/rootlessport/main.go @@ -1,3 +1,6 @@ +//go:build linux +// +build linux + package main import ( @@ -307,11 +310,11 @@ func exposePorts(pm rkport.Manager, portMappings []types.PortMapping, childIP st ChildPort: int(port.ContainerPort + i), ChildIP: childIP, } - if err := rkportutil.ValidatePortSpec(spec, nil); err != nil { - return err - } - if _, err := pm.AddPort(ctx, spec); err != nil { - return err + + for _, spec = range splitDualStackSpecIfWsl(spec) { + if err := validateAndAddPort(ctx, pm, spec); err != nil { + return err + } } } } @@ -319,6 +322,17 @@ func exposePorts(pm rkport.Manager, portMappings []types.PortMapping, childIP st return nil } +func validateAndAddPort(ctx context.Context, pm rkport.Manager, spec rkport.Spec) error { + if err := rkportutil.ValidatePortSpec(spec, nil); err != nil { + return err + } + if _, err := pm.AddPort(ctx, spec); err != nil { + return err + } + + return nil +} + func child() error { // load the config from the parent var opaque map[string]string |