-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
podman run starts the main process in the container before the slirp4netns ipv6 network is setup #11062
Comments
OK this only affects slirp4netns with ipv6. Podman already waits for slirp4netns to report that it is ready. Therefore I assume slirp4netns does not wait for ipv6 setup to finish before it writes to the readyfd. diff --git a/libpod/networking_slirp4netns.go b/libpod/networking_slirp4netns.go
index 410b377ec..ee717d6d4 100644
--- a/libpod/networking_slirp4netns.go
+++ b/libpod/networking_slirp4netns.go
@@ -16,6 +16,7 @@ import (
"syscall"
"time"
+ "github.com/containernetworking/plugins/pkg/ns"
"github.com/containers/podman/v3/pkg/errorhandling"
"github.com/containers/podman/v3/pkg/rootlessport"
"github.com/containers/podman/v3/pkg/servicereaper"
@@ -310,6 +311,13 @@ func (r *Runtime) setupSlirp4netns(ctr *Container) error {
return err
}
+ ctr.state.NetNS.Do(func(nn ns.NetNS) error {
+ cmd2 := exec.Command("ip", "addr")
+ cmd2.Stdout = os.Stdout
+ cmd2.Stderr = os.Stderr
+ return cmd2.Run()
+ })
+
// Set a default slirp subnet. Parsing a string with the net helper is easier than building the struct myself
_, ctr.slirp4netnsSubnet, _ = net.ParseCIDR(defaultSlirp4netnsSubnet) This will not work: @AkihiroSuda PTAL Any ideas why slirp4netns does not wait until ipv6 setup is done? |
Because The actual setup might be done by the kernel? How can slirp4netns (or Podman) wait for the completion of the setup event? |
I see, it looks like the delay is caused by IPv6 Duplicate Address Detection (DAD). I think we should turn this of in the namespace it is safe to assume that there cannot be a address conflict in the ns, e.g |
friendly ping |
SGTM, perhaps it should be done on Podman side. |
A friendly reminder that this issue had no activity for 30 days. |
Fixes: containers/podman#11062 Signed-off-by: Daniel J Walsh <[email protected]>
Fixes: containers/podman#11062 Signed-off-by: Daniel J Walsh <[email protected]>
When this vendors into Podman and the containers.conf gets released to the field, this will be fixed. |
Fixes: containers#11062 Signed-off-by: Daniel J Walsh <[email protected]>
Duplicate Address Detection slows the ipv6 setup down for 1-2 seconds. Since slirp4netns is run it is own namespace and not directly routed we can skip this to make the ipv6 address immediately available. We change the default to make sure the slirp tap interface gets the correct value assigned so DAD is disabled for it. Also make sure to change this value back to the original after slirp4netns is ready in case users rely on this sysctl. Fixes containers#11062 Signed-off-by: Paul Holzinger <[email protected]>
Duplicate Address Detection slows the ipv6 setup down for 1-2 seconds. Since slirp4netns is run it is own namespace and not directly routed we can skip this to make the ipv6 address immediately available. We change the default to make sure the slirp tap interface gets the correct value assigned so DAD is disabled for it. Also make sure to change this value back to the original after slirp4netns is ready in case users rely on this sysctl. Fixes containers#11062 Signed-off-by: Paul Holzinger <[email protected]>
Is this a BUG REPORT or FEATURE REQUEST? (leave only one on its own line)
/kind bug
If you start a rootless container with slirp4netns:enable_ipv6=true the IPv6 network is not working straight away but only after a short time, like 1-2s
Steps to reproduce the issue:
podman run -it --network slirp4netns:enable_ipv6=true --entrypoint bash fedora:34 -c "curl -v -6 https://www.google.com"
Describe the results you received:
The command fails with
Network is unreachable
.Describe the results you expected:
That the network works straight away.
Additional information you deem important (e.g. issue happens only occasionally):
The problem does not occur when using IPv4 (
-4
instead of-6
).The issue can be seen with podman 3.1.2 and 2.2.1.
Output of
podman version
:Output of
podman info --debug
:Package info (e.g. output of
rpm -q podman
orapt list podman
):Have you tested with the latest version of Podman and have you checked the Podman Troubleshooting Guide? (https://github.com/containers/podman/blob/master/troubleshooting.md)
@Luap99 reproduced this with v3.2.3 with slirp4netns v1.1.8+dev
Additional environment details (AWS, VirtualBox, physical, etc.):
The text was updated successfully, but these errors were encountered: