From fc5e3706e9b9f81d5ce75e3013488dc23cb6558d Mon Sep 17 00:00:00 2001 From: Wim Date: Sun, 17 Jun 2018 01:11:46 +0200 Subject: Do not run iptablesDNS workaround on IPv6 addresses Closes: #954 Approved by: mheon --- libpod/networking.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'libpod') diff --git a/libpod/networking.go b/libpod/networking.go index 092ce2a3f..74ca340a0 100644 --- a/libpod/networking.go +++ b/libpod/networking.go @@ -61,7 +61,9 @@ func (r *Runtime) configureNetNS(ctr *Container, ctrNS ns.NetNS) (err error) { // https://github.com/containernetworking/plugins/pull/75 if resultStruct.IPs != nil { for _, ip := range resultStruct.IPs { - iptablesDNS("-I", ip.Address.IP.String()) + if ip.Address.IP.To4() != nil { + iptablesDNS("-I", ip.Address.IP.String()) + } } } return nil @@ -173,7 +175,9 @@ func (r *Runtime) teardownNetNS(ctr *Container) error { // on cleanup. Remove when https://github.com/containernetworking/plugins/pull/75 // is merged. for _, ip := range ctr.state.IPs { - iptablesDNS("-D", ip.Address.IP.String()) + if ip.Address.IP.To4() != nil { + iptablesDNS("-D", ip.Address.IP.String()) + } } logrus.Debugf("Tearing down network namespace at %s for container %s", ctr.state.NetNS.Path(), ctr.ID()) -- cgit v1.2.3-54-g00ecf