This is an automated email from the ASF dual-hosted git repository.
maskit pushed a commit to branch quic-latest
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/quic-latest by this push:
new 6b10433 Update for draft-18
6b10433 is described below
commit 6b10433908147e337f36ba2cc2cea95c9da18c55
Author: Masakazu Kitajo <[email protected]>
AuthorDate: Thu Feb 21 17:22:28 2019 +0900
Update for draft-18
---
iocore/net/QUICNetVConnection.cc | 6 +-
iocore/net/quic/Mock.h | 4 +-
iocore/net/quic/QUICAltConnectionManager.cc | 29 ++++--
iocore/net/quic/QUICAltConnectionManager.h | 6 +-
iocore/net/quic/QUICConfig.cc | 28 +++--
iocore/net/quic/QUICConfig.h | 13 ++-
iocore/net/quic/QUICTransportParameters.cc | 10 +-
iocore/net/quic/QUICTypes.cc | 116 +++++++++++----------
iocore/net/quic/QUICTypes.h | 14 ++-
.../net/quic/test/test_QUICAltConnectionManager.cc | 55 ++++++----
iocore/net/quic/test/test_QUICPacketFactory.cc | 2 +-
mgmt/RecordsConfig.cc | 4 +-
src/tscore/ink_inet.cc | 4 +-
13 files changed, 179 insertions(+), 112 deletions(-)
diff --git a/iocore/net/QUICNetVConnection.cc b/iocore/net/QUICNetVConnection.cc
index 0003181..e681230 100644
--- a/iocore/net/QUICNetVConnection.cc
+++ b/iocore/net/QUICNetVConnection.cc
@@ -1002,9 +1002,9 @@
QUICNetVConnection::_state_handshake_process_initial_packet(QUICPacketUPtr packe
if (this->netvc_context == NET_VCONNECTION_IN) {
if (!this->_alt_con_manager) {
QUICConfig::scoped_config params;
- this->_alt_con_manager =
- new QUICAltConnectionManager(this, *this->_ctable,
this->_peer_quic_connection_id, params->instance_id(),
- params->num_alt_connection_ids(),
params->preferred_address());
+ this->_alt_con_manager = new QUICAltConnectionManager(this,
*this->_ctable, this->_peer_quic_connection_id,
+
params->instance_id(), params->num_alt_connection_ids(),
+
params->preferred_address_ipv4(), params->preferred_address_ipv6());
this->_frame_generators.push_back(this->_alt_con_manager);
this->_frame_dispatcher->add_handler(this->_alt_con_manager);
}
diff --git a/iocore/net/quic/Mock.h b/iocore/net/quic/Mock.h
index 1210c82..d552394 100644
--- a/iocore/net/quic/Mock.h
+++ b/iocore/net/quic/Mock.h
@@ -266,7 +266,7 @@ public:
std::string_view
negotiated_application_name() const override
{
- return "h3-17";
+ return "h3-18";
}
int _transmit_count = 0;
@@ -346,7 +346,7 @@ class MockQUICConnectionInfoProvider : public
QUICConnectionInfoProvider
std::string_view
negotiated_application_name() const override
{
- return "h3-17";
+ return "h3-18";
}
};
diff --git a/iocore/net/quic/QUICAltConnectionManager.cc
b/iocore/net/quic/QUICAltConnectionManager.cc
index 7a7980d..1e0574d 100644
--- a/iocore/net/quic/QUICAltConnectionManager.cc
+++ b/iocore/net/quic/QUICAltConnectionManager.cc
@@ -46,14 +46,15 @@
QUICAltConnectionManager::QUICAltConnectionManager(QUICConnection *qc, QUICConne
QUICAltConnectionManager::QUICAltConnectionManager(QUICConnection *qc,
QUICConnectionTable &ctable,
QUICConnectionId
peer_initial_cid, uint32_t instance_id, uint8_t num_alt_con,
- const IpEndpoint
*preferred_endpoint)
+ const IpEndpoint
*preferred_endpoint_ipv4,
+ const IpEndpoint
*preferred_endpoint_ipv6)
: _qc(qc), _ctable(ctable), _instance_id(instance_id), _nids(num_alt_con)
{
// Sequence number of the initial CID is 0
this->_alt_quic_connection_ids_remote.push_back({0, peer_initial_cid, {},
{true}});
this->_alt_quic_connection_ids_local = static_cast<AltConnectionInfo
*>(ats_malloc(sizeof(AltConnectionInfo) * this->_nids));
- this->_init_alt_connection_ids(preferred_endpoint);
+ this->_init_alt_connection_ids(preferred_endpoint_ipv4,
preferred_endpoint_ipv6);
}
QUICAltConnectionManager::~QUICAltConnectionManager()
@@ -117,18 +118,32 @@ QUICAltConnectionManager::_generate_next_alt_con_info()
}
void
-QUICAltConnectionManager::_init_alt_connection_ids(const IpEndpoint
*preferred_endpoint)
+QUICAltConnectionManager::_init_alt_connection_ids(const IpEndpoint
*preferred_endpoint_ipv4,
+ const IpEndpoint
*preferred_endpoint_ipv6)
{
- if (preferred_endpoint) {
+ if (preferred_endpoint_ipv4 || preferred_endpoint_ipv6) {
this->_alt_quic_connection_ids_local[0] =
this->_generate_next_alt_con_info();
// This alt cid will be advertised via Transport Parameter
this->_alt_quic_connection_ids_local[0].advertised = true;
- this->_preferred_address = new QUICPreferredAddress(*preferred_endpoint,
this->_alt_quic_connection_ids_local[0].id,
-
this->_alt_quic_connection_ids_local[0].token);
+ IpEndpoint empty_endpoint_ipv4;
+ IpEndpoint empty_endpoint_ipv6;
+ empty_endpoint_ipv4.sa.sa_family = AF_UNSPEC;
+ empty_endpoint_ipv6.sa.sa_family = AF_UNSPEC;
+ if (preferred_endpoint_ipv4 == nullptr) {
+ preferred_endpoint_ipv4 = &empty_endpoint_ipv4;
+ }
+ if (preferred_endpoint_ipv6 == nullptr) {
+ preferred_endpoint_ipv6 = &empty_endpoint_ipv6;
+ }
+
+ // FIXME Check nullptr dereference
+ this->_preferred_address =
+ new QUICPreferredAddress(*preferred_endpoint_ipv4,
*preferred_endpoint_ipv6, this->_alt_quic_connection_ids_local[0].id,
+ this->_alt_quic_connection_ids_local[0].token);
}
- for (int i = (preferred_endpoint ? 1 : 0); i < this->_nids; ++i) {
+ for (int i = (preferred_endpoint_ipv4 || preferred_endpoint_ipv6 ? 1 : 0); i
< this->_nids; ++i) {
this->_alt_quic_connection_ids_local[i] =
this->_generate_next_alt_con_info();
}
this->_need_advertise = true;
diff --git a/iocore/net/quic/QUICAltConnectionManager.h
b/iocore/net/quic/QUICAltConnectionManager.h
index de49527..97086c5 100644
--- a/iocore/net/quic/QUICAltConnectionManager.h
+++ b/iocore/net/quic/QUICAltConnectionManager.h
@@ -44,7 +44,8 @@ public:
* Constructor for servers
*/
QUICAltConnectionManager(QUICConnection *qc, QUICConnectionTable &ctable,
QUICConnectionId peer_initial_cid, uint32_t instance_id,
- uint8_t num_alt_con, const IpEndpoint
*preferred_endpoint = nullptr);
+ uint8_t num_alt_con, const IpEndpoint
*preferred_endpoint_ipv4 = nullptr,
+ const IpEndpoint *preferred_endpoint_ipv6 =
nullptr);
~QUICAltConnectionManager();
/**
@@ -109,7 +110,8 @@ private:
QUICPreferredAddress *_preferred_address = nullptr;
AltConnectionInfo _generate_next_alt_con_info();
- void _init_alt_connection_ids(const IpEndpoint *preferred_endpoint =
nullptr);
+ void _init_alt_connection_ids(const IpEndpoint *preferred_endpoint_ipv4 =
nullptr,
+ const IpEndpoint *preferred_endpoint_ipv6 =
nullptr);
bool _update_alt_connection_id(uint64_t chosen_seq_num);
void _records_new_connection_id_frame(QUICEncryptionLevel level, const
QUICNewConnectionIdFrame &frame);
diff --git a/iocore/net/quic/QUICConfig.cc b/iocore/net/quic/QUICConfig.cc
index f7e1554..8ec9e4f 100644
--- a/iocore/net/quic/QUICConfig.cc
+++ b/iocore/net/quic/QUICConfig.cc
@@ -36,7 +36,7 @@
// https://www.openssl.org/docs/manmaster/man3/SSL_CTX_set_alpn_protos.html
// Should be integrate with IP_PROTO_TAG_HTTP_QUIC in ts/ink_inet.h ?
using namespace std::literals;
-static constexpr std::string_view QUIC_ALPN_PROTO_LIST("\5hq-17"sv);
+static constexpr std::string_view QUIC_ALPN_PROTO_LIST("\5hq-18"sv);
int QUICConfig::_config_id = 0;
int QUICConfigParams::_connection_table_size = 65521;
@@ -146,9 +146,13 @@ QUICConfigParams::initialize()
// Transport Parameters
REC_EstablishStaticConfigInt32U(this->_no_activity_timeout_in,
"proxy.config.quic.no_activity_timeout_in");
REC_EstablishStaticConfigInt32U(this->_no_activity_timeout_out,
"proxy.config.quic.no_activity_timeout_out");
- REC_ReadConfigStringAlloc(this->_preferred_address,
"proxy.config.quic.preferred_address");
- if (this->_preferred_address) {
- ats_ip_pton(this->_preferred_address, &this->_preferred_endpoint);
+ REC_ReadConfigStringAlloc(this->_preferred_address_ipv4,
"proxy.config.quic.preferred_address_ipv4");
+ if (this->_preferred_address_ipv4) {
+ ats_ip_pton(this->_preferred_address_ipv4,
&this->_preferred_endpoint_ipv4);
+ }
+ REC_ReadConfigStringAlloc(this->_preferred_address_ipv6,
"proxy.config.quic.preferred_address_ipv6");
+ if (this->_preferred_address_ipv6) {
+ ats_ip_pton(this->_preferred_address_ipv6,
&this->_preferred_endpoint_ipv6);
}
REC_EstablishStaticConfigInt32U(this->_initial_max_data_in,
"proxy.config.quic.initial_max_data_in");
REC_EstablishStaticConfigInt32U(this->_initial_max_data_out,
"proxy.config.quic.initial_max_data_out");
@@ -207,13 +211,23 @@ QUICConfigParams::no_activity_timeout_out() const
}
const IpEndpoint *
-QUICConfigParams::preferred_address() const
+QUICConfigParams::preferred_address_ipv4() const
+{
+ if (!this->_preferred_address_ipv4) {
+ return nullptr;
+ }
+
+ return &this->_preferred_endpoint_ipv4;
+}
+
+const IpEndpoint *
+QUICConfigParams::preferred_address_ipv6() const
{
- if (!this->_preferred_address) {
+ if (!this->_preferred_address_ipv6) {
return nullptr;
}
- return &this->_preferred_endpoint;
+ return &this->_preferred_endpoint_ipv6;
}
uint32_t
diff --git a/iocore/net/quic/QUICConfig.h b/iocore/net/quic/QUICConfig.h
index 306f544..f40e012 100644
--- a/iocore/net/quic/QUICConfig.h
+++ b/iocore/net/quic/QUICConfig.h
@@ -51,7 +51,8 @@ public:
// Transport Parameters
uint32_t no_activity_timeout_in() const;
uint32_t no_activity_timeout_out() const;
- const IpEndpoint *preferred_address() const;
+ const IpEndpoint *preferred_address_ipv4() const;
+ const IpEndpoint *preferred_address_ipv6() const;
uint32_t initial_max_data_in() const;
uint32_t initial_max_data_out() const;
uint32_t initial_max_stream_data_bidi_local_in() const;
@@ -105,10 +106,12 @@ private:
SSL_CTX *_client_ssl_ctx = nullptr;
// Transport Parameters
- uint32_t _no_activity_timeout_in = 0;
- uint32_t _no_activity_timeout_out = 0;
- const char *_preferred_address = nullptr;
- IpEndpoint _preferred_endpoint;
+ uint32_t _no_activity_timeout_in = 0;
+ uint32_t _no_activity_timeout_out = 0;
+ const char *_preferred_address_ipv4 = nullptr;
+ const char *_preferred_address_ipv6 = nullptr;
+ IpEndpoint _preferred_endpoint_ipv4;
+ IpEndpoint _preferred_endpoint_ipv6;
uint32_t _initial_max_data_in = 0;
uint32_t _initial_max_data_out = 0;
uint32_t _initial_max_stream_data_bidi_local_in = 0;
diff --git a/iocore/net/quic/QUICTransportParameters.cc
b/iocore/net/quic/QUICTransportParameters.cc
index 0362c3f..8fe99cb 100644
--- a/iocore/net/quic/QUICTransportParameters.cc
+++ b/iocore/net/quic/QUICTransportParameters.cc
@@ -300,12 +300,14 @@ QUICTransportParameters::_print() const
QUICPreferredAddress pref_addr(p.second->data(), p.second->len());
char cid_hex_str[QUICConnectionId::MAX_HEX_STR_LENGTH];
char token_hex_str[QUICStatelessResetToken::LEN * 2 + 1];
- char ep_hex_str[512];
+ char ep_ipv4_hex_str[512];
+ char ep_ipv6_hex_str[512];
pref_addr.cid().hex(cid_hex_str, sizeof(cid_hex_str));
to_hex_str(token_hex_str, sizeof(token_hex_str),
pref_addr.token().buf(), QUICStatelessResetToken::LEN);
- ats_ip_nptop(pref_addr.endpoint(), ep_hex_str, sizeof(ep_hex_str));
- Debug(tag, "%s: Endpoint=%s, CID=%s, Token=%s",
QUICDebugNames::transport_parameter_id(p.first), ep_hex_str, cid_hex_str,
- token_hex_str);
+ ats_ip_nptop(pref_addr.endpoint_ipv4(), ep_ipv4_hex_str,
sizeof(ep_ipv4_hex_str));
+ ats_ip_nptop(pref_addr.endpoint_ipv6(), ep_ipv6_hex_str,
sizeof(ep_ipv6_hex_str));
+ Debug(tag, "%s: Endpoint(IPv4)=%s, Endpoint(IPv6)=%s, CID=%s, Token=%s",
QUICDebugNames::transport_parameter_id(p.first),
+ ep_ipv4_hex_str, ep_ipv6_hex_str, cid_hex_str, token_hex_str);
} else {
Debug(tag, "%s: (long data)",
QUICDebugNames::transport_parameter_id(p.first));
}
diff --git a/iocore/net/quic/QUICTypes.cc b/iocore/net/quic/QUICTypes.cc
index a826f47..85dedd6 100644
--- a/iocore/net/quic/QUICTypes.cc
+++ b/iocore/net/quic/QUICTypes.cc
@@ -366,40 +366,29 @@ QUICPreferredAddress::QUICPreferredAddress(const uint8_t
*buf, uint16_t len)
const uint8_t *p = buf;
- // ipVersion
- uint64_t type = p[0];
- p += 1;
+ // ipv4Address
+ in_addr_t addr_ipv4;
+ memcpy(&addr_ipv4, p, 4);
+ p += 4;
+
+ // ipv4Port
+ in_port_t port_ipv4;
+ memcpy(&port_ipv4, p, 2);
+ p += 2;
- // ipAddress
- uint16_t addr_len = p[0];
- p += 1;
- if (type == 4) {
- if (addr_len == 4) {
- in_addr_t addr;
- memcpy(&addr, p, addr_len);
- p += 4;
- in_port_t port;
- memcpy(&port, p, 2);
- p += 2;
- ats_ip4_set(&this->_endpoint, addr, port);
- } else {
- return;
- }
- } else if (type == 6) {
- if (addr_len == TS_IP6_SIZE) {
- in6_addr addr;
- memcpy(&addr, p, addr_len);
- p += TS_IP6_SIZE;
- in_port_t port;
- memcpy(&port, p, 2);
- p += 2;
- ats_ip6_set(&this->_endpoint, addr, port);
- } else {
- return;
- }
- } else {
- return;
- }
+ ats_ip4_set(&this->_endpoint_ipv4, addr_ipv4, port_ipv4);
+
+ // ipv6Address
+ in6_addr addr_ipv6;
+ memcpy(&addr_ipv6, p, 16);
+ p += TS_IP6_SIZE;
+
+ // ipv6Port
+ in_port_t port_ipv6;
+ memcpy(&port_ipv6, p, 2);
+ p += 2;
+
+ ats_ip6_set(&this->_endpoint_ipv6, addr_ipv6, port_ipv6);
// CID
uint16_t cid_len = QUICIntUtil::read_nbytes_as_uint(p, 1);
@@ -419,10 +408,28 @@ QUICPreferredAddress::is_available() const
return this->_valid;
}
+bool
+QUICPreferredAddress::has_ipv4() const
+{
+ return this->_endpoint_ipv4.isValid();
+}
+
+bool
+QUICPreferredAddress::has_ipv6() const
+{
+ return this->_endpoint_ipv6.isValid();
+}
+
+const IpEndpoint
+QUICPreferredAddress::endpoint_ipv4() const
+{
+ return this->_endpoint_ipv4;
+}
+
const IpEndpoint
-QUICPreferredAddress::endpoint() const
+QUICPreferredAddress::endpoint_ipv6() const
{
- return this->_endpoint;
+ return this->_endpoint_ipv6;
}
const QUICConnectionId
@@ -443,30 +450,31 @@ QUICPreferredAddress::store(uint8_t *buf, uint16_t &len)
const
size_t dummy;
uint8_t *p = buf;
- // ipVersion
- if (this->_endpoint.isIp4()) {
- p[0] = 4;
- } else if (this->_endpoint.isIp6()) {
- p[0] = 6;
+ if (this->_endpoint_ipv4.isValid()) {
+ // ipv4Address
+ memcpy(p, &ats_ip4_addr_cast(this->_endpoint_ipv4), 4);
+ p += 4;
+
+ // ipv4Port
+ memcpy(p, &ats_ip_port_cast(this->_endpoint_ipv4), 2);
+ p += 2;
} else {
- return;
+ memset(p, 0, 6);
+ p += 6;
}
- p += 1;
- // ipAddress
- size_t addr_len = ats_ip_addr_size(this->_endpoint);
- p[0] = addr_len;
- p += 1;
- if (this->_endpoint.isIp4()) {
- memcpy(p, &ats_ip4_addr_cast(this->_endpoint), addr_len);
+ if (this->_endpoint_ipv6.isValid()) {
+ // ipv6Address
+ memcpy(p, &ats_ip6_addr_cast(this->_endpoint_ipv6), 16);
+ p += 16;
+
+ // ipv6Port
+ memcpy(p, &ats_ip_port_cast(this->_endpoint_ipv6), 2);
+ p += 2;
} else {
- memcpy(p, &ats_ip6_addr_cast(this->_endpoint), addr_len);
+ memset(p, 0, 18);
+ p += 18;
}
- p += addr_len;
-
- // port
- memcpy(p, &ats_ip_port_cast(this->_endpoint), 2);
- p += 2;
// CID
uint8_t cid_len = this->_cid.length();
diff --git a/iocore/net/quic/QUICTypes.h b/iocore/net/quic/QUICTypes.h
index 31fe659..4451581 100644
--- a/iocore/net/quic/QUICTypes.h
+++ b/iocore/net/quic/QUICTypes.h
@@ -50,7 +50,7 @@ using QUICOffset = uint64_t;
// Note: Fix QUIC_ALPN_PROTO_LIST in QUICConfig.cc
// Note: Change ExtensionType
(QUICTransportParametersHandler::TRANSPORT_PARAMETER_ID) if it's changed
constexpr QUICVersion QUIC_SUPPORTED_VERSIONS[] = {
- 0xff000011,
+ 0xff000012,
};
constexpr QUICVersion QUIC_EXERCISE_VERSIONS = 0x1a2a3a4a;
@@ -399,21 +399,25 @@ public:
constexpr static int16_t MIN_LEN = 26;
constexpr static int16_t MAX_LEN = 295;
- QUICPreferredAddress(IpEndpoint endpoint, QUICConnectionId cid,
QUICStatelessResetToken token)
- : _endpoint(endpoint), _cid(cid), _token(token), _valid(true)
+ QUICPreferredAddress(IpEndpoint endpoint_ipv4, IpEndpoint endpoint_ipv6,
QUICConnectionId cid, QUICStatelessResetToken token)
+ : _endpoint_ipv4(endpoint_ipv4), _endpoint_ipv6(endpoint_ipv6), _cid(cid),
_token(token), _valid(true)
{
}
QUICPreferredAddress(const uint8_t *buf, uint16_t len);
bool is_available() const;
- const IpEndpoint endpoint() const;
+ bool has_ipv4() const;
+ bool has_ipv6() const;
+ const IpEndpoint endpoint_ipv4() const;
+ const IpEndpoint endpoint_ipv6() const;
const QUICConnectionId cid() const;
const QUICStatelessResetToken token() const;
void store(uint8_t *buf, uint16_t &len) const;
private:
- IpEndpoint _endpoint;
+ IpEndpoint _endpoint_ipv4;
+ IpEndpoint _endpoint_ipv6;
QUICConnectionId _cid;
QUICStatelessResetToken _token;
bool _valid = false;
diff --git a/iocore/net/quic/test/test_QUICAltConnectionManager.cc
b/iocore/net/quic/test/test_QUICAltConnectionManager.cc
index 5c1bdca..d30da7b 100644
--- a/iocore/net/quic/test/test_QUICAltConnectionManager.cc
+++ b/iocore/net/quic/test/test_QUICAltConnectionManager.cc
@@ -29,40 +29,55 @@
TEST_CASE("QUICPreferredAddress", "[quic]")
{
- const uint8_t buf[] = {
- 0x04, // ipVersion
- 0x04, // ipAddress length
- 0x01, 0x02, 0x03, 0x04, // ipAddress
- 0x11, 0x22, // port
- 0x01, // connectionId length
- 0x55, // connectionId
- 0x10, 0x11, 0x12, 0x13, // statelessResetToken
- 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
+ uint8_t buf[] = {
+ 0x12, 0x34, 0x56, 0x78, // IPv4 address
+ 0x23, 0x45, // IPv4 port
+ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, // IPv6 address
+ 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x34, 0x56, // IPv6 port
+ 0x01, //
ConnectionId length
+ 0x55, // ConnectionId
+ 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, // Stateless
Reset Token
+ 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff,
};
uint8_t cid_buf[] = {0x55};
QUICConnectionId cid55(cid_buf, sizeof(cid_buf));
+ in6_addr ipv6_addr;
+ memcpy(ipv6_addr.s6_addr,
"\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f", 16);
SECTION("load")
{
auto pref_addr = new QUICPreferredAddress(buf, sizeof(buf));
CHECK(pref_addr->is_available());
- CHECK(pref_addr->endpoint().isIp4());
- CHECK(pref_addr->endpoint().host_order_port() == 0x1122);
- CHECK(pref_addr->endpoint().sin.sin_addr.s_addr == 0x04030201);
+ CHECK(pref_addr->has_ipv4());
+ CHECK(pref_addr->endpoint_ipv4().isIp4());
+ CHECK(pref_addr->endpoint_ipv4().host_order_port() == 0x2345);
+ CHECK(pref_addr->endpoint_ipv4().sin.sin_addr.s_addr == 0x78563412);
+ CHECK(pref_addr->has_ipv6());
+ CHECK(pref_addr->endpoint_ipv6().isIp6());
+ CHECK(pref_addr->endpoint_ipv6().host_order_port() == 0x3456);
+ CHECK(memcmp(pref_addr->endpoint_ipv6().sin6.sin6_addr.s6_addr,
ipv6_addr.s6_addr, 16) == 0);
CHECK(pref_addr->cid() == cid55);
- CHECK(memcmp(pref_addr->token().buf(), buf + 10, 16) == 0);
+ CHECK(memcmp(pref_addr->token().buf(), buf + 26, 16) == 0);
}
SECTION("store")
{
- IpEndpoint ep;
- ats_ip4_set(&ep, 0x04030201, 0x2211);
+ IpEndpoint ep_ipv4;
+ ats_ip4_set(&ep_ipv4, 0x78563412, 0x4523);
- auto pref_addr = new QUICPreferredAddress(ep, cid55, {buf + 10});
+ IpEndpoint ep_ipv6;
+ ats_ip6_set(&ep_ipv6, ipv6_addr, 0x5634);
+
+ auto pref_addr = new QUICPreferredAddress(ep_ipv4, ep_ipv6, cid55, {buf +
26});
CHECK(pref_addr->is_available());
- CHECK(pref_addr->endpoint().isIp4());
- CHECK(pref_addr->endpoint().host_order_port() == 0x1122);
- CHECK(pref_addr->endpoint().sin.sin_addr.s_addr == 0x04030201);
+ CHECK(pref_addr->has_ipv4());
+ CHECK(pref_addr->endpoint_ipv4().isIp4());
+ CHECK(pref_addr->endpoint_ipv4().host_order_port() == 0x2345);
+ CHECK(pref_addr->endpoint_ipv4().sin.sin_addr.s_addr == 0x78563412);
+ CHECK(pref_addr->has_ipv6());
+ CHECK(pref_addr->endpoint_ipv6().isIp6());
+ CHECK(pref_addr->endpoint_ipv6().host_order_port() == 0x3456);
+ CHECK(memcmp(pref_addr->endpoint_ipv6().sin6.sin6_addr.s6_addr,
ipv6_addr.s6_addr, 16) == 0);
CHECK(pref_addr->cid() == cid55);
uint8_t actual[QUICPreferredAddress::MAX_LEN];
@@ -76,5 +91,7 @@ TEST_CASE("QUICPreferredAddress", "[quic]")
{
auto pref_addr = new QUICPreferredAddress(nullptr, 0);
CHECK(!pref_addr->is_available());
+ CHECK(!pref_addr->has_ipv4());
+ CHECK(!pref_addr->has_ipv6());
}
}
diff --git a/iocore/net/quic/test/test_QUICPacketFactory.cc
b/iocore/net/quic/test/test_QUICPacketFactory.cc
index dd1f057..35995f3 100644
--- a/iocore/net/quic/test/test_QUICPacketFactory.cc
+++ b/iocore/net/quic/test/test_QUICPacketFactory.cc
@@ -53,7 +53,7 @@
TEST_CASE("QUICPacketFactory_Create_VersionNegotiationPacket", "[quic]")
0x55, // DCIL/SCIL
0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, // Destination Connection
ID
0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, // Source Connection ID
- 0xff, 0x00, 0x00, 0x11, // Supported Version
+ 0xff, 0x00, 0x00, 0x12, // Supported Version
};
uint8_t buf[1024] = {0};
size_t buf_len;
diff --git a/mgmt/RecordsConfig.cc b/mgmt/RecordsConfig.cc
index 150ba24..3bfbda4 100644
--- a/mgmt/RecordsConfig.cc
+++ b/mgmt/RecordsConfig.cc
@@ -1375,7 +1375,9 @@ static const RecordElement RecordsConfig[] =
,
{RECT_CONFIG, "proxy.config.quic.no_activity_timeout_out", RECD_INT, "30",
RECU_DYNAMIC, RR_NULL, RECC_STR, "^-?[0-9]+$", RECA_NULL}
,
- {RECT_CONFIG, "proxy.config.quic.preferred_address", RECD_STRING, nullptr ,
RECU_DYNAMIC, RR_NULL, RECC_NULL, nullptr, RECA_NULL}
+ {RECT_CONFIG, "proxy.config.quic.preferred_address_ipv4", RECD_STRING,
nullptr , RECU_DYNAMIC, RR_NULL, RECC_NULL, nullptr, RECA_NULL}
+ ,
+ {RECT_CONFIG, "proxy.config.quic.preferred_address_ipv6", RECD_STRING,
nullptr , RECU_DYNAMIC, RR_NULL, RECC_NULL, nullptr, RECA_NULL}
,
{RECT_CONFIG, "proxy.config.quic.initial_max_data_in", RECD_INT, "65536",
RECU_DYNAMIC, RR_NULL, RECC_STR, "^-?[0-9]+$", RECA_NULL}
,
diff --git a/src/tscore/ink_inet.cc b/src/tscore/ink_inet.cc
index 681191e..429f52a 100644
--- a/src/tscore/ink_inet.cc
+++ b/src/tscore/ink_inet.cc
@@ -50,8 +50,8 @@ const std::string_view IP_PROTO_TAG_HTTP_0_9("http/0.9"sv);
const std::string_view IP_PROTO_TAG_HTTP_1_0("http/1.0"sv);
const std::string_view IP_PROTO_TAG_HTTP_1_1("http/1.1"sv);
const std::string_view IP_PROTO_TAG_HTTP_2_0("h2"sv); // HTTP/2 over TLS
-const std::string_view IP_PROTO_TAG_HTTP_QUIC("hq-17"sv); // HTTP/0.9 over QUIC
-const std::string_view IP_PROTO_TAG_HTTP_3("h3-17"sv); // HTTP/3 over QUIC
+const std::string_view IP_PROTO_TAG_HTTP_QUIC("hq-18"sv); // HTTP/0.9 over QUIC
+const std::string_view IP_PROTO_TAG_HTTP_3("h3-18"sv); // HTTP/3 over QUIC
const std::string_view UNIX_PROTO_TAG{"unix"sv};