-
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
base: main
Are you sure you want to change the base?
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.
// we need to check if the packet is a response (from destination to source). In this case, we skip to the instruction where we compare the | ||
// loaded source IP with the destination IP from the packet spec. The skipRequestCheck flag indicates whether we need to call calculateSkipFalse | ||
// to determine how many instructions to skip before checking for response packets or just skip to the last instruction (drop packet). | ||
if skipRequestCheck { |
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.
is there a better name than skipRequestCheck
? Even after reading the comment, the name still doesn't make sense to me.
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.
@antoninbas Since it tells if we need to jump to return traffic check part of the filter, how about checkIfResponse
or jumpToResponseCheck
?
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.
IMO the current variable name is the "opposite" of what it should be almost.
Maybe I would go with needsOtherTrafficDirectionCheck
as a drop-in replacement for skipRequestCheck
?
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.
needsOtherTrafficDirectionCheck
makes sense. Or maybe needsReturnTrafficDirectionCheck
to be more specific?
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.
I wouldn't assume that we check one direction before the other. That's why I would recommend sticking with "other direction".
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.
Changed the name and also rephrased the comment to better reflect its purpose.
// we need to check if the packet is a response (from destination to source). In this case, we skip to the instruction where we compare the | ||
// loaded source IP with the destination IP from the packet spec. The skipRequestCheck flag indicates whether we need to call calculateSkipFalse | ||
// to determine how many instructions to skip before checking for response packets or just skip to the last instruction (drop packet). | ||
if skipRequestCheck { |
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.
IMO the current variable name is the "opposite" of what it should be almost.
Maybe I would go with needsOtherTrafficDirectionCheck
as a drop-in replacement for skipRequestCheck
?
Signed-off-by: Aryan Bakliwal <aryanbakliwal12345@gmail.com>
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. |
fixes: #6862
Added
bidirectional
field in packet capture CR spec.For testing, I created two pods and pinged one from the other.
Screenshot of the

.pcapng
output file.