Skip to content

Commit

Permalink
Check and return an error when iptables version parsing fails
Browse files Browse the repository at this point in the history
  • Loading branch information
fedepaol committed Sep 3, 2019
1 parent 969b135 commit b1deb38
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 b1deb38

Please sign in to comment.