summaryrefslogtreecommitdiffhomepage
path: root/pkg/test/dockerutil/container.go
diff options
context:
space:
mode:
authorKevin Krakauer <krakauer@google.com>2020-06-14 22:40:46 -0700
committerKevin Krakauer <krakauer@google.com>2020-07-28 10:51:14 -0700
commitd9c9420335a78b54bc04ec0639d89539b4c3972c (patch)
treeab69c3973150a3931f2814349ca3dada75f0eadb /pkg/test/dockerutil/container.go
parenta05ea20ef1107cc0a4ace94d6dffd7c7e590b264 (diff)
ip6tables testing
We skip gVisor tests for now, as ip6tables aren't yet implemented.
Diffstat (limited to 'pkg/test/dockerutil/container.go')
-rw-r--r--pkg/test/dockerutil/container.go9
1 files changed, 7 insertions, 2 deletions
diff --git a/pkg/test/dockerutil/container.go b/pkg/test/dockerutil/container.go
index b59503188..441173ec2 100644
--- a/pkg/test/dockerutil/container.go
+++ b/pkg/test/dockerutil/container.go
@@ -360,13 +360,18 @@ func (c *Container) SandboxPid(ctx context.Context) (int, error) {
}
// FindIP returns the IP address of the container.
-func (c *Container) FindIP(ctx context.Context) (net.IP, error) {
+func (c *Container) FindIP(ctx context.Context, ipv6 bool) (net.IP, error) {
resp, err := c.client.ContainerInspect(ctx, c.id)
if err != nil {
return nil, err
}
- ip := net.ParseIP(resp.NetworkSettings.DefaultNetworkSettings.IPAddress)
+ var ip net.IP
+ if ipv6 {
+ ip = net.ParseIP(resp.NetworkSettings.DefaultNetworkSettings.GlobalIPv6Address)
+ } else {
+ ip = net.ParseIP(resp.NetworkSettings.DefaultNetworkSettings.IPAddress)
+ }
if ip == nil {
return net.IP{}, fmt.Errorf("invalid IP: %q", ip)
}