Skip to content

quiche: update tar and implement EnvoyQuicProofSource#11316

Merged
mattklein123 merged 34 commits into
envoyproxy:masterfrom
danzh2010:updatetar4
Jun 10, 2020
Merged

quiche: update tar and implement EnvoyQuicProofSource#11316
mattklein123 merged 34 commits into
envoyproxy:masterfrom
danzh2010:updatetar4

Conversation

@danzh2010
Copy link
Copy Markdown
Contributor

@danzh2010 danzh2010 commented May 26, 2020

Update QUICHE tar to 25da9198727ef05edeb99d9f4ce5b6acb3cb87b5 which turn on IETF QUIC by default.

Add QuicDownstream/UpstreamTransport protobuf to wrap tls.v3.Downstream/UpstreamTlsContext to distinguish QuicServer/ClientTransportSocketConfigFactory from Downstream/UpstreamSslSocketFactory by typed_config. And change configs in unit and integration tests accordingly. This is needed to retrieve filter chain correctly based on typed_config. Previously integration tests has been creating the wrong TransportSocketFactory which wasn't in use.

Fix quic_http_integration_test to work with IETF QUIC:

  • Add real implementation of ProofSource::GetCertChain() and ComputeTlsSignature() in EnvoyQuicProofSource which overrides EnvoyQuicFakeProofSource. The verifier is still a fake one which doesn't verify signature.
  • This QUICHE tar ball has an issue in ACK alarm which is not compatible with current implementation of Envoy event system(how timers work in libevent and timer granularity >1ms). So I added a walk-around in EnvoyQuicAlarm to make sure a timer scheduled within 1ms is triggered in next event loop. Otherwise QUIC ACK alarm keeps re-arm itself in same event loop and never exit. There will be an upstream fix to ensure QUICHE behavior doesn't assume platform event system behavior and timer granularity so.

Fix unit tests for ActiveQuicListener and EnvoyQuicDispatcher to work with IETF QUIC:

  • Add TestProofSource for unit tests
  • Add a util function for CHLO generation according to different versions

Risk Level: low, not in use
Testing: modify EnvoyQuicFakeProofSourceTest to test EnvoyQuicProofSource
Fixes #10767 #10422

danzh1989 added 10 commits May 14, 2020 14:56
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
@repokitteh-read-only
Copy link
Copy Markdown

CC @envoyproxy/api-shepherds: Your approval is needed for changes made to api/.
CC @envoyproxy/api-watchers: FYI only for changes made to api/.

🐱

Caused by: #11316 was opened by danzh2010.

see: more, trace.

danzh1989 added 8 commits May 26, 2020 11:25
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
@danzh2010 danzh2010 changed the title Updatetar4 quiche: update tar and implement EnvoyQuicProofSource May 27, 2020
Signed-off-by: Dan Zhang <danzh@google.com>
@danzh2010 danzh2010 marked this pull request as ready for review May 27, 2020 23:31
@danzh2010
Copy link
Copy Markdown
Contributor Author

/assign @wu-bin @htuch

Signed-off-by: Dan Zhang <danzh@google.com>
@htuch
Copy link
Copy Markdown
Member

htuch commented May 29, 2020

@danzh1989 is it possible to split the tar update and the implementation part into distinct PRs?

Signed-off-by: Dan Zhang <danzh@google.com>
Copy link
Copy Markdown
Contributor

@wu-bin wu-bin left a comment

Choose a reason for hiding this comment

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

Thanks Dan, this looks good overall. It seems presubmit is failing, can you take a look at it?

// in QUICHE, and we are working on the fix. Once QUICHE is fixed of expecting this behavior, we
// no longer need to round up the duration.
timer_->enableHRTimer(std::chrono::microseconds(
(duration < quic::QuicTime::Delta::FromMicroseconds(1)) ? 1 : duration.ToMicroseconds()));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: How about std::max(1, duration.ToMicroseconds());

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Doesn't show up - did you miss an upload?
Also cc @antoniovicente for if there's a better way to do this, or if it requires your libevent workarounds

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please add a TODO(antoniovicente) here. I'm looking into some improvements here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

sorry, updated with Bin's suggestion now.
Added TODO for Antonio, assuming it would be improvement with the timer impl.

namespace Envoy {
namespace Quic {

class EnvoyQuicProofSource : public EnvoyQuicFakeProofSource,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

In that case, please address the TODOs and renames as soon as this PR lands.

Comment on lines +34 to +35
return quic::QuicReferenceCountedPointer<quic::ProofSource::Chain>(
new quic::ProofSource::Chain({}));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What's the difference between returning a nullptr and returning a non-nullptr but the chain is empty? Does caller need to handle them differently?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, AFAIK reject reason differs in these two cases.

Signed-off-by: Dan Zhang <danzh@google.com>
@danzh2010
Copy link
Copy Markdown
Contributor Author

Thanks Dan, this looks good overall. It seems presubmit is failing, can you take a look at it?

Fixed those clang-tidy error. PTAL

Signed-off-by: Dan Zhang <danzh@google.com>
@danzh2010
Copy link
Copy Markdown
Contributor Author

coverage CI failed with error: Code coverage for extension source/extensions/transport_sockets/tls is lower than limit of 94.5 (94.4)

This PR didn't touch any files under tls directory.

@danzh2010
Copy link
Copy Markdown
Contributor Author

@alyssawilk Can you take a look now?

Copy link
Copy Markdown
Contributor

@alyssawilk alyssawilk left a comment

Choose a reason for hiding this comment

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

Wohoo, getting there!

// [#protodoc-title: quic transport]
// [#extension: envoy.transport_sockets.quic]

// Configuration for QUIC transport socket. This provides Google's QUIC implementation to Envoy.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

for QUIC -> for Downstream QUIC (and upstream below)

"This provides" doesn't seem quite right. Also is this just for Google-QUIC or also used for IETF-QUIC, just Google's implementation?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I should say Google's GQuic and IQuic implementation.

// in QUICHE, and we are working on the fix. Once QUICHE is fixed of expecting this behavior, we
// no longer need to round up the duration.
timer_->enableHRTimer(std::chrono::microseconds(
(duration < quic::QuicTime::Delta::FromMicroseconds(1)) ? 1 : duration.ToMicroseconds()));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Doesn't show up - did you miss an upload?
Also cc @antoniovicente for if there's a better way to do this, or if it requires your libevent workarounds

namespace Envoy {
namespace Quic {

class EnvoyQuicProofSource : public EnvoyQuicFakeProofSource,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

+1!

testing::ValuesIn({true, false}));

TEST_P(EnvoyQuicServerStreamTest, GetRequestAndResponse) {
quic::SetVerbosityLogThreshold(1);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Was this for your debugging or is there value in leaving it in? If so maybe comment?

ditto for uses below.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

namespace Envoy {
namespace Quic {

std::vector<std::pair<Network::Address::IpVersion, bool>> generateTestParam() {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is this the same in all three places? If so consider a utility

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

moved into test utils

danzh1989 added 4 commits June 9, 2020 14:38
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Copy link
Copy Markdown
Contributor

@alyssawilk alyssawilk left a comment

Choose a reason for hiding this comment

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

@mattklein123 / @htuch needs another API stamp

Copy link
Copy Markdown
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

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

Awesome to see progress here! I found one typo but feel free to fix that in your next change.

#include "envoy/extensions/transport_sockets/tls/v3/cert.pb.h"
#include "envoy/extensions/transport_sockets/tls/v3/tls.pb.validate.h"

// #include "envoy/extensions/transport_sockets/tls/v3/tls.pb.validate.h"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

delete?

@mattklein123 mattklein123 merged commit 92e608f into envoyproxy:master Jun 10, 2020
@danzh2010 danzh2010 deleted the updatetar4 branch June 10, 2020 19:01
@wrowe
Copy link
Copy Markdown
Contributor

wrowe commented Jun 11, 2020

This commit has broken Windows compilation due to upstream quiche.

bazel-out/x64_windows-opt/bin/external/com_googlesource_quiche/quiche/quic/core/crypto/certificate_view.cc(140): error C7555: use of designated initializers requires at least '/std:c++latest'

See https://developercommunity.visualstudio.com/idea/518768/c-designated-initializers.html and expand comments.

Until we are able to build against bleed (stdc++20), meaning all stdc++17 changes have been adopted, this patch is a nonstarter. Can this be reverted and tabled until envoy is at least at stdc++17, or until addressed upstream using stdc++?

@wrowe
Copy link
Copy Markdown
Contributor

wrowe commented Jun 11, 2020

cc @sunjayBhatia

@danzh2010
Copy link
Copy Markdown
Contributor Author

This commit has broken Windows compilation due to upstream quiche.

bazel-out/x64_windows-opt/bin/external/com_googlesource_quiche/quiche/quic/core/crypto/certificate_view.cc(140): error C7555: use of designated initializers requires at least '/std:c++latest'

See https://developercommunity.visualstudio.com/idea/518768/c-designated-initializers.html and expand comments.

Until we are able to build against bleed (stdc++20), meaning all stdc++17 changes have been adopted, this patch is a nonstarter. Can this be reverted and tabled until envoy is at least at stdc++17, or until addressed upstream using stdc++?

It can be easily fixed in upstream. But we might easily run into same problem again in the future.

@antoniovicente
Copy link
Copy Markdown
Contributor

antoniovicente commented Jun 11, 2020 via email

@danzh2010
Copy link
Copy Markdown
Contributor Author

Please try to get an upstream fix in quiche done ASAP. Reverting the PR may still make sense to get back to a stable state. We may want to enable one of these clang warning modes to prevent future breakage: -Wc99-designator -Wc99-extensions -Wc++20-designator (may require clang 10) -Wc++20-extensions (may require clang 10)

On Thu, Jun 11, 2020 at 10:33 AM danzh @.***> wrote: This commit has broken Windows compilation due to upstream quiche. bazel-out/x64_windows-opt/bin/external/com_googlesource_quiche/quiche/quic/core/crypto/certificate_view.cc(140): error C7555: use of designated initializers requires at least '/std:c++latest' See https://developercommunity.visualstudio.com/idea/518768/c-designated-initializers.html and expand comments. Until we are able to build against bleed (stdc++20), meaning all stdc++17 changes have been adopted, this patch is a nonstarter. Can this be reverted and tabled until envoy is at least at stdc++17, or until addressed upstream using stdc++? It can be easily fixed in upstream. But we might easily run into same problem again in the future. — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#11316 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGZ33CNYPMK5Z6AVVTF66F3RWDTKFANCNFSM4NJ7MHGQ .

Fix is in #11562

yashwant121 pushed a commit to yashwant121/envoy that referenced this pull request Jun 24, 2020
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: yashwant121 <yadavyashwant36@gmail.com>
songhu pushed a commit to songhu/envoy that referenced this pull request Jun 25, 2020
yashwant121 pushed a commit to yashwant121/envoy that referenced this pull request Jul 24, 2020
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: yashwant121 <yadavyashwant36@gmail.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.

quiche build failure under clang 10

8 participants