mirror of
https://github.com/tailscale/tailscale.git
synced 2026-12-06 00:22:20 -08:00
util/linuxfw: fix crash in DelSNATRule when no rules are found
Appears to be a missing nil handling case. I looked back over other usage of findRule and the others all have nil guards. findRule returns nil when no rules are found matching the arguments. Fixes #9553 Signed-off-by: James Tucker <[email protected]>
This commit is contained in:
1 parent
697f92f4a7
commit
2066f9fbb2
1 file changed
+3
-1
@@ -1109,7 +1109,9 @@ func (n *nftablesRunner) DelSNATRule() error {
|
||||
return fmt.Errorf("find SNAT rule v4: %w", err)
|
||||
}
|
||||
|
||||
_ = conn.DelRule(SNATRule)
|
||||
if SNATRule != nil {
|
||||
_ = conn.DelRule(SNATRule)
|
||||
}
|
||||
}
|
||||
|
||||
if err := conn.Flush(); err != nil {
|
||||
|
||||
Reference in new issue
Block a user