Do not run iptablesDNS workaround on IPv6 addresses
Closes:
Approved by: mheon
@@ -61,9 +61,11 @@ 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 {
+ if ip.Address.IP.To4() != nil {
iptablesDNS("-I", ip.Address.IP.String())
}
}
+ }
return nil
}
@@ -173,8 +175,10 @@ 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 {
+ 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())
