You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by ma...@apache.org on 2018/01/16 05:30:15 UTC
[trafficserver] 02/02: Fix QUICTransportParameters validations of
initial_max_stream_id_bidi/uni
This is an automated email from the ASF dual-hosted git repository.
masaori pushed a commit to branch quic-latest
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
commit af7e1b460fe5f00e5939cc291cd2f2beafdc1a62
Author: Masaori Koshiba <ma...@apache.org>
AuthorDate: Tue Jan 16 14:29:58 2018 +0900
Fix QUICTransportParameters validations of initial_max_stream_id_bidi/uni
---
iocore/net/quic/QUICConfig.h | 8 ++++----
iocore/net/quic/QUICTransportParameters.cc | 27 +++++++++++++++------------
2 files changed, 19 insertions(+), 16 deletions(-)
diff --git a/iocore/net/quic/QUICConfig.h b/iocore/net/quic/QUICConfig.h
index 233c035..c4525a1 100644
--- a/iocore/net/quic/QUICConfig.h
+++ b/iocore/net/quic/QUICConfig.h
@@ -46,10 +46,10 @@ private:
uint32_t _no_activity_timeout_out = 30;
uint32_t _initial_max_data = 131072;
uint32_t _initial_max_stream_data = 2048;
- uint32_t _initial_max_stream_id_bidi_out = 100;
- uint32_t _initial_max_stream_id_bidi_in = 101;
- uint32_t _initial_max_stream_id_uni_out = 102;
- uint32_t _initial_max_stream_id_uni_in = 103;
+ uint32_t _initial_max_stream_id_bidi_in = 100;
+ uint32_t _initial_max_stream_id_bidi_out = 101;
+ uint32_t _initial_max_stream_id_uni_in = 102;
+ uint32_t _initial_max_stream_id_uni_out = 103;
uint32_t _server_id = 0;
};
diff --git a/iocore/net/quic/QUICTransportParameters.cc b/iocore/net/quic/QUICTransportParameters.cc
index 0bffe55..5a15b87 100644
--- a/iocore/net/quic/QUICTransportParameters.cc
+++ b/iocore/net/quic/QUICTransportParameters.cc
@@ -349,8 +349,9 @@ QUICTransportParametersInClientHello::_parameters_offset(const uint8_t *) const
int
QUICTransportParametersInClientHello::_validate_parameters() const
{
- if (QUICTransportParameters::_validate_parameters() < 0) {
- return 0;
+ int res = QUICTransportParameters::_validate_parameters();
+ if (res < 0) {
+ return res - 100;
}
decltype(this->_parameters)::const_iterator ite;
@@ -366,7 +367,7 @@ QUICTransportParametersInClientHello::_validate_parameters() const
return -2;
}
if (QUICTypeUtil::detect_stream_type(QUICTypeUtil::read_nbytes_as_uint(ite->second->data(), ite->second->len())) !=
- QUICStreamType::CLIENT_BIDI) {
+ QUICStreamType::SERVER_BIDI) {
return -3;
}
}
@@ -376,7 +377,7 @@ QUICTransportParametersInClientHello::_validate_parameters() const
return -4;
}
if (QUICTypeUtil::detect_stream_type(QUICTypeUtil::read_nbytes_as_uint(ite->second->data(), ite->second->len())) !=
- QUICStreamType::CLIENT_UNI) {
+ QUICStreamType::SERVER_UNI) {
return -5;
}
}
@@ -446,8 +447,9 @@ QUICTransportParametersInEncryptedExtensions::_parameters_offset(const uint8_t *
int
QUICTransportParametersInEncryptedExtensions::_validate_parameters() const
{
- if (QUICTransportParameters::_validate_parameters() < 0) {
- return 0;
+ int res = QUICTransportParameters::_validate_parameters();
+ if (res < 0) {
+ return res - 100;
}
decltype(this->_parameters)::const_iterator ite;
@@ -467,7 +469,7 @@ QUICTransportParametersInEncryptedExtensions::_validate_parameters() const
return -3;
}
if (QUICTypeUtil::detect_stream_type(QUICTypeUtil::read_nbytes_as_uint(ite->second->data(), ite->second->len())) !=
- QUICStreamType::SERVER_BIDI) {
+ QUICStreamType::CLIENT_BIDI) {
return -4;
}
}
@@ -477,7 +479,7 @@ QUICTransportParametersInEncryptedExtensions::_validate_parameters() const
return -5;
}
if (QUICTypeUtil::detect_stream_type(QUICTypeUtil::read_nbytes_as_uint(ite->second->data(), ite->second->len())) !=
- QUICStreamType::SERVER_UNI) {
+ QUICStreamType::CLIENT_UNI) {
return -6;
}
}
@@ -511,8 +513,9 @@ QUICTransportParametersInNewSessionTicket::_parameters_offset(const uint8_t *buf
int
QUICTransportParametersInNewSessionTicket::_validate_parameters() const
{
- if (QUICTransportParameters::_validate_parameters() < 0) {
- return 0;
+ int res = QUICTransportParameters::_validate_parameters();
+ if (res < 0) {
+ return res - 100;
}
decltype(this->_parameters)::const_iterator ite;
@@ -532,7 +535,7 @@ QUICTransportParametersInNewSessionTicket::_validate_parameters() const
return -3;
}
if (QUICTypeUtil::detect_stream_type(QUICTypeUtil::read_nbytes_as_uint(ite->second->data(), ite->second->len())) !=
- QUICStreamType::SERVER_BIDI) {
+ QUICStreamType::CLIENT_BIDI) {
return -4;
}
}
@@ -542,7 +545,7 @@ QUICTransportParametersInNewSessionTicket::_validate_parameters() const
return -5;
}
if (QUICTypeUtil::detect_stream_type(QUICTypeUtil::read_nbytes_as_uint(ite->second->data(), ite->second->len())) !=
- QUICStreamType::SERVER_UNI) {
+ QUICStreamType::CLIENT_UNI) {
return -6;
}
}
--
To stop receiving notification emails like this one, please contact
"commits@trafficserver.apache.org" <co...@trafficserver.apache.org>.