libnetwork: use conntrack and --ctstate for all rules
On modern kernels this is an alias; however newer code has preferred ctstate while older code has preferred the deprecated 'state' name. Prefer the newer name for uniformity in the rules libnetwork creates, and because some implementations/distributions of the xtables userland tools may not support the legacy alias. Signed-off-by: Bjorn Neergaard <bjorn.neergaard@docker.com>
This commit is contained in:
parent
796c05ca32
commit
f20abbc96c
1 changed files with 2 additions and 2 deletions
|
@ -422,7 +422,7 @@ func programIngress(gwIP net.IP, ingressPorts []*PortConfig, isDelete bool) erro
|
|||
// Filter table rules to allow a published service to be accessible in the local node from..
|
||||
// 1) service tasks attached to other networks
|
||||
// 2) unmanaged containers on bridge networks
|
||||
rule := []string{addDelOpt, ingressChain, "-m", "state", "-p", protocol, "--sport", publishedPort, "--state", "ESTABLISHED,RELATED", "-j", "ACCEPT"}
|
||||
rule := []string{addDelOpt, ingressChain, "-p", protocol, "--sport", publishedPort, "-m", "conntrack", "--ctstate", "ESTABLISHED,RELATED", "-j", "ACCEPT"}
|
||||
if portErr = iptable.RawCombinedOutput(rule...); portErr != nil {
|
||||
err := fmt.Errorf("set up rule failed, %v: %v", rule, portErr)
|
||||
if !isDelete {
|
||||
|
@ -430,7 +430,7 @@ func programIngress(gwIP net.IP, ingressPorts []*PortConfig, isDelete bool) erro
|
|||
}
|
||||
log.G(context.TODO()).Warn(err)
|
||||
}
|
||||
rollbackRule := []string{rollbackAddDelOpt, ingressChain, "-m", "state", "-p", protocol, "--sport", publishedPort, "--state", "ESTABLISHED,RELATED", "-j", "ACCEPT"}
|
||||
rollbackRule := []string{rollbackAddDelOpt, ingressChain, "-p", protocol, "--sport", publishedPort, "-m", "conntrack", "--ctstate", "ESTABLISHED,RELATED", "-j", "ACCEPT"}
|
||||
rollbackRules = append(rollbackRules, rollbackRule)
|
||||
|
||||
rule = []string{addDelOpt, ingressChain, "-p", protocol, "--dport", publishedPort, "-j", "ACCEPT"}
|
||||
|
|
Loading…
Add table
Reference in a new issue