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 |
antoninbas
left a comment
There was a problem hiding this comment.
could we add an e2e test with the Both direction?
7b17816 to
7eb34de
Compare
|
@antoninbas @hangyan I have refactored the |
antoninbas
left a comment
There was a problem hiding this comment.
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. |
|
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
antoninbas
left a comment
There was a problem hiding this comment.
Some small comments but overall LGTM. Thanks for all the work and patience.
2df63b1 to
d71b417
Compare
antoninbas
left a comment
There was a problem hiding this comment.
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 <aryanbakliwal12345@gmail.com>
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.
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?
| if ports.SrcPort != nil { | ||
| assert.Contains(t, []int32{int32(tcp.SrcPort), int32(tcp.DstPort)}, *ports.SrcPort) | ||
| } | ||
| } else { |






fixes: #6862
A new
directionfield 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

.pcapngoutput file (both directions).