Merge pull request #692 from odysseus654/pr/move-connect-packet-type

The domain server should see Packet ID=1 as a (broken) attempt to connect to the domain server
This commit is contained in:
Kalila 2021-04-29 18:39:25 -04:00 committed by GitHub
commit a3626c83f4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 5 deletions

View file

@ -661,7 +661,7 @@ bool DomainServer::isPacketVerified(const udt::Packet& packet) {
// if this is a mismatching connect packet, we can't simply drop it on the floor
// send back a packet to the interface that tells them we refuse connection for a mismatch
if (headerType == PacketType::DomainConnectRequest
if ((headerType == PacketType::DomainConnectRequest || headerType == PacketType::DomainConnectRequestPending)
&& headerVersion != versionForPacketType(PacketType::DomainConnectRequest)) {
DomainGatekeeper::sendProtocolMismatchConnectionDenial(packet.getSenderSockAddr());
}
@ -807,6 +807,8 @@ void DomainServer::setupNodeListAndAssignments() {
// register the gatekeeper for the packets it needs to receive
packetReceiver.registerListener(PacketType::DomainConnectRequest,
PacketReceiver::makeUnsourcedListenerReference<DomainGatekeeper>(&_gatekeeper, &DomainGatekeeper::processConnectRequestPacket));
packetReceiver.registerListener(PacketType::DomainConnectRequestPending,
PacketReceiver::makeUnsourcedListenerReference<DomainGatekeeper>(&_gatekeeper, &DomainGatekeeper::processConnectRequestPacket));
packetReceiver.registerListener(PacketType::ICEPing,
PacketReceiver::makeUnsourcedListenerReference<DomainGatekeeper>(&_gatekeeper, &DomainGatekeeper::processICEPingPacket));
packetReceiver.registerListener(PacketType::ICEPingReply,

View file

@ -24,7 +24,7 @@ int packetTypeMetaTypeId = qRegisterMetaType<PacketType>();
PacketVersion versionForPacketType(PacketType packetType) {
switch (packetType) {
case PacketType::StunResponse:
case PacketType::DomainConnectRequestPending: // keeping the old version to maintain the protocol hash
return 17;
case PacketType::DomainList:
return static_cast<PacketVersion>(DomainListVersion::HasConnectReason);

View file

@ -33,7 +33,7 @@ public:
// This enum must hold 256 or fewer packet types (so the value is <= 255) since it is statically typed as a uint8_t
enum class Value : uint8_t {
Unknown,
StunResponse,
DomainConnectRequestPending,
DomainList,
Ping,
PingReply,
@ -170,7 +170,7 @@ public:
const static QSet<PacketTypeEnum::Value> getNonSourcedPackets() {
const static QSet<PacketTypeEnum::Value> NON_SOURCED_PACKETS = QSet<PacketTypeEnum::Value>()
<< PacketTypeEnum::Value::StunResponse << PacketTypeEnum::Value::CreateAssignment
<< PacketTypeEnum::Value::DomainConnectRequestPending << PacketTypeEnum::Value::CreateAssignment
<< PacketTypeEnum::Value::RequestAssignment << PacketTypeEnum::Value::DomainServerRequireDTLS
<< PacketTypeEnum::Value::DomainConnectRequest << PacketTypeEnum::Value::DomainList
<< PacketTypeEnum::Value::DomainConnectionDenied << PacketTypeEnum::Value::DomainServerPathQuery

View file

@ -53,7 +53,7 @@ local message_positions = {
local packet_types = {
[0] = "Unknown",
[1] = "StunResponse",
[1] = "DomainConnectRequestPending",
[2] = "DomainList",
[3] = "Ping",
[4] = "PingReply",