Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

conntrack: Fix a bug in swapAB #415

Merged
merged 1 commit into from
Mar 30, 2023

Conversation

ronensc
Copy link
Collaborator

@ronensc ronensc commented Mar 29, 2023

When implementing the swapAB logic I missed the fact that in addition to swapping the values of the connection source and destination, their hashes should be swapped as well. Without this, aggregates such as Bytes_AB and Bytes_BA would be wrong.
I realized that I had the same bug in the unit test the was supposed to test it.
This PR fixes the problem and the test.

Once merged, this will allow us to spot connections that their source and destination were swapped by inspecting their newConnection record. The Bytes_AB would be 0 while Bytes_BA would be >0.

Swap hashA and hashB when swapAB is flagged
@codecov
Copy link

codecov bot commented Mar 29, 2023

Codecov Report

Merging #415 (b13d7f2) into main (a31a0c0) will decrease coverage by 0.02%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #415      +/-   ##
==========================================
- Coverage   64.39%   64.37%   -0.02%     
==========================================
  Files          94       94              
  Lines        6560     6563       +3     
==========================================
+ Hits         4224     4225       +1     
- Misses       2096     2097       +1     
- Partials      240      241       +1     
Flag Coverage Δ
unittests 64.37% <100.00%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
pkg/pipeline/extract/conntrack/conn.go 78.68% <100.00%> (+0.53%) ⬆️
pkg/pipeline/extract/conntrack/conntrack.go 93.37% <100.00%> (ø)

... and 1 file with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Copy link
Collaborator

@jpinsonneau jpinsonneau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch @ronensc ! Code LGTM

Would this bug result in duplicated connections coming from the same FLP ? I don't think I've seen such

@ronensc
Copy link
Collaborator Author

ronensc commented Mar 29, 2023

Good catch @ronensc ! Code LGTM

Would this bug result in duplicated connections coming from the same FLP ? I don't think I've seen such

I don't think this bug would result in duplicated connections

@jpinsonneau
Copy link
Collaborator

@ronensc @jotak we should backport this in release-1.2

@jotak
Copy link
Member

jotak commented Mar 30, 2023

+1 to backport.
If I understand correctly this is a small bug on bytes/pckt counters, only in the context of conversation flows.
I'd say it can be merged & backported without need for QE/doc given the limited impact - @memodi is that ok with you? The unit test look good to me

@ronensc ronensc added the ok-to-test To set manually when a PR is safe to test. Triggers image build on PR. label Mar 30, 2023
@github-actions
Copy link

New image: quay.io/netobserv/flowlogs-pipeline:d6f2770. It will expire after two weeks.

@memodi
Copy link

memodi commented Mar 30, 2023

Yes, I am fine. @Amoghrd - I vaguely remember you mentioned about noticing something similar..

@Amoghrd
Copy link
Contributor

Amoghrd commented Mar 30, 2023

Yeah, I am fine too.
I had seen an issue with incorrect Byte and Packet numbers which is due to duplicate connections I think which Joel opened a bug for.

@jotak
Copy link
Member

jotak commented Mar 30, 2023

/approve

@openshift-ci
Copy link

openshift-ci bot commented Mar 30, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jotak

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-robot openshift-merge-robot merged commit 725cec1 into netobserv:main Mar 30, 2023
@ronensc ronensc deleted the fix-swapab branch March 30, 2023 14:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm ok-to-test To set manually when a PR is safe to test. Triggers image build on PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants