mirror of
https://github.com/containers/podman.git
synced 2025-10-19 04:03:23 +08:00
ps: do not loop over port protocol
This can never included a comma in the protocol so it just complicated things for no reason, we never needed this and commit edc3dc5e11 already ensures this cannot happen. Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
@ -497,17 +497,14 @@ func portsToString(ports []types.PortMapping, exposedPorts map[uint16][]string)
|
||||
if hostIP == "" {
|
||||
hostIP = "0.0.0.0"
|
||||
}
|
||||
protocols := strings.Split(port.Protocol, ",")
|
||||
for _, protocol := range protocols {
|
||||
if port.Range > 1 {
|
||||
fmt.Fprintf(sb, "%s:%d-%d->%d-%d/%s, ",
|
||||
hostIP, port.HostPort, port.HostPort+port.Range-1,
|
||||
port.ContainerPort, port.ContainerPort+port.Range-1, protocol)
|
||||
} else {
|
||||
fmt.Fprintf(sb, "%s:%d->%d/%s, ",
|
||||
hostIP, port.HostPort,
|
||||
port.ContainerPort, protocol)
|
||||
}
|
||||
if port.Range > 1 {
|
||||
fmt.Fprintf(sb, "%s:%d-%d->%d-%d/%s, ",
|
||||
hostIP, port.HostPort, port.HostPort+port.Range-1,
|
||||
port.ContainerPort, port.ContainerPort+port.Range-1, port.Protocol)
|
||||
} else {
|
||||
fmt.Fprintf(sb, "%s:%d->%d/%s, ",
|
||||
hostIP, port.HostPort,
|
||||
port.ContainerPort, port.Protocol)
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user