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

bpf_metadata: extract setting requested proxylib app protocol #1129

Merged

Conversation

mhofstetter
Copy link
Member

Currently, the function extractSocketMetadata does not only extract relevant information from the socket and enriches it with data retrieved from BPF maps. It also has some side-effects: namely setting the proxylib protocol as application protocol on the network socket.

Therefore, this commit splits this logic from the function extractSocketMetadata and moves the part that is setting the proxylib l7 protocol as requested app protocol on the network socket into a dedicated function on the SocketMetadata struct that then is called from the BPF metadata listener filter in the onAccept function.

The part that is evaluating the ProxyLib L7 proto is still kept in the function extractSocketMetadata.

This way, we can keep the function extractSocketMetadata free of side-effects and bundle the logic that changes the socket in the BPF metadata listener filter (onAccept).

Note: socket.connectionInfoProvider().restoreLocalAddress(dst_address) - the last modifying action in extractSocketMetadata) will be cleaned up in a follow up commit.

Currently, the function `extractSocketMetadata` does not only extract relevant
information from the socket and enriches it with data retrieved from BPF maps.
It also has some side-effects: namely setting the proxylib protocol as application
protocol on the network socket.

Therefore, this commit splits this logic from the function `extractSocketMetadata`
and moves the part that is setting the proxylib l7 protocol as requested app protocol
on the network socket into a dedicated function on the SocketMetadata struct that
then is called from the BPF metadata listener filter in the onAccept function.

The part that is evaluating the ProxyLib L7 proto is still kept in the function
`extractSocketMetadata`.

This way, we can keep the function extractSocketMetadata free of side-effects and
bundle the logic that changes the socket in the BPF metadata listener filter (onAccept).

Note: socket.connectionInfoProvider().restoreLocalAddress(dst_address) - the last
modifying action in extractSocketMetadata) will be cleaned up in a follow up commit.

Signed-off-by: Marco Hofstetter <[email protected]>
@mhofstetter mhofstetter marked this pull request as ready for review January 20, 2025 10:32
@mhofstetter mhofstetter requested a review from a team as a code owner January 20, 2025 10:32
Copy link
Member

@jrajahalme jrajahalme 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 the clean-up!

@jrajahalme jrajahalme added this pull request to the merge queue Jan 20, 2025
Merged via the queue into cilium:main with commit 23103fb Jan 20, 2025
5 checks passed
@mhofstetter mhofstetter deleted the pr/mhofstetter/bpfmetadata-proxylib-proto branch January 20, 2025 12:53
mhofstetter added a commit to mhofstetter/proxy that referenced this pull request Jan 20, 2025
The refactoring of PR cilium#1129 completely missed calling the newly
introduced function `configureProxyLibApplicationProtocol` in
the BPF metadata listener filter.

This commit fixes this.

Signed-off-by: Marco Hofstetter <[email protected]>
github-merge-queue bot pushed a commit that referenced this pull request Jan 20, 2025
The refactoring of PR #1129 completely missed calling the newly
introduced function `configureProxyLibApplicationProtocol` in
the BPF metadata listener filter.

This commit fixes this.

Signed-off-by: Marco Hofstetter <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants