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>
| ... | ... |
@@ -422,7 +422,7 @@ func programIngress(gwIP net.IP, ingressPorts []*PortConfig, isDelete bool) erro |
| 422 | 422 |
// Filter table rules to allow a published service to be accessible in the local node from.. |
| 423 | 423 |
// 1) service tasks attached to other networks |
| 424 | 424 |
// 2) unmanaged containers on bridge networks |
| 425 |
- rule := []string{addDelOpt, ingressChain, "-m", "state", "-p", protocol, "--sport", publishedPort, "--state", "ESTABLISHED,RELATED", "-j", "ACCEPT"}
|
|
| 425 |
+ rule := []string{addDelOpt, ingressChain, "-p", protocol, "--sport", publishedPort, "-m", "conntrack", "--ctstate", "ESTABLISHED,RELATED", "-j", "ACCEPT"}
|
|
| 426 | 426 |
if portErr = iptable.RawCombinedOutput(rule...); portErr != nil {
|
| 427 | 427 |
err := fmt.Errorf("set up rule failed, %v: %v", rule, portErr)
|
| 428 | 428 |
if !isDelete {
|
| ... | ... |
@@ -430,7 +430,7 @@ func programIngress(gwIP net.IP, ingressPorts []*PortConfig, isDelete bool) erro |
| 430 | 430 |
} |
| 431 | 431 |
log.G(context.TODO()).Warn(err) |
| 432 | 432 |
} |
| 433 |
- rollbackRule := []string{rollbackAddDelOpt, ingressChain, "-m", "state", "-p", protocol, "--sport", publishedPort, "--state", "ESTABLISHED,RELATED", "-j", "ACCEPT"}
|
|
| 433 |
+ rollbackRule := []string{rollbackAddDelOpt, ingressChain, "-p", protocol, "--sport", publishedPort, "-m", "conntrack", "--ctstate", "ESTABLISHED,RELATED", "-j", "ACCEPT"}
|
|
| 434 | 434 |
rollbackRules = append(rollbackRules, rollbackRule) |
| 435 | 435 |
|
| 436 | 436 |
rule = []string{addDelOpt, ingressChain, "-p", protocol, "--dport", publishedPort, "-j", "ACCEPT"}
|