-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Conversation
Signed-off-by: Renjie Tang <renjietang@google.com>
Signed-off-by: Renjie Tang <renjietang@google.com>
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.
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(); } |
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.
Given that optname_
appears to be const, does this method always return true?
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.
You are right. I was cargo culting the socket tagging code.
Now it fixed. It should always return true.
It's quite hard to add an integration test for this. I added a unit test to test on socket option hash generations. |
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