Skip to content

cocci: New test to find missing identity_is_{remote_,}node#18385

Merged
pchaigno merged 1 commit intocilium:masterfrom
pchaigno:new-cocci-scripts
Jan 12, 2022
Merged

cocci: New test to find missing identity_is_{remote_,}node#18385
pchaigno merged 1 commit intocilium:masterfrom
pchaigno:new-cocci-scripts

Conversation

@pchaigno
Copy link
Copy Markdown
Member

@pchaigno pchaigno commented Jan 5, 2022

This new Coccinelle script finds and replaces missing calls to helper functions identity_is_node and identity_is_remote_node. These functions were introduced in commit 7021861 ("bpf: Refactor node identity checking") to prepare for the addition of KUBE_APISERVER_NODE_ID, which also corresponds to a remote node identity.

The script is a bit more convoluted than ideally should be, because I haven't found a succinct way to tell Coccinelle that e != HOST_ID && e != REMOTE_NODE_ID is semantically equivalent to e != REMOTE_NODE_ID && e != HOST_ID, so we have to enumerate both cases.

This was tested by reverting some of the changes introduced in commit 7021861 ("bpf: Refactor node identity checking").

This new Coccinelle script finds and replaces missing calls to helper
functions identity_is_node and identity_is_remote_node. These functions
were introduced in commit 7021861 ("bpf: Refactor node identity
checking") to prepare for the addition of KUBE_APISERVER_NODE_ID, which
also corresponds to a remote node identity.

The script is a bit more covoluted than ideally should be, because
I haven't found a succinct way to tell Coccinelle that "e != HOST_ID &&
e != REMOTE_NODE_ID" is semantically equivalent to "e != REMOTE_NODE_ID
&& e != HOST_ID", so we have to enumerate both cases.

This was tested by reverting some of the changes introduced in commit
7021861 ("bpf: Refactor node identity checking").

Signed-off-by: Paul Chaignon <paul@cilium.io>
@pchaigno pchaigno added area/CI Continuous Integration testing issue or flake area/datapath Impacts bpf/ or low-level forwarding details, including map management and monitor messages. release-note/ci This PR makes changes to the CI. labels Jan 5, 2022
@pchaigno pchaigno requested review from a team and borkmann January 5, 2022 15:34
@pchaigno pchaigno mentioned this pull request Jan 5, 2022
9 tasks
@pchaigno pchaigno merged commit 1226a75 into cilium:master Jan 12, 2022
@pchaigno pchaigno deleted the new-cocci-scripts branch January 12, 2022 08:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/CI Continuous Integration testing issue or flake area/datapath Impacts bpf/ or low-level forwarding details, including map management and monitor messages. release-note/ci This PR makes changes to the CI.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants