|
@@ -570,28 +570,6 @@ func newNetworkManager(config *DaemonConfig) (*NetworkManager, error) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- // Accept incoming packets for existing connections
|
|
|
- existingArgs := []string{"FORWARD", "-o", config.BridgeIface, "-m", "conntrack", "--ctstate", "RELATED,ESTABLISHED", "-j", "ACCEPT"}
|
|
|
-
|
|
|
- if !iptables.Exists(existingArgs...) {
|
|
|
- if output, err := iptables.Raw(append([]string{"-I"}, existingArgs...)...); err != nil {
|
|
|
- return nil, fmt.Errorf("Unable to allow incoming packets: %s", err)
|
|
|
- } else if len(output) != 0 {
|
|
|
- return nil, fmt.Errorf("Error iptables allow incoming: %s", output)
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // Accept all non-intercontainer outgoing packets
|
|
|
- outgoingArgs := []string{"FORWARD", "-i", config.BridgeIface, "!", "-o", config.BridgeIface, "-j", "ACCEPT"}
|
|
|
-
|
|
|
- if !iptables.Exists(outgoingArgs...) {
|
|
|
- if output, err := iptables.Raw(append([]string{"-I"}, outgoingArgs...)...); err != nil {
|
|
|
- return nil, fmt.Errorf("Unable to allow outgoing packets: %s", err)
|
|
|
- } else if len(output) != 0 {
|
|
|
- return nil, fmt.Errorf("Error iptables allow outgoing: %s", output)
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
args := []string{"FORWARD", "-i", config.BridgeIface, "-o", config.BridgeIface, "-j"}
|
|
|
acceptArgs := append(args, "ACCEPT")
|
|
|
dropArgs := append(args, "DROP")
|
|
@@ -617,6 +595,29 @@ func newNetworkManager(config *DaemonConfig) (*NetworkManager, error) {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ // Accept all non-intercontainer outgoing packets
|
|
|
+ outgoingArgs := []string{"FORWARD", "-i", config.BridgeIface, "!", "-o", config.BridgeIface, "-j", "ACCEPT"}
|
|
|
+
|
|
|
+ if !iptables.Exists(outgoingArgs...) {
|
|
|
+ if output, err := iptables.Raw(append([]string{"-I"}, outgoingArgs...)...); err != nil {
|
|
|
+ return nil, fmt.Errorf("Unable to allow outgoing packets: %s", err)
|
|
|
+ } else if len(output) != 0 {
|
|
|
+ return nil, fmt.Errorf("Error iptables allow outgoing: %s", output)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // Accept incoming packets for existing connections
|
|
|
+ existingArgs := []string{"FORWARD", "-o", config.BridgeIface, "-m", "conntrack", "--ctstate", "RELATED,ESTABLISHED", "-j", "ACCEPT"}
|
|
|
+
|
|
|
+ if !iptables.Exists(existingArgs...) {
|
|
|
+ if output, err := iptables.Raw(append([]string{"-I"}, existingArgs...)...); err != nil {
|
|
|
+ return nil, fmt.Errorf("Unable to allow incoming packets: %s", err)
|
|
|
+ } else if len(output) != 0 {
|
|
|
+ return nil, fmt.Errorf("Error iptables allow incoming: %s", output)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
tcpPortAllocator, err := newPortAllocator()
|