浏览代码

Merge pull request #1273 from mrjana/lb

Match only locally destined requests for ingress
Alessandro Boch 9 年之前
父节点
当前提交
21c6bab508
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2 2
      libnetwork/service_linux.go

+ 2 - 2
libnetwork/service_linux.go

@@ -436,8 +436,8 @@ func programIngress(gwIP net.IP, ingressPorts []*PortConfig, isDelete bool) erro
 		}
 		}
 
 
 		for _, chain := range []string{"OUTPUT", "PREROUTING"} {
 		for _, chain := range []string{"OUTPUT", "PREROUTING"} {
-			if !iptables.Exists(iptables.Nat, chain, "-j", ingressChain) {
-				if err := iptables.RawCombinedOutput("-t", "nat", "-I", chain, "-j", ingressChain); err != nil {
+			if !iptables.Exists(iptables.Nat, chain, "-m", "addrtype", "--dst-type", "LOCAL", "-j", ingressChain) {
+				if err := iptables.RawCombinedOutput("-t", "nat", "-I", chain, "-m", "addrtype", "--dst-type", "LOCAL", "-j", ingressChain); err != nil {
 					return fmt.Errorf("failed to add jump rule in %s to ingress chain: %v", chain, err)
 					return fmt.Errorf("failed to add jump rule in %s to ingress chain: %v", chain, err)
 				}
 				}
 			}
 			}