begin identifying Packet Type ID=1 as "domain connect" for a future version of the protocol, so we can detect protocol breaks when we shift to using this as our domain connect packet.

This commit is contained in:
Heather Anderson 2020-09-06 22:05:26 -07:00
parent c7e79a5e3e
commit 9f5e06503a
3 changed files with 6 additions and 4 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 // 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 // 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)) { && headerVersion != versionForPacketType(PacketType::DomainConnectRequest)) {
DomainGatekeeper::sendProtocolMismatchConnectionDenial(packet.getSenderSockAddr()); DomainGatekeeper::sendProtocolMismatchConnectionDenial(packet.getSenderSockAddr());
} }
@ -807,6 +807,8 @@ void DomainServer::setupNodeListAndAssignments() {
// register the gatekeeper for the packets it needs to receive // register the gatekeeper for the packets it needs to receive
packetReceiver.registerListener(PacketType::DomainConnectRequest, packetReceiver.registerListener(PacketType::DomainConnectRequest,
PacketReceiver::makeUnsourcedListenerReference<DomainGatekeeper>(&_gatekeeper, &DomainGatekeeper::processConnectRequestPacket)); PacketReceiver::makeUnsourcedListenerReference<DomainGatekeeper>(&_gatekeeper, &DomainGatekeeper::processConnectRequestPacket));
packetReceiver.registerListener(PacketType::DomainConnectRequestPending,
PacketReceiver::makeUnsourcedListenerReference<DomainGatekeeper>(&_gatekeeper, &DomainGatekeeper::processConnectRequestPacket));
packetReceiver.registerListener(PacketType::ICEPing, packetReceiver.registerListener(PacketType::ICEPing,
PacketReceiver::makeUnsourcedListenerReference<DomainGatekeeper>(&_gatekeeper, &DomainGatekeeper::processICEPingPacket)); PacketReceiver::makeUnsourcedListenerReference<DomainGatekeeper>(&_gatekeeper, &DomainGatekeeper::processICEPingPacket));
packetReceiver.registerListener(PacketType::ICEPingReply, packetReceiver.registerListener(PacketType::ICEPingReply,

View file

@ -24,7 +24,7 @@ int packetTypeMetaTypeId = qRegisterMetaType<PacketType>();
PacketVersion versionForPacketType(PacketType packetType) { PacketVersion versionForPacketType(PacketType packetType) {
switch (packetType) { switch (packetType) {
case PacketType::StunResponse: case PacketType::DomainConnectRequestPending: // keeping the old version to maintain the protocol hash
return 17; return 17;
case PacketType::DomainList: case PacketType::DomainList:
return static_cast<PacketVersion>(DomainListVersion::HasConnectReason); 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 // 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 { enum class Value : uint8_t {
Unknown, Unknown,
StunResponse, DomainConnectRequestPending,
DomainList, DomainList,
Ping, Ping,
PingReply, PingReply,
@ -170,7 +170,7 @@ public:
const static QSet<PacketTypeEnum::Value> getNonSourcedPackets() { const static QSet<PacketTypeEnum::Value> getNonSourcedPackets() {
const static QSet<PacketTypeEnum::Value> NON_SOURCED_PACKETS = QSet<PacketTypeEnum::Value>() 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::RequestAssignment << PacketTypeEnum::Value::DomainServerRequireDTLS
<< PacketTypeEnum::Value::DomainConnectRequest << PacketTypeEnum::Value::DomainList << PacketTypeEnum::Value::DomainConnectRequest << PacketTypeEnum::Value::DomainList
<< PacketTypeEnum::Value::DomainConnectionDenied << PacketTypeEnum::Value::DomainServerPathQuery << PacketTypeEnum::Value::DomainConnectionDenied << PacketTypeEnum::Value::DomainServerPathQuery