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

Add bidirectional packet capture #6882

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

AryanBakliwal
Copy link

@AryanBakliwal AryanBakliwal commented Dec 23, 2024

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.
image

@AryanBakliwal
Copy link
Author

@hangyan please let me know what you think about this

@AryanBakliwal
Copy link
Author

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

E1229 11:44:58.723258       1 packetcapture_controller.go:424] "PacketCapture failed capturing packets" err="invalid argument" name="pc-test"

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 Capture method everywhere.

===> Running golangci (linux) <===
===> Running golangci (windows) <===
cmd/antrea-agent/agent.go:64:2: could not import antrea.io/antrea/pkg/agent/packetcapture (-: # antrea.io/antrea/pkg/agent/packetcapture
pkg/agent/packetcapture/packetcapture_controller.go:170:23: cannot use capture (variable of type *capture.pcapCapture) as PacketCapturer value in assignment: *capture.pcapCapture does not implement PacketCapturer (wrong type for method Capture)
                have Capture(context.Context, string, int, "net".IP, "net".IP, *"antrea.io/antrea/pkg/apis/crd/v1alpha1".Packet) (chan gopacket.Packet, error)
                want Capture(context.Context, string, int, "net".IP, "net".IP, *"antrea.io/antrea/pkg/apis/crd/v1alpha1".Packet, bool) (chan gopacket.Packet, error)) (typecheck)
        "antrea.io/antrea/pkg/agent/packetcapture"
        ^
pkg/agent/packetcapture/capture_interface.go:1: : # antrea.io/antrea/pkg/agent/packetcapture [antrea.io/antrea/pkg/agent/packetcapture.test]
pkg/agent/packetcapture/packetcapture_controller.go:170:23: cannot use capture (variable of type *capture.pcapCapture) as PacketCapturer value in assignment: *capture.pcapCapture does not implement PacketCapturer (wrong type for method Capture)
                have Capture(context.Context, string, int, "net".IP, "net".IP, *"antrea.io/antrea/pkg/apis/crd/v1alpha1".Packet) (chan gopacket.Packet, error)
                want Capture(context.Context, string, int, "net".IP, "net".IP, *"antrea.io/antrea/pkg/apis/crd/v1alpha1".Packet, bool) (chan gopacket.Packet, error) (typecheck)
// Copyright 2024 Antrea Authors.
make: *** [Makefile:329: golangci] Error 1

@hangyan
Copy link
Member

hangyan commented Jan 2, 2025

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

E1229 11:44:58.723258       1 packetcapture_controller.go:424] "PacketCapture failed capturing packets" err="invalid argument" name="pc-test"

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 Capture method everywhere.

===> Running golangci (linux) <===
===> Running golangci (windows) <===
cmd/antrea-agent/agent.go:64:2: could not import antrea.io/antrea/pkg/agent/packetcapture (-: # antrea.io/antrea/pkg/agent/packetcapture
pkg/agent/packetcapture/packetcapture_controller.go:170:23: cannot use capture (variable of type *capture.pcapCapture) as PacketCapturer value in assignment: *capture.pcapCapture does not implement PacketCapturer (wrong type for method Capture)
                have Capture(context.Context, string, int, "net".IP, "net".IP, *"antrea.io/antrea/pkg/apis/crd/v1alpha1".Packet) (chan gopacket.Packet, error)
                want Capture(context.Context, string, int, "net".IP, "net".IP, *"antrea.io/antrea/pkg/apis/crd/v1alpha1".Packet, bool) (chan gopacket.Packet, error)) (typecheck)
        "antrea.io/antrea/pkg/agent/packetcapture"
        ^
pkg/agent/packetcapture/capture_interface.go:1: : # antrea.io/antrea/pkg/agent/packetcapture [antrea.io/antrea/pkg/agent/packetcapture.test]
pkg/agent/packetcapture/packetcapture_controller.go:170:23: cannot use capture (variable of type *capture.pcapCapture) as PacketCapturer value in assignment: *capture.pcapCapture does not implement PacketCapturer (wrong type for method Capture)
                have Capture(context.Context, string, int, "net".IP, "net".IP, *"antrea.io/antrea/pkg/apis/crd/v1alpha1".Packet) (chan gopacket.Packet, error)
                want Capture(context.Context, string, int, "net".IP, "net".IP, *"antrea.io/antrea/pkg/apis/crd/v1alpha1".Packet, bool) (chan gopacket.Packet, error) (typecheck)
// Copyright 2024 Antrea Authors.
make: *** [Makefile:329: golangci] Error 1

this error was reported by golangci on windows, we have a pcap_unsupported.go for windows/... interface, it's an non-op since we didn't support this on windows yet, you should change that too.

@AryanBakliwal
Copy link
Author

I’ve added the direction field with enum values (SourceToDestination, DestinationToSource, and Both) and set the default to SourceToDestination. Additionally, I’ve updated the YAML manifests, packet capture guide and tests accordingly.

Please let me know if any adjustments are needed or if there's anything else I should update or add.

Captured packets

ICMP (SourceToDestination)
Screenshot from 2025-01-06 00-07-02

ICMP (DestinationToSource)
Screenshot from 2025-01-06 00-14-28

ICMP (Both)
Screenshot from 2025-01-06 00-17-58

TCP (SourceToDestination)
image

TCP (DestinationToSource)
image

TCP (Both)
image

Copy link
Contributor

@antoninbas antoninbas left a 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?

@AryanBakliwal
Copy link
Author

@antoninbas @hangyan I have refactored the compilePacketFilter function, added a test case for dstPort and Both in bpf_test.go, generated the manifests by running make manifest and added an e2e test with the Both direction.
Could you please review the changes? Let me know if there’s anything else I can improve.

Copy link
Contributor

@antoninbas antoninbas left a 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

@AryanBakliwal
Copy link
Author

@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.

hangyan
hangyan previously approved these changes Feb 17, 2025
Copy link
Member

@hangyan hangyan left a 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

@antoninbas antoninbas added the action/release-note Indicates a PR that should be included in release notes. label Feb 24, 2025
@antoninbas antoninbas added this to the Antrea v2.4 release milestone Feb 24, 2025
@luolanzone
Copy link
Contributor

Hi @AryanBakliwal please re-base to the latest main branch and squash all your changes into one commit. Thanks.

@AryanBakliwal AryanBakliwal force-pushed the bidirection branch 2 times, most recently from 474a382 to 4044b23 Compare February 25, 2025 19:02
@antoninbas antoninbas added the area/ops/packetcapture Issues or PRs related to the PacketCapture feature label Feb 25, 2025
Copy link
Contributor

@antoninbas antoninbas left a 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 {
Copy link
Contributor

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.

Copy link
Author

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 ?

Copy link
Contributor

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?

Copy link
Author

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?

Copy link
Contributor

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".

Copy link
Author

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 {
Copy link
Contributor

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>
Copy link
Contributor

@antoninbas antoninbas left a 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?

@antoninbas
Copy link
Contributor

@AryanBakliwal I just started the Github workflows, let's see if there is any test or linting failure

@hangyan
Copy link
Member

hangyan commented Mar 6, 2025

LGTM, thanks for this great contribution and for your patience during the review process

@hangyan do you want to take another look?

sure. will do it now and give my feedback soon

@hangyan
Copy link
Member

hangyan commented Mar 6, 2025

LGTM.

Thanks @AryanBakliwal

@AryanBakliwal
Copy link
Author

Thank you @antoninbas and @hangyan for guiding me through this. Your support made it much easier :)

@antoninbas
Copy link
Contributor

/test-all

@antoninbas
Copy link
Contributor

@AryanBakliwal One if your new e2e tests has failed in CI. I'm copying the logs below for convenience. PTAL.

Logs for failed test
2025-03-06T09:55:13.0928191Z === CONT  TestPacketCapture/testPacketCaptureBasic/testPacketCaptureBasic/ipv4-tcp-both
2025-03-06T09:55:14.5665773Z     packetcapture_test.go:581: CR status not match, actual: {NumberCaptured:5 FilePath:sftp://10.96.206.31:22/upload/ipv4-tcp-both.pcapng Conditions:[{Type:PacketCaptureStarted Status:True LastTransitionTime:2025-03-06 09:55:13 +0000 UTC Reason:Started Message:} {Type:PacketCaptureComplete Status:True LastTransitionTime:2025-03-06 09:55:14 +0000 UTC Reason:Succeed Message:} {Type:PacketCaptureFileUploaded Status:True LastTransitionTime:2025-03-06 09:55:14 +0000 UTC Reason:Succeed Message:}]}, expected: {NumberCaptured:10 FilePath:sftp://10.96.206.31:22/upload/ipv4-tcp.pcapng Conditions:[{Type:PacketCaptureStarted Status:True LastTransitionTime:0001-01-01 00:00:00 +0000 UTC Reason:Started Message:} {Type:PacketCaptureComplete Status:True LastTransitionTime:0001-01-01 00:00:00 +0000 UTC Reason:Succeed Message:} {Type:PacketCaptureFileUploaded Status:True LastTransitionTime:0001-01-01 00:00:00 +0000 UTC Reason:Succeed Message:}]}
2025-03-06T09:55:14.6059211Z I0306 09:55:14.605566   26834 framework.go:2950] Copying file "/tmp/antrea/packetcapture/packets/ipv4-tcp-both.pcapng" from Pod kube-system/antrea-agent-9rqsg
2025-03-06T09:55:14.6060486Z     packetcapture_test.go:699: 
2025-03-06T09:55:14.6061597Z         	Error Trace:	/home/runner/work/antrea/antrea/test/e2e/packetcapture_test.go:699
2025-03-06T09:55:14.6063285Z         	            				/home/runner/work/antrea/antrea/test/e2e/packetcapture_test.go:598
2025-03-06T09:55:14.6065129Z         	            				/home/runner/work/antrea/antrea/test/e2e/packetcapture_test.go:473
2025-03-06T09:55:14.6066262Z         	Error:      	Not equal: 
2025-03-06T09:55:14.6067020Z         	            	expected: "10.244.2.52"
2025-03-06T09:55:14.6067893Z         	            	actual  : "10.244.0.115"
2025-03-06T09:55:14.6068216Z         	            	
2025-03-06T09:55:14.6068671Z         	            	Diff:
2025-03-06T09:55:14.6069069Z         	            	--- Expected
2025-03-06T09:55:14.6069508Z         	            	+++ Actual
2025-03-06T09:55:14.6069859Z         	            	@@ -1 +1 @@
2025-03-06T09:55:14.6070217Z         	            	-10.244.2.52
2025-03-06T09:55:14.6070573Z         	            	+10.244.0.115
2025-03-06T09:55:14.6071187Z         	Test:       	TestPacketCapture/testPacketCaptureBasic/testPacketCaptureBasic/ipv4-tcp-both
2025-03-06T09:55:14.6071826Z     packetcapture_test.go:700: 
2025-03-06T09:55:14.6072579Z         	Error Trace:	/home/runner/work/antrea/antrea/test/e2e/packetcapture_test.go:700
2025-03-06T09:55:14.6074019Z         	            				/home/runner/work/antrea/antrea/test/e2e/packetcapture_test.go:598
2025-03-06T09:55:14.6075207Z         	            				/home/runner/work/antrea/antrea/test/e2e/packetcapture_test.go:473
2025-03-06T09:55:14.6075904Z         	Error:      	Not equal: 
2025-03-06T09:55:14.6076481Z         	            	expected: "10.244.0.115"
2025-03-06T09:55:14.6077124Z         	            	actual  : "10.244.2.52"
2025-03-06T09:55:14.6077868Z         	            	
2025-03-06T09:55:14.6078287Z         	            	Diff:
2025-03-06T09:55:14.6078637Z         	            	--- Expected
2025-03-06T09:55:14.6079211Z         	            	+++ Actual
2025-03-06T09:55:14.6079690Z         	            	@@ -1 +1 @@
2025-03-06T09:55:14.6080143Z         	            	-10.244.0.115
2025-03-06T09:55:14.6080645Z         	            	+10.244.2.52
2025-03-06T09:55:14.6081466Z         	Test:       	TestPacketCapture/testPacketCaptureBasic/testPacketCaptureBasic/ipv4-tcp-both
2025-03-06T09:55:14.6081961Z     packetcapture_test.go:718: 
2025-03-06T09:55:14.6082648Z         	Error Trace:	/home/runner/work/antrea/antrea/test/e2e/packetcapture_test.go:718
2025-03-06T09:55:14.6083801Z         	            				/home/runner/work/antrea/antrea/test/e2e/packetcapture_test.go:598
2025-03-06T09:55:14.6084893Z         	            				/home/runner/work/antrea/antrea/test/e2e/packetcapture_test.go:473
2025-03-06T09:55:14.6085317Z         	Error:      	Not equal: 
2025-03-06T09:55:14.6085765Z         	            	expected: 80
2025-03-06T09:55:14.6086399Z         	            	actual  : 49834
2025-03-06T09:55:14.6087969Z         	Test:       	TestPacketCapture/testPacketCaptureBasic/testPacketCaptureBasic/ipv4-tcp-both
2025-03-06T09:55:14.6088858Z     packetcapture_test.go:699: 
2025-03-06T09:55:14.6089458Z         	Error Trace:	/home/runner/work/antrea/antrea/test/e2e/packetcapture_test.go:699
2025-03-06T09:55:14.6090442Z         	            				/home/runner/work/antrea/antrea/test/e2e/packetcapture_test.go:598
2025-03-06T09:55:14.6091540Z         	            				/home/runner/work/antrea/antrea/test/e2e/packetcapture_test.go:473
2025-03-06T09:55:14.6092163Z         	Error:      	Not equal: 
2025-03-06T09:55:14.6092598Z         	            	expected: "10.244.2.52"
2025-03-06T09:55:14.6093046Z         	            	actual  : "10.244.0.115"
2025-03-06T09:55:14.6093488Z         	            	
2025-03-06T09:55:14.6093773Z         	            	Diff:
2025-03-06T09:55:14.6094116Z         	            	--- Expected
2025-03-06T09:55:14.6094462Z         	            	+++ Actual
2025-03-06T09:55:14.6094907Z         	            	@@ -1 +1 @@
2025-03-06T09:55:14.6095256Z         	            	-10.244.2.52
2025-03-06T09:55:14.6095599Z         	            	+10.244.0.115
2025-03-06T09:55:14.6096205Z         	Test:       	TestPacketCapture/testPacketCaptureBasic/testPacketCaptureBasic/ipv4-tcp-both
2025-03-06T09:55:14.6096819Z     packetcapture_test.go:700: 
2025-03-06T09:55:14.6097693Z         	Error Trace:	/home/runner/work/antrea/antrea/test/e2e/packetcapture_test.go:700
2025-03-06T09:55:14.6099330Z         	            				/home/runner/work/antrea/antrea/test/e2e/packetcapture_test.go:598
2025-03-06T09:55:14.6101419Z         	            				/home/runner/work/antrea/antrea/test/e2e/packetcapture_test.go:473
2025-03-06T09:55:14.6102254Z         	Error:      	Not equal: 
2025-03-06T09:55:14.6102985Z         	            	expected: "10.244.0.115"
2025-03-06T09:55:14.6103580Z         	            	actual  : "10.244.2.52"
2025-03-06T09:55:14.6103895Z         	            	
2025-03-06T09:55:14.6104310Z         	            	Diff:
2025-03-06T09:55:14.6104693Z         	            	--- Expected
2025-03-06T09:55:14.6105254Z         	            	+++ Actual
2025-03-06T09:55:14.6105776Z         	            	@@ -1 +1 @@
2025-03-06T09:55:14.6106253Z         	            	-10.244.0.115
2025-03-06T09:55:14.6106793Z         	            	+10.244.2.52
2025-03-06T09:55:14.6108147Z         	Test:       	TestPacketCapture/testPacketCaptureBasic/testPacketCaptureBasic/ipv4-tcp-both
2025-03-06T09:55:14.6109011Z     packetcapture_test.go:718: 
2025-03-06T09:55:14.6110100Z         	Error Trace:	/home/runner/work/antrea/antrea/test/e2e/packetcapture_test.go:718
2025-03-06T09:55:14.6111940Z         	            				/home/runner/work/antrea/antrea/test/e2e/packetcapture_test.go:598
2025-03-06T09:55:14.6113729Z         	            				/home/runner/work/antrea/antrea/test/e2e/packetcapture_test.go:473
2025-03-06T09:55:14.6114483Z         	Error:      	Not equal: 
2025-03-06T09:55:14.6115090Z         	            	expected: 80
2025-03-06T09:55:14.6115957Z         	            	actual  : 49834
2025-03-06T09:55:14.6116999Z         	Test:       	TestPacketCapture/testPacketCaptureBasic/testPacketCaptureBasic/ipv4-tcp-both
2025-03-06T09:55:14.6119002Z     packetcapture_test.go:598: 
2025-03-06T09:55:14.6120589Z         	Error Trace:	/home/runner/work/antrea/antrea/test/e2e/packetcapture_test.go:598
2025-03-06T09:55:14.6122658Z         	            				/home/runner/work/antrea/antrea/test/e2e/packetcapture_test.go:473
2025-03-06T09:55:14.6123398Z         	Error:      	Received unexpected error:
2025-03-06T09:55:14.6124333Z         	            	EOF
2025-03-06T09:55:14.6126047Z         	Test:       	TestPacketCapture/testPacketCaptureBasic/testPacketCaptureBasic/ipv4-tcp-both
2025-03-06T09:55:14.6127161Z === CONT  TestPacketCapture/testPacketCaptureBasic/testPacketCaptureBasic/ipv4-tcp
2025-03-06T09:55:16.1084962Z I0306 09:55:16.108202   26834 framework.go:2950] Copying file "/tmp/antrea/packetcapture/packets/ipv4-tcp.pcapng" from Pod kube-system/antrea-agent-9rqsg
2025-03-06T09:55:16.1149248Z === CONT  TestPacketCapture/testPacketCaptureBasic/testPacketCaptureBasic/non-existing-pod
2025-03-06T09:55:17.1262610Z === CONT  TestPacketCapture/testPacketCaptureBasic/testPacketCaptureBasic/invalid-host-public-key
2025-03-06T09:55:23.4110071Z I0306 09:55:23.410656   26834 framework.go:2950] Copying file "/tmp/antrea/packetcapture/packets/ipv4-icmp.pcapng" from Pod kube-system/antrea-agent-9rqsg
2025-03-06T09:55:28.4360245Z I0306 09:55:28.435537   26834 framework.go:2950] Copying file "/tmp/antrea/packetcapture/packets/ipv4-icmp-timeout.pcapng" from Pod kube-system/antrea-agent-9rqsg
2025-03-06T09:55:34.6221684Z I0306 09:55:34.621816   26834 framework.go:2950] Copying file "/tmp/antrea/packetcapture/packets/ipv4-udp.pcapng" from Pod kube-system/antrea-agent-9rqsg
2025-03-06T09:55:39.4440890Z I0306 09:55:39.443728   26834 framework.go:2950] Copying file "/tmp/antrea/packetcapture/packets/invalid-host-public-key.pcapng" from Pod kube-system/antrea-agent-9rqsg
2025-03-06T09:55:52.4711478Z === NAME  TestPacketCapture
2025-03-06T09:55:52.4713224Z     fixtures.go:352: Exporting test logs to '/home/runner/work/antrea/antrea/log/TestPacketCapture/beforeTeardown.Mar06-09-55-52'
2025-03-06T09:55:55.2982465Z     fixtures.go:523: Deleting 'testpacketcapture-1m63oz7o' K8s Namespace
2025-03-06T09:55:55.3026064Z I0306 09:55:55.302338   26834 framework.go:882] Deleting Namespace testpacketcapture-1m63oz7o took 4.302301ms
2025-03-06T09:55:55.3031550Z --- FAIL: TestPacketCapture (52.69s)
2025-03-06T09:55:55.3033334Z     --- FAIL: TestPacketCapture/testPacketCaptureBasic (42.40s)
2025-03-06T09:55:55.3034117Z         --- FAIL: TestPacketCapture/testPacketCaptureBasic/testPacketCaptureBasic (0.00s)
2025-03-06T09:55:55.3035120Z             --- FAIL: TestPacketCapture/testPacketCaptureBasic/testPacketCaptureBasic/ipv4-tcp-both (1.52s)
2025-03-06T09:55:55.3036220Z             --- PASS: TestPacketCapture/testPacketCaptureBasic/testPacketCaptureBasic/ipv4-tcp (1.50s)
2025-03-06T09:55:55.3038200Z             --- PASS: TestPacketCapture/testPacketCaptureBasic/testPacketCaptureBasic/non-existing-pod (1.01s)
2025-03-06T09:55:55.3039872Z             --- PASS: TestPacketCapture/testPacketCaptureBasic/testPacketCaptureBasic/ipv4-icmp (10.32s)
2025-03-06T09:55:55.3041535Z             --- PASS: TestPacketCapture/testPacketCaptureBasic/testPacketCaptureBasic/ipv4-icmp-timeout (15.35s)
2025-03-06T09:55:55.3043277Z             --- PASS: TestPacketCapture/testPacketCaptureBasic/testPacketCaptureBasic/ipv4-udp (21.54s)
2025-03-06T09:55:55.3045166Z             --- PASS: TestPacketCapture/testPacketCaptureBasic/testPacketCaptureBasic/invalid-host-public-key (22.32s)

@AryanBakliwal
Copy link
Author

@AryanBakliwal One if your new e2e tests has failed in CI. I'm copying the logs below for convenience. PTAL.

Logs for failed test

2025-03-06T09:55:13.0928191Z === CONT  TestPacketCapture/testPacketCaptureBasic/testPacketCaptureBasic/ipv4-tcp-both

2025-03-06T09:55:14.5665773Z     packetcapture_test.go:581: CR status not match, actual: {NumberCaptured:5 FilePath:sftp://10.96.206.31:22/upload/ipv4-tcp-both.pcapng Conditions:[{Type:PacketCaptureStarted Status:True LastTransitionTime:2025-03-06 09:55:13 +0000 UTC Reason:Started Message:} {Type:PacketCaptureComplete Status:True LastTransitionTime:2025-03-06 09:55:14 +0000 UTC Reason:Succeed Message:} {Type:PacketCaptureFileUploaded Status:True LastTransitionTime:2025-03-06 09:55:14 +0000 UTC Reason:Succeed Message:}]}, expected: {NumberCaptured:10 FilePath:sftp://10.96.206.31:22/upload/ipv4-tcp.pcapng Conditions:[{Type:PacketCaptureStarted Status:True LastTransitionTime:0001-01-01 00:00:00 +0000 UTC Reason:Started Message:} {Type:PacketCaptureComplete Status:True LastTransitionTime:0001-01-01 00:00:00 +0000 UTC Reason:Succeed Message:} {Type:PacketCaptureFileUploaded Status:True LastTransitionTime:0001-01-01 00:00:00 +0000 UTC Reason:Succeed Message:}]}

2025-03-06T09:55:14.6059211Z I0306 09:55:14.605566   26834 framework.go:2950] Copying file "/tmp/antrea/packetcapture/packets/ipv4-tcp-both.pcapng" from Pod kube-system/antrea-agent-9rqsg

2025-03-06T09:55:14.6060486Z     packetcapture_test.go:699: 

2025-03-06T09:55:14.6061597Z         	Error Trace:	/home/runner/work/antrea/antrea/test/e2e/packetcapture_test.go:699

2025-03-06T09:55:14.6063285Z         	            				/home/runner/work/antrea/antrea/test/e2e/packetcapture_test.go:598

2025-03-06T09:55:14.6065129Z         	            				/home/runner/work/antrea/antrea/test/e2e/packetcapture_test.go:473

2025-03-06T09:55:14.6066262Z         	Error:      	Not equal: 

2025-03-06T09:55:14.6067020Z         	            	expected: "10.244.2.52"

2025-03-06T09:55:14.6067893Z         	            	actual  : "10.244.0.115"

2025-03-06T09:55:14.6068216Z         	            	

2025-03-06T09:55:14.6068671Z         	            	Diff:

2025-03-06T09:55:14.6069069Z         	            	--- Expected

2025-03-06T09:55:14.6069508Z         	            	+++ Actual

2025-03-06T09:55:14.6069859Z         	            	@@ -1 +1 @@

2025-03-06T09:55:14.6070217Z         	            	-10.244.2.52

2025-03-06T09:55:14.6070573Z         	            	+10.244.0.115

