Prechádzať zdrojové kódy

iptables: error out on version detection failure

Error out in case the iptables version cannot be determined. It is not
safe assume anything at this point, because execution attempts will most
probably result in errors.
Stefan Junker 9 rokov pred
rodič
commit
332ceb2cfb
1 zmenil súbory, kde vykonal 1 pridanie a 4 odobranie
  1. 1 4
      iptables/iptables.go

+ 1 - 4
iptables/iptables.go

@@ -18,7 +18,6 @@ import (
 	"bytes"
 	"fmt"
 	"io"
-	"log"
 	"os/exec"
 	"regexp"
 	"strconv"
@@ -55,9 +54,7 @@ func New() (*IPTables, error) {
 	}
 	checkPresent, waitPresent, err := getIptablesCommandSupport()
 	if err != nil {
-		log.Printf("Error checking iptables version, assuming version at least 1.4.20: %v", err)
-		checkPresent = true
-		waitPresent = true
+		return nil, fmt.Errorf("error checking iptables version: %v", err)
 	}
 	ipt := IPTables{
 		path:     path,