calico icon indicating copy to clipboard operation
calico copied to clipboard

Add missing negation operator

Open therealak12 opened this issue 2 years ago • 1 comments

Description

The GetFeatures function correctly fills the RestoreSupportsLock variable but IMO it's not used correctly afterwards. We fill iptablesLock with a dummyLock if RestoreSupportsLock is true and with NewSharedLock(...) output otherwise. I think this should be reversed.

Related issues/PRs

Todos

  • [ ] Tests
  • [ ] Documentation
  • [ ] Release note

Release Note

TBD

TBD

Reminder for the reviewer

Make sure that this PR has the correct labels and milestone set.

Every PR needs one docs-* label.

  • docs-pr-required: This change requires a change to the documentation that has not been completed yet.
  • docs-completed: This change has all necessary documentation completed.
  • docs-not-required: This change has no user-facing impact and requires no docs.

Every PR needs one release-note-* label.

  • release-note-required: This PR has user-facing changes. Most PRs should have this label.
  • release-note-not-required: This PR has no user-facing changes.

Other optional labels:

  • cherry-pick-candidate: This PR should be cherry-picked to an earlier release. For bug fixes only.
  • needs-operator-pr: This PR is related to install and requires a corresponding change to the operator.

therealak12 avatar Oct 07 '22 10:10 therealak12

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Oct 07 '22 10:10 CLAassistant

@caseydavenport Would you please take a look at this 😄?

therealak12 avatar Nov 05 '22 18:11 therealak12

@therealak12 If I understand correctly, I think the current code is correct.

Basically, if the version of iptables supports locking natively, then Calico doesn't need to implement its own lock and can just use a dummy lock implementation.

However, if the version of iptables doesn't have native locking support, Calico uses its own implementation of a lock.

caseydavenport avatar Nov 08 '22 17:11 caseydavenport

Oh thanks, you're right.

therealak12 avatar Nov 08 '22 17:11 therealak12