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

[mobile]Create a real dummy socket option to manage network type hashing #38099

Merged
merged 5 commits into from
Jan 17, 2025

Conversation

RenjieTang
Copy link
Contributor

Commit Message: Create a real dummy socket option to manage network type hashing
Additional Description: The previous approach uses IP_TTL and it might cause unwanted behavior in production.
Risk Level: low
Testing: existing tests
Docs Changes: n/a
Release Notes: n/a
Platform Specific Features: mobile only
Runtime guard: envoy_reloadable_features_use_network_type_socket_option

Signed-off-by: Renjie Tang <renjietang@google.com>
Signed-off-by: Renjie Tang <renjietang@google.com>
Copy link

CC @envoyproxy/runtime-guard-changes: FYI only for changes made to (source/common/runtime/runtime_features.cc).

🐱

Caused by: #38099 was opened by RenjieTang.

see: more, trace.

Signed-off-by: Renjie Tang <renjietang@google.com>
Signed-off-by: Renjie Tang <renjietang@google.com>
Copy link
Contributor

@RyanTheOptimist RyanTheOptimist left a comment

Choose a reason for hiding this comment

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

Nice! Looks very clean. Is it worth writing a test that the hash computation generates different values? (An integration/end-to-end test would be amazing but probably would also be hard)

return absl::make_optional(std::move(details));
}

bool NetworkTypeSocketOptionImpl::isSupported() const { return optname_.hasValue(); }
Copy link
Contributor

Choose a reason for hiding this comment

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

Given that optname_ appears to be const, does this method always return true?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are right. I was cargo culting the socket tagging code.
Now it fixed. It should always return true.

Signed-off-by: Renjie Tang <renjietang@google.com>
@RenjieTang
Copy link
Contributor Author

Nice! Looks very clean. Is it worth writing a test that the hash computation generates different values? (An integration/end-to-end test would be amazing but probably would also be hard)

It's quite hard to add an integration test for this. I added a unit test to test on socket option hash generations.

@RyanTheOptimist RyanTheOptimist merged commit 9b4e465 into envoyproxy:main Jan 17, 2025
25 checks passed
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