Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
89 commits
Select commit Hold shift + click to select a range
edfbf4b
merged all commits
danzh1989 Oct 4, 2019
f574a58
fix mem slice warning
danzh1989 Oct 4, 2019
5cc1622
remove broken include
danzh1989 Oct 4, 2019
469dc2a
cryptoConnect
danzh1989 Oct 4, 2019
68b6501
fix xfcc test
danzh1989 Oct 4, 2019
3a42546
remove stream libs
danzh1989 Oct 7, 2019
c0ede9a
fix asan
danzh1989 Oct 7, 2019
3e39fbe
revert non-HCM change
danzh1989 Oct 7, 2019
d7c610b
Revert "revert non-HCM change"
danzh1989 Oct 7, 2019
013701b
Merge branch 'master' into quicintegration
danzh1989 Oct 8, 2019
95eb51d
revert HCM, client and integration test
danzh1989 Oct 8, 2019
c4d2bad
Revert "revert HCM, client and integration test"
danzh1989 Oct 8, 2019
e040f72
remove unrelated change
danzh1989 Oct 9, 2019
29128aa
fix asan
danzh1989 Oct 10, 2019
31340f2
typo
danzh1989 Oct 10, 2019
88ebd06
add test for readDisable
danzh1989 Oct 14, 2019
8a2740d
rename var
danzh1989 Oct 14, 2019
e43a1fe
typo
danzh1989 Oct 14, 2019
438a8d7
bufferLimit
danzh1989 Oct 14, 2019
4056e85
typo
danzh1989 Oct 14, 2019
b6b10ac
add more
danzh1989 Oct 15, 2019
f7eb6e3
adjust send buffer threshold, modify doc
danzh1989 Oct 16, 2019
75e36e0
above watermark upon stream creation
danzh1989 Oct 16, 2019
92068a4
fix clang_tidy
danzh1989 Oct 16, 2019
c6c2177
typo
danzh1989 Oct 17, 2019
6175a34
remove debug log
danzh1989 Oct 17, 2019
35d4539
add test for simulated buffer
danzh1989 Oct 17, 2019
2c3551c
Merge branch 'master' into quicintegration
danzh1989 Oct 18, 2019
1200a32
watermark for each stream
danzh1989 Oct 18, 2019
07400f2
fix proto error
danzh1989 Oct 18, 2019
b06844f
doc
danzh1989 Oct 18, 2019
6c53df8
Merge branch 'master' into quicencode
danzh1989 Oct 21, 2019
8d637bc
add test util
danzh1989 Oct 21, 2019
20fe85c
add test util
danzh1989 Oct 21, 2019
484ffba
fix typos in doc
danzh1989 Oct 21, 2019
e967b46
add test for client stream and session
danzh1989 Oct 23, 2019
90a6953
improve comment
danzh1989 Oct 23, 2019
bddb942
code cleanup in test
danzh1989 Oct 24, 2019
3cad65e
Merge branch 'master' into quicencode
danzh1989 Oct 24, 2019
81e2fa9
fix quiche_copts
danzh1989 Oct 24, 2019
e1436e5
Merge branch 'master' into quicintegration
danzh1989 Oct 25, 2019
9f00be6
add quic codec factory
danzh1989 Oct 25, 2019
497cf1e
fix clang format
danzh1989 Oct 25, 2019
00fceea
fix client stream test
danzh1989 Oct 25, 2019
9b72210
remove AtMost EXPECT_CALL
danzh1989 Oct 28, 2019
6c03488
comment in watermark buffer
danzh1989 Oct 28, 2019
86c8ec1
comment about buffer limit
danzh1989 Oct 29, 2019
a23de7f
fix namespace
danzh1989 Oct 30, 2019
6f33c26
format
danzh1989 Oct 30, 2019
e1e9fa4
add tracking issue
danzh1989 Oct 31, 2019
2d7f6ac
comments
danzh1989 Nov 4, 2019
dddd250
Merge branch 'quicencode' into quicintegration
danzh1989 Nov 5, 2019
c3b2133
fix readDisable test
danzh1989 Nov 6, 2019
c37b29d
remove ConnectionPtr
danzh1989 Nov 6, 2019
783850b
Merge branch 'master' into quicintegration
danzh1989 Nov 6, 2019
552c3bd
code clean up
danzh1989 Nov 6, 2019
3a713db
fix typo
danzh1989 Nov 11, 2019
669a5f7
add category
danzh1989 Nov 11, 2019
1852966
Merge branch 'master' into quicintegration
danzh1989 Nov 12, 2019
2be9d32
use readPacketsFromSocket
danzh1989 Nov 12, 2019
adeb9b4
seperate codec factory
danzh1989 Nov 13, 2019
afb85f5
add alarm test
danzh1989 Nov 13, 2019
b77973b
move blocking event loop to IntegrationCodecClient
danzh1989 Nov 14, 2019
e193ebb
metadata no-op
danzh1989 Nov 14, 2019
8033b1e
remove dynamic_cast
danzh1989 Nov 15, 2019
34bdc2d
typo
danzh1989 Nov 15, 2019
6c5f5bf
Merge branch 'master' into quicintegration
danzh1989 Nov 19, 2019
65bf87e
Merge branch 'master' into quicintegration
danzh1989 Nov 19, 2019
391704c
udp listener test
danzh1989 Nov 20, 2019
9e8e2c7
Merge branch 'master' into quicintegration
danzh1989 Nov 20, 2019
183a1f9
debug udp listener test
danzh1989 Nov 20, 2019
476e52f
debug coverage test
danzh1989 Nov 21, 2019
9c762c6
fix quic namespace
danzh1989 Nov 21, 2019
e770972
adjust client handshake idle timeout
danzh1989 Nov 21, 2019
5036296
debug coverage test
danzh1989 Nov 21, 2019
0850f1a
coverage test
danzh1989 Nov 21, 2019
a28f76b
Merge branch 'master' into quicintegration
danzh1989 Nov 21, 2019
05f33c4
fix client side
danzh1989 Nov 21, 2019
3840dce
fix interface change
danzh1989 Nov 21, 2019
b52be05
adjust coverage log level
danzh1989 Nov 22, 2019
bcbc147
re-enable trace logging in coverage test
danzh1989 Nov 22, 2019
b10639f
revert bazel coverage script
danzh1989 Nov 22, 2019
2855ae9
disable quic logging
danzh1989 Nov 22, 2019
a2282a4
revert handshake timeout to 5s
danzh1989 Nov 25, 2019
bf2669e
Merge branch 'master' into quicintegration
danzh1989 Dec 2, 2019
88780bb
address comments
danzh1989 Dec 4, 2019
88530b2
revert bazelrc
danzh1989 Dec 4, 2019
1a42c05
factory rename
danzh1989 Dec 4, 2019
cd58540
typo
danzh1989 Dec 4, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions bazel/external/quiche.BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -2006,6 +2006,7 @@ envoy_cc_library(
copts = quiche_copts,
repository = "@envoy",
tags = ["nofips"],
visibility = ["//visibility:public"],
deps = [
":quic_core_alarm_interface_lib",
":quic_core_crypto_encryption_lib",
Expand Down
6 changes: 6 additions & 0 deletions source/common/http/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,11 @@ envoy_cc_library(
"//source/common/common:enum_to_int",
"//source/common/common:linked_object",
"//source/common/common:minimal_logger_lib",
"//source/common/config:utility_lib",
"//source/common/http/http1:codec_lib",
"//source/common/http/http2:codec_lib",
"//source/common/http/http3:quic_codec_factory_lib",
"//source/common/http/http3:well_known_names",
"//source/common/network:filter_lib",
],
)
Expand Down Expand Up @@ -180,8 +183,11 @@ envoy_cc_library(
"//source/common/common:regex_lib",
"//source/common/common:scope_tracker",
"//source/common/common:utility_lib",
"//source/common/config:utility_lib",
"//source/common/http/http1:codec_lib",
"//source/common/http/http2:codec_lib",
"//source/common/http/http3:quic_codec_factory_lib",
"//source/common/http/http3:well_known_names",
"//source/common/network:utility_lib",
"//source/common/router:config_lib",
"//source/common/runtime:uuid_util_lib",
Expand Down
9 changes: 7 additions & 2 deletions source/common/http/codec_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@
#include "envoy/http/codec.h"

#include "common/common/enum_to_int.h"
#include "common/config/utility.h"
#include "common/http/exception.h"
#include "common/http/http1/codec_impl.h"
#include "common/http/http2/codec_impl.h"
#include "common/http/http3/quic_codec_factory.h"
#include "common/http/http3/well_known_names.h"
#include "common/http/utility.h"

namespace Envoy {
Expand Down Expand Up @@ -158,8 +161,10 @@ CodecClientProd::CodecClientProd(Type type, Network::ClientConnectionPtr&& conne
break;
}
case Type::HTTP3: {
// TODO(danzh) Add QUIC codec;
NOT_IMPLEMENTED_GCOVR_EXCL_LINE;
codec_ = std::unique_ptr<ClientConnection>(
Config::Utility::getAndCheckFactory<Http::QuicHttpClientConnectionFactory>(
Http::QuicCodecNames::get().Quiche)
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.

nit: similar TODO here for config. Please add this in a follow up.

.createQuicClientConnection(*connection_, *this));
}
}
}
Expand Down
21 changes: 21 additions & 0 deletions source/common/http/http3/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
licenses(["notice"]) # Apache 2

load(
"//bazel:envoy_build_system.bzl",
"envoy_cc_library",
"envoy_package",
)

envoy_package()

envoy_cc_library(
name = "quic_codec_factory_lib",
hdrs = ["quic_codec_factory.h"],
deps = ["//include/envoy/http:codec_interface"],
)

envoy_cc_library(
name = "well_known_names",
hdrs = ["well_known_names.h"],
deps = ["//source/common/singleton:const_singleton"],
)
38 changes: 38 additions & 0 deletions source/common/http/http3/quic_codec_factory.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#pragma once

#include <string>

#include "envoy/http/codec.h"
#include "envoy/network/connection.h"

namespace Envoy {
namespace Http {

// A factory to create Http::ServerConnection instance for QUIC.
class QuicHttpServerConnectionFactory {
public:
virtual ~QuicHttpServerConnectionFactory() {}

virtual std::string name() const PURE;

virtual std::unique_ptr<ServerConnection>
createQuicServerConnection(Network::Connection& connection, ConnectionCallbacks& callbacks) PURE;

static std::string category() { return "quic_client_codec"; }
};

// A factory to create Http::ClientConnection instance for QUIC.
class QuicHttpClientConnectionFactory {
public:
virtual ~QuicHttpClientConnectionFactory() {}

virtual std::string name() const PURE;

virtual std::unique_ptr<ClientConnection>
createQuicClientConnection(Network::Connection& connection, ConnectionCallbacks& callbacks) PURE;

static std::string category() { return "quic_server_codec"; }
};

} // namespace Http
} // namespace Envoy
19 changes: 19 additions & 0 deletions source/common/http/http3/well_known_names.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#pragma once

#include <string>

#include "common/singleton/const_singleton.h"

namespace Envoy {
namespace Http {

class QuicCodecNameValues {
public:
// QUICHE is the only QUIC implementation for now.
const std::string Quiche = "quiche";
};

using QuicCodecNames = ConstSingleton<QuicCodecNameValues>;

} // namespace Http
} // namespace Envoy
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
#include "common/http/default_server_string.h"
#include "common/http/http1/codec_impl.h"
#include "common/http/http2/codec_impl.h"
#include "common/http/http3/quic_codec_factory.h"
#include "common/http/http3/well_known_names.h"
#include "common/http/utility.h"
#include "common/protobuf/utility.h"
#include "common/router/rds_impl.h"
Expand Down Expand Up @@ -415,8 +417,14 @@ HttpConnectionManagerConfig::createCodec(Network::Connection& connection,
connection, callbacks, context_.scope(), http2_settings_, maxRequestHeadersKb(),
maxRequestHeadersCount());
case CodecType::HTTP3:
// TODO(danzh) create QUIC specific codec.
NOT_IMPLEMENTED_GCOVR_EXCL_LINE;
// Hard code Quiche factory name here to instantiate a QUIC codec implemented.
// TODO(danzh) Add support to get the factory name from config, possibly
// from HttpConnectionManager protobuf. This is not essential till there are multiple
// implementations of QUIC.
return std::unique_ptr<Http::ServerConnection>(
Config::Utility::getAndCheckFactory<Http::QuicHttpServerConnectionFactory>(
Http::QuicCodecNames::get().Quiche)
.createQuicServerConnection(connection, callbacks));
case CodecType::AUTO:
return Http::ConnectionManagerUtility::autoCreateCodec(
connection, data, callbacks, context_.scope(), http1_settings_, http2_settings_,
Expand Down
43 changes: 43 additions & 0 deletions source/extensions/quic_listeners/quiche/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,12 @@ envoy_cc_library(
hdrs = ["codec_impl.h"],
tags = ["nofips"],
deps = [
":envoy_quic_client_session_lib",
":envoy_quic_server_session_lib",
"//include/envoy/http:codec_interface",
"//include/envoy/registry",
"//source/common/http/http3:quic_codec_factory_lib",
"//source/common/http/http3:well_known_names",
"@com_googlesource_quiche//:quic_core_http_spdy_session_lib",
],
)
Expand Down Expand Up @@ -159,6 +163,30 @@ envoy_cc_library(
],
)

envoy_cc_library(
name = "envoy_quic_client_session_lib",
srcs = [
"envoy_quic_client_session.cc",
"envoy_quic_client_stream.cc",
],
hdrs = [
"envoy_quic_client_session.h",
"envoy_quic_client_stream.h",
],
tags = ["nofips"],
deps = [
":envoy_quic_client_connection_lib",
":envoy_quic_stream_lib",
":envoy_quic_utils_lib",
":quic_filter_manager_connection_lib",
"//source/common/buffer:buffer_lib",
"//source/common/common:assert_lib",
"//source/common/http:header_map_lib",
"//source/extensions/quic_listeners/quiche/platform:quic_platform_mem_slice_storage_impl_lib",
"@com_googlesource_quiche//:quic_core_http_client_lib",
],
)

envoy_cc_library(
name = "quic_io_handle_wrapper_lib",
hdrs = ["quic_io_handle_wrapper.h"],
Expand Down Expand Up @@ -194,6 +222,19 @@ envoy_cc_library(
],
)

envoy_cc_library(
name = "envoy_quic_client_connection_lib",
srcs = ["envoy_quic_client_connection.cc"],
hdrs = ["envoy_quic_client_connection.h"],
tags = ["nofips"],
deps = [
":envoy_quic_connection_lib",
":envoy_quic_packet_writer_lib",
"//include/envoy/event:dispatcher_interface",
"//source/common/network:socket_option_factory_lib",
],
)

envoy_cc_library(
name = "envoy_quic_dispatcher_lib",
srcs = ["envoy_quic_dispatcher.cc"],
Expand Down Expand Up @@ -258,6 +299,8 @@ envoy_cc_library(
"//include/envoy/http:codec_interface",
"//source/common/http:header_map_lib",
"//source/common/network:address_lib",
"//source/common/network:listen_socket_lib",
"//source/common/network:socket_option_factory_lib",
"@com_googlesource_quiche//:quic_core_http_header_list_lib",
],
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ ActiveQuicListener::ActiveQuicListener(Event::Dispatcher& dispatcher,
quic::QuicRandom::GetInstance(), std::make_unique<EnvoyQuicFakeProofSource>(),
quic::KeyExchangeSource::Default());
auto connection_helper = std::make_unique<EnvoyQuicConnectionHelper>(dispatcher_);
crypto_config_->AddDefaultConfig(random, connection_helper->GetClock(),
quic::QuicCryptoServerConfig::ConfigOptions());
auto alarm_factory =
std::make_unique<EnvoyQuicAlarmFactory>(dispatcher_, *connection_helper->GetClock());
quic_dispatcher_ = std::make_unique<EnvoyQuicDispatcher>(
Expand All @@ -43,6 +45,8 @@ ActiveQuicListener::ActiveQuicListener(Event::Dispatcher& dispatcher,
quic_dispatcher_->InitializeWithWriter(new EnvoyQuicPacketWriter(listen_socket_));
}

ActiveQuicListener::~ActiveQuicListener() { onListenerShutdown(); }

void ActiveQuicListener::onListenerShutdown() {
ENVOY_LOG(info, "Quic listener {} shutdown.", config_.name());
quic_dispatcher_->Shutdown();
Expand All @@ -55,7 +59,7 @@ void ActiveQuicListener::onData(Network::UdpRecvData& data) {
envoyAddressInstanceToQuicSocketAddress(data.addresses_.local_));
quic::QuicTime timestamp =
quic::QuicTime::Zero() +
quic::QuicTime::Delta::FromMilliseconds(std::chrono::duration_cast<std::chrono::milliseconds>(
quic::QuicTime::Delta::FromMicroseconds(std::chrono::duration_cast<std::chrono::microseconds>(
data.receive_time_.time_since_epoch())
.count());
uint64_t num_slice = data.buffer_->getRawSlices(nullptr, 0);
Expand All @@ -64,7 +68,7 @@ void ActiveQuicListener::onData(Network::UdpRecvData& data) {
data.buffer_->getRawSlices(&slice, 1);
// TODO(danzh): pass in TTL and UDP header.
quic::QuicReceivedPacket packet(reinterpret_cast<char*>(slice.mem_), slice.len_, timestamp,
/*owns_buffer=*/false, /*ttl=*/0, /*ttl_valid=*/true,
/*owns_buffer=*/false, /*ttl=*/0, /*ttl_valid=*/false,
/*packet_headers=*/nullptr, /*headers_length=*/0,
/*owns_header_buffer*/ false);
quic_dispatcher_->ProcessPacket(self_address, peer_address, packet);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ class ActiveQuicListener : public Network::UdpListenerCallbacks,
Network::SocketSharedPtr listen_socket,
Network::ListenerConfig& listener_config, const quic::QuicConfig& quic_config);

~ActiveQuicListener() override;

// TODO(#7465): Make this a callback.
void onListenerShutdown();

Expand Down
Loading