Browse code

Apply same typed iptables errors to network driver.

Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)

Jessica Frazelle authored on 2014/11/21 09:20:29
Showing 1 changed files
... ...
@@ -195,7 +195,7 @@ func setupIPTables(addr net.Addr, icc, ipmasq bool) error {
195 195
 			if output, err := iptables.Raw(append([]string{"-I"}, natArgs...)...); err != nil {
196 196
 				return fmt.Errorf("Unable to enable network bridge NAT: %s", err)
197 197
 			} else if len(output) != 0 {
198
-				return fmt.Errorf("Error iptables postrouting: %s", output)
198
+				return &iptables.ChainError{Chain: "POSTROUTING", Output: output}
199 199
 			}
200 200
 		}
201 201
 	}
... ...
@@ -236,7 +236,7 @@ func setupIPTables(addr net.Addr, icc, ipmasq bool) error {
236 236
 		if output, err := iptables.Raw(append([]string{"-I"}, outgoingArgs...)...); err != nil {
237 237
 			return fmt.Errorf("Unable to allow outgoing packets: %s", err)
238 238
 		} else if len(output) != 0 {
239
-			return fmt.Errorf("Error iptables allow outgoing: %s", output)
239
+			return &iptables.ChainError{Chain: "FORWARD outgoing", Output: output}
240 240
 		}
241 241
 	}
242 242
 
... ...
@@ -247,7 +247,7 @@ func setupIPTables(addr net.Addr, icc, ipmasq bool) error {
247 247
 		if output, err := iptables.Raw(append([]string{"-I"}, existingArgs...)...); err != nil {
248 248
 			return fmt.Errorf("Unable to allow incoming packets: %s", err)
249 249
 		} else if len(output) != 0 {
250
-			return fmt.Errorf("Error iptables allow incoming: %s", output)
250
+			return &iptables.ChainError{Chain: "FORWARD incoming", Output: output}
251 251
 		}
252 252
 	}
253 253
 	return nil