Explorar o código

Register natChain with portmapper

- Becasue it is the only chain which carries the hairpin mode info
- Also install the skipDNAT rule only if userland-proxy == true

Signed-off-by: Alessandro Boch <aboch@docker.com>
Alessandro Boch %!s(int64=9) %!d(string=hai) anos
pai
achega
5e5dc809cc
Modificáronse 1 ficheiros con 4 adicións e 1 borrados
  1. 4 1
      libnetwork/drivers/bridge/setup_ip_tables.go

+ 4 - 1
libnetwork/drivers/bridge/setup_ip_tables.go

@@ -115,7 +115,7 @@ func (n *bridgeNetwork) setupIPTables(config *networkConfiguration, i *bridgeInt
 			return iptables.ProgramChain(filterChain, config.BridgeName, hairpinMode, false)
 			return iptables.ProgramChain(filterChain, config.BridgeName, hairpinMode, false)
 		})
 		})
 
 
-		n.portMapper.SetIptablesChain(filterChain, n.getNetworkBridgeName())
+		n.portMapper.SetIptablesChain(natChain, n.getNetworkBridgeName())
 	}
 	}
 
 
 	if err := ensureJumpRule("FORWARD", IsolationChain); err != nil {
 	if err := ensureJumpRule("FORWARD", IsolationChain); err != nil {
@@ -148,6 +148,9 @@ func setupIPTablesInternal(bridgeIface string, addr net.Addr, icc, ipmasq, hairp
 		if err := programChainRule(natRule, "NAT", enable); err != nil {
 		if err := programChainRule(natRule, "NAT", enable); err != nil {
 			return err
 			return err
 		}
 		}
+	}
+
+	if ipmasq && !hairpin {
 		if err := programChainRule(skipDNAT, "SKIP DNAT", enable); err != nil {
 		if err := programChainRule(skipDNAT, "SKIP DNAT", enable); err != nil {
 			return err
 			return err
 		}
 		}