Skip to content

inbound, outbound: Param-ify listen::Addrs#955

Merged
hawkw merged 10 commits intomainfrom
eliza/orig-dst-param
Mar 23, 2021
Merged

inbound, outbound: Param-ify listen::Addrs#955
hawkw merged 10 commits intomainfrom
eliza/orig-dst-param

Conversation

@hawkw
Copy link
Contributor

@hawkw hawkw commented Mar 19, 2021

This PR changes the Services constructed by the inbound and outbound
stacks from always taking the listen::Addrs type as a target, to being
parameterized over a target type that implements Param for various
address types.

This required changing some middleware layers that were previously
hardcoded to listen::Addrs, and adding Param impls to
listen::Addrs for various address types. I also added a new
TcpAccept::from_local_addr constructor, which sets the target address
based on the server's listen address, rather than from the
SO_ORIGINAL_DST address. This is used by the admin server, which doesn't
configure its listening socket to include original dst addresses.
Previously, the From implementation for TcpAccept just always tried
the orig dst addr and fell back to the listen addr if it was not
present. Now, we have separate behavior for the admin server and the
proxy servers --- admin always uses the local addr, and the proxies only
try SO_ORIGINAL_DST or fail.

There's no functional change here, but this will set up for a future
change to make stacks generic over SO_ORIGINAL_DST detection, allowing
us to remove the currently quite awkward feature flagging.

@hawkw hawkw requested review from a team and olix0r March 19, 2021 19:06
Signed-off-by: Eliza Weisman <[email protected]>
@hawkw hawkw requested a review from olix0r March 19, 2021 20:38
@hawkw hawkw requested a review from olix0r March 22, 2021 18:18
.check_new_service::<T, I>()
.push_switch(
PreventLoop::from(server_port),
PreventLoop::from(server_port).to_switch(),
Copy link
Member

Choose a reason for hiding this comment

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

Can we consolidate this switch to actually build a target type that holds the origdst? It looks like we have to handle this case with an error in at least 3 places... Not a blocker, though, as I understand followups may ease this...

I also find switches harder to understand with the impulse decoupled from the stack -- it'd probably be easier to follow by embedding the closure here directly...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can we consolidate this switch to actually build a target type that holds the origdst? It looks like we have to handle this case with an error in at least 3 places... Not a blocker, though, as I understand followups may ease this...

the intent was to follow up with a branch that changes the whole stack to be based on Param<OrigDstAddr> rather than Param<Option<OrigDstAddr>>, so this is kind of an intermediate state; if you'd prefer to avoid that, we could try to land the whole change in one bigger branch when it's ready?

@hawkw hawkw merged commit fce8c4a into main Mar 23, 2021
@hawkw hawkw deleted the eliza/orig-dst-param branch March 23, 2021 21:16
olix0r added a commit to linkerd/linkerd2 that referenced this pull request Mar 30, 2021
This release fixes two issues:

1. The inbound proxy could break non-meshed TLS connections when the
   initial ClientHello message was larger than 512 bytes or when the
   entire message was not received in the first data packet of the
   connection. TLS detection has been fixed to ensure that the entire
   message is preserved in these cases.

2. The admin server could emit warnings about HTTP detection failing in
   some innocuous situations, such as when the socket closes before
   a request is sent. These situations are now handled gracefully
   without logging warnings.

---

* Update MAINTAINERS to point at the main repo (linkerd/linkerd2-proxy#950)
* outbound: Configure endpoint construction in logical stack (linkerd/linkerd2-proxy#949)
* outbound: Decouple the TCP connect stack from the target type (linkerd/linkerd2-proxy#951)
* outbound: Make HTTP endpoint stack generic on its target (linkerd/linkerd2-proxy#952)
* outbound: Make the HTTP server stack generic (linkerd/linkerd2-proxy#953)
* Update profile response to include a logical address (linkerd/linkerd2-proxy#954)
* inbound, outbound: `Param`-ify `listen::Addrs` (linkerd/linkerd2-proxy#955)
* tls: Fix inbound I/O when TLS detection fails (linkerd/linkerd2-proxy#958)
*  tls: Test SNI detection (linkerd/linkerd2-proxy#959)
* admin: Handle connections that fail protocol detection (linkerd/linkerd2-proxy#960)
olix0r added a commit to linkerd/linkerd2 that referenced this pull request Mar 30, 2021
This release fixes two issues:

1. The inbound proxy could break non-meshed TLS connections when the
   initial ClientHello message was larger than 512 bytes or when the
   entire message was not received in the first data packet of the
   connection. TLS detection has been fixed to ensure that the entire
   message is preserved in these cases.

2. The admin server could emit warnings about HTTP detection failing in
   some innocuous situations, such as when the socket closes before
   a request is sent. These situations are now handled gracefully
   without logging warnings.

---

* Update MAINTAINERS to point at the main repo (linkerd/linkerd2-proxy#950)
* outbound: Configure endpoint construction in logical stack (linkerd/linkerd2-proxy#949)
* outbound: Decouple the TCP connect stack from the target type (linkerd/linkerd2-proxy#951)
* outbound: Make HTTP endpoint stack generic on its target (linkerd/linkerd2-proxy#952)
* outbound: Make the HTTP server stack generic (linkerd/linkerd2-proxy#953)
* Update profile response to include a logical address (linkerd/linkerd2-proxy#954)
* inbound, outbound: `Param`-ify `listen::Addrs` (linkerd/linkerd2-proxy#955)
* tls: Fix inbound I/O when TLS detection fails (linkerd/linkerd2-proxy#958)
*  tls: Test SNI detection (linkerd/linkerd2-proxy#959)
* admin: Handle connections that fail protocol detection (linkerd/linkerd2-proxy#960)
hawkw added a commit that referenced this pull request Mar 31, 2021
…957)

This branch introduces a new `transport::listen::Bind` trait that
abstracts over binding and listening on a socket. Now, rather than
owning an instance of  the `BindTcp` type, `ServerConfig`s are passed as
a parameter to a type implementing the `Bind` trait. This will
eventually allow end-to-end testing without creating actual TCP sockets,
as `Bind` produces a `Stream` of an IO type and an `Addrs` type.

PR #955 changed the proxy stacks to be a target type which implements
the `Param` trait for various types of address, rather than a fixed
type. This PR also changes the inbound and outbound proxies to take
targets which implement `Param<OrigDstAddr>`, rather than requiring
`Param<Option<OrigDstAddr>>` and punting fallibility to every point
where original dst addresses are used.

The `BindTcp` type is now generic over a more general `GetAddrs` trait,
rather than a `SO_ORIGINAL_DST`-specific `OrigDstAddr` trait. Rather
than always producing a `listen::Addrs` with an `Option<OrigDstAddr>`,
we now produce a variable addresses type, which may or may not incldue
the original destination address (the admin and tap servers don't
require SO_ORIGINAL_DST). This allows whether or not original
destination addresses are included to be determined at compile time
rather than at runtime.

Finally, the incorrect feature flagging of mock original destination
addresses has been fixed, The "mock-orig-dst" feature has been removed,
and the integration tests now simply construct their own mock `GetAddrs`
function that's used to configure the test proxy. In the future, we
should be able to refactor the tests to avoid this by simply passing in
their own mock `Bind` types which produce streams of in-memory mock
connections, rather than actual TCP connections.

Signed-off-by: Eliza Weisman <[email protected]>
Co-authored-by: Oliver Gould <[email protected]>
Pothulapati pushed a commit to linkerd/linkerd2 that referenced this pull request Apr 14, 2021
This release fixes two issues:

1. The inbound proxy could break non-meshed TLS connections when the
   initial ClientHello message was larger than 512 bytes or when the
   entire message was not received in the first data packet of the
   connection. TLS detection has been fixed to ensure that the entire
   message is preserved in these cases.

2. The admin server could emit warnings about HTTP detection failing in
   some innocuous situations, such as when the socket closes before
   a request is sent. These situations are now handled gracefully
   without logging warnings.

---

* Update MAINTAINERS to point at the main repo (linkerd/linkerd2-proxy#950)
* outbound: Configure endpoint construction in logical stack (linkerd/linkerd2-proxy#949)
* outbound: Decouple the TCP connect stack from the target type (linkerd/linkerd2-proxy#951)
* outbound: Make HTTP endpoint stack generic on its target (linkerd/linkerd2-proxy#952)
* outbound: Make the HTTP server stack generic (linkerd/linkerd2-proxy#953)
* Update profile response to include a logical address (linkerd/linkerd2-proxy#954)
* inbound, outbound: `Param`-ify `listen::Addrs` (linkerd/linkerd2-proxy#955)
* tls: Fix inbound I/O when TLS detection fails (linkerd/linkerd2-proxy#958)
*  tls: Test SNI detection (linkerd/linkerd2-proxy#959)
* admin: Handle connections that fail protocol detection (linkerd/linkerd2-proxy#960)
jijeesh pushed a commit to jijeesh/linkerd2 that referenced this pull request Apr 21, 2021
This release fixes two issues:

1. The inbound proxy could break non-meshed TLS connections when the
   initial ClientHello message was larger than 512 bytes or when the
   entire message was not received in the first data packet of the
   connection. TLS detection has been fixed to ensure that the entire
   message is preserved in these cases.

2. The admin server could emit warnings about HTTP detection failing in
   some innocuous situations, such as when the socket closes before
   a request is sent. These situations are now handled gracefully
   without logging warnings.

---

* Update MAINTAINERS to point at the main repo (linkerd/linkerd2-proxy#950)
* outbound: Configure endpoint construction in logical stack (linkerd/linkerd2-proxy#949)
* outbound: Decouple the TCP connect stack from the target type (linkerd/linkerd2-proxy#951)
* outbound: Make HTTP endpoint stack generic on its target (linkerd/linkerd2-proxy#952)
* outbound: Make the HTTP server stack generic (linkerd/linkerd2-proxy#953)
* Update profile response to include a logical address (linkerd/linkerd2-proxy#954)
* inbound, outbound: `Param`-ify `listen::Addrs` (linkerd/linkerd2-proxy#955)
* tls: Fix inbound I/O when TLS detection fails (linkerd/linkerd2-proxy#958)
*  tls: Test SNI detection (linkerd/linkerd2-proxy#959)
* admin: Handle connections that fail protocol detection (linkerd/linkerd2-proxy#960)

Signed-off-by: Jijeesh <[email protected]>
kleimkuhler pushed a commit to linkerd/linkerd2 that referenced this pull request May 12, 2021
This release fixes two issues:

1. The inbound proxy could break non-meshed TLS connections when the
   initial ClientHello message was larger than 512 bytes or when the
   entire message was not received in the first data packet of the
   connection. TLS detection has been fixed to ensure that the entire
   message is preserved in these cases.

2. The admin server could emit warnings about HTTP detection failing in
   some innocuous situations, such as when the socket closes before
   a request is sent. These situations are now handled gracefully
   without logging warnings.

---

* Update MAINTAINERS to point at the main repo (linkerd/linkerd2-proxy#950)
* outbound: Configure endpoint construction in logical stack (linkerd/linkerd2-proxy#949)
* outbound: Decouple the TCP connect stack from the target type (linkerd/linkerd2-proxy#951)
* outbound: Make HTTP endpoint stack generic on its target (linkerd/linkerd2-proxy#952)
* outbound: Make the HTTP server stack generic (linkerd/linkerd2-proxy#953)
* Update profile response to include a logical address (linkerd/linkerd2-proxy#954)
* inbound, outbound: `Param`-ify `listen::Addrs` (linkerd/linkerd2-proxy#955)
* tls: Fix inbound I/O when TLS detection fails (linkerd/linkerd2-proxy#958)
*  tls: Test SNI detection (linkerd/linkerd2-proxy#959)
* admin: Handle connections that fail protocol detection (linkerd/linkerd2-proxy#960)
kleimkuhler pushed a commit to linkerd/linkerd2 that referenced this pull request May 12, 2021
This release fixes two issues:

1. The inbound proxy could break non-meshed TLS connections when the
   initial ClientHello message was larger than 512 bytes or when the
   entire message was not received in the first data packet of the
   connection. TLS detection has been fixed to ensure that the entire
   message is preserved in these cases.

2. The admin server could emit warnings about HTTP detection failing in
   some innocuous situations, such as when the socket closes before
   a request is sent. These situations are now handled gracefully
   without logging warnings.

---

* Update MAINTAINERS to point at the main repo (linkerd/linkerd2-proxy#950)
* outbound: Configure endpoint construction in logical stack (linkerd/linkerd2-proxy#949)
* outbound: Decouple the TCP connect stack from the target type (linkerd/linkerd2-proxy#951)
* outbound: Make HTTP endpoint stack generic on its target (linkerd/linkerd2-proxy#952)
* outbound: Make the HTTP server stack generic (linkerd/linkerd2-proxy#953)
* Update profile response to include a logical address (linkerd/linkerd2-proxy#954)
* inbound, outbound: `Param`-ify `listen::Addrs` (linkerd/linkerd2-proxy#955)
* tls: Fix inbound I/O when TLS detection fails (linkerd/linkerd2-proxy#958)
*  tls: Test SNI detection (linkerd/linkerd2-proxy#959)
* admin: Handle connections that fail protocol detection (linkerd/linkerd2-proxy#960)
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