2025-03-06T09:55:14.6071187Z         	Test:       	TestPacketCapture/testPacketCaptureBasic/testPacketCaptureBasic/ipv4-tcp-both

2025-03-06T09:55:14.6071826Z     packetcapture_test.go:700: 

2025-03-06T09:55:14.6072579Z         	Error Trace:	/home/runner/work/antrea/antrea/test/e2e/packetcapture_test.go:700

2025-03-06T09:55:14.6074019Z         	            				/home/runner/work/antrea/antrea/test/e2e/packetcapture_test.go:598

2025-03-06T09:55:14.6075207Z         	            				/home/runner/work/antrea/antrea/test/e2e/packetcapture_test.go:473

2025-03-06T09:55:14.6075904Z         	Error:      	Not equal: 

2025-03-06T09:55:14.6076481Z         	            	expected: "10.244.0.115"

2025-03-06T09:55:14.6077124Z         	            	actual  : "10.244.2.52"

2025-03-06T09:55:14.6077868Z         	            	

2025-03-06T09:55:14.6078287Z         	            	Diff:

2025-03-06T09:55:14.6078637Z         	            	--- Expected

2025-03-06T09:55:14.6079211Z         	            	+++ Actual

2025-03-06T09:55:14.6079690Z         	            	@@ -1 +1 @@

2025-03-06T09:55:14.6080143Z         	            	-10.244.0.115

2025-03-06T09:55:14.6080645Z         	            	+10.244.2.52

2025-03-06T09:55:14.6081466Z         	Test:       	TestPacketCapture/testPacketCaptureBasic/testPacketCaptureBasic/ipv4-tcp-both

2025-03-06T09:55:14.6081961Z     packetcapture_test.go:718: 

2025-03-06T09:55:14.6082648Z         	Error Trace:	/home/runner/work/antrea/antrea/test/e2e/packetcapture_test.go:718

2025-03-06T09:55:14.6083801Z         	            				/home/runner/work/antrea/antrea/test/e2e/packetcapture_test.go:598

2025-03-06T09:55:14.6084893Z         	            				/home/runner/work/antrea/antrea/test/e2e/packetcapture_test.go:473

2025-03-06T09:55:14.6085317Z         	Error:      	Not equal: 

