提交 b4b0dbe9 authored 作者: Iñaki Baz Castillo's avatar Iñaki Baz Castillo

Ready for 3.5.0

上级 4d982567
......@@ -3,9 +3,9 @@
### 3.5.0 (pre)
* `PipeTransport`: Add support for RTP retransmission (RTX + NACK) and SRTP. Useful when connecting two mediasoup servers running in different hosts.
* `PlainRtpTransport`: Add support for SRTP.
* Rename `PlainRtpTransport` to `PlainTransport` everywhere (classes, methods, TypeScript types, etc). Keep previous names and mark them as deprecated.
* `PipeTransport`: Add support for SRTP and RTP retransmission (RTX + NACK). Useful when connecting two mediasoup servers running in different hosts via pipe transports.
* `PlainTransport`: Add support for SRTP.
* Rename `PlainRtpTransport` to `PlainTransport` everywhere (classes, methods, TypeScript types, etc). Keep previous names and mark them as DEPRECATED.
* Fix vulnarability in IPv6 parser.
......
......@@ -80,7 +80,7 @@ $ MS_FUZZ_UTILS=1 LSAN_OPTIONS=verbosity=1:log_threads=1 ./out/Release/mediasoup
* Detect memory leaks and fuzz everything with log level "warn":
```bash
$ MS_FUZZ_LOG_LEVEL=warn LSAN_OPTIONS=verbosity=1:log_threads=1 ./out/Release/mediasoup-worker-fuzzer -artifact_prefix=fuzzer/reports/ -max_len=1400 fuzzer/new-corpus deps/webrtc-fuzzer-corpora/corpora/stun-corpus deps/webrtc-fuzzer-corpora/corpora/rtcp-corpus deps/webrtc-fuzzer-corpora/corpora/rtp-corpus
$ MS_FUZZ_LOG_LEVEL=warn LSAN_OPTIONS=verbosity=1:log_threads=1 ./out/Release/mediasoup-worker-fuzzer -artifact_prefix=fuzzer/reports/ -max_len=1400 fuzzer/new-corpus deps/webrtc-fuzzer-corpora/corpora/stun-corpus deps/webrtc-fuzzer-corpora/corpora/rtp-corpus deps/webrtc-fuzzer-corpora/corpora/rtcp-corpus
```
* Verify that a specific crash is fixed:
......
......@@ -73,7 +73,7 @@ class Worker extends EnhancedEventEmitter_1.EnhancedEventEmitter {
// options
{
env: {
MEDIASOUP_VERSION: '3.4.13'
MEDIASOUP_VERSION: '3.5.0-pre'
},
detached: false,
// fd 0 (stdin) : Just ignore it.
......
......@@ -17,7 +17,7 @@ exports.types = types;
/**
* Expose mediasoup version.
*/
exports.version = '3.4.13';
exports.version = '3.5.0-pre';
/**
* Expose parseScalabilityMode() function.
*/
......
{
"name": "mediasoup",
"version": "3.4.13",
"version": "3.5.0-pre",
"description": "Cutting Edge WebRTC Video Conferencing",
"contributors": [
"Iñaki Baz Castillo <ibc@aliax.net> (https://inakibaz.me)",
......@@ -56,22 +56,22 @@
"uuid": "^7.0.1"
},
"devDependencies": {
"@types/node": "^13.7.6",
"@types/node": "^13.7.7",
"@types/random-number": "0.0.0",
"@types/uuid": "^7.0.0",
"@typescript-eslint/eslint-plugin": "^2.21.0",
"@typescript-eslint/parser": "^2.21.0",
"cross-env": "^7.0.0",
"eslint": "^6.8.0",
"eslint-plugin-jest": "^23.8.0",
"eslint-plugin-jest": "^23.8.1",
"gulp": "^4.0.2",
"gulp-clang-format": "^1.0.27",
"jest": "^25.1.0",
"jest-tobetype": "^1.2.3",
"open-cli": "^5.0.0",
"sctp": "^0.0.19",
"tsc-watch": "^4.1.0",
"typescript": "^3.8.2"
"tsc-watch": "^4.2.2",
"typescript": "^3.8.3"
},
"optionalDependencies": {
"clang-tools-prebuilt": "^0.1.4"
......
This source diff could not be displayed because it is too large. You can view the blob instead.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
\ No newline at end of file
......@@ -6,11 +6,19 @@
void Fuzzer::Utils::Fuzz(const uint8_t* data, size_t len)
{
uint8_t data2[len + 64];
uint8_t data2[len + INET6_ADDRSTRLEN * 3]; // For some fuzzers below.
std::memcpy(data2, data, len);
// IP class.
::Utils::IP::GetFamily(reinterpret_cast<const char*>(data2), len);
/* IP class. */
std::string ip;
ip = std::string(reinterpret_cast<const char*>(data2), INET6_ADDRSTRLEN / 2);
::Utils::IP::GetFamily(ip);
ip = std::string(reinterpret_cast<const char*>(data2), INET6_ADDRSTRLEN);
::Utils::IP::GetFamily(ip);
ip = std::string(reinterpret_cast<const char*>(data2), INET6_ADDRSTRLEN * 2);
::Utils::IP::GetFamily(ip);
// Protect with try/catch since throws are legit.
try
{
......@@ -21,7 +29,8 @@ void Fuzzer::Utils::Fuzz(const uint8_t* data, size_t len)
{
}
// Byte class.
/* Byte class. */
::Utils::Byte::Get1Byte(data2, len);
::Utils::Byte::Get2Bytes(data2, len);
::Utils::Byte::Get3Bytes(data2, len);
......@@ -35,15 +44,18 @@ void Fuzzer::Utils::Fuzz(const uint8_t* data, size_t len)
::Utils::Byte::PadTo4Bytes(static_cast<uint16_t>(len));
::Utils::Byte::PadTo4Bytes(static_cast<uint32_t>(len));
// Bits class.
/* Bits class. */
::Utils::Bits::CountSetBits(static_cast<uint16_t>(len));
// Crypto class.
/* Crypto class. */
::Utils::Crypto::GetRandomUInt(static_cast<uint32_t>(len), static_cast<uint32_t>(len + 1000000));
::Utils::Crypto::GetRandomString(len);
::Utils::Crypto::GetCRC32(data2, len);
// String class.
/* String class. */
// Protect with try/catch since throws are legit.
try
{
......@@ -55,7 +67,8 @@ void Fuzzer::Utils::Fuzz(const uint8_t* data, size_t len)
{
}
// Time class.
/* Time class. */
auto ntp = ::Utils::Time::TimeMs2Ntp(static_cast<uint64_t>(len));
::Utils::Time::Ntp2TimeMs(ntp);
::Utils::Time::IsNewerTimestamp(static_cast<uint32_t>(len), static_cast<uint32_t>(len * len));
......
......@@ -21,7 +21,6 @@ namespace Utils
class IP
{
public:
static int GetFamily(const char* ip, size_t ipLen);
static int GetFamily(const std::string& ip);
static void GetAddressInfo(const struct sockaddr* addr, int& family, std::string& ip, uint16_t& port);
static bool CompareAddresses(const struct sockaddr* addr1, const struct sockaddr* addr2);
......@@ -31,11 +30,6 @@ namespace Utils
/* Inline static methods. */
inline int IP::GetFamily(const std::string& ip)
{
return GetFamily(ip.c_str(), ip.size());
}
inline bool IP::CompareAddresses(const struct sockaddr* addr1, const struct sockaddr* addr2)
{
// Compare family.
......
......@@ -197,30 +197,6 @@ namespace RTC
uint16_t port{ 0u };
std::string srtpKeyBase64;
auto jsonIpIt = request->data.find("ip");
if (jsonIpIt == request->data.end() || !jsonIpIt->is_string())
MS_THROW_TYPE_ERROR("missing ip");
ip = jsonIpIt->get<std::string>();
// This may throw.
Utils::IP::NormalizeIp(ip);
auto jsonPortIt = request->data.find("port");
// clang-format off
if (
jsonPortIt == request->data.end() ||
!Utils::Json::IsPositiveInteger(*jsonPortIt)
)
// clang-format on
{
MS_THROW_TYPE_ERROR("missing port");
}
port = jsonPortIt->get<uint16_t>();
auto jsonSrtpParametersIt = request->data.find("srtpParameters");
if (!HasSrtp() && jsonSrtpParametersIt != request->data.end())
......@@ -321,6 +297,30 @@ namespace RTC
delete[] srtpRemoteKey;
}
auto jsonIpIt = request->data.find("ip");
if (jsonIpIt == request->data.end() || !jsonIpIt->is_string())
MS_THROW_TYPE_ERROR("missing ip");
ip = jsonIpIt->get<std::string>();
// This may throw.
Utils::IP::NormalizeIp(ip);
auto jsonPortIt = request->data.find("port");
// clang-format off
if (
jsonPortIt == request->data.end() ||
!Utils::Json::IsPositiveInteger(*jsonPortIt)
)
// clang-format on
{
MS_THROW_TYPE_ERROR("missing port");
}
port = jsonPortIt->get<uint16_t>();
int err;
switch (Utils::IP::GetFamily(ip))
......
......@@ -302,12 +302,6 @@ namespace RTC
if (this->connectCalled)
MS_THROW_ERROR("connect() already called");
// Reject if comedia mode or multiSource is set.
if (this->comedia)
MS_THROW_ERROR("cannot call connect() when comedia mode is set");
else if (this->multiSource)
MS_THROW_ERROR("cannot call connect() when multiSource is set");
try
{
std::string ip;
......
......@@ -68,7 +68,7 @@ namespace RTC
err = uv_ip4_addr(ip.c_str(), 0, reinterpret_cast<struct sockaddr_in*>(&bindAddr));
if (err != 0)
MS_ABORT("uv_ip4_addr() failed: %s", uv_strerror(err));
MS_THROW_ERROR("uv_ip4_addr() failed: %s", uv_strerror(err));
break;
}
......@@ -78,7 +78,7 @@ namespace RTC
err = uv_ip6_addr(ip.c_str(), 0, reinterpret_cast<struct sockaddr_in6*>(&bindAddr));
if (err != 0)
MS_ABORT("uv_ip6_addr() failed: %s", uv_strerror(err));
MS_THROW_ERROR("uv_ip6_addr() failed: %s", uv_strerror(err));
// Don't also bind into IPv4 when listening in IPv6.
flags |= UV_UDP_IPV6ONLY;
......@@ -89,7 +89,7 @@ namespace RTC
// This cannot happen.
default:
{
MS_ABORT("unknown IP family");
MS_THROW_ERROR("unknown IP family");
}
}
......@@ -108,7 +108,7 @@ namespace RTC
if (attempt > numAttempts)
{
MS_THROW_ERROR(
"no more available ports [transport:%s, ip:%s, numAttempt:%zu]",
"no more available ports [transport:%s, ip:'%s', numAttempt:%zu]",
transportStr.c_str(),
ip.c_str(),
numAttempts);
......@@ -121,7 +121,7 @@ namespace RTC
port = static_cast<uint16_t>(portIdx + Settings::configuration.rtcMinPort);
MS_DEBUG_DEV(
"testing port [transport:%s, ip:%s, port:%" PRIu16 ", attempt:%zu/%zu]",
"testing port [transport:%s, ip:'%s', port:%" PRIu16 ", attempt:%zu/%zu]",
transportStr.c_str(),
ip.c_str(),
port,
......@@ -132,7 +132,7 @@ namespace RTC
if (ports[portIdx])
{
MS_DEBUG_DEV(
"port in use, trying again [transport:%s, ip:%s, port:%" PRIu16 ", attempt:%zu/%zu]",
"port in use, trying again [transport:%s, ip:'%s', port:%" PRIu16 ", attempt:%zu/%zu]",
transportStr.c_str(),
ip.c_str(),
port,
......@@ -197,7 +197,7 @@ namespace RTC
flags);
MS_WARN_DEV(
"uv_udp_bind() failed [transport:%s, ip:%s, port:%" PRIu16 ", attempt:%zu/%zu]: %s",
"uv_udp_bind() failed [transport:%s, ip:'%s', port:%" PRIu16 ", attempt:%zu/%zu]: %s",
transportStr.c_str(),
ip.c_str(),
port,
......@@ -218,7 +218,7 @@ namespace RTC
if (err)
{
MS_WARN_DEV(
"uv_tcp_bind() failed [transport:%s, ip:%s, port:%" PRIu16 ", attempt:%zu/%zu]: %s",
"uv_tcp_bind() failed [transport:%s, ip:'%s', port:%" PRIu16 ", attempt:%zu/%zu]: %s",
transportStr.c_str(),
ip.c_str(),
port,
......@@ -237,7 +237,7 @@ namespace RTC
static_cast<uv_connection_cb>(onFakeConnection));
MS_WARN_DEV(
"uv_listen() failed [transport:%s, ip:%s, port:%" PRIu16 ", attempt:%zu/%zu]: %s",
"uv_listen() failed [transport:%s, ip:'%s', port:%" PRIu16 ", attempt:%zu/%zu]: %s",
transportStr.c_str(),
ip.c_str(),
port,
......@@ -263,7 +263,7 @@ namespace RTC
case UV_EMFILE:
{
MS_THROW_ERROR(
"port bind failed due to too many open files [transport:%s, ip:%s, port:%" PRIu16
"port bind failed due to too many open files [transport:%s, ip:'%s', port:%" PRIu16
", attempt:%zu/%zu]",
transportStr.c_str(),
ip.c_str(),
......@@ -278,7 +278,7 @@ namespace RTC
case UV_EADDRNOTAVAIL:
{
MS_THROW_ERROR(
"port bind failed due to address not available [transport:%s, ip:%s, port:%" PRIu16
"port bind failed due to address not available [transport:%s, ip:'%s', port:%" PRIu16
", attempt:%zu/%zu]",
transportStr.c_str(),
ip.c_str(),
......@@ -300,7 +300,7 @@ namespace RTC
ports[portIdx] = true;
MS_DEBUG_DEV(
"bind succeeded [transport:%s, ip:%s, port:%" PRIu16 ", attempt:%zu/%zu]",
"bind succeeded [transport:%s, ip:'%s', port:%" PRIu16 ", attempt:%zu/%zu]",
transportStr.c_str(),
ip.c_str(),
port,
......
......@@ -8,15 +8,19 @@
namespace Utils
{
int IP::GetFamily(const char* ip, size_t ipLen)
int IP::GetFamily(const std::string& ip)
{
MS_TRACE();
static char IpBuffer[INET6_ADDRSTRLEN];
if (ip.size() >= INET6_ADDRSTRLEN)
return AF_UNSPEC;
auto ipPtr = ip.c_str();
char ipBuffer[INET6_ADDRSTRLEN] = { 0 };
if (uv_inet_pton(AF_INET, ip, IpBuffer) == 0)
if (uv_inet_pton(AF_INET, ipPtr, ipBuffer) == 0)
return AF_INET;
else if (uv_inet_pton(AF_INET6, ip, IpBuffer) == 0)
else if (uv_inet_pton(AF_INET6, ipPtr, ipBuffer) == 0)
return AF_INET6;
else
return AF_UNSPEC;
......@@ -135,7 +139,7 @@ namespace Utils
default:
{
MS_THROW_TYPE_ERROR("invalid ip '%s'", ip.c_str());
MS_THROW_TYPE_ERROR("invalid IP '%s'", ip.c_str());
}
}
}
......
......@@ -31,6 +31,9 @@ SCENARIO("Utils::IP::GetFamily()")
ip = "a:b:c:D::0";
REQUIRE(IP::GetFamily(ip) == AF_INET6);
ip = "0000:0000:0000:0000:0000:ffff:192.168.100.228";
REQUIRE(IP::GetFamily(ip) == AF_INET6);
ip = "::0:";
REQUIRE(IP::GetFamily(ip) == AF_UNSPEC);
......@@ -63,6 +66,9 @@ SCENARIO("Utils::IP::GetFamily()")
ip = "";
REQUIRE(IP::GetFamily(ip) == AF_UNSPEC);
ip = "0000:0000:0000:0000:0000:ffff:192.168.100.228.4567";
REQUIRE(IP::GetFamily(ip) == AF_UNSPEC);
}
SCENARIO("Utils::IP::NormalizeIp()")
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论