moby/libnetwork/osl
Cory Snider 992dc33fc5 libnetwork/osl: restore the right thread's netns
osl.setIPv6 mistakenly captured the calling goroutine's thread's network
namespace instead of the network namespace of the thread getting its
namespace temporarily changed. As this function appears to only be
called from contexts in the process's initial network namespace, this
mistake would be of little consequence at runtime. The libnetwork unit
tests, on the other hand, unshare network namespaces so as not to
interfere with each other or the host's network namespace. But due to
this bug, the isolation backfires and the network namespace of
goroutines used by a test which are expected to be in the initial
network namespace can randomly become the isolated network namespace of
some other test. Symptoms include a loopback network server running in
one goroutine being inexplicably and randomly being unreachable by a
client in another goroutine.

Capture the original network namespace of the thread from the thread to
be tampered with, after locking the goroutine to the thread.

Signed-off-by: Cory Snider <csnider@mirantis.com>
(cherry picked from commit 6d79864135)
Signed-off-by: Cory Snider <csnider@mirantis.com>
2023-05-23 11:31:28 -04:00
..
kernel all: replace strings.Replace with strings.ReplaceAll 2022-05-09 19:45:40 +08:00
interface_linux.go libnetwork/osl: unify stubs for IfaceOption 2023-04-28 20:20:58 +02:00
interface_unsupported.go libnetwork/osl: unify stubs for IfaceOption 2023-04-28 20:20:58 +02:00
namespace_linux.go libnetwork/osl: restore the right thread's netns 2023-05-23 11:31:28 -04:00
namespace_unsupported.go Update to Go 1.17.0, and gofmt with Go 1.17 2021-08-24 23:33:27 +02:00
namespace_windows.go libnetwork: drop InitOSContext() 2022-10-25 13:35:44 -04:00
neigh_linux.go libnetwork/osl: unify stubs for NeighOption 2023-04-28 20:20:58 +02:00
neigh_unsupported.go libnetwork/osl: unify stubs for NeighOption 2023-04-28 20:20:58 +02:00
options_linux.go Add service virtual IP to sandbox's loopback address 2017-08-08 16:16:45 -07:00
route_linux.go libnetwork: fix empty-lines (revive) 2022-09-26 19:21:58 +02:00
sandbox.go libnetwork/osl: unify stubs for NeighOption 2023-04-28 20:20:58 +02:00
sandbox_freebsd.go libnetwork: drop InitOSContext() 2022-10-25 13:35:44 -04:00
sandbox_linux_test.go [chore] clean up reexec.Init() calls 2023-05-11 16:31:41 +02:00
sandbox_unsupported.go Update to Go 1.17.0, and gofmt with Go 1.17 2021-08-24 23:33:27 +02:00
sandbox_unsupported_test.go Update to Go 1.17.0, and gofmt with Go 1.17 2021-08-24 23:33:27 +02:00