2025-03-06T09:55:14.6085765Z         	            	expected: 80

2025-03-06T09:55:14.6086399Z         	            	actual  : 49834

2025-03-06T09:55:14.6087969Z         	Test:       	TestPacketCapture/testPacketCaptureBasic/testPacketCaptureBasic/ipv4-tcp-both

2025-03-06T09:55:14.6088858Z     packetcapture_test.go:699: 

2025-03-06T09:55:14.6089458Z         	Error Trace:	/home/runner/work/antrea/antrea/test/e2e/packetcapture_test.go:699

2025-03-06T09:55:14.6090442Z         	            				/home/runner/work/antrea/antrea/test/e2e/packetcapture_test.go:598

2025-03-06T09:55:14.6091540Z         	            				/home/runner/work/antrea/antrea/test/e2e/packetcapture_test.go:473

2025-03-06T09:55:14.6092163Z         	Error:      	Not equal: 

2025-03-06T09:55:14.6092598Z         	            	expected: "10.244.2.52"

2025-03-06T09:55:14.6093046Z         	            	actual  : "10.244.0.115"

2025-03-06T09:55:14.6093488Z         	            	

2025-03-06T09:55:14.6093773Z         	            	Diff:

2025-03-06T09:55:14.6094116Z         	            	--- Expected

2025-03-06T09:55:14.6094462Z         	            	+++ Actual

2025-03-06T09:55:14.6094907Z         	            	@@ -1 +1 @@

2025-03-06T09:55:14.6095256Z         	            	-10.244.2.52

2025-03-06T09:55:14.6095599Z         	            	+10.244.0.115

2025-03-06T09:55:14.6096205Z         	Test:       	TestPacketCapture/testPacketCaptureBasic/testPacketCaptureBasic/ipv4-tcp-both

2025-03-06T09:55:14.6096819Z     packetcapture_test.go:700: 

2025-03-06T09:55:14.6097693Z         	Error Trace:	/home/runner/work/antrea/antrea/test/e2e/packetcapture_test.go:700

2025-03-06T09:55:14.6099330Z         	            				/home/runner/work/antrea/antrea/test/e2e/packetcapture_test.go:598

2025-03-06T09:55:14.6101419Z         	            				/home/runner/work/antrea/antrea/test/e2e/packetcapture_test.go:473

2025-03-06T09:55:14.6102254Z         	Error:      	Not equal: 

2025-03-06T09:55:14.6102985Z         	            	expected: "10.244.0.115"

2025-03-06T09:55:14.6103580Z         	            	actual  : "10.244.2.52"

2025-03-06T09:55:14.6103895Z         	            	

2025-03-06T09:55:14.6104310Z         	            	Diff:

2025-03-06T09:55:14.6104693Z         	            	--- Expected

2025-03-06T09:55:14.6105254Z         	            	+++ Actual

2025-03-06T09:55:14.6105776Z         	            	@@ -1 +1 @@

2025-03-06T09:55:14.6106253Z         	            	-10.244.0.115

2025-03-06T09:55:14.6106793Z         	            	+10.244.2.52

2025-03-06T09:55:14.6108147Z         	Test:       	TestPacketCapture/testPacketCaptureBasic/testPacketCaptureBasic/ipv4-tcp-both

2025-03-06T09:55:14.6109011Z     packetcapture_test.go:718: 

2025-03-06T09:55:14.6110100Z         	Error Trace:	/home/runner/work/antrea/antrea/test/e2e/packetcapture_test.go:718

2025-03-06T09:55:14.6111940Z         	            				/home/runner/work/antrea/antrea/test/e2e/packetcapture_test.go:598

2025-03-06T09:55:14.6113729Z         	            				/home/runner/work/antrea/antrea/test/e2e/packetcapture_test.go:473

2025-03-06T09:55:14.6114483Z         	Error:      	Not equal: 

2025-03-06T09:55:14.6115090Z         	            	expected: 80

2025-03-06T09:55:14.6115957Z         	            	actual  : 49834

2025-03-06T09:55:14.6116999Z         	Test:       	TestPacketCapture/testPacketCaptureBasic/testPacketCaptureBasic/ipv4-tcp-both

2025-03-06T09:55:14.6119002Z     packetcapture_test.go:598: 

2025-03-06T09:55:14.6120589Z         	Error Trace:	/home/runner/work/antrea/antrea/test/e2e/packetcapture_test.go:598

2025-03-06T09:55:14.6122658Z         	            				/home/runner/work/antrea/antrea/test/e2e/packetcapture_test.go:473

