util/linuxfw: fix chain comparison (#11639)

Don't compare pointer fields by pointer value, but by the actual value

Updates#cleanup

Signed-off-by: Irbe Krumina <irbe@tailscale.com>
pull/11644/head
Irbe Krumina 8 months ago committed by GitHub
parent 8c75da27fc
commit 1fbaf26106
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -447,7 +447,7 @@ func getOrCreateChain(c *nftables.Conn, cinfo chainInfo) (*nftables.Chain, error
// type/hook/priority, but for "conventional chains" assume they're what // type/hook/priority, but for "conventional chains" assume they're what
// we expect (in case iptables-nft/ufw make minor behavior changes in // we expect (in case iptables-nft/ufw make minor behavior changes in
// the future). // the future).
if isTSChain(chain.Name) && (chain.Type != cinfo.chainType || chain.Hooknum != cinfo.chainHook || chain.Priority != cinfo.chainPriority) { if isTSChain(chain.Name) && (chain.Type != cinfo.chainType || *chain.Hooknum != *cinfo.chainHook || *chain.Priority != *cinfo.chainPriority) {
return nil, fmt.Errorf("chain %s already exists with different type/hook/priority", cinfo.name) return nil, fmt.Errorf("chain %s already exists with different type/hook/priority", cinfo.name)
} }
return chain, nil return chain, nil

Loading…
Cancel
Save