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

NETOBSERV-1850 fix cli enrichment issue #91

Merged
merged 1 commit into from
Sep 20, 2024
Merged

Conversation

jpinsonneau
Copy link
Contributor

@jpinsonneau jpinsonneau commented Sep 19, 2024

Description

Fix CLI packet enrichment issue where all packets were pointing the same info

Dependencies

n/a

Checklist

If you are not familiar with our processes or don't know what to answer in the list below, let us know in a comment: the maintainers will take care of that.

  • Is this PR backed with a JIRA ticket? If so, make sure it is written as a title prefix (in general, PRs affecting the NetObserv/Network Observability product should be backed with a JIRA ticket - especially if they bring user facing changes).
  • Does this PR require product documentation?
    • If so, make sure the JIRA epic is labelled with "documentation" and provides a description relevant for doc writers, such as use cases or scenarios. Any required step to activate or configure the feature should be documented there, such as new CRD knobs.
  • Does this PR require a product release notes entry?
    • If so, fill in "Release Note Text" in the JIRA.
  • Is there anything else the QE team should know before testing? E.g: configuration changes, environment setup, etc.
    • If so, make sure it is described in the JIRA ticket.
  • QE requirements (check 1 from the list):
    • Standard QE validation, with pre-merge tests unless stated otherwise.
    • Regression tests only (e.g. refactoring with no user-facing change).
    • No QE (e.g. trivial change with high reviewer's confidence, or per agreement with the QE team).

Copy link

openshift-ci bot commented Sep 19, 2024

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please ask for approval from jpinsonneau. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found 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

Copy link

codecov bot commented Sep 19, 2024

Codecov Report

Attention: Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.

Project coverage is 25.08%. Comparing base (dd4a15c) to head (8298b25).
Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
cmd/packet_capture.go 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #91      +/-   ##
==========================================
- Coverage   25.10%   25.08%   -0.03%     
==========================================
  Files           8        8              
  Lines        1147     1148       +1     
==========================================
  Hits          288      288              
- Misses        838      839       +1     
  Partials       21       21              
Flag Coverage Δ
unittests 25.08% <0.00%> (-0.03%) ⬇️

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

Files with missing lines Coverage Δ
cmd/root.go 47.61% <ø> (ø)
cmd/packet_capture.go 0.00% <0.00%> (ø)

// then append packet to file
err = pw.WriteEnhancedPacketBlock(0, ts, b, types.EnhancedPacketOptions{})
// then append packet to file using totalPackets as unique id
err = pw.WriteEnhancedPacketBlock(totalPackets, ts, b, types.EnhancedPacketOptions{})
Copy link
Contributor

@msherif1234 msherif1234 Sep 20, 2024

Choose a reason for hiding this comment

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

@jpinsonneau how the total packet can be unique id ? why not startupTime ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I increase the totalPackets value each time we add a packet just below this call:

		totalPackets = totalPackets + 1

Copy link
Contributor

Choose a reason for hiding this comment

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

yeah I saw that isn't that will be the case with other pkts u capture so if I received 2 udp pkts then 2 tcp pkts in two different runs won't that collide ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

do you open the 2 pcapng files in one ? 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tried the following code to see what happens:

err = pw.WriteEnhancedPacketBlock(uint32(startupTime.UnixMilli())+totalPackets, ts, b, types.EnhancedPacketOptions{})

And it seems wireshark is not expecting that. Here the id is an index related to the previously created interface description using WriteInterfaceDescription call:
image

Copy link
Contributor

Choose a reason for hiding this comment

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

ok I guess lets proceed as is thanks for confirming

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thank you for reviewing !

@msherif1234
Copy link
Contributor

/lgtm

@jotak
Copy link
Member

jotak commented Sep 20, 2024

To be tested post merge

@jotak jotak merged commit 135a110 into netobserv:main Sep 20, 2024
9 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants