Skip to content

Commit 8c26c13

Browse files
committed
add logic to append
1 parent bce0cbc commit 8c26c13

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

iptables/iptables.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,14 @@ func (c *Client) AppendIptableRule(version, tableName, chainName, match, target
198198
}
199199

200200
cmd := c.GetAppendIptableRuleCmd(version, tableName, chainName, match, target)
201-
return c.RunCmd(version, cmd.Params)
201+
err := c.RunCmd(version, cmd.Params)
202+
if err != nil {
203+
return err
204+
}
205+
if !c.RuleExists(version, tableName, chainName, match, target) {
206+
return errCouldNotValidateRuleExists
207+
}
208+
return nil
202209
}
203210

204211
// Delete matched iptable rule

0 commit comments

Comments
 (0)