-
Notifications
You must be signed in to change notification settings - Fork 2.6k
--network=pasta:--map-gw
breaks subsequent network option parsing
#22477
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Labels
kind/bug
Categorizes issue or PR as related to a bug.
locked - please file new issue/PR
Assist humans wanting to comment on an old issue or PR with locked comments.
network
Networking related issue or feature
pasta
pasta(1) bugs or features
Comments
Uh oh, I guess |
@sbrivio-rh yes we shouldn't modify the slice while iterating over it. I work on a proper fix. |
Luap99
added a commit
to Luap99/common
that referenced
this issue
Apr 24, 2024
If a port option was given after --map-gw then parsing failed as the next arg was always skipped due the modification of the slice. Modifing the slice inside the loop is bad and does not do what some might think. Append here basically creates a new slice (thus you always have to assign the result to the variable) with the same pointer to the same underlying array of data[1]. The loop however will still continue to loop over the slice as it saw it at the begining of the loop. So in the bug case the underlying array would look like this: {"--config-net", "--map-gw", "-T", "80"} and after the append call to remove --map-gw like this: {"--config-net", "-T", "80", "80"} The loop iterator has no idea this happen and just moves to the next index 2 ("80") and thus we never passed "-T" causing this bug. [1] https://go.dev/blog/slices-intro Fixes containers/podman#22477 Signed-off-by: Paul Holzinger <pholzing@redhat.com>
Opened containers/common#1966 |
Luap99
added a commit
to Luap99/common
that referenced
this issue
Apr 24, 2024
If a port option was given after --map-gw then parsing failed as the next arg was always skipped due the modification of the slice. Modifing the slice inside the loop is bad and does not do what some might think. Append here basically creates a new slice (thus you always have to assign the result to the variable) with the same pointer to the same underlying array of data[1]. The loop however will still continue to loop over the slice as it saw it at the begining of the loop. So in the bug case the underlying array would look like this: {"--config-net", "--map-gw", "-T", "80"} and after the append call to remove --map-gw like this: {"--config-net", "-T", "80", "80"} The loop iterator has no idea this happen and just moves to the next index 2 ("80") and thus we never passed "-T" causing this bug. [1] https://go.dev/blog/slices-intro Fixes containers/podman#22477 Signed-off-by: Paul Holzinger <pholzing@redhat.com>
# for free
to subscribe to this conversation on GitHub.
Already have an account?
#.
Labels
kind/bug
Categorizes issue or PR as related to a bug.
locked - please file new issue/PR
Assist humans wanting to comment on an old issue or PR with locked comments.
network
Networking related issue or feature
pasta
pasta(1) bugs or features
Issue Description
Using the
--network=pasta:--map-gw
option breaks the parsing of subsequent network options.fails while this works:
Steps to reproduce the issue
Steps to reproduce the issue
podman run -it --rm --network=pasta:--map-gw,-T,9129 archlinux /bin/bash
Describe the results you received
Describe the results you expected
The container should start with the expected network configuration.
podman info output
Podman in a container
No
Privileged Or Rootless
Rootless
Upstream Latest Release
Yes
Additional environment details
Additional environment details
Additional information
Additional information like issue happens only occasionally or issue happens with a particular architecture or on a particular setting
The text was updated successfully, but these errors were encountered: