-
Notifications
You must be signed in to change notification settings - Fork 5.5k
tls: move ssl connection info into SocketAddressProvider #17334
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
Changes from 8 commits
cad3fa0
288b40a
2dffc9f
f9881a3
3b56911
d04acbd
f18d2af
2df315a
f4f5746
e4c648d
4801259
69c9244
e05ab4e
03377f8
60b8ed5
7d1729c
93073ae
27426b8
8238485
e996cc8
c14b661
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -9,6 +9,7 @@ | |||
| #include "envoy/config/core/v3/base.pb.h" | ||||
| #include "envoy/network/address.h" | ||||
| #include "envoy/network/io_handle.h" | ||||
| #include "envoy/ssl/connection.h" | ||||
|
|
||||
| #include "absl/strings/string_view.h" | ||||
| #include "absl/types/optional.h" | ||||
|
|
@@ -92,6 +93,18 @@ class SocketAddressProvider { | |||
| * @param indent_level the level of indentation. | ||||
| */ | ||||
| virtual void dumpState(std::ostream& os, int indent_level) const PURE; | ||||
|
|
||||
| /** | ||||
| * @return the upstream SSL connection. This will be nullptr if the upstream | ||||
| * connection does not use SSL. | ||||
| */ | ||||
| virtual Ssl::ConnectionInfoConstSharedPtr upstreamSslConnection() const PURE; | ||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this interface should only have the downstreamSslConnection(). All the other fields here are specific to the downstream connection, so including the upstream connection seems misleading.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I feel strange too. Although we can keep this in the StreamInfo also, but it still feel strange, since the StreamInfo is only mean to stream for one direction(upstream, or downstream). Also can see the downstream StreamInfo's upstream SSL info is copied from upstream StreamInfo. For example: envoy/source/common/tcp_proxy/tcp_proxy.cc Line 531 in a8033fa
So in the end, the upstream SSL info is still mixed with downstream SSL info into downstream StreamInfo. Based on my guess the reason is the filter need the upstream StreamInfo, but other than tcpProxy or HttpRouter filter can't get the upstream StreamInfo, since the upstream StreamInfo is created the last filter (tcpProxy/http router filter).
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The streaminfo is a bit odd, and has a mix of upstream/downstream. But
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. thanks, got it, let me revert the change to upstream SSL info. |
||||
|
|
||||
| /** | ||||
| * @return the downstream SSL connection. This will be nullptr if the downstream | ||||
| * connection does not use SSL. | ||||
| */ | ||||
| virtual Ssl::ConnectionInfoConstSharedPtr downstreamSslConnection() const PURE; | ||||
|
soulxu marked this conversation as resolved.
Outdated
|
||||
| }; | ||||
|
|
||||
| class SocketAddressSetter : public SocketAddressProvider { | ||||
|
|
@@ -131,6 +144,18 @@ class SocketAddressSetter : public SocketAddressProvider { | |||
| * @param id Connection ID of the downstream connection. | ||||
| **/ | ||||
| virtual void setConnectionID(uint64_t id) PURE; | ||||
|
|
||||
| /** | ||||
| * @param connection_info sets the downstream ssl connection. | ||||
| */ | ||||
| virtual void | ||||
| setDownstreamSslConnection(const Ssl::ConnectionInfoConstSharedPtr& ssl_connection_info) PURE; | ||||
|
|
||||
| /** | ||||
| * @param connection_info sets the upstream ssl connection. | ||||
| */ | ||||
| virtual void | ||||
| setUpstreamSslConnection(const Ssl::ConnectionInfoConstSharedPtr& ssl_connection_info) PURE; | ||||
| }; | ||||
|
|
||||
| using SocketAddressSetterSharedPtr = std::shared_ptr<SocketAddressSetter>; | ||||
|
|
@@ -153,7 +178,7 @@ class Socket { | |||
| */ | ||||
| virtual SocketAddressSetter& addressProvider() PURE; | ||||
| virtual const SocketAddressProvider& addressProvider() const PURE; | ||||
| virtual SocketAddressProviderSharedPtr addressProviderSharedPtr() const PURE; | ||||
| virtual SocketAddressSetterSharedPtr addressProviderSharedPtr() const PURE; | ||||
|
soulxu marked this conversation as resolved.
Outdated
|
||||
|
|
||||
| /** | ||||
| * @return IoHandle for the underlying connection | ||||
|
|
||||
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -467,30 +467,12 @@ class StreamInfo { | |||
| */ | ||||
| virtual const Network::SocketAddressProvider& downstreamAddressProvider() const PURE; | ||||
|
|
||||
| /** | ||||
| * @param connection_info sets the downstream ssl connection. | ||||
| */ | ||||
| virtual void | ||||
| setDownstreamSslConnection(const Ssl::ConnectionInfoConstSharedPtr& ssl_connection_info) PURE; | ||||
|
|
||||
| /** | ||||
| * @return the downstream SSL connection. This will be nullptr if the downstream | ||||
| * connection does not use SSL. | ||||
| */ | ||||
| virtual Ssl::ConnectionInfoConstSharedPtr downstreamSslConnection() const PURE; | ||||
|
|
||||
| /** | ||||
| * @param connection_info sets the upstream ssl connection. | ||||
| */ | ||||
| virtual void | ||||
| setUpstreamSslConnection(const Ssl::ConnectionInfoConstSharedPtr& ssl_connection_info) PURE; | ||||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was kept to avoid change the 'downstreamSslConnection()' interface as non const. I feel change the 'downstreamSslConnection' isn't right direction. Also this is why I can change the place to set the upstream SSL connection
|
||||
|
|
||||
| /** | ||||
| * @return the upstream SSL connection. This will be nullptr if the upstream | ||||
| * connection does not use SSL. | ||||
| */ | ||||
| virtual Ssl::ConnectionInfoConstSharedPtr upstreamSslConnection() const PURE; | ||||
|
|
||||
| /** | ||||
| * @return const Router::RouteEntry* Get the route entry selected for this request. Note: this | ||||
| * will be nullptr if no route was selected. | ||||
|
|
||||
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.
note: I have to change this due to allow the StreamInfo to set the upstream SSL connection into the AddressProvider.