Merge pull request #707 from danwinship/checkPorts

portmap: fix checkPorts result when chain does not exist
This commit is contained in:
Casey Callendrello 2022-02-23 17:46:33 +01:00 committed by GitHub
commit 9f67faf00f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -127,26 +127,12 @@ func checkPorts(config *PortMapConf, containerNet net.IPNet) error {
} }
if ip4t != nil { if ip4t != nil {
exists, err := utils.ChainExists(ip4t, dnatChain.table, dnatChain.name)
if err != nil {
return err
}
if !exists {
return err
}
if err := dnatChain.check(ip4t); err != nil { if err := dnatChain.check(ip4t); err != nil {
return fmt.Errorf("could not check ipv4 dnat: %v", err) return fmt.Errorf("could not check ipv4 dnat: %v", err)
} }
} }
if ip6t != nil { if ip6t != nil {
exists, err := utils.ChainExists(ip6t, dnatChain.table, dnatChain.name)
if err != nil {
return err
}
if !exists {
return err
}
if err := dnatChain.check(ip6t); err != nil { if err := dnatChain.check(ip6t); err != nil {
return fmt.Errorf("could not check ipv6 dnat: %v", err) return fmt.Errorf("could not check ipv6 dnat: %v", err)
} }