2025-03-06T09:55:14.6123398Z         	Error:      	Received unexpected error:

2025-03-06T09:55:14.6124333Z         	            	EOF

2025-03-06T09:55:14.6126047Z         	Test:       	TestPacketCapture/testPacketCaptureBasic/testPacketCaptureBasic/ipv4-tcp-both

2025-03-06T09:55:14.6127161Z === CONT  TestPacketCapture/testPacketCaptureBasic/testPacketCaptureBasic/ipv4-tcp

2025-03-06T09:55:16.1084962Z I0306 09:55:16.108202   26834 framework.go:2950] Copying file "/tmp/antrea/packetcapture/packets/ipv4-tcp.pcapng" from Pod kube-system/antrea-agent-9rqsg

2025-03-06T09:55:16.1149248Z === CONT  TestPacketCapture/testPacketCaptureBasic/testPacketCaptureBasic/non-existing-pod

2025-03-06T09:55:17.1262610Z === CONT  TestPacketCapture/testPacketCaptureBasic/testPacketCaptureBasic/invalid-host-public-key

2025-03-06T09:55:23.4110071Z I0306 09:55:23.410656   26834 framework.go:2950] Copying file "/tmp/antrea/packetcapture/packets/ipv4-icmp.pcapng" from Pod kube-system/antrea-agent-9rqsg

2025-03-06T09:55:28.4360245Z I0306 09:55:28.435537   26834 framework.go:2950] Copying file "/tmp/antrea/packetcapture/packets/ipv4-icmp-timeout.pcapng" from Pod kube-system/antrea-agent-9rqsg

2025-03-06T09:55:34.6221684Z I0306 09:55:34.621816   26834 framework.go:2950] Copying file "/tmp/antrea/packetcapture/packets/ipv4-udp.pcapng" from Pod kube-system/antrea-agent-9rqsg

2025-03-06T09:55:39.4440890Z I0306 09:55:39.443728   26834 framework.go:2950] Copying file "/tmp/antrea/packetcapture/packets/invalid-host-public-key.pcapng" from Pod kube-system/antrea-agent-9rqsg

2025-03-06T09:55:52.4711478Z === NAME  TestPacketCapture

2025-03-06T09:55:52.4713224Z     fixtures.go:352: Exporting test logs to '/home/runner/work/antrea/antrea/log/TestPacketCapture/beforeTeardown.Mar06-09-55-52'

2025-03-06T09:55:55.2982465Z     fixtures.go:523: Deleting 'testpacketcapture-1m63oz7o' K8s Namespace

2025-03-06T09:55:55.3026064Z I0306 09:55:55.302338   26834 framework.go:882] Deleting Namespace testpacketcapture-1m63oz7o took 4.302301ms

2025-03-06T09:55:55.3031550Z --- FAIL: TestPacketCapture (52.69s)

2025-03-06T09:55:55.3033334Z     --- FAIL: TestPacketCapture/testPacketCaptureBasic (42.40s)

2025-03-06T09:55:55.3034117Z         --- FAIL: TestPacketCapture/testPacketCaptureBasic/testPacketCaptureBasic (0.00s)

2025-03-06T09:55:55.3035120Z             --- FAIL: TestPacketCapture/testPacketCaptureBasic/testPacketCaptureBasic/ipv4-tcp-both (1.52s)

2025-03-06T09:55:55.3036220Z             --- PASS: TestPacketCapture/testPacketCaptureBasic/testPacketCaptureBasic/ipv4-tcp (1.50s)

2025-03-06T09:55:55.3038200Z             --- PASS: TestPacketCapture/testPacketCaptureBasic/testPacketCaptureBasic/non-existing-pod (1.01s)

2025-03-06T09:55:55.3039872Z             --- PASS: TestPacketCapture/testPacketCaptureBasic/testPacketCaptureBasic/ipv4-icmp (10.32s)

2025-03-06T09:55:55.3041535Z             --- PASS: TestPacketCapture/testPacketCaptureBasic/testPacketCaptureBasic/ipv4-icmp-timeout (15.35s)

2025-03-06T09:55:55.3043277Z             --- PASS: TestPacketCapture/testPacketCaptureBasic/testPacketCaptureBasic/ipv4-udp (21.54s)

2025-03-06T09:55:55.3045166Z             --- PASS: TestPacketCapture/testPacketCaptureBasic/testPacketCaptureBasic/invalid-host-public-key (22.32s)

I'll look into it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
action/release-note Indicates a PR that should be included in release notes. area/ops/packetcapture Issues or PRs related to the PacketCapture feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bi-direction capture support for PacketCapture
5 participants