Skip to content

[network] add socket option introspection#5351

Merged
mattklein123 merged 4 commits intoenvoyproxy:masterfrom
klarose:add_socket_option_introspection
Dec 21, 2018
Merged

[network] add socket option introspection#5351
mattklein123 merged 4 commits intoenvoyproxy:masterfrom
klarose:add_socket_option_introspection

Conversation

@klarose
Copy link
Copy Markdown
Contributor

@klarose klarose commented Dec 19, 2018

Description: In PR #5035 I added the ability to get information of what low level options would be applied to a socket option. This is useful for unit testing. Since I am likely going to cancel that PR, I figured it'd make sense to submit this functionality separately. I intend on using it in future PRs.

From the commit:

We want to be able to introspect the options being passed around without
needing to actually apply them. The simplest way to do this is to have
them return the values they would set. Since the values may differ based
on who they are visiting, this introspection takes into account the
socket and state passed in.

Risk Level: Low. A simple read-only extension of an existing interface that is not invoked from any production code. The riskiest change is the refactoring of AddrFamilyAwareSocketOption, but its UTs continue to pass.
Testing: Added new UT for the new code. Ran UT on //test/common/network/... and //test/common/upstream/...
Docs Changes: None
Release Notes: None

We want to be able to introspect the options being passed around without
needing to actually apply them. The simplest way to do this is to have
them return the values they would set. Since the values may differ based
on who they are visiting, this introspection takes into account the
socket and state passed in.

Signed-off-by: Kyle Larose <kyle@agilicus.com>
Suggestions from review.

Signed-off-by: Kyle Larose <kyle@agilicus.com>
@klarose
Copy link
Copy Markdown
Contributor Author

klarose commented Dec 20, 2018

@zuercher I'd appreciate it you looked over this again (since it's just a chunk of what you've already reviewed. :) )

Copy link
Copy Markdown
Member

@zuercher zuercher left a comment

Choose a reason for hiding this comment

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

Looks good! One nit and a question.

Signed-off-by: Kyle Larose <kyle@agilicus.com>
Rather than returning a detail whose option may collide with other
unsupported options, just return nullopt making it appear as though it
wouldn't be added to the socket.

Signed-off-by: Kyle Larose <kyle@agilicus.com>
Copy link
Copy Markdown
Member

@zuercher zuercher left a comment

Choose a reason for hiding this comment

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

Thanks!

@mattklein123 mattklein123 merged commit f37a312 into envoyproxy:master Dec 21, 2018
fredlas pushed a commit to fredlas/envoy that referenced this pull request Mar 5, 2019
We want to be able to introspect the options being passed around without
needing to actually apply them. The simplest way to do this is to have
them return the values they would set. Since the values may differ based
on who they are visiting, this introspection takes into account the
socket and state passed in.

Signed-off-by: Kyle Larose <kyle@agilicus.com>
Signed-off-by: Fred Douglas <fredlas@google.com>
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.

3 participants