Compare commits

...

1 Commits

Author SHA1 Message Date
Brad Fitzpatrick
fd7ea8e2c3 util/linuxfw: don't panic on delete of chain in nil table
Fixes #10003

Change-Id: Ibef8326ffbbef5ba59caa21baa1f2cf4f5185971
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2023-10-27 17:28:35 -07:00

View File

@@ -860,7 +860,12 @@ func (n *nftablesRunner) createDummyPostroutingChains() (retErr error) {
}
// deleteChainIfExists deletes a chain if it exists.
//
// If table is nil, it returns nil.
func deleteChainIfExists(c *nftables.Conn, table *nftables.Table, name string) error {
if table == nil {
return nil
}
chain, err := getChainFromTable(c, table, name)
if err != nil && !errors.Is(err, errorChainNotFound{table.Name, name}) {
return fmt.Errorf("get chain: %w", err)