spiegel_podman/pkg/specgen
Paul Holzinger 19c579826a
pkg/specgen: fix port conflict on host assignment
This fixes two problems when parsing ports.

First, check for host port conflicts. When we are given the same ip:host
port combo twice then we need to reject that as invalid, the backend
cannot bind the same port twice and thus we always get a runtime
failure. Failing early in the create code path is much better.

Second, when assigning random ports for expose we still have to check
for proper conflicts. The first error was using allUsedContainerPortsMap
to check for conflicts but this holds container side ports, we need to
ensure there are no conflicts on the host port.

Then there was the other issue that the array in the map was copied and
accessed by value on lookup. And because the code did not reassign the
value it then failed to actually update the correct ports.
To address that I switch the map to store the array by reference which
will avoid the bigger copies as we only need to update the pointer now.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2026-06-09 16:12:35 +02:00
..
generate pkg/specgen: fix port conflict on host assignment 2026-06-09 16:12:35 +02:00
container_validate.go RUN-4539: Change podman module paths 2026-04-22 14:02:25 -05:00
namespaces.go RUN-4539: Change podman module paths 2026-04-22 14:02:25 -05:00
namespaces_test.go Move to deterministic network setup order 2026-04-17 10:00:32 -04:00
pod_validate.go Remove Slirp network mode constant and error on usage 2026-04-13 08:22:36 -04:00
podspecgen.go Update stale comments referencing slirp4netns 2026-04-27 10:22:26 -04:00
resources_freebsd.go lint: reenable revive unused-parameter check 2025-10-01 10:42:08 -04:00
resources_linux.go vendor: update common, image, storage to main 2025-11-21 14:24:29 +01:00
specgen.go Update stale comments referencing slirp4netns 2026-04-27 10:22:26 -04:00
specgen_local.go Switch common, storage and image to monorepo. 2025-09-01 12:33:04 +02:00
specgen_remote.go chore: delete obsolete // +build lines 2024-01-04 11:53:38 +02:00
specgen_test.go Convert SpecGen values to be nullable where possible 2024-01-30 10:42:24 -05:00
utils.go lint: reenable revive unused-parameter check 2025-10-01 10:42:08 -04:00
utils_linux.go pkg/specgen: error out when a block device isn't 2025-06-10 13:50:02 -07:00
volumes.go RUN-4539: Change podman module paths 2026-04-22 14:02:25 -05:00
volumes_linux_test.go fix: mounting issue with single character volume on windows 2025-03-26 17:57:52 +01:00
volumes_windows_test.go [Fixes: #27571] Fix 'shouldResolveWinPaths' returning 'false' on Windows 2025-11-21 15:32:39 +03:00
winpath.go Introduce podman machine cp command 2025-02-28 09:56:46 -05:00
winpath_linux.go [Fixes: #27571] Fix 'shouldResolveWinPaths' returning 'false' on Windows 2025-11-21 15:32:39 +03:00
winpath_unsupported.go lint: reenable revive unused-parameter check 2025-10-01 10:42:08 -04:00
winpath_windows.go lint: reenable revive unused-parameter check 2025-10-01 10:42:08 -04:00