Skip to content

Optimized the FD fetch logic of openssl#905

Merged
cfc4n merged 5 commits into
masterfrom
feat/enhance-pr-903
Dec 20, 2025
Merged

Optimized the FD fetch logic of openssl#905
cfc4n merged 5 commits into
masterfrom
feat/enhance-pr-903

Conversation

@cfc4n
Copy link
Copy Markdown
Member

@cfc4n cfc4n commented Dec 20, 2025

This pull request refactors the logic for extracting BIO and file descriptor information from SSL objects in the OpenSSL probe code. The main improvement is the introduction of two helper functions to handle reading the read and write BIOs, which reduces code duplication and streamlines error handling in the probe entry functions.

Refactoring and code simplification:

  • Added helper functions process_SSL_rbio and process_SSL_wbio to encapsulate the logic for reading the BIO type and file descriptor from the SSL object's read and write BIOs, respectively. This centralizes error handling and memory access logic.
  • Updated probe_entry_SSL_write to use the new process_SSL_wbio function, removing duplicated code for accessing the write BIO and file descriptor. [1] [2]
  • Updated probe_entry_SSL_read to use the new process_SSL_rbio function, removing duplicated code for accessing the read BIO and file descriptor.

…L probing functions

Signed-off-by: CFC4N <cfc4n.cs@gmail.com>
…L probing functions

Signed-off-by: CFC4N <cfc4n.cs@gmail.com>
…proved clarity

Signed-off-by: CFC4N <cfc4n.cs@gmail.com>
… improved modularity

Signed-off-by: CFC4N <cfc4n.cs@gmail.com>
@dosubot dosubot Bot added size:L This PR changes 100-499 lines, ignoring generated files. improve labels Dec 20, 2025
@github-actions
Copy link
Copy Markdown

✅ E2E Test Results: PASSED

Test Run: #20391124974

Tests Executed:

  • TLS/OpenSSL Module (curl → github.com)
  • GnuTLS Module (wget/curl → github.com)
  • GoTLS Module (Go client → github.com)

✅ All e2e tests passed successfully! The TLS capture functionality is working correctly.


Automated e2e test results for commit 6eba7c0

@github-actions
Copy link
Copy Markdown

🔧 Debug Build Complete (PR #905)

📦 Download Links:

⏰ Files will be retained for 7 days, please download and test promptly.


This build includes debug binaries for: android/linux (arm64/amd64)

…ctions

Signed-off-by: CFC4N <cfc4n.cs@gmail.com>
@github-actions
Copy link
Copy Markdown

✅ E2E Test Results: PASSED

Test Run: #20391309120

Tests Executed:

  • TLS/OpenSSL Module (curl → github.com)
  • GnuTLS Module (wget/curl → github.com)
  • GoTLS Module (Go client → github.com)

✅ All e2e tests passed successfully! The TLS capture functionality is working correctly.


Automated e2e test results for commit 31788e0

@github-actions
Copy link
Copy Markdown

🔧 Debug Build Complete (PR #905)

📦 Download Links:

⏰ Files will be retained for 7 days, please download and test promptly.


This build includes debug binaries for: android/linux (arm64/amd64)

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request refactors the OpenSSL BIO and file descriptor extraction logic in the eBPF probe code by introducing helper functions to reduce code duplication and improve maintainability. The changes consolidate repeated logic for reading BIO information from SSL objects.

  • Introduced process_SSL_bio helper to extract BIO type and file descriptor from SSL objects
  • Introduced probe_entry_SSL and probe_ret_SSL generic helpers to handle SSL read/write probe entry and return logic
  • Added should_trace helper to centralize PID/UID filtering logic

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread kern/openssl.h
Comment thread kern/openssl.h
Comment thread kern/openssl.h
Comment thread kern/openssl.h
Comment thread kern/openssl.h
@cfc4n cfc4n merged commit 0766a93 into master Dec 20, 2025
18 of 19 checks passed
@cfc4n cfc4n deleted the feat/enhance-pr-903 branch December 20, 2025 08:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

improve size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants