-
Notifications
You must be signed in to change notification settings - Fork 388
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
Add bidirectional packet capture #6882
Conversation
@hangyan please let me know what you think about this |
Hey @hangyan @antoninbas, I made the changes in the bpf code according to the one generated by tcpdump. When I try to test the bidirectional packet capture, it fails with this log
Could you please take a look and help me identify what might be going wrong? Also, golangci-lint is giving me this error even though I have changed the
|
this error was reported by golangci on windows, we have a |
I’ve added the Please let me know if any adjustments are needed or if there's anything else I should update or add. Captured packets |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could we add an e2e test with the Both
direction?
7b17816
to
7eb34de
Compare
@antoninbas @hangyan I have refactored the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for your ongoing work on this
@antoninbas @hangyan Changed the function and param name, and added some comments. Please let me know if there’s anything else I should take care of. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your work
Hi @AryanBakliwal please re-base to the latest main branch and squash all your changes into one commit. Thanks. |
474a382
to
4044b23
Compare
4044b23
to
2df63b1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some small comments but overall LGTM. Thanks for all the work and patience.
2df63b1
to
d71b417
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks for this great contribution and for your patience during the review process
@hangyan do you want to take another look?
@AryanBakliwal I just started the Github workflows, let's see if there is any test or linting failure |
sure. will do it now and give my feedback soon |
LGTM. Thanks @AryanBakliwal |
Thank you @antoninbas and @hangyan for guiding me through this. Your support made it much easier :) |
/test-all |
@AryanBakliwal One if your new e2e tests has failed in CI. I'm copying the logs below for convenience. PTAL. Logs for failed test
|
I'll look into it. |
d71b417
to
f4fe82d
Compare
/test-all |
Signed-off-by: Aryan Bakliwal <[email protected]>
f4fe82d
to
4f4ed52
Compare
/test-e2e |
@antoninbas the e2e test is passing now |
/test-all |
if pc.Spec.Direction == crdv1alpha1.CaptureDirectionBoth { | ||
assert.Contains(t, []string{srcIP.String(), dstIP.String()}, ip.SrcIP.String()) | ||
assert.Contains(t, []string{srcIP.String(), dstIP.String()}, ip.DstIP.String()) | ||
} else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this code would be wrong for the DestinationToSource
direction. Could you add a single e2e test case for the DestinationToSource
direction as a follow-up PR, and update this verification function accordingly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, will add it
if ports.SrcPort != nil { | ||
assert.Contains(t, []int32{int32(tcp.SrcPort), int32(tcp.DstPort)}, *ports.SrcPort) | ||
} | ||
} else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
fixes: #6862
A new
direction
field is added to the PacketCapture CRD.Packets can now be captured from source to destination (default),
destination to source, or in both directions.
Screenshot of the

.pcapng
output file (both directions).