Skip to content

Commit

Permalink
Merge pull request #69 from fedepaol/check_version_fail
Browse files Browse the repository at this point in the history
Check and return an error when iptables version parsing fails
  • Loading branch information
squeed authored Sep 17, 2019
2 parents 969b135 + b1deb38 commit af017ce
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions iptables/iptables.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,13 @@ func NewWithProtocol(proto Protocol) (*IPTables, error) {
return nil, err
}
vstring, err := getIptablesVersionString(path)
if err != nil {
return nil, fmt.Errorf("could not get iptables version: %v", err)
}
v1, v2, v3, mode, err := extractIptablesVersion(vstring)
if err != nil {
return nil, fmt.Errorf("failed to extract iptables version from [%s]: %v", vstring, err)
}

checkPresent, waitPresent, randomFullyPresent := getIptablesCommandSupport(v1, v2, v3)

Expand Down

0 comments on commit af017ce

Please sign in to comment.