moby/libnetwork/netutils
Cory Snider 1b64f2e28b libnetwork: stop caching global netlink handle
The global netlink handle ns.NlHandle() is indirectly cached for the
life of the process by the netutils.CheckRouteOverlaps() function. This
caching behaviour is a problem for the libnetwork unit tests as the
global netlink handle changes every time testutils.SetupTestOSContext()
is called, i.e. at the start of nearly every test case. Route overlaps
can be checked for in the wrong network namespace, causing spurious test
failures e.g. when running the same test twice in a row with -count=2.
Stop the netlink handle from being cached by shadowing the package-scope
variable with a function-scoped one.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2022-11-08 17:58:06 -05:00
..
utils.go netutils: minor cleanups 2021-06-17 10:49:48 +02:00
utils_freebsd.go Fix libnetwork imports 2021-06-01 21:51:23 +00:00
utils_linux.go libnetwork: stop caching global netlink handle 2022-11-08 17:58:06 -05:00
utils_linux_test.go Only check if route overlaps routes with scope: LINK 2021-08-25 10:58:06 +02:00
utils_windows.go Fix libnetwork imports 2021-06-01 21:51:23 +